当前位置: 首页 > news >正文

网站排名软件利搜怎么样seo网站推广与优化方案

网站排名软件利搜怎么样,seo网站推广与优化方案,各类微网站建设,江苏建信建设集团网站整体就是mysql里存了一张表&#xff0c;然后在java程序里用mybatis把数据读出来的一个简单示例。 库 blog里有一张表 article 整个项目就是增加了这3个文件 首先是mybatis-config.xml文件 <?xml version"1.0" encoding"UTF-8" ?> <!DOCTYPE c…

整体就是mysql里存了一张表,然后在java程序里用mybatis把数据读出来的一个简单示例。

库 blog里有一张表 article

整个项目就是增加了这3个文件

首先是mybatis-config.xml文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configurationPUBLIC "-//mybatis.org//DTD Config 3.0//EN""http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration><environments default="development"><environment id="development"><transactionManager type="JDBC"/><dataSource type="POOLED"><property name="driver" value="com.mysql.cj.jdbc.Driver"/><property name="url" value="jdbc:mysql://localhost:3306/blog"/><property name="username" value="root"/><property name="password" value="123456"/></dataSource></environment></environments><!--写好的sql映射文件(EmployeeMapper.xml)注册到全局配置文件(mybatis-config.xml)中--><mappers><mapper resource="ArticleMapper.xml"/></mappers>
</configuration>

然后是ArticleMapper.XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.mybatis.example.BlogMapper"><select id="selectArticle" resultType="org.example.po.Article">select * from article where id = #{id}</select>
</mapper>

然后是和数据库存储模型对应的对象Article类

package org.example.po;import java.util.Date;public class Article {private Integer id;private String title;private String desc;private Integer cate;private Date createdAt;private Date updatedAt;private String content;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title == null ? null : title.trim();}public String getDesc() {return desc;}public void setDesc(String desc) {this.desc = desc == null ? null : desc.trim();}public Integer getCate() {return cate;}public void setCate(Integer cate) {this.cate = cate;}public Date getCreatedAt() {return createdAt;}public void setCreatedAt(Date createdAt) {this.createdAt = createdAt;}public Date getUpdatedAt() {return updatedAt;}public void setUpdatedAt(Date updatedAt) {this.updatedAt = updatedAt;}public String getContent() {return content;}public void setContent(String content) {this.content = content == null ? null : content.trim();}
}

然后就是运行类,main方法

package org.example;import com.google.gson.Gson;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.example.po.Article;import java.io.InputStream;public class Main {public static void main(String[] args) throws Exception {String resource="mybatis-config.xml";InputStream inputStream= Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory=new SqlSessionFactoryBuilder().build(inputStream);SqlSession sqlSession=sqlSessionFactory.openSession();Article article=sqlSession.selectOne("selectArticle",1);Gson gson=new Gson();System.out.println("Hello world!");System.out.println(gson.toJson(article));}
}

最后把pom.XML也贴一下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>mybatis-study</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.source>14</maven.compiler.source><maven.compiler.target>14</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.5.9</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.27</version></dependency><dependency><groupId>com.google.code.gson</groupId><artifactId>gson</artifactId><version>2.10</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.30</version></dependency></dependencies></project>

其他问题可以参这个官方教程

mybatis – MyBatis 3 | XML 映射器

http://www.hrbkazy.com/news/50615.html

相关文章:

  • 水印在线制作网站国内最好的搜索引擎
  • 上市公司协会网站建设汇报电商软文范例100字
  • 网站建设 提升和扩大沧州百度推广公司
  • 程序员兼职接单平台南昌seo服务
  • 企业网站制作广东seo推广
  • 网站图片怎么做才有吸引力从事网络营销的公司
  • 推广普通话活动方案和总结济南seo网站排名关键词优化
  • 交河做网站b站推广
  • 做网站卖广告如何在百度发布短视频
  • 网站建设需要的人才如何推广自己的店铺?
  • 吉安网站建设全网引擎搜索
  • 修改wordpress文章发布页面模板佛山网站优化软件
  • 官方网站 优帮云网络运营师资格证
  • 交易网站怎么做近期重大新闻事件
  • 又拍网站怎么做的推广app是什么工作
  • 校园社交网站怎么做中牟网络推广
  • 怎么用外网校内网站做英语信息推广平台有哪些
  • 做网站路由器映射外网ip营销的概念
  • 网站备案登陆用户名是什么关键词挖掘网站
  • xampp安装网站模板抖音搜索引擎优化
  • 织梦做双语网站何鹏seo
  • 网站建设的税收分类编码百度一下你就知道啦
  • 做百度移动端网站优化seo快速排名上首页
  • 资讯文章网站模板百度推广一个月多少钱
  • 大学网页制作与网站建设seo关键词优化报价
  • 运城做网站价格松原今日头条新闻
  • 廊坊建设局网站6淘宝指数查询入口
  • 网站安装系统怎么安装教程视频昆明百度推广开户
  • office文件包里的做网站软件上海推广系统
  • 电商网站在线支付怎么做流量平台