前言

  MyBatis官网:http://www.mybatis.org/mybatis-3/zh/index.html

  本文记录springboot与mybatis的整合实例;1、以注解方式;2、手写XML配置、逆向工程生成XML配置

  maven依赖

  1. <!-- springboot -->
  2. <dependency>
  3. <groupId>org.springframework.boot</groupId>
  4. <artifactId>spring-boot-starter-web</artifactId>
  5. </dependency>
  6.  
  7. <!-- MVC -->
  8. <dependency>
  9. <groupId>org.springframework.boot</groupId>
  10. <artifactId>spring-boot-starter-test</artifactId>
  11. <scope>test</scope>
  12. </dependency>
  13.  
  14. <!--Thymeleaf模板依赖-->
  15. <dependency>
  16. <groupId>org.springframework.boot</groupId>
  17. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  18. </dependency>
  19.  
  20. <!--热部署工具dev-tools-->
  21. <dependency>
  22. <groupId>org.springframework.boot</groupId>
  23. <artifactId>spring-boot-devtools</artifactId>
  24. <scope>runtime</scope>
  25. </dependency>
  26.  
  27. <!--添加MyBatis依赖 -->
  28. <dependency>
  29. <groupId>org.mybatis.spring.boot</groupId>
  30. <artifactId>mybatis-spring-boot-starter</artifactId>
  31. <version>1.3.1</version>
  32. </dependency>
  33.  
  34. <!--添加MySQL驱动依赖 -->
  35. <dependency>
  36. <groupId>mysql</groupId>
  37. <artifactId>mysql-connector-java</artifactId>
  38. <scope>runtime</scope>
  39. </dependency>

  application.yml

  1. #注意:在yml文件中添加value值时,value前面需要加一个空格
  2. #2.0.0的配置切换为servlet.path而不是"-"
  3. server:
  4. port: #端口号
  5. servlet:
  6. context-path: /springboot
  7.  
  8. spring:
  9. thymeleaf:
  10. cache: false #关闭页面缓存
  11. prefix: classpath:/view/ #thymeleaf访问根路径
  12. mode: LEGACYHTML5
  13.  
  14. datasource: #数据库相关
  15. url: jdbc:mysql://localhost:/test?characterEncoding=utf-
  16. username: root
  17. password:
  18. driver-class-name: com.mysql.jdbc.Driver
  19. mvc:
  20. date-format: yyyy-MM-dd HH:mm:ss #mvc接收参数时对日期进行格式化
  21.  
  22. jackson:
  23. date-format: yyyy-MM-dd HH:mm:ss #jackson对响应回去的日期参数进行格式化
  24. time-zone: GMT+
  25.  
  26. mybatis:
  27. configuration:
  28. map-underscore-to-camel-case: true #开启驼峰映射

  result,通用响应数据格式

  注:不想自己写set、get方法的用lombok插件

  1. public class Result {
  2.  
  3. private String message;
  4.  
  5. private Integer status;
  6.  
  7. private Object data;
  8.  
  9. public Result() {
  10. }
  11.  
  12. public Result(String message, Integer status, Object data) {
  13. this.message = message;
  14. this.status = status;
  15. this.data = data;
  16. }
  17.  
  18. public String getMessage() {
  19. return message;
  20. }
  21.  
  22. public void setMessage(String message) {
  23. this.message = message;
  24. }
  25.  
  26. public Integer getStatus() {
  27. return status;
  28. }
  29.  
  30. public void setStatus(Integer status) {
  31. this.status = status;
  32. }
  33.  
  34. public Object getData() {
  35. return data;
  36. }
  37.  
  38. public void setData(Object data) {
  39. this.data = data;
  40. }
  41.  
  42. @Override
  43. public String toString() {
  44. return "Result{" +
  45. "message='" + message + '\'' +
  46. ", status=" + status +
  47. ", data=" + data +
  48. '}';
  49. }
  50.  
  51. public static Result build(Integer status,String message,Object data){
  52. return new Result(message,status,data);
  53. }
  54. }

  user,实体类

  注:不想自己写set、get方法的用lombok插件

  1. public class User {
  2.  
  3. private Integer id;
  4.  
  5. private String username;
  6.  
  7. private String password;
  8.  
  9. private Date created;
  10.  
  11. public User(){}
  12.  
  13. public Integer getId() {
  14. return id;
  15. }
  16.  
  17. public void setId(Integer id) {
  18. this.id = id;
  19. }
  20.  
  21. public String getUsername() {
  22. return username;
  23. }
  24.  
  25. public void setUsername(String username) {
  26. this.username = username;
  27. }
  28.  
  29. public String getPassword() {
  30. return password;
  31. }
  32.  
  33. public void setPassword(String password) {
  34. this.password = password;
  35. }
  36.  
  37. public Date getCreated() {
  38. return created;
  39. }
  40.  
  41. public void setCreated(Date created) {
  42. this.created = created;
  43. }
  44.  
  45. @Override
  46. public String toString() {
  47. return "User{" +
  48. "id=" + id +
  49. ", username='" + username + '\'' +
  50. ", password='" + password + '\'' +
  51. ", created=" + created +
  52. '}';
  53. }
  54. }

  表SQL

  1. DROP TABLE IF EXISTS `tb_user`;
  2. CREATE TABLE `tb_user` (
  3. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '表id',
  4. `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
  5. `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
  6. `created` datetime NULL DEFAULT NULL COMMENT '创建时间',PRIMARY KEY (`id`) USING BTREE
  7. ) ENGINE = InnoDB AUTO_INCREMENT = 45 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Compact;

  controller

  1. @RestController
  2. @RequestMapping("/user")
  3. public class UserController {
  4.  
  5. @Autowired
  6. private UserService userService;
  7.  
  8. @RequestMapping("/insert")
  9. public Result insert(User user) {
  10. return userService.insert(user);
  11. }
  12.  
  13. @RequestMapping("/delete")
  14. public Result delete(User user) {
  15. return userService.delete(user);
  16. }
  17.  
  18. @RequestMapping("/update")
  19. public Result update(User user) {
  20. return userService.update(user);
  21. }
  22.  
  23. @RequestMapping("/select")
  24. public Result select(User user) {
  25. return userService.select(user);
  26. }
  27. }

  service

  1. public interface UserService {
  2.  
  3. /**
  4. * 增
  5. */
  6. Result insert(User user);
  7.  
  8. /**
  9. * 删
  10. */
  11. Result delete(User user);
  12.  
  13. /**
  14. * 改
  15. */
  16. Result update(User user);
  17.  
  18. /**
  19. * 查
  20. */
  21. Result select(User user);
  22. }
  1. @Service
  2. public class UserServiceImpl implements UserService {
  3.  
  4. @Autowired
  5. private UserMapper userMapper;
  6.  
  7. @Override
  8. public Result insert(User user) {
  9. int i = userMapper.insert(user);
  10. if (i > 0) {
  11. return Result.build(200, "操作成功!", user);
  12. } else {
  13. return Result.build(400, "操作失败!", null);
  14. }
  15. }
  16.  
  17. @Override
  18. public Result delete(User user) {
  19. int i = userMapper.delete(user);
  20. if (i > 0) {
  21. return Result.build(200, "操作成功!", user);
  22. } else {
  23. return Result.build(400, "操作失败!", null);
  24. }
  25. }
  26.  
  27. @Override
  28. public Result update(User user) {
  29. int i = userMapper.update(user);
  30. if (i > 0) {
  31. return select(user);
  32. } else {
  33. return Result.build(400, "操作失败!", null);
  34. }
  35. }
  36.  
  37. @Override
  38. public Result select(User user) {
  39. User user1 = userMapper.select(user);
  40. if (user1 != null) {
  41. return Result.build(200, "操作成功!", user1);
  42. } else {
  43. return Result.build(400, "操作失败!", user1);
  44. }
  45. }
  46. }

  

  接下来不同就是mapper映射了

  注解方式

  工程结构

  mapper.java

  直接使用注解,@Insert、@Delete、@Update、@Select,前三个事务自动提交,不用我们管理;增、删、改返回的是影响的行数,当设置了主键自动递增,需要返回自增主键时添加@Options(useGeneratedKeys = true),设置是否获取主键并设置到模型实体属性中;注意:insert接口返回的依旧是受影响的行数,但自增主键已经设置到了模型实体属性中。

  这里介绍以下占位符跟拼接符的区别:

  占位符 #{param}
  占位符在拼接sql的过程中,会给指定的占位符,加上引号
  简单类型传参:
  1、会忽略占位符的名字
  2、会忽略占位符的数据类型
  3、会忽略占位符的顺序,将传进去的参加,依次赋给所有的占位符
  适用场景:
  单一占位符传参查询

  拼接符 ${param}
  拼接符相当于连接符合,把左右两边、自己拼接在一起
  1、不接受简单类型传参,只接收对象类型或者Map集合类型传参
  2、动态指定表名,列名,排序的方式(升序or降序)

  1. @Mapper
  2. @Component(value = "UserMapper")
  3. public interface UserMapper {
  4.  
  5. /**
  6. * 增
  7. */
  8. @Insert(value = "insert into tb_user(username,password,created) value(#{username},#{password},#{created})")
  9. @Options(useGeneratedKeys = true)
  10. int insert(User user);
  11.  
  12. /**
  13. * 删
  14. */
  15. @Delete("delete from tb_user where id = #{id}")
  16. int delete(User user);
  17.  
  18. /**
  19. * 改
  20. */
  21. @Update(value = "update tb_user set username = #{username} where id = #{id}")
  22. int update(User user);
  23.  
  24. /**
  25. * 查
  26. */
  27. @Select(value = "select * from tb_user where id = #{id}")
  28. User select(User user);
  29.  
  30. }

  配置XML

  工程目录

  加多了mybatis相关的XML配置文件

  其他部分都没有变,变的只有以下部分:

  application.yml的mybatis部分改成,

  1. mybatis:
  2.  
  3. # 配置mapper的扫描,找到所有的mapper.xml映射文件
  4. mapperLocations: classpath:conf/mybatis/mapper/*.xml
  5.  
  6. # 加载全局的配置文件
  7. configLocation: classpath:conf/mybatis/mybatis.cfg.xml

  mapper.java

  不再使用注解,将SQL写到XML里面

  1. @Mapper
  2. @Component(value = "UserMapper")
  3. public interface UserMapper {
  4.  
  5. /**
  6. * 增
  7. */
  8. int insert(User user);
  9.  
  10. /**
  11. * 删
  12. */
  13. int delete(User user);
  14.  
  15. /**
  16. * 改
  17. */
  18. int update(User user);
  19.  
  20. /**
  21. * 查
  22. */
  23. User select(User user);
  24.  
  25. }

  mybatis.cgf.xml

  这里配置全局设置,但我这里没什么要配的

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE configuration
  3. PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-config.dtd">
  5. <!-- 全局配置文件 -->
  6. <configuration>
  7.  
  8. </configuration>

  UserMapper.xml

  因为我们的表主键是自动递增,insert标签使用useGeneratedKeys="true"  keyProperty="id",模型实体属性就会设置递增后的值

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="cn.mapper.UserMapper">
  6.  
  7. <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.pojo.User">
  8. insert into tb_user(username,password,created) value(#{username},#{password},#{created})
  9. </insert>
  10.  
  11. <delete id="delete" parameterType="cn.pojo.User">
  12. delete from tb_user where id = #{id}
  13. </delete>
  14.  
  15. <update id="update" parameterType="cn.pojo.User">
  16. update tb_user set username = #{username} where id = #{id}
  17. </update>
  18.  
  19. <select id="select" parameterType="cn.pojo.User" resultType="cn.pojo.User">
  20. select * from tb_user where id = #{id}
  21. </select>
  22.  
  23. </mapper>

  逆向工程

  注意:本逆向工程例子是我之前毕业设计的表为操作对象,为了方便介绍,我直接用之前的项目做介绍

  数据库单表逆向生成单表对应的pojo实体、mapper.java、mapper.xml,无需手写这几个文件,生成的接口方法已经足够满足大部分业务需求,实现快速开发,关于逆向工程的具体配置,请戳官网介绍:https://www.cnblogs.com/nzbin/p/8117535.html 或这篇博客:Mybatis(七) mybatis的逆向工程的配置详解

  逆向工程项目结构

  逆向工程配置文件genreatorConfig.xml,名字无所谓,只要在java程序中作为file传入就好  (存放生成文件的对应的包要提前建好,否则会找不到)

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE generatorConfiguration
  3. PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
  4. "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
  5.  
  6. <generatorConfiguration>
  7. <context id="testTables" targetRuntime="MyBatis3">
  8. <commentGenerator>
  9. <!-- 是否去除自动生成的注释 true:是 : false:否 -->
  10. <property name="suppressAllComments" value="true" />
  11. </commentGenerator>
  12. <!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
  13. <jdbcConnection driverClass="com.mysql.jdbc.Driver"
  14. connectionURL="jdbc:mysql://localhost:3306/cpsh" userId="root"
  15. password="123456">
  16. </jdbcConnection>
  17. <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
  18. NUMERIC 类型解析为java.math.BigDecimal -->
  19. <javaTypeResolver>
  20. <property name="forceBigDecimals" value="false" />
  21. </javaTypeResolver>
  22.  
  23. <!-- targetProject:生成PO类的位置 -->
  24. <javaModelGenerator targetPackage="cn.gx.hzu.cpsh.common.pojo"
  25. targetProject=".\src">
  26. <!-- enableSubPackages:是否让schema作为包的后缀 -->
  27. <property name="enableSubPackages" value="false" />
  28. <!-- 从数据库返回的值被清理前后的空格 -->
  29. <property name="trimStrings" value="true" />
  30. </javaModelGenerator>
  31. <!-- targetProject:mapper映射文件.xml生成的位置 -->
  32. <sqlMapGenerator targetPackage="cn.gx.hzu.cpsh.common.mapper"
  33. targetProject=".\src">
  34. <!-- enableSubPackages:是否让schema作为包的后缀 -->
  35. <property name="enableSubPackages" value="false" />
  36. </sqlMapGenerator>
  37. <!-- targetPackage:mapper接口.java生成的位置 -->
  38. <javaClientGenerator type="XMLMAPPER"
  39. targetPackage="cn.gx.hzu.cpsh.common.mapper"
  40. targetProject=".\src">
  41. <!-- enableSubPackages:是否让schema作为包的后缀 -->
  42. <property name="enableSubPackages" value="false" />
  43. </javaClientGenerator>
  44. <!-- 指定数据库表 -->
  45. <table schema="" tableName="t_ad"></table>
  46. <table schema="" tableName="t_admin"></table>
  47. <table schema="" tableName="t_ad_position"></table>
  48. <table schema="" tableName="t_chat"></table>
  49. <table schema="" tableName="t_purchase"></table>
  50. <table schema="" tableName="t_recommend"></table>
  51. <table schema="" tableName="t_sell"></table>
  52. <table schema="" tableName="t_type"></table>
  53. <table schema="" tableName="t_user"></table>
  54. <table schema="" tableName="t_user_datum"></table>
  55. <table schema="" tableName="t_notice"></table>
  56.  
  57. </context>
  58. </generatorConfiguration>

  GeneratorSqlmap.java 文件,配置好XML后,直接运行main函数就行

  1. public class GeneratorSqlmap {
  2.  
  3. public void generator() throws Exception{
  4.  
  5. List<String> warnings = new ArrayList<String>();
  6. boolean overwrite = true;
  7. //指定 逆向工程配置文件
  8. File configFile = new File("generatorConfig.xml");
  9. ConfigurationParser cp = new ConfigurationParser(warnings);
  10. Configuration config = cp.parseConfiguration(configFile);
  11. DefaultShellCallback callback = new DefaultShellCallback(overwrite);
  12. MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
  13. callback, warnings);
  14. myBatisGenerator.generate(null);
  15.  
  16. }
  17. public static void main(String[] args) throws Exception {
  18. try {
  19. GeneratorSqlmap generatorSqlmap = new GeneratorSqlmap();
  20. generatorSqlmap.generator();
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24.  
  25. }
  26.  
  27. }

  生成后总体的效果

  

  pojo.java

  数据库字段如果是有大写字母,逆向工程生成的实体类中的属性全都是小写

  数据库字段如果有下划线,逆向工程生成的实体类中下划线后面的字母会以大写开头

  1. public class TUser {
  2. private Integer id;
  3.  
  4. private String username;
  5.  
  6. private String password;
  7.  
  8. private String phone;
  9.  
  10. private String eamil;
  11.  
  12. private Integer credit;
  13.  
  14. private String registerTime;
  15.  
  16. private String loginTime;
  17.  
  18. private String loginCity;
  19.  
  20. private String logoutTime;
  21.  
  22. private String chatId;
  23.  
  24. private Integer isAuthentication;
  25.  
  26. private Integer status;
  27.  
  28. public Integer getId() {
  29. return id;
  30. }
  31.  
  32. public void setId(Integer id) {
  33. this.id = id;
  34. }
  35.  
  36. public String getUsername() {
  37. return username;
  38. }
  39.  
  40. public void setUsername(String username) {
  41. this.username = username == null ? null : username.trim();
  42. }
  43.  
  44. public String getPassword() {
  45. return password;
  46. }
  47.  
  48. public void setPassword(String password) {
  49. this.password = password == null ? null : password.trim();
  50. }
  51.  
  52. public String getPhone() {
  53. return phone;
  54. }
  55.  
  56. public void setPhone(String phone) {
  57. this.phone = phone == null ? null : phone.trim();
  58. }
  59.  
  60. public String getEamil() {
  61. return eamil;
  62. }
  63.  
  64. public void setEamil(String eamil) {
  65. this.eamil = eamil == null ? null : eamil.trim();
  66. }
  67.  
  68. public Integer getCredit() {
  69. return credit;
  70. }
  71.  
  72. public void setCredit(Integer credit) {
  73. this.credit = credit;
  74. }
  75.  
  76. public String getRegisterTime() {
  77. return registerTime;
  78. }
  79.  
  80. public void setRegisterTime(String registerTime) {
  81. this.registerTime = registerTime == null ? null : registerTime.trim();
  82. }
  83.  
  84. public String getLoginTime() {
  85. return loginTime;
  86. }
  87.  
  88. public void setLoginTime(String loginTime) {
  89. this.loginTime = loginTime == null ? null : loginTime.trim();
  90. }
  91.  
  92. public String getLoginCity() {
  93. return loginCity;
  94. }
  95.  
  96. public void setLoginCity(String loginCity) {
  97. this.loginCity = loginCity == null ? null : loginCity.trim();
  98. }
  99.  
  100. public String getLogoutTime() {
  101. return logoutTime;
  102. }
  103.  
  104. public void setLogoutTime(String logoutTime) {
  105. this.logoutTime = logoutTime == null ? null : logoutTime.trim();
  106. }
  107.  
  108. public String getChatId() {
  109. return chatId;
  110. }
  111.  
  112. public void setChatId(String chatId) {
  113. this.chatId = chatId == null ? null : chatId.trim();
  114. }
  115.  
  116. public Integer getIsAuthentication() {
  117. return isAuthentication;
  118. }
  119.  
  120. public void setIsAuthentication(Integer isAuthentication) {
  121. this.isAuthentication = isAuthentication;
  122. }
  123.  
  124. public Integer getStatus() {
  125. return status;
  126. }
  127.  
  128. public void setStatus(Integer status) {
  129. this.status = status;
  130. }
  131. }

  *Example.java

  example类的使用方法请戳:http://www.cnblogs.com/liuzunli/articles/9257949.html

  1. public class TUserExample {
  2. protected String orderByClause;
  3.  
  4. protected boolean distinct;
  5.  
  6. protected List<Criteria> oredCriteria;
  7.  
  8. public TUserExample() {
  9. oredCriteria = new ArrayList<Criteria>();
  10. }
  11.  
  12. public void setOrderByClause(String orderByClause) {
  13. this.orderByClause = orderByClause;
  14. }
  15.  
  16. public String getOrderByClause() {
  17. return orderByClause;
  18. }
  19.  
  20. public void setDistinct(boolean distinct) {
  21. this.distinct = distinct;
  22. }
  23.  
  24. public boolean isDistinct() {
  25. return distinct;
  26. }
  27.  
  28. public List<Criteria> getOredCriteria() {
  29. return oredCriteria;
  30. }
  31.  
  32. public void or(Criteria criteria) {
  33. oredCriteria.add(criteria);
  34. }
  35.  
  36. public Criteria or() {
  37. Criteria criteria = createCriteriaInternal();
  38. oredCriteria.add(criteria);
  39. return criteria;
  40. }
  41.  
  42. public Criteria createCriteria() {
  43. Criteria criteria = createCriteriaInternal();
  44. if (oredCriteria.size() == 0) {
  45. oredCriteria.add(criteria);
  46. }
  47. return criteria;
  48. }
  49.  
  50. protected Criteria createCriteriaInternal() {
  51. Criteria criteria = new Criteria();
  52. return criteria;
  53. }
  54.  
  55. public void clear() {
  56. oredCriteria.clear();
  57. orderByClause = null;
  58. distinct = false;
  59. }
  60.  
  61. protected abstract static class GeneratedCriteria {
  62. protected List<Criterion> criteria;
  63.  
  64. protected GeneratedCriteria() {
  65. super();
  66. criteria = new ArrayList<Criterion>();
  67. }
  68.  
  69. public boolean isValid() {
  70. return criteria.size() > 0;
  71. }
  72.  
  73. public List<Criterion> getAllCriteria() {
  74. return criteria;
  75. }
  76.  
  77. public List<Criterion> getCriteria() {
  78. return criteria;
  79. }
  80.  
  81. protected void addCriterion(String condition) {
  82. if (condition == null) {
  83. throw new RuntimeException("Value for condition cannot be null");
  84. }
  85. criteria.add(new Criterion(condition));
  86. }
  87.  
  88. protected void addCriterion(String condition, Object value, String property) {
  89. if (value == null) {
  90. throw new RuntimeException("Value for " + property + " cannot be null");
  91. }
  92. criteria.add(new Criterion(condition, value));
  93. }
  94.  
  95. protected void addCriterion(String condition, Object value1, Object value2, String property) {
  96. if (value1 == null || value2 == null) {
  97. throw new RuntimeException("Between values for " + property + " cannot be null");
  98. }
  99. criteria.add(new Criterion(condition, value1, value2));
  100. }
  101.  
  102. public Criteria andIdIsNull() {
  103. addCriterion("id is null");
  104. return (Criteria) this;
  105. }
  106.  
  107. public Criteria andIdIsNotNull() {
  108. addCriterion("id is not null");
  109. return (Criteria) this;
  110. }
  111.  
  112. public Criteria andIdEqualTo(Integer value) {
  113. addCriterion("id =", value, "id");
  114. return (Criteria) this;
  115. }
  116.  
  117. public Criteria andIdNotEqualTo(Integer value) {
  118. addCriterion("id <>", value, "id");
  119. return (Criteria) this;
  120. }
  121.  
  122. public Criteria andIdGreaterThan(Integer value) {
  123. addCriterion("id >", value, "id");
  124. return (Criteria) this;
  125. }
  126.  
  127. public Criteria andIdGreaterThanOrEqualTo(Integer value) {
  128. addCriterion("id >=", value, "id");
  129. return (Criteria) this;
  130. }
  131.  
  132. public Criteria andIdLessThan(Integer value) {
  133. addCriterion("id <", value, "id");
  134. return (Criteria) this;
  135. }
  136.  
  137. public Criteria andIdLessThanOrEqualTo(Integer value) {
  138. addCriterion("id <=", value, "id");
  139. return (Criteria) this;
  140. }
  141.  
  142. public Criteria andIdIn(List<Integer> values) {
  143. addCriterion("id in", values, "id");
  144. return (Criteria) this;
  145. }
  146.  
  147. public Criteria andIdNotIn(List<Integer> values) {
  148. addCriterion("id not in", values, "id");
  149. return (Criteria) this;
  150. }
  151.  
  152. public Criteria andIdBetween(Integer value1, Integer value2) {
  153. addCriterion("id between", value1, value2, "id");
  154. return (Criteria) this;
  155. }
  156.  
  157. public Criteria andIdNotBetween(Integer value1, Integer value2) {
  158. addCriterion("id not between", value1, value2, "id");
  159. return (Criteria) this;
  160. }
  161.  
  162. public Criteria andUsernameIsNull() {
  163. addCriterion("username is null");
  164. return (Criteria) this;
  165. }
  166.  
  167. public Criteria andUsernameIsNotNull() {
  168. addCriterion("username is not null");
  169. return (Criteria) this;
  170. }
  171.  
  172. public Criteria andUsernameEqualTo(String value) {
  173. addCriterion("username =", value, "username");
  174. return (Criteria) this;
  175. }
  176.  
  177. public Criteria andUsernameNotEqualTo(String value) {
  178. addCriterion("username <>", value, "username");
  179. return (Criteria) this;
  180. }
  181.  
  182. public Criteria andUsernameGreaterThan(String value) {
  183. addCriterion("username >", value, "username");
  184. return (Criteria) this;
  185. }
  186.  
  187. public Criteria andUsernameGreaterThanOrEqualTo(String value) {
  188. addCriterion("username >=", value, "username");
  189. return (Criteria) this;
  190. }
  191.  
  192. public Criteria andUsernameLessThan(String value) {
  193. addCriterion("username <", value, "username");
  194. return (Criteria) this;
  195. }
  196.  
  197. public Criteria andUsernameLessThanOrEqualTo(String value) {
  198. addCriterion("username <=", value, "username");
  199. return (Criteria) this;
  200. }
  201.  
  202. public Criteria andUsernameLike(String value) {
  203. addCriterion("username like", value, "username");
  204. return (Criteria) this;
  205. }
  206.  
  207. public Criteria andUsernameNotLike(String value) {
  208. addCriterion("username not like", value, "username");
  209. return (Criteria) this;
  210. }
  211.  
  212. public Criteria andUsernameIn(List<String> values) {
  213. addCriterion("username in", values, "username");
  214. return (Criteria) this;
  215. }
  216.  
  217. public Criteria andUsernameNotIn(List<String> values) {
  218. addCriterion("username not in", values, "username");
  219. return (Criteria) this;
  220. }
  221.  
  222. public Criteria andUsernameBetween(String value1, String value2) {
  223. addCriterion("username between", value1, value2, "username");
  224. return (Criteria) this;
  225. }
  226.  
  227. public Criteria andUsernameNotBetween(String value1, String value2) {
  228. addCriterion("username not between", value1, value2, "username");
  229. return (Criteria) this;
  230. }
  231.  
  232. public Criteria andPasswordIsNull() {
  233. addCriterion("password is null");
  234. return (Criteria) this;
  235. }
  236.  
  237. public Criteria andPasswordIsNotNull() {
  238. addCriterion("password is not null");
  239. return (Criteria) this;
  240. }
  241.  
  242. public Criteria andPasswordEqualTo(String value) {
  243. addCriterion("password =", value, "password");
  244. return (Criteria) this;
  245. }
  246.  
  247. public Criteria andPasswordNotEqualTo(String value) {
  248. addCriterion("password <>", value, "password");
  249. return (Criteria) this;
  250. }
  251.  
  252. public Criteria andPasswordGreaterThan(String value) {
  253. addCriterion("password >", value, "password");
  254. return (Criteria) this;
  255. }
  256.  
  257. public Criteria andPasswordGreaterThanOrEqualTo(String value) {
  258. addCriterion("password >=", value, "password");
  259. return (Criteria) this;
  260. }
  261.  
  262. public Criteria andPasswordLessThan(String value) {
  263. addCriterion("password <", value, "password");
  264. return (Criteria) this;
  265. }
  266.  
  267. public Criteria andPasswordLessThanOrEqualTo(String value) {
  268. addCriterion("password <=", value, "password");
  269. return (Criteria) this;
  270. }
  271.  
  272. public Criteria andPasswordLike(String value) {
  273. addCriterion("password like", value, "password");
  274. return (Criteria) this;
  275. }
  276.  
  277. public Criteria andPasswordNotLike(String value) {
  278. addCriterion("password not like", value, "password");
  279. return (Criteria) this;
  280. }
  281.  
  282. public Criteria andPasswordIn(List<String> values) {
  283. addCriterion("password in", values, "password");
  284. return (Criteria) this;
  285. }
  286.  
  287. public Criteria andPasswordNotIn(List<String> values) {
  288. addCriterion("password not in", values, "password");
  289. return (Criteria) this;
  290. }
  291.  
  292. public Criteria andPasswordBetween(String value1, String value2) {
  293. addCriterion("password between", value1, value2, "password");
  294. return (Criteria) this;
  295. }
  296.  
  297. public Criteria andPasswordNotBetween(String value1, String value2) {
  298. addCriterion("password not between", value1, value2, "password");
  299. return (Criteria) this;
  300. }
  301.  
  302. public Criteria andPhoneIsNull() {
  303. addCriterion("phone is null");
  304. return (Criteria) this;
  305. }
  306.  
  307. public Criteria andPhoneIsNotNull() {
  308. addCriterion("phone is not null");
  309. return (Criteria) this;
  310. }
  311.  
  312. public Criteria andPhoneEqualTo(String value) {
  313. addCriterion("phone =", value, "phone");
  314. return (Criteria) this;
  315. }
  316.  
  317. public Criteria andPhoneNotEqualTo(String value) {
  318. addCriterion("phone <>", value, "phone");
  319. return (Criteria) this;
  320. }
  321.  
  322. public Criteria andPhoneGreaterThan(String value) {
  323. addCriterion("phone >", value, "phone");
  324. return (Criteria) this;
  325. }
  326.  
  327. public Criteria andPhoneGreaterThanOrEqualTo(String value) {
  328. addCriterion("phone >=", value, "phone");
  329. return (Criteria) this;
  330. }
  331.  
  332. public Criteria andPhoneLessThan(String value) {
  333. addCriterion("phone <", value, "phone");
  334. return (Criteria) this;
  335. }
  336.  
  337. public Criteria andPhoneLessThanOrEqualTo(String value) {
  338. addCriterion("phone <=", value, "phone");
  339. return (Criteria) this;
  340. }
  341.  
  342. public Criteria andPhoneLike(String value) {
  343. addCriterion("phone like", value, "phone");
  344. return (Criteria) this;
  345. }
  346.  
  347. public Criteria andPhoneNotLike(String value) {
  348. addCriterion("phone not like", value, "phone");
  349. return (Criteria) this;
  350. }
  351.  
  352. public Criteria andPhoneIn(List<String> values) {
  353. addCriterion("phone in", values, "phone");
  354. return (Criteria) this;
  355. }
  356.  
  357. public Criteria andPhoneNotIn(List<String> values) {
  358. addCriterion("phone not in", values, "phone");
  359. return (Criteria) this;
  360. }
  361.  
  362. public Criteria andPhoneBetween(String value1, String value2) {
  363. addCriterion("phone between", value1, value2, "phone");
  364. return (Criteria) this;
  365. }
  366.  
  367. public Criteria andPhoneNotBetween(String value1, String value2) {
  368. addCriterion("phone not between", value1, value2, "phone");
  369. return (Criteria) this;
  370. }
  371.  
  372. public Criteria andEamilIsNull() {
  373. addCriterion("eamil is null");
  374. return (Criteria) this;
  375. }
  376.  
  377. public Criteria andEamilIsNotNull() {
  378. addCriterion("eamil is not null");
  379. return (Criteria) this;
  380. }
  381.  
  382. public Criteria andEamilEqualTo(String value) {
  383. addCriterion("eamil =", value, "eamil");
  384. return (Criteria) this;
  385. }
  386.  
  387. public Criteria andEamilNotEqualTo(String value) {
  388. addCriterion("eamil <>", value, "eamil");
  389. return (Criteria) this;
  390. }
  391.  
  392. public Criteria andEamilGreaterThan(String value) {
  393. addCriterion("eamil >", value, "eamil");
  394. return (Criteria) this;
  395. }
  396.  
  397. public Criteria andEamilGreaterThanOrEqualTo(String value) {
  398. addCriterion("eamil >=", value, "eamil");
  399. return (Criteria) this;
  400. }
  401.  
  402. public Criteria andEamilLessThan(String value) {
  403. addCriterion("eamil <", value, "eamil");
  404. return (Criteria) this;
  405. }
  406.  
  407. public Criteria andEamilLessThanOrEqualTo(String value) {
  408. addCriterion("eamil <=", value, "eamil");
  409. return (Criteria) this;
  410. }
  411.  
  412. public Criteria andEamilLike(String value) {
  413. addCriterion("eamil like", value, "eamil");
  414. return (Criteria) this;
  415. }
  416.  
  417. public Criteria andEamilNotLike(String value) {
  418. addCriterion("eamil not like", value, "eamil");
  419. return (Criteria) this;
  420. }
  421.  
  422. public Criteria andEamilIn(List<String> values) {
  423. addCriterion("eamil in", values, "eamil");
  424. return (Criteria) this;
  425. }
  426.  
  427. public Criteria andEamilNotIn(List<String> values) {
  428. addCriterion("eamil not in", values, "eamil");
  429. return (Criteria) this;
  430. }
  431.  
  432. public Criteria andEamilBetween(String value1, String value2) {
  433. addCriterion("eamil between", value1, value2, "eamil");
  434. return (Criteria) this;
  435. }
  436.  
  437. public Criteria andEamilNotBetween(String value1, String value2) {
  438. addCriterion("eamil not between", value1, value2, "eamil");
  439. return (Criteria) this;
  440. }
  441.  
  442. public Criteria andCreditIsNull() {
  443. addCriterion("credit is null");
  444. return (Criteria) this;
  445. }
  446.  
  447. public Criteria andCreditIsNotNull() {
  448. addCriterion("credit is not null");
  449. return (Criteria) this;
  450. }
  451.  
  452. public Criteria andCreditEqualTo(Integer value) {
  453. addCriterion("credit =", value, "credit");
  454. return (Criteria) this;
  455. }
  456.  
  457. public Criteria andCreditNotEqualTo(Integer value) {
  458. addCriterion("credit <>", value, "credit");
  459. return (Criteria) this;
  460. }
  461.  
  462. public Criteria andCreditGreaterThan(Integer value) {
  463. addCriterion("credit >", value, "credit");
  464. return (Criteria) this;
  465. }
  466.  
  467. public Criteria andCreditGreaterThanOrEqualTo(Integer value) {
  468. addCriterion("credit >=", value, "credit");
  469. return (Criteria) this;
  470. }
  471.  
  472. public Criteria andCreditLessThan(Integer value) {
  473. addCriterion("credit <", value, "credit");
  474. return (Criteria) this;
  475. }
  476.  
  477. public Criteria andCreditLessThanOrEqualTo(Integer value) {
  478. addCriterion("credit <=", value, "credit");
  479. return (Criteria) this;
  480. }
  481.  
  482. public Criteria andCreditIn(List<Integer> values) {
  483. addCriterion("credit in", values, "credit");
  484. return (Criteria) this;
  485. }
  486.  
  487. public Criteria andCreditNotIn(List<Integer> values) {
  488. addCriterion("credit not in", values, "credit");
  489. return (Criteria) this;
  490. }
  491.  
  492. public Criteria andCreditBetween(Integer value1, Integer value2) {
  493. addCriterion("credit between", value1, value2, "credit");
  494. return (Criteria) this;
  495. }
  496.  
  497. public Criteria andCreditNotBetween(Integer value1, Integer value2) {
  498. addCriterion("credit not between", value1, value2, "credit");
  499. return (Criteria) this;
  500. }
  501.  
  502. public Criteria andRegisterTimeIsNull() {
  503. addCriterion("register_time is null");
  504. return (Criteria) this;
  505. }
  506.  
  507. public Criteria andRegisterTimeIsNotNull() {
  508. addCriterion("register_time is not null");
  509. return (Criteria) this;
  510. }
  511.  
  512. public Criteria andRegisterTimeEqualTo(String value) {
  513. addCriterion("register_time =", value, "registerTime");
  514. return (Criteria) this;
  515. }
  516.  
  517. public Criteria andRegisterTimeNotEqualTo(String value) {
  518. addCriterion("register_time <>", value, "registerTime");
  519. return (Criteria) this;
  520. }
  521.  
  522. public Criteria andRegisterTimeGreaterThan(String value) {
  523. addCriterion("register_time >", value, "registerTime");
  524. return (Criteria) this;
  525. }
  526.  
  527. public Criteria andRegisterTimeGreaterThanOrEqualTo(String value) {
  528. addCriterion("register_time >=", value, "registerTime");
  529. return (Criteria) this;
  530. }
  531.  
  532. public Criteria andRegisterTimeLessThan(String value) {
  533. addCriterion("register_time <", value, "registerTime");
  534. return (Criteria) this;
  535. }
  536.  
  537. public Criteria andRegisterTimeLessThanOrEqualTo(String value) {
  538. addCriterion("register_time <=", value, "registerTime");
  539. return (Criteria) this;
  540. }
  541.  
  542. public Criteria andRegisterTimeLike(String value) {
  543. addCriterion("register_time like", value, "registerTime");
  544. return (Criteria) this;
  545. }
  546.  
  547. public Criteria andRegisterTimeNotLike(String value) {
  548. addCriterion("register_time not like", value, "registerTime");
  549. return (Criteria) this;
  550. }
  551.  
  552. public Criteria andRegisterTimeIn(List<String> values) {
  553. addCriterion("register_time in", values, "registerTime");
  554. return (Criteria) this;
  555. }
  556.  
  557. public Criteria andRegisterTimeNotIn(List<String> values) {
  558. addCriterion("register_time not in", values, "registerTime");
  559. return (Criteria) this;
  560. }
  561.  
  562. public Criteria andRegisterTimeBetween(String value1, String value2) {
  563. addCriterion("register_time between", value1, value2, "registerTime");
  564. return (Criteria) this;
  565. }
  566.  
  567. public Criteria andRegisterTimeNotBetween(String value1, String value2) {
  568. addCriterion("register_time not between", value1, value2, "registerTime");
  569. return (Criteria) this;
  570. }
  571.  
  572. public Criteria andLoginTimeIsNull() {
  573. addCriterion("login_time is null");
  574. return (Criteria) this;
  575. }
  576.  
  577. public Criteria andLoginTimeIsNotNull() {
  578. addCriterion("login_time is not null");
  579. return (Criteria) this;
  580. }
  581.  
  582. public Criteria andLoginTimeEqualTo(String value) {
  583. addCriterion("login_time =", value, "loginTime");
  584. return (Criteria) this;
  585. }
  586.  
  587. public Criteria andLoginTimeNotEqualTo(String value) {
  588. addCriterion("login_time <>", value, "loginTime");
  589. return (Criteria) this;
  590. }
  591.  
  592. public Criteria andLoginTimeGreaterThan(String value) {
  593. addCriterion("login_time >", value, "loginTime");
  594. return (Criteria) this;
  595. }
  596.  
  597. public Criteria andLoginTimeGreaterThanOrEqualTo(String value) {
  598. addCriterion("login_time >=", value, "loginTime");
  599. return (Criteria) this;
  600. }
  601.  
  602. public Criteria andLoginTimeLessThan(String value) {
  603. addCriterion("login_time <", value, "loginTime");
  604. return (Criteria) this;
  605. }
  606.  
  607. public Criteria andLoginTimeLessThanOrEqualTo(String value) {
  608. addCriterion("login_time <=", value, "loginTime");
  609. return (Criteria) this;
  610. }
  611.  
  612. public Criteria andLoginTimeLike(String value) {
  613. addCriterion("login_time like", value, "loginTime");
  614. return (Criteria) this;
  615. }
  616.  
  617. public Criteria andLoginTimeNotLike(String value) {
  618. addCriterion("login_time not like", value, "loginTime");
  619. return (Criteria) this;
  620. }
  621.  
  622. public Criteria andLoginTimeIn(List<String> values) {
  623. addCriterion("login_time in", values, "loginTime");
  624. return (Criteria) this;
  625. }
  626.  
  627. public Criteria andLoginTimeNotIn(List<String> values) {
  628. addCriterion("login_time not in", values, "loginTime");
  629. return (Criteria) this;
  630. }
  631.  
  632. public Criteria andLoginTimeBetween(String value1, String value2) {
  633. addCriterion("login_time between", value1, value2, "loginTime");
  634. return (Criteria) this;
  635. }
  636.  
  637. public Criteria andLoginTimeNotBetween(String value1, String value2) {
  638. addCriterion("login_time not between", value1, value2, "loginTime");
  639. return (Criteria) this;
  640. }
  641.  
  642. public Criteria andLoginCityIsNull() {
  643. addCriterion("login_city is null");
  644. return (Criteria) this;
  645. }
  646.  
  647. public Criteria andLoginCityIsNotNull() {
  648. addCriterion("login_city is not null");
  649. return (Criteria) this;
  650. }
  651.  
  652. public Criteria andLoginCityEqualTo(String value) {
  653. addCriterion("login_city =", value, "loginCity");
  654. return (Criteria) this;
  655. }
  656.  
  657. public Criteria andLoginCityNotEqualTo(String value) {
  658. addCriterion("login_city <>", value, "loginCity");
  659. return (Criteria) this;
  660. }
  661.  
  662. public Criteria andLoginCityGreaterThan(String value) {
  663. addCriterion("login_city >", value, "loginCity");
  664. return (Criteria) this;
  665. }
  666.  
  667. public Criteria andLoginCityGreaterThanOrEqualTo(String value) {
  668. addCriterion("login_city >=", value, "loginCity");
  669. return (Criteria) this;
  670. }
  671.  
  672. public Criteria andLoginCityLessThan(String value) {
  673. addCriterion("login_city <", value, "loginCity");
  674. return (Criteria) this;
  675. }
  676.  
  677. public Criteria andLoginCityLessThanOrEqualTo(String value) {
  678. addCriterion("login_city <=", value, "loginCity");
  679. return (Criteria) this;
  680. }
  681.  
  682. public Criteria andLoginCityLike(String value) {
  683. addCriterion("login_city like", value, "loginCity");
  684. return (Criteria) this;
  685. }
  686.  
  687. public Criteria andLoginCityNotLike(String value) {
  688. addCriterion("login_city not like", value, "loginCity");
  689. return (Criteria) this;
  690. }
  691.  
  692. public Criteria andLoginCityIn(List<String> values) {
  693. addCriterion("login_city in", values, "loginCity");
  694. return (Criteria) this;
  695. }
  696.  
  697. public Criteria andLoginCityNotIn(List<String> values) {
  698. addCriterion("login_city not in", values, "loginCity");
  699. return (Criteria) this;
  700. }
  701.  
  702. public Criteria andLoginCityBetween(String value1, String value2) {
  703. addCriterion("login_city between", value1, value2, "loginCity");
  704. return (Criteria) this;
  705. }
  706.  
  707. public Criteria andLoginCityNotBetween(String value1, String value2) {
  708. addCriterion("login_city not between", value1, value2, "loginCity");
  709. return (Criteria) this;
  710. }
  711.  
  712. public Criteria andLogoutTimeIsNull() {
  713. addCriterion("logout_time is null");
  714. return (Criteria) this;
  715. }
  716.  
  717. public Criteria andLogoutTimeIsNotNull() {
  718. addCriterion("logout_time is not null");
  719. return (Criteria) this;
  720. }
  721.  
  722. public Criteria andLogoutTimeEqualTo(String value) {
  723. addCriterion("logout_time =", value, "logoutTime");
  724. return (Criteria) this;
  725. }
  726.  
  727. public Criteria andLogoutTimeNotEqualTo(String value) {
  728. addCriterion("logout_time <>", value, "logoutTime");
  729. return (Criteria) this;
  730. }
  731.  
  732. public Criteria andLogoutTimeGreaterThan(String value) {
  733. addCriterion("logout_time >", value, "logoutTime");
  734. return (Criteria) this;
  735. }
  736.  
  737. public Criteria andLogoutTimeGreaterThanOrEqualTo(String value) {
  738. addCriterion("logout_time >=", value, "logoutTime");
  739. return (Criteria) this;
  740. }
  741.  
  742. public Criteria andLogoutTimeLessThan(String value) {
  743. addCriterion("logout_time <", value, "logoutTime");
  744. return (Criteria) this;
  745. }
  746.  
  747. public Criteria andLogoutTimeLessThanOrEqualTo(String value) {
  748. addCriterion("logout_time <=", value, "logoutTime");
  749. return (Criteria) this;
  750. }
  751.  
  752. public Criteria andLogoutTimeLike(String value) {
  753. addCriterion("logout_time like", value, "logoutTime");
  754. return (Criteria) this;
  755. }
  756.  
  757. public Criteria andLogoutTimeNotLike(String value) {
  758. addCriterion("logout_time not like", value, "logoutTime");
  759. return (Criteria) this;
  760. }
  761.  
  762. public Criteria andLogoutTimeIn(List<String> values) {
  763. addCriterion("logout_time in", values, "logoutTime");
  764. return (Criteria) this;
  765. }
  766.  
  767. public Criteria andLogoutTimeNotIn(List<String> values) {
  768. addCriterion("logout_time not in", values, "logoutTime");
  769. return (Criteria) this;
  770. }
  771.  
  772. public Criteria andLogoutTimeBetween(String value1, String value2) {
  773. addCriterion("logout_time between", value1, value2, "logoutTime");
  774. return (Criteria) this;
  775. }
  776.  
  777. public Criteria andLogoutTimeNotBetween(String value1, String value2) {
  778. addCriterion("logout_time not between", value1, value2, "logoutTime");
  779. return (Criteria) this;
  780. }
  781.  
  782. public Criteria andChatIdIsNull() {
  783. addCriterion("chat_id is null");
  784. return (Criteria) this;
  785. }
  786.  
  787. public Criteria andChatIdIsNotNull() {
  788. addCriterion("chat_id is not null");
  789. return (Criteria) this;
  790. }
  791.  
  792. public Criteria andChatIdEqualTo(String value) {
  793. addCriterion("chat_id =", value, "chatId");
  794. return (Criteria) this;
  795. }
  796.  
  797. public Criteria andChatIdNotEqualTo(String value) {
  798. addCriterion("chat_id <>", value, "chatId");
  799. return (Criteria) this;
  800. }
  801.  
  802. public Criteria andChatIdGreaterThan(String value) {
  803. addCriterion("chat_id >", value, "chatId");
  804. return (Criteria) this;
  805. }
  806.  
  807. public Criteria andChatIdGreaterThanOrEqualTo(String value) {
  808. addCriterion("chat_id >=", value, "chatId");
  809. return (Criteria) this;
  810. }
  811.  
  812. public Criteria andChatIdLessThan(String value) {
  813. addCriterion("chat_id <", value, "chatId");
  814. return (Criteria) this;
  815. }
  816.  
  817. public Criteria andChatIdLessThanOrEqualTo(String value) {
  818. addCriterion("chat_id <=", value, "chatId");
  819. return (Criteria) this;
  820. }
  821.  
  822. public Criteria andChatIdLike(String value) {
  823. addCriterion("chat_id like", value, "chatId");
  824. return (Criteria) this;
  825. }
  826.  
  827. public Criteria andChatIdNotLike(String value) {
  828. addCriterion("chat_id not like", value, "chatId");
  829. return (Criteria) this;
  830. }
  831.  
  832. public Criteria andChatIdIn(List<String> values) {
  833. addCriterion("chat_id in", values, "chatId");
  834. return (Criteria) this;
  835. }
  836.  
  837. public Criteria andChatIdNotIn(List<String> values) {
  838. addCriterion("chat_id not in", values, "chatId");
  839. return (Criteria) this;
  840. }
  841.  
  842. public Criteria andChatIdBetween(String value1, String value2) {
  843. addCriterion("chat_id between", value1, value2, "chatId");
  844. return (Criteria) this;
  845. }
  846.  
  847. public Criteria andChatIdNotBetween(String value1, String value2) {
  848. addCriterion("chat_id not between", value1, value2, "chatId");
  849. return (Criteria) this;
  850. }
  851.  
  852. public Criteria andIsAuthenticationIsNull() {
  853. addCriterion("is_authentication is null");
  854. return (Criteria) this;
  855. }
  856.  
  857. public Criteria andIsAuthenticationIsNotNull() {
  858. addCriterion("is_authentication is not null");
  859. return (Criteria) this;
  860. }
  861.  
  862. public Criteria andIsAuthenticationEqualTo(Integer value) {
  863. addCriterion("is_authentication =", value, "isAuthentication");
  864. return (Criteria) this;
  865. }
  866.  
  867. public Criteria andIsAuthenticationNotEqualTo(Integer value) {
  868. addCriterion("is_authentication <>", value, "isAuthentication");
  869. return (Criteria) this;
  870. }
  871.  
  872. public Criteria andIsAuthenticationGreaterThan(Integer value) {
  873. addCriterion("is_authentication >", value, "isAuthentication");
  874. return (Criteria) this;
  875. }
  876.  
  877. public Criteria andIsAuthenticationGreaterThanOrEqualTo(Integer value) {
  878. addCriterion("is_authentication >=", value, "isAuthentication");
  879. return (Criteria) this;
  880. }
  881.  
  882. public Criteria andIsAuthenticationLessThan(Integer value) {
  883. addCriterion("is_authentication <", value, "isAuthentication");
  884. return (Criteria) this;
  885. }
  886.  
  887. public Criteria andIsAuthenticationLessThanOrEqualTo(Integer value) {
  888. addCriterion("is_authentication <=", value, "isAuthentication");
  889. return (Criteria) this;
  890. }
  891.  
  892. public Criteria andIsAuthenticationIn(List<Integer> values) {
  893. addCriterion("is_authentication in", values, "isAuthentication");
  894. return (Criteria) this;
  895. }
  896.  
  897. public Criteria andIsAuthenticationNotIn(List<Integer> values) {
  898. addCriterion("is_authentication not in", values, "isAuthentication");
  899. return (Criteria) this;
  900. }
  901.  
  902. public Criteria andIsAuthenticationBetween(Integer value1, Integer value2) {
  903. addCriterion("is_authentication between", value1, value2, "isAuthentication");
  904. return (Criteria) this;
  905. }
  906.  
  907. public Criteria andIsAuthenticationNotBetween(Integer value1, Integer value2) {
  908. addCriterion("is_authentication not between", value1, value2, "isAuthentication");
  909. return (Criteria) this;
  910. }
  911.  
  912. public Criteria andStatusIsNull() {
  913. addCriterion("status is null");
  914. return (Criteria) this;
  915. }
  916.  
  917. public Criteria andStatusIsNotNull() {
  918. addCriterion("status is not null");
  919. return (Criteria) this;
  920. }
  921.  
  922. public Criteria andStatusEqualTo(Integer value) {
  923. addCriterion("status =", value, "status");
  924. return (Criteria) this;
  925. }
  926.  
  927. public Criteria andStatusNotEqualTo(Integer value) {
  928. addCriterion("status <>", value, "status");
  929. return (Criteria) this;
  930. }
  931.  
  932. public Criteria andStatusGreaterThan(Integer value) {
  933. addCriterion("status >", value, "status");
  934. return (Criteria) this;
  935. }
  936.  
  937. public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
  938. addCriterion("status >=", value, "status");
  939. return (Criteria) this;
  940. }
  941.  
  942. public Criteria andStatusLessThan(Integer value) {
  943. addCriterion("status <", value, "status");
  944. return (Criteria) this;
  945. }
  946.  
  947. public Criteria andStatusLessThanOrEqualTo(Integer value) {
  948. addCriterion("status <=", value, "status");
  949. return (Criteria) this;
  950. }
  951.  
  952. public Criteria andStatusIn(List<Integer> values) {
  953. addCriterion("status in", values, "status");
  954. return (Criteria) this;
  955. }
  956.  
  957. public Criteria andStatusNotIn(List<Integer> values) {
  958. addCriterion("status not in", values, "status");
  959. return (Criteria) this;
  960. }
  961.  
  962. public Criteria andStatusBetween(Integer value1, Integer value2) {
  963. addCriterion("status between", value1, value2, "status");
  964. return (Criteria) this;
  965. }
  966.  
  967. public Criteria andStatusNotBetween(Integer value1, Integer value2) {
  968. addCriterion("status not between", value1, value2, "status");
  969. return (Criteria) this;
  970. }
  971. }
  972.  
  973. public static class Criteria extends GeneratedCriteria {
  974.  
  975. protected Criteria() {
  976. super();
  977. }
  978. }
  979.  
  980. public static class Criterion {
  981. private String condition;
  982.  
  983. private Object value;
  984.  
  985. private Object secondValue;
  986.  
  987. private boolean noValue;
  988.  
  989. private boolean singleValue;
  990.  
  991. private boolean betweenValue;
  992.  
  993. private boolean listValue;
  994.  
  995. private String typeHandler;
  996.  
  997. public String getCondition() {
  998. return condition;
  999. }
  1000.  
  1001. public Object getValue() {
  1002. return value;
  1003. }
  1004.  
  1005. public Object getSecondValue() {
  1006. return secondValue;
  1007. }
  1008.  
  1009. public boolean isNoValue() {
  1010. return noValue;
  1011. }
  1012.  
  1013. public boolean isSingleValue() {
  1014. return singleValue;
  1015. }
  1016.  
  1017. public boolean isBetweenValue() {
  1018. return betweenValue;
  1019. }
  1020.  
  1021. public boolean isListValue() {
  1022. return listValue;
  1023. }
  1024.  
  1025. public String getTypeHandler() {
  1026. return typeHandler;
  1027. }
  1028.  
  1029. protected Criterion(String condition) {
  1030. super();
  1031. this.condition = condition;
  1032. this.typeHandler = null;
  1033. this.noValue = true;
  1034. }
  1035.  
  1036. protected Criterion(String condition, Object value, String typeHandler) {
  1037. super();
  1038. this.condition = condition;
  1039. this.value = value;
  1040. this.typeHandler = typeHandler;
  1041. if (value instanceof List<?>) {
  1042. this.listValue = true;
  1043. } else {
  1044. this.singleValue = true;
  1045. }
  1046. }
  1047.  
  1048. protected Criterion(String condition, Object value) {
  1049. this(condition, value, null);
  1050. }
  1051.  
  1052. protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
  1053. super();
  1054. this.condition = condition;
  1055. this.value = value;
  1056. this.secondValue = secondValue;
  1057. this.typeHandler = typeHandler;
  1058. this.betweenValue = true;
  1059. }
  1060.  
  1061. protected Criterion(String condition, Object value, Object secondValue) {
  1062. this(condition, value, secondValue, null);
  1063. }
  1064. }
  1065. }

  *mapper.java

public interface TUserMapper {
int countByExample(TUserExample example); int deleteByExample(TUserExample example); int deleteByPrimaryKey(Integer id); int insert(TUser record); int insertSelective(TUser record); List<TUser> selectByExample(TUserExample example); TUser selectByPrimaryKey(Integer id); int updateByExampleSelective(@Param("record") TUser record, @Param("example") TUserExample example); int updateByExample(@Param("record") TUser record, @Param("example") TUserExample example); int updateByPrimaryKeySelective(TUser record); int updateByPrimaryKey(TUser record);
}

  *Mapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.gx.hzu.cpsh.common.mapper.TUserMapper" >
<resultMap id="BaseResultMap" type="cn.gx.hzu.cpsh.common.pojo.TUser" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="phone" property="phone" jdbcType="VARCHAR" />
<result column="eamil" property="eamil" jdbcType="VARCHAR" />
<result column="credit" property="credit" jdbcType="INTEGER" />
<result column="register_time" property="registerTime" jdbcType="VARCHAR" />
<result column="login_time" property="loginTime" jdbcType="VARCHAR" />
<result column="login_city" property="loginCity" jdbcType="VARCHAR" />
<result column="logout_time" property="logoutTime" jdbcType="VARCHAR" />
<result column="chat_id" property="chatId" jdbcType="VARCHAR" />
<result column="is_authentication" property="isAuthentication" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, username, password, phone, eamil, credit, register_time, login_time, login_city,
logout_time, chat_id, is_authentication, status
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="cn.gx.hzu.cpsh.common.pojo.TUserExample" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from t_user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from t_user
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from t_user
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="cn.gx.hzu.cpsh.common.pojo.TUserExample" >
delete from t_user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="cn.gx.hzu.cpsh.common.pojo.TUser" >
insert into t_user (id, username, password,
phone, eamil, credit,
register_time, login_time, login_city,
logout_time, chat_id, is_authentication,
status)
values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{eamil,jdbcType=VARCHAR}, #{credit,jdbcType=INTEGER},
#{registerTime,jdbcType=VARCHAR}, #{loginTime,jdbcType=VARCHAR}, #{loginCity,jdbcType=VARCHAR},
#{logoutTime,jdbcType=VARCHAR}, #{chatId,jdbcType=VARCHAR}, #{isAuthentication,jdbcType=INTEGER},
#{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cn.gx.hzu.cpsh.common.pojo.TUser" >
insert into t_user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="username != null" >
username,
</if>
<if test="password != null" >
password,
</if>
<if test="phone != null" >
phone,
</if>
<if test="eamil != null" >
eamil,
</if>
<if test="credit != null" >
credit,
</if>
<if test="registerTime != null" >
register_time,
</if>
<if test="loginTime != null" >
login_time,
</if>
<if test="loginCity != null" >
login_city,
</if>
<if test="logoutTime != null" >
logout_time,
</if>
<if test="chatId != null" >
chat_id,
</if>
<if test="isAuthentication != null" >
is_authentication,
</if>
<if test="status != null" >
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="username != null" >
#{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
<if test="phone != null" >
#{phone,jdbcType=VARCHAR},
</if>
<if test="eamil != null" >
#{eamil,jdbcType=VARCHAR},
</if>
<if test="credit != null" >
#{credit,jdbcType=INTEGER},
</if>
<if test="registerTime != null" >
#{registerTime,jdbcType=VARCHAR},
</if>
<if test="loginTime != null" >
#{loginTime,jdbcType=VARCHAR},
</if>
<if test="loginCity != null" >
#{loginCity,jdbcType=VARCHAR},
</if>
<if test="logoutTime != null" >
#{logoutTime,jdbcType=VARCHAR},
</if>
<if test="chatId != null" >
#{chatId,jdbcType=VARCHAR},
</if>
<if test="isAuthentication != null" >
#{isAuthentication,jdbcType=INTEGER},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="cn.gx.hzu.cpsh.common.pojo.TUserExample" resultType="java.lang.Integer" >
select count(*) from t_user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update t_user
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.username != null" >
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.password != null" >
password = #{record.password,jdbcType=VARCHAR},
</if>
<if test="record.phone != null" >
phone = #{record.phone,jdbcType=VARCHAR},
</if>
<if test="record.eamil != null" >
eamil = #{record.eamil,jdbcType=VARCHAR},
</if>
<if test="record.credit != null" >
credit = #{record.credit,jdbcType=INTEGER},
</if>
<if test="record.registerTime != null" >
register_time = #{record.registerTime,jdbcType=VARCHAR},
</if>
<if test="record.loginTime != null" >
login_time = #{record.loginTime,jdbcType=VARCHAR},
</if>
<if test="record.loginCity != null" >
login_city = #{record.loginCity,jdbcType=VARCHAR},
</if>
<if test="record.logoutTime != null" >
logout_time = #{record.logoutTime,jdbcType=VARCHAR},
</if>
<if test="record.chatId != null" >
chat_id = #{record.chatId,jdbcType=VARCHAR},
</if>
<if test="record.isAuthentication != null" >
is_authentication = #{record.isAuthentication,jdbcType=INTEGER},
</if>
<if test="record.status != null" >
status = #{record.status,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update t_user
set id = #{record.id,jdbcType=INTEGER},
username = #{record.username,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
phone = #{record.phone,jdbcType=VARCHAR},
eamil = #{record.eamil,jdbcType=VARCHAR},
credit = #{record.credit,jdbcType=INTEGER},
register_time = #{record.registerTime,jdbcType=VARCHAR},
login_time = #{record.loginTime,jdbcType=VARCHAR},
login_city = #{record.loginCity,jdbcType=VARCHAR},
logout_time = #{record.logoutTime,jdbcType=VARCHAR},
chat_id = #{record.chatId,jdbcType=VARCHAR},
is_authentication = #{record.isAuthentication,jdbcType=INTEGER},
status = #{record.status,jdbcType=INTEGER}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="cn.gx.hzu.cpsh.common.pojo.TUser" >
update t_user
<set >
<if test="username != null" >
username = #{username,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
<if test="phone != null" >
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="eamil != null" >
eamil = #{eamil,jdbcType=VARCHAR},
</if>
<if test="credit != null" >
credit = #{credit,jdbcType=INTEGER},
</if>
<if test="registerTime != null" >
register_time = #{registerTime,jdbcType=VARCHAR},
</if>
<if test="loginTime != null" >
login_time = #{loginTime,jdbcType=VARCHAR},
</if>
<if test="loginCity != null" >
login_city = #{loginCity,jdbcType=VARCHAR},
</if>
<if test="logoutTime != null" >
logout_time = #{logoutTime,jdbcType=VARCHAR},
</if>
<if test="chatId != null" >
chat_id = #{chatId,jdbcType=VARCHAR},
</if>
<if test="isAuthentication != null" >
is_authentication = #{isAuthentication,jdbcType=INTEGER},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.gx.hzu.cpsh.common.pojo.TUser" >
update t_user
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
eamil = #{eamil,jdbcType=VARCHAR},
credit = #{credit,jdbcType=INTEGER},
register_time = #{registerTime,jdbcType=VARCHAR},
login_time = #{loginTime,jdbcType=VARCHAR},
login_city = #{loginCity,jdbcType=VARCHAR},
logout_time = #{logoutTime,jdbcType=VARCHAR},
chat_id = #{chatId,jdbcType=VARCHAR},
is_authentication = #{isAuthentication,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

  生成好代码之后我们就可以掉mapper接口的方法愉快的进行开发了,配合上pagehelpr插件,轻松实现分页、排序

  如果你也在用Mybatis,建议尝试该分页插件,这个一定是最方便使用的分页插件。该插件目前支持Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库分页。

  maven

    <dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>3.4.2-fix</version>
</dependency>

  第一步:在Mybatis配置xml中配置拦截器插件:

<!-- 配置分页插件 -->
<plugins>
<plugin interceptor="com.github.pagehelper.PageHelper">
<!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库-->
<property name="dialect" value="mysql"/>
</plugin>
</plugins>

  第二步:在代码中使用

//分页处理  page当前页   rows每页多少条记录
PageHelper.startPage(page, rows);
//紧跟着的第一个select就会被分页 查询回来的list大小为rows
List<TbItem> list = itemMapper.selectByExample(example);
//使用PageInfo对结果集进行包装 通过包装后的pageinfo对象取得相关数据
PageInfo<TbItem> pageInfo = new PageInfo<>(list);

  PageInfo类  定义的属性:

    //当前页
private int pageNum;
//每页的数量
private int pageSize;
//当前页的数量
private int size;
//排序
private String orderBy;
//由于startRow和endRow不常用,这里说个具体的用法
//可以在页面中"显示startRow到endRow 共size条数据"
private int startRow;
private int endRow;
//当前页面第一个元素在数据库中的行号
private int startRow;
//当前页面最后一个元素在数据库中的行号
private int endRow;
//总记录数
private long total;
//总页数
private int pages;
//结果集
private List<T> list;
//第一页
private int firstPage;
//前一页
private int prePage;
//下一页
private int nextPage;
//最后一页
private int lastPage;
//是否为第一页
private boolean isFirstPage = false;
//是否为最后一页
private boolean isLastPage = false;
//是否有前一页
private boolean hasPreviousPage = false;
//是否有下一页
private boolean hasNextPage = false;
//导航页码数
private int navigatePages;
//所有导航页号
private int[] navigatepageNums;

  

  原理:分页插件会自动在你的查询语句后面添加 order by addtime DESC limit ?,?

  使用原理:
  pageHelper会使用ThreadLocal获取到同一线程中的变量信息,各个线程之间的Threadlocal不会相互干扰,也就是Thread1中的ThreadLocal1之后获取到Tread1中的变量的信息,不会获取到Thread2中的信息
  所以在多线程环境下,各个Threadlocal之间相互隔离,可以实现,不同thread使用不同的数据源或不同的Thread中执行不同的SQL语句
  所以,PageHelper利用这一点通过拦截器获取到同一线程中的预编译好的SQL语句之后将SQL语句包装成具有分页功能的SQL语句,并将其再次赋值给下一步操作,所以实际执行的SQL语句就是有了分页功能的SQL语句
  

  注意:
  1、只有紧跟在PageHelper.startPage方法后的第一个Mybatis的查询(Select方法)方法会被分页。
  2、分页插件不支持带有for update语句的分页
  3、分页插件不支持关联结果查询

  效果展示

  经测试,注解方式跟配置XML方式效果一致,传参、调用方式、返回结果都一致,接口均能正常调用。

  insert接口

  update接口

  select接口

  delete接口

  后记

  MyBatis 是一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射。MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集。MyBatis 可以使用简单的 XML 或注解来配置和映射原生信息,将接口和 Java 的 POJOs(Plain Old Java Objects,普通的 Java对象)映射成数据库中的记录。

  当我们一说起mybatis就会默默滴跟hibernate进行对比:

  Hibernate DAO层开发比较简单,sql语句都封装好了,mybatis需要维护sql,手动写
  Hibernate可移植性高,更改数据库方言即可,mybatis可移植性差,不同的数据库sql不同
  Mybatis可以进行更细致的sql优化,减少没必要的查询字段,而hibernate封装太过彻底

  代码开源

  代码已经开源、托管到我的GitHub、码云:

  GitHub:https://github.com/huanzi-qch/springBoot

  码云:https://gitee.com/huanzi-qch/springBoot

SpringBoot系列——MyBatis整合的更多相关文章

  1. SpringBoot系列——MyBatis-Plus整合封装

    前言 MyBatis-Plus是一款MyBatis的增强工具(简称MP),为简化开发.提高效率,但我们并没有直接使用MP的CRUD接口,而是在原来的基础上封装一层通用代码,单表继承我们的通用代码,实现 ...

  2. SpringBoot与Mybatis整合方式01(源码分析)

    前言:入职新公司,SpringBoot和Mybatis都被封装了一次,光用而不知道原理实在受不了,于是开始恶补源码,由于刚开始比较浅,存属娱乐,大神勿喷. 就如网上的流传的SpringBoot与Myb ...

  3. 30分钟带你了解Springboot与Mybatis整合最佳实践

    前言:Springboot怎么使用想必也无需我多言,Mybitas作为实用性极强的ORM框架也深受广大开发人员喜爱,有关如何整合它们的文章在网络上随处可见.但是今天我会从实战的角度出发,谈谈我对二者结 ...

  4. SpringBoot+Shiro+mybatis整合实战

    SpringBoot+Shiro+mybatis整合 1. 使用Springboot版本2.0.4 与shiro的版本 引入springboot和shiro依赖 <?xml version=&q ...

  5. Springboot与Mybatis整合

    最近自己用springboot和mybatis做了整合,记录一下: 1.先导入用到的jar包 <dependency> <groupId>org.springframework ...

  6. SpringBoot与Mybatis整合实例详解

    介绍 从Spring Boot项目名称中的Boot可以看出来,SpringBoot的作用在于创建和启动新的基于Spring框架的项目,它的目的是帮助开发人员很容易的创建出独立运行的产品和产品级别的基于 ...

  7. spring-boot、mybatis整合

    一.MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis 可以使用简单的 X ...

  8. springBoot和MyBatis整合中出现SpringBoot无法启动时处理方式

    在springBoot和Myatis   整合中出现springBoot无法启动   并且报以下错误 Description: Field userMapper in cn.lijun.control ...

  9. springboot+Druid+mybatis整合

    一.添加Druid.MySQL连接池.mybatis依赖 <!--整合Druid--> <dependency> <groupId>com.alibaba</ ...

随机推荐

  1. TS+React+Redux 使用之搭建环境

    使用 create-react-app 构建 1.全局安装create-react-app npm install -g create-react-app 2.创建一个项目 create-react- ...

  2. dedecms 文章根据 权重排序

    原文链接 一: dede:list   标签 找到 /include/arc.listview.class.php if($orderby=="senddate" || $orde ...

  3. mysql里的数据库引擎, 编码格式

    针对数据库里即使设置了varchar类型的字段, 值输入中文报错的情况,是因为数据库的默认编码类型不支持汉字输入. utf-8 可以编译全球通用的所有语言符号. 由1-6个可变字节组成,有非常严格的排 ...

  4. C语言复习5_调试

    使用CodeBlocks调试程序 首先要注意,只有打开projects(.cbp文件)的情况下才能debug,单独打开.c文件是不能debug的 1.在行号旁边左键,出现红点,表示为断点breakpo ...

  5. Python基础之函数参数

    一.实参 1.实参分类: 2.实参基础代码: def fun01(a, b, c): print(a) print(b) print(c) # 位置传参:实参与形参的位置依次对应 fun01(1, 2 ...

  6. 手机touch事件及参数【转】(自己懒得写了,找了一篇摘过来)

    [html5构建触屏网站]之touch事件 前言 一个触屏网站到底和传统的pc端网站有什么区别呢,交互方式的改变首当其冲.例如我们常用的click事件,在触屏设备下是如此无力. 手机上的大部分交互都是 ...

  7. Winsock编程基继承基础(网络对时程序)

    #include <iostream> #include <stdio.h> #include "InitSock.h" using namespace s ...

  8. 【RL-TCPnet网络教程】第22章 RL-TCPnet之网络协议IP

    第22章      RL-TCPnet之网络协议IP 本章节为大家讲解IP(Internet Protocol,网络协议),通过前面章节对TCP和UDP的学习,需要大家对IP也有个基础的认识. (本章 ...

  9. 想成为Python全栈开发工程师必须掌握的技能

    什么是Python全栈工程师? 即从前端页面的实现,到后台代码的编写,再到数据库的管理,一人可以搞定一个公司网站的所有事情,真正实现全栈开发. 全栈只是个概念 也分很多种类 真正的全栈工程师涵盖了we ...

  10. Java-SSM框架页面时间格式转换

    在JSP中,列表查询绑定时间时,会出现以下的时间格式,那样看起来的话,感觉... 那如何转换成“yyyy-MM-dd HH:mm:ss”格式呢?--很简单,在JSP头顶加上 <%@ taglib ...