一、前言
下面通过mybatis-generator-core-1.3.1的版本,其中依赖包(mybatis-generator-core-1.3.1.jar、mysql-connector-java-5.1.6-bin.jar、sqljdbc4.jar、ojdbc14.jar),其中通过在eclipse中和批处理文件run.bat两种不同的方式基于generator.xml配置文件来生产dao、mappers及model层代码类,需下载完整的源码跳转到“mybatis-generator-core-1.3.1包”示例下载页面
二、方法一(基于批处理方式)
1.在mysql的数据库test中创建guser表脚本
CREATE TABLE 'guser' (@b@ 'id' int(20) NOT NULL COMMENT '主键',@b@ 'name' varchar(60) DEFAULT NULL COMMENT '用户名',@b@ 'create_by' varchar(60) DEFAULT NULL COMMENT '创建人',@b@ 'create_time' date DEFAULT NULL COMMENT '创建时间',@b@ 'update_by' varchar(60) DEFAULT NULL COMMENT '更新人',@b@ 'update_time' date DEFAULT NULL COMMENT '更新时间',@b@ PRIMARY KEY ('id')@b@) ENGINE=MyISAM DEFAULT CHARSET=utf8;
2.generator.xml的配置内容如下
<?xml version="1.0" encoding="UTF-8"?>@b@<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">@b@<generatorConfiguration>@b@@b@ <!-- classPathEntry:数据库的JDBC驱动--> @b@ <classPathEntry location="C:\WS\mybatis-generator-core-1.3.1\lib\mysql-connector-java-3.2.0-alpha-bin.jar" /> @b@@b@ <context id="DB2Tables" targetRuntime="MyBatis3">@b@ @b@ <!-- 去除自动生成的注释 -->@b@ <commentGenerator><property name="suppressAllComments" value="true" /></commentGenerator> @b@ @b@ <jdbcConnection driverClass="com.mysql.jdbc.Driver" @b@ connectionURL="jdbc:mysql://192.168.1.9:3306/test" @b@ userId="root" @b@ password="123456"> @b@ </jdbcConnection>@b@ @b@ <javaTypeResolver > @b@ <property name="forceBigDecimals" value="false" /> @b@ </javaTypeResolver>@b@ @b@ <!-- targetProject:自动生成model代码的位置 --> @b@ <javaModelGenerator targetPackage="com.xwood.gen.model" targetProject="C:\WS\mybatis-generator-core-1.3.1\target\"> @b@ <property name="enableSubPackages" value="true" /> @b@ <property name="trimStrings" value="true" /> @b@ </javaModelGenerator>@b@ @b@ <!-- targetProject:自动生成mappers代码的位置 --> @b@ <sqlMapGenerator targetPackage="com.xwood.gen.mappers" targetProject="C:\WS\mybatis-generator-core-1.3.1\target\"> @b@ <property name="enableSubPackages" value="true" /> @b@ </sqlMapGenerator>@b@ @b@ <!-- targetProject:自动生成dao代码的位置 --> @b@ <javaClientGenerator type="XMLMAPPER" targetPackage="com.xwood.gen.dao" targetProject="C:\WS\mybatis-generator-core-1.3.1\target\"> @b@ <property name="enableSubPackages" value="true" /> @b@ </javaClientGenerator>@b@ @b@ @b@ <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名-->@b@ <table tableName="guser" domainObjectName="Guser" >@b@ @b@ </table> @b@ @b@ </context> @b@ @b@</generatorConfiguration>
如果连接oracle数据库修改部分如下
<?xml version="1.0" encoding="UTF-8"?>@b@<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">@b@<generatorConfiguration>@b@@b@ <!-- classPathEntry:数据库的JDBC驱动--> @b@ <classPathEntry location="C:\WS\mybatis-generator-core-1.3.1\lib\ojdbc14.jar" /> @b@@b@ <context id="DB2Tables" targetRuntime="MyBatis3">@b@ @b@ <!-- 去除自动生成的注释 -->@b@ <commentGenerator><property name="suppressAllComments" value="true" /></commentGenerator> @b@ @b@ <jdbcConnection driverClass="oracle.jdbc.OracleDriver" @b@ connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:oracle" @b@ userId="testa" @b@ password="testa"> @b@ </jdbcConnection>@b@ @b@ ....@b@ @b@ </context> @b@ @b@</generatorConfiguration>
3.配置JAVA_HOME环境,后配置run.bat批处理文件,内容如下
java -jar C:\WS\mybatis-generator-core-1.3.1\lib\mybatis-generator-core-1.3.1.jar -configfile C:\WS\mybatis-generator-core-1.3.1\generator.xml -overwrite
4.运行run.bat能正常在target目录生成dao、mappers及model代码,如下图所示
三、方法二(基于eclipse方式)
1.在项目的generator.xml,配置如下
<?xml version="1.0" encoding="UTF-8"?>@b@<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">@b@<generatorConfiguration>@b@@b@ <!-- classPathEntry:数据库的JDBC驱动--> @b@ <classPathEntry location="C:\WS\mybatis-generator-core-1.3.1\lib\mysql-connector-java-3.2.0-alpha-bin.jar" /> @b@@b@ <context id="DB2Tables" targetRuntime="MyBatis3">@b@ @b@ <!-- 去除自动生成的注释 -->@b@ <commentGenerator><property name="suppressAllComments" value="true" /></commentGenerator> @b@ @b@ <jdbcConnection driverClass="com.mysql.jdbc.Driver" @b@ connectionURL="jdbc:mysql://192.168.1.9:3306/test" @b@ @b@ userId="root" @b@ password="123456"> @b@ </jdbcConnection>@b@ @b@ <javaTypeResolver > @b@ <property name="forceBigDecimals" value="false" /> @b@ </javaTypeResolver>@b@ @b@ <!-- targetProject:自动生成model代码的位置 --> @b@ <javaModelGenerator targetPackage="com.xwood.gen.model" targetProject="C:\WS\NJ\project\xwood-project\JavaTest\src\"> @b@ <property name="enableSubPackages" value="true" /> @b@ <property name="trimStrings" value="true" /> @b@ </javaModelGenerator>@b@ @b@ <!-- targetProject:自动生成mappers代码的位置 --> @b@ <sqlMapGenerator targetPackage="com.xwood.gen.mappers" targetProject="C:\WS\NJ\project\xwood-project\JavaTest\src\"> @b@ <property name="enableSubPackages" value="true" /> @b@ </sqlMapGenerator>@b@ @b@ <!-- targetProject:自动生成dao代码的位置 --> @b@ <javaClientGenerator type="XMLMAPPER" targetPackage="com.xwood.gen.dao" targetProject="C:\WS\NJ\project\xwood-project\JavaTest\src\"> @b@ <property name="enableSubPackages" value="true" /> @b@ </javaClientGenerator>@b@ @b@ @b@ <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名-->@b@ <table tableName="guser" domainObjectName="Guser" >@b@ @b@ </table> @b@ @b@ </context> @b@ @b@</generatorConfiguration>
2.在项目中引入mybatis-generator-core-1.3.1.jar、mysql-connector-java-5.1.6-bin.jar及mybatis-3.0.2.jar.zip,
3.编写GeneratorExecuter执行类入口,代码如下
import java.io.File;@b@import java.util.ArrayList;@b@import java.util.List;@b@@b@import org.mybatis.generator.api.MyBatisGenerator;@b@import org.mybatis.generator.config.Configuration;@b@import org.mybatis.generator.config.xml.ConfigurationParser;@b@import org.mybatis.generator.internal.DefaultShellCallback;@b@@b@public class GeneratorExecuter {@b@@b@ public void generator() throws Exception{@b@ List<String> warnings = new ArrayList<String>();@b@ boolean overwrite = true;@b@ @b@ File configFile = new File("C:\\WS\\NJ\\project\\xwood-project\\JavaTest\\src\\com\\xwood\\gen\\generator.xml"); @b@ ConfigurationParser cp = new ConfigurationParser(warnings);@b@ Configuration config = cp.parseConfiguration(configFile);@b@ DefaultShellCallback callback = new DefaultShellCallback(overwrite);@b@ MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,@b@ callback, warnings);@b@ myBatisGenerator.generate(null);@b@ }@b@ public static void main(String[] args) throws Exception {@b@ try {@b@ GeneratorExecuter generatorSqlmap = new GeneratorExecuter();@b@ generatorSqlmap.generator();@b@ } catch (Exception e) {@b@ e.printStackTrace();@b@ }@b@ }@b@@b@}
4.运行结果如下图
四、方法三 (基于eclipse插件方式)
具体使用步骤请参考“使用eclipse的mybatis-generator-plugins插件来生成代码”
五、生成结果如下
1.dao层代码GuserMapper.java
import com.xwood.gen.model.Guser;@b@import com.xwood.gen.model.GuserExample;@b@import java.util.List;@b@import org.apache.ibatis.annotations.Param;@b@@b@public interface GuserMapper {@b@ int countByExample(GuserExample example);@b@@b@ int deleteByExample(GuserExample example);@b@@b@ int deleteByPrimaryKey(Integer id);@b@@b@ int insert(Guser record);@b@@b@ int insertSelective(Guser record);@b@@b@ List<Guser> selectByExample(GuserExample example);@b@@b@ Guser selectByPrimaryKey(Integer id);@b@@b@ int updateByExampleSelective(@Param("record") Guser record, @Param("example") GuserExample example);@b@@b@ int updateByExample(@Param("record") Guser record, @Param("example") GuserExample example);@b@@b@ int updateByPrimaryKeySelective(Guser record);@b@@b@ int updateByPrimaryKey(Guser record);@b@}
2.mappers层代码GuserMapper.xml
<?xml version="1.0" encoding="UTF-8" ?>@b@<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >@b@<mapper namespace="com.xwood.gen.dao.GuserMapper" >@b@ <resultMap id="BaseResultMap" type="com.xwood.gen.model.Guser" >@b@ <id column="id" property="id" jdbcType="INTEGER" />@b@ <result column="name" property="name" jdbcType="VARCHAR" />@b@ <result column="create_by" property="createBy" jdbcType="VARCHAR" />@b@ <result column="create_time" property="createTime" jdbcType="DATE" />@b@ <result column="update_by" property="updateBy" jdbcType="VARCHAR" />@b@ <result column="update_time" property="updateTime" jdbcType="DATE" />@b@ </resultMap>@b@ <sql id="Example_Where_Clause" >@b@ <where >@b@ <foreach collection="oredCriteria" item="criteria" separator="or" >@b@ <if test="criteria.valid" >@b@ <trim prefix="(" suffix=")" prefixOverrides="and" >@b@ <foreach collection="criteria.criteria" item="criterion" >@b@ <choose >@b@ <when test="criterion.noValue" >@b@ and ${criterion.condition}@b@ </when>@b@ <when test="criterion.singleValue" >@b@ and ${criterion.condition} #{criterion.value}@b@ </when>@b@ <when test="criterion.betweenValue" >@b@ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}@b@ </when>@b@ <when test="criterion.listValue" >@b@ and ${criterion.condition}@b@ <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >@b@ #{listItem}@b@ </foreach>@b@ </when>@b@ </choose>@b@ </foreach>@b@ </trim>@b@ </if>@b@ </foreach>@b@ </where>@b@ </sql>@b@ <sql id="Update_By_Example_Where_Clause" >@b@ <where >@b@ <foreach collection="example.oredCriteria" item="criteria" separator="or" >@b@ <if test="criteria.valid" >@b@ <trim prefix="(" suffix=")" prefixOverrides="and" >@b@ <foreach collection="criteria.criteria" item="criterion" >@b@ <choose >@b@ <when test="criterion.noValue" >@b@ and ${criterion.condition}@b@ </when>@b@ <when test="criterion.singleValue" >@b@ and ${criterion.condition} #{criterion.value}@b@ </when>@b@ <when test="criterion.betweenValue" >@b@ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}@b@ </when>@b@ <when test="criterion.listValue" >@b@ and ${criterion.condition}@b@ <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >@b@ #{listItem}@b@ </foreach>@b@ </when>@b@ </choose>@b@ </foreach>@b@ </trim>@b@ </if>@b@ </foreach>@b@ </where>@b@ </sql>@b@ <sql id="Base_Column_List" >@b@ id, name, create_by, create_time, update_by, update_time@b@ </sql>@b@ <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xwood.gen.model.GuserExample" >@b@ select@b@ <if test="distinct" >@b@ distinct@b@ </if>@b@ <include refid="Base_Column_List" />@b@ from guser@b@ <if test="_parameter != null" >@b@ <include refid="Example_Where_Clause" />@b@ </if>@b@ <if test="orderByClause != null" >@b@ order by ${orderByClause}@b@ </if>@b@ </select>@b@ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >@b@ select @b@ <include refid="Base_Column_List" />@b@ from guser@b@ where id = #{id,jdbcType=INTEGER}@b@ </select>@b@ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >@b@ delete from guser@b@ where id = #{id,jdbcType=INTEGER}@b@ </delete>@b@ <delete id="deleteByExample" parameterType="com.xwood.gen.model.GuserExample" >@b@ delete from guser@b@ <if test="_parameter != null" >@b@ <include refid="Example_Where_Clause" />@b@ </if>@b@ </delete>@b@ <insert id="insert" parameterType="com.xwood.gen.model.Guser" >@b@ insert into guser (id, name, create_by, @b@ create_time, update_by, update_time@b@ )@b@ values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, @b@ #{createTime,jdbcType=DATE}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=DATE}@b@ )@b@ </insert>@b@ <insert id="insertSelective" parameterType="com.xwood.gen.model.Guser" >@b@ insert into guser@b@ <trim prefix="(" suffix=")" suffixOverrides="," >@b@ <if test="id != null" >@b@ id,@b@ </if>@b@ <if test="name != null" >@b@ name,@b@ </if>@b@ <if test="createBy != null" >@b@ create_by,@b@ </if>@b@ <if test="createTime != null" >@b@ create_time,@b@ </if>@b@ <if test="updateBy != null" >@b@ update_by,@b@ </if>@b@ <if test="updateTime != null" >@b@ update_time,@b@ </if>@b@ </trim>@b@ <trim prefix="values (" suffix=")" suffixOverrides="," >@b@ <if test="id != null" >@b@ #{id,jdbcType=INTEGER},@b@ </if>@b@ <if test="name != null" >@b@ #{name,jdbcType=VARCHAR},@b@ </if>@b@ <if test="createBy != null" >@b@ #{createBy,jdbcType=VARCHAR},@b@ </if>@b@ <if test="createTime != null" >@b@ #{createTime,jdbcType=DATE},@b@ </if>@b@ <if test="updateBy != null" >@b@ #{updateBy,jdbcType=VARCHAR},@b@ </if>@b@ <if test="updateTime != null" >@b@ #{updateTime,jdbcType=DATE},@b@ </if>@b@ </trim>@b@ </insert>@b@ <select id="countByExample" parameterType="com.xwood.gen.model.GuserExample" resultType="java.lang.Integer" >@b@ select count(*) from guser@b@ <if test="_parameter != null" >@b@ <include refid="Example_Where_Clause" />@b@ </if>@b@ </select>@b@ <update id="updateByExampleSelective" parameterType="map" >@b@ update guser@b@ <set >@b@ <if test="record.id != null" >@b@ id = #{record.id,jdbcType=INTEGER},@b@ </if>@b@ <if test="record.name != null" >@b@ name = #{record.name,jdbcType=VARCHAR},@b@ </if>@b@ <if test="record.createBy != null" >@b@ create_by = #{record.createBy,jdbcType=VARCHAR},@b@ </if>@b@ <if test="record.createTime != null" >@b@ create_time = #{record.createTime,jdbcType=DATE},@b@ </if>@b@ <if test="record.updateBy != null" >@b@ update_by = #{record.updateBy,jdbcType=VARCHAR},@b@ </if>@b@ <if test="record.updateTime != null" >@b@ update_time = #{record.updateTime,jdbcType=DATE},@b@ </if>@b@ </set>@b@ <if test="_parameter != null" >@b@ <include refid="Update_By_Example_Where_Clause" />@b@ </if>@b@ </update>@b@ <update id="updateByExample" parameterType="map" >@b@ update guser@b@ set id = #{record.id,jdbcType=INTEGER},@b@ name = #{record.name,jdbcType=VARCHAR},@b@ create_by = #{record.createBy,jdbcType=VARCHAR},@b@ create_time = #{record.createTime,jdbcType=DATE},@b@ update_by = #{record.updateBy,jdbcType=VARCHAR},@b@ update_time = #{record.updateTime,jdbcType=DATE}@b@ <if test="_parameter != null" >@b@ <include refid="Update_By_Example_Where_Clause" />@b@ </if>@b@ </update>@b@ <update id="updateByPrimaryKeySelective" parameterType="com.xwood.gen.model.Guser" >@b@ update guser@b@ <set >@b@ <if test="name != null" >@b@ name = #{name,jdbcType=VARCHAR},@b@ </if>@b@ <if test="createBy != null" >@b@ create_by = #{createBy,jdbcType=VARCHAR},@b@ </if>@b@ <if test="createTime != null" >@b@ create_time = #{createTime,jdbcType=DATE},@b@ </if>@b@ <if test="updateBy != null" >@b@ update_by = #{updateBy,jdbcType=VARCHAR},@b@ </if>@b@ <if test="updateTime != null" >@b@ update_time = #{updateTime,jdbcType=DATE},@b@ </if>@b@ </set>@b@ where id = #{id,jdbcType=INTEGER}@b@ </update>@b@ <update id="updateByPrimaryKey" parameterType="com.xwood.gen.model.Guser" >@b@ update guser@b@ set name = #{name,jdbcType=VARCHAR},@b@ create_by = #{createBy,jdbcType=VARCHAR},@b@ create_time = #{createTime,jdbcType=DATE},@b@ update_by = #{updateBy,jdbcType=VARCHAR},@b@ update_time = #{updateTime,jdbcType=DATE}@b@ where id = #{id,jdbcType=INTEGER}@b@ </update>@b@</mapper>
3.model层代码Guser.java、GuserExample.java
public class Guser {@b@ private Integer id;@b@@b@ private String name;@b@@b@ private String createBy;@b@@b@ private Date createTime;@b@@b@ private String updateBy;@b@@b@ private Date updateTime;@b@@b@ public Integer getId() {@b@ return id;@b@ }@b@@b@ public void setId(Integer id) {@b@ this.id = id;@b@ }@b@@b@ public String getName() {@b@ return name;@b@ }@b@@b@ public void setName(String name) {@b@ this.name = name == null ? null : name.trim();@b@ }@b@@b@ public String getCreateBy() {@b@ return createBy;@b@ }@b@@b@ public void setCreateBy(String createBy) {@b@ this.createBy = createBy == null ? null : createBy.trim();@b@ }@b@@b@ public Date getCreateTime() {@b@ return createTime;@b@ }@b@@b@ public void setCreateTime(Date createTime) {@b@ this.createTime = createTime;@b@ }@b@@b@ public String getUpdateBy() {@b@ return updateBy;@b@ }@b@@b@ public void setUpdateBy(String updateBy) {@b@ this.updateBy = updateBy == null ? null : updateBy.trim();@b@ }@b@@b@ public Date getUpdateTime() {@b@ return updateTime;@b@ }@b@@b@ public void setUpdateTime(Date updateTime) {@b@ this.updateTime = updateTime;@b@ }@b@}
public class GuserExample {@b@ protected String orderByClause;@b@@b@ protected boolean distinct;@b@@b@ protected List<Criteria> oredCriteria;@b@@b@ public GuserExample() {@b@ oredCriteria = new ArrayList<Criteria>();@b@ }@b@@b@ public void setOrderByClause(String orderByClause) {@b@ this.orderByClause = orderByClause;@b@ }@b@@b@ public String getOrderByClause() {@b@ return orderByClause;@b@ }@b@@b@ public void setDistinct(boolean distinct) {@b@ this.distinct = distinct;@b@ }@b@@b@ public boolean isDistinct() {@b@ return distinct;@b@ }@b@@b@ public List<Criteria> getOredCriteria() {@b@ return oredCriteria;@b@ }@b@@b@ public void or(Criteria criteria) {@b@ oredCriteria.add(criteria);@b@ }@b@@b@ public Criteria or() {@b@ Criteria criteria = createCriteriaInternal();@b@ oredCriteria.add(criteria);@b@ return criteria;@b@ }@b@@b@ public Criteria createCriteria() {@b@ Criteria criteria = createCriteriaInternal();@b@ if (oredCriteria.size() == 0) {@b@ oredCriteria.add(criteria);@b@ }@b@ return criteria;@b@ }@b@@b@ protected Criteria createCriteriaInternal() {@b@ Criteria criteria = new Criteria();@b@ return criteria;@b@ }@b@@b@ public void clear() {@b@ oredCriteria.clear();@b@ orderByClause = null;@b@ distinct = false;@b@ }@b@@b@ protected abstract static class GeneratedCriteria {@b@ protected List<Criterion> criteria;@b@@b@ protected GeneratedCriteria() {@b@ super();@b@ criteria = new ArrayList<Criterion>();@b@ }@b@@b@ public boolean isValid() {@b@ return criteria.size() > 0;@b@ }@b@@b@ public List<Criterion> getAllCriteria() {@b@ return criteria;@b@ }@b@@b@ public List<Criterion> getCriteria() {@b@ return criteria;@b@ }@b@@b@ protected void addCriterion(String condition) {@b@ if (condition == null) {@b@ throw new RuntimeException("Value for condition cannot be null");@b@ }@b@ criteria.add(new Criterion(condition));@b@ }@b@@b@ protected void addCriterion(String condition, Object value, String property) {@b@ if (value == null) {@b@ throw new RuntimeException("Value for " + property + " cannot be null");@b@ }@b@ criteria.add(new Criterion(condition, value));@b@ }@b@@b@ protected void addCriterion(String condition, Object value1, Object value2, String property) {@b@ if (value1 == null || value2 == null) {@b@ throw new RuntimeException("Between values for " + property + " cannot be null");@b@ }@b@ criteria.add(new Criterion(condition, value1, value2));@b@ }@b@@b@ protected void addCriterionForJDBCDate(String condition, Date value, String property) {@b@ if (value == null) {@b@ throw new RuntimeException("Value for " + property + " cannot be null");@b@ }@b@ addCriterion(condition, new java.sql.Date(value.getTime()), property);@b@ }@b@@b@ protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) {@b@ if (values == null || values.size() == 0) {@b@ throw new RuntimeException("Value list for " + property + " cannot be null or empty");@b@ }@b@ List<java.sql.Date> dateList = new ArrayList<java.sql.Date>();@b@ Iterator<Date> iter = values.iterator();@b@ while (iter.hasNext()) {@b@ dateList.add(new java.sql.Date(iter.next().getTime()));@b@ }@b@ addCriterion(condition, dateList, property);@b@ }@b@@b@ protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) {@b@ if (value1 == null || value2 == null) {@b@ throw new RuntimeException("Between values for " + property + " cannot be null");@b@ }@b@ addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property);@b@ }@b@@b@ public Criteria andIdIsNull() {@b@ addCriterion("id is null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdIsNotNull() {@b@ addCriterion("id is not null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdEqualTo(Integer value) {@b@ addCriterion("id =", value, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdNotEqualTo(Integer value) {@b@ addCriterion("id <>", value, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdGreaterThan(Integer value) {@b@ addCriterion("id >", value, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdGreaterThanOrEqualTo(Integer value) {@b@ addCriterion("id >=", value, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdLessThan(Integer value) {@b@ addCriterion("id <", value, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdLessThanOrEqualTo(Integer value) {@b@ addCriterion("id <=", value, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdIn(List<Integer> values) {@b@ addCriterion("id in", values, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdNotIn(List<Integer> values) {@b@ addCriterion("id not in", values, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdBetween(Integer value1, Integer value2) {@b@ addCriterion("id between", value1, value2, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdNotBetween(Integer value1, Integer value2) {@b@ addCriterion("id not between", value1, value2, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameIsNull() {@b@ addCriterion("name is null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameIsNotNull() {@b@ addCriterion("name is not null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameEqualTo(String value) {@b@ addCriterion("name =", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameNotEqualTo(String value) {@b@ addCriterion("name <>", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameGreaterThan(String value) {@b@ addCriterion("name >", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameGreaterThanOrEqualTo(String value) {@b@ addCriterion("name >=", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameLessThan(String value) {@b@ addCriterion("name <", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameLessThanOrEqualTo(String value) {@b@ addCriterion("name <=", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameLike(String value) {@b@ addCriterion("name like", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameNotLike(String value) {@b@ addCriterion("name not like", value, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameIn(List<String> values) {@b@ addCriterion("name in", values, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameNotIn(List<String> values) {@b@ addCriterion("name not in", values, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameBetween(String value1, String value2) {@b@ addCriterion("name between", value1, value2, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameNotBetween(String value1, String value2) {@b@ addCriterion("name not between", value1, value2, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByIsNull() {@b@ addCriterion("create_by is null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByIsNotNull() {@b@ addCriterion("create_by is not null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByEqualTo(String value) {@b@ addCriterion("create_by =", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByNotEqualTo(String value) {@b@ addCriterion("create_by <>", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByGreaterThan(String value) {@b@ addCriterion("create_by >", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByGreaterThanOrEqualTo(String value) {@b@ addCriterion("create_by >=", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByLessThan(String value) {@b@ addCriterion("create_by <", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByLessThanOrEqualTo(String value) {@b@ addCriterion("create_by <=", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByLike(String value) {@b@ addCriterion("create_by like", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByNotLike(String value) {@b@ addCriterion("create_by not like", value, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByIn(List<String> values) {@b@ addCriterion("create_by in", values, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByNotIn(List<String> values) {@b@ addCriterion("create_by not in", values, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByBetween(String value1, String value2) {@b@ addCriterion("create_by between", value1, value2, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByNotBetween(String value1, String value2) {@b@ addCriterion("create_by not between", value1, value2, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeIsNull() {@b@ addCriterion("create_time is null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeIsNotNull() {@b@ addCriterion("create_time is not null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeEqualTo(Date value) {@b@ addCriterionForJDBCDate("create_time =", value, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeNotEqualTo(Date value) {@b@ addCriterionForJDBCDate("create_time <>", value, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeGreaterThan(Date value) {@b@ addCriterionForJDBCDate("create_time >", value, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {@b@ addCriterionForJDBCDate("create_time >=", value, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeLessThan(Date value) {@b@ addCriterionForJDBCDate("create_time <", value, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeLessThanOrEqualTo(Date value) {@b@ addCriterionForJDBCDate("create_time <=", value, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeIn(List<Date> values) {@b@ addCriterionForJDBCDate("create_time in", values, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeNotIn(List<Date> values) {@b@ addCriterionForJDBCDate("create_time not in", values, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeBetween(Date value1, Date value2) {@b@ addCriterionForJDBCDate("create_time between", value1, value2, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeNotBetween(Date value1, Date value2) {@b@ addCriterionForJDBCDate("create_time not between", value1, value2, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByIsNull() {@b@ addCriterion("update_by is null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByIsNotNull() {@b@ addCriterion("update_by is not null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByEqualTo(String value) {@b@ addCriterion("update_by =", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByNotEqualTo(String value) {@b@ addCriterion("update_by <>", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByGreaterThan(String value) {@b@ addCriterion("update_by >", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByGreaterThanOrEqualTo(String value) {@b@ addCriterion("update_by >=", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByLessThan(String value) {@b@ addCriterion("update_by <", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByLessThanOrEqualTo(String value) {@b@ addCriterion("update_by <=", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByLike(String value) {@b@ addCriterion("update_by like", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByNotLike(String value) {@b@ addCriterion("update_by not like", value, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByIn(List<String> values) {@b@ addCriterion("update_by in", values, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByNotIn(List<String> values) {@b@ addCriterion("update_by not in", values, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByBetween(String value1, String value2) {@b@ addCriterion("update_by between", value1, value2, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByNotBetween(String value1, String value2) {@b@ addCriterion("update_by not between", value1, value2, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeIsNull() {@b@ addCriterion("update_time is null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeIsNotNull() {@b@ addCriterion("update_time is not null");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeEqualTo(Date value) {@b@ addCriterionForJDBCDate("update_time =", value, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeNotEqualTo(Date value) {@b@ addCriterionForJDBCDate("update_time <>", value, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeGreaterThan(Date value) {@b@ addCriterionForJDBCDate("update_time >", value, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {@b@ addCriterionForJDBCDate("update_time >=", value, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeLessThan(Date value) {@b@ addCriterionForJDBCDate("update_time <", value, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {@b@ addCriterionForJDBCDate("update_time <=", value, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeIn(List<Date> values) {@b@ addCriterionForJDBCDate("update_time in", values, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeNotIn(List<Date> values) {@b@ addCriterionForJDBCDate("update_time not in", values, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeBetween(Date value1, Date value2) {@b@ addCriterionForJDBCDate("update_time between", value1, value2, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {@b@ addCriterionForJDBCDate("update_time not between", value1, value2, "updateTime");@b@ return (Criteria) this;@b@ }@b@ }@b@@b@ public static class Criteria extends GeneratedCriteria {@b@@b@ protected Criteria() {@b@ super();@b@ }@b@ }@b@@b@ public static class Criterion {@b@ private String condition;@b@@b@ private Object value;@b@@b@ private Object secondValue;@b@@b@ private boolean noValue;@b@@b@ private boolean singleValue;@b@@b@ private boolean betweenValue;@b@@b@ private boolean listValue;@b@@b@ private String typeHandler;@b@@b@ public String getCondition() {@b@ return condition;@b@ }@b@@b@ public Object getValue() {@b@ return value;@b@ }@b@@b@ public Object getSecondValue() {@b@ return secondValue;@b@ }@b@@b@ public boolean isNoValue() {@b@ return noValue;@b@ }@b@@b@ public boolean isSingleValue() {@b@ return singleValue;@b@ }@b@@b@ public boolean isBetweenValue() {@b@ return betweenValue;@b@ }@b@@b@ public boolean isListValue() {@b@ return listValue;@b@ }@b@@b@ public String getTypeHandler() {@b@ return typeHandler;@b@ }@b@@b@ protected Criterion(String condition) {@b@ super();@b@ this.condition = condition;@b@ this.typeHandler = null;@b@ this.noValue = true;@b@ }@b@@b@ protected Criterion(String condition, Object value, String typeHandler) {@b@ super();@b@ this.condition = condition;@b@ this.value = value;@b@ this.typeHandler = typeHandler;@b@ if (value instanceof List<?>) {@b@ this.listValue = true;@b@ } else {@b@ this.singleValue = true;@b@ }@b@ }@b@@b@ protected Criterion(String condition, Object value) {@b@ this(condition, value, null);@b@ }@b@@b@ protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {@b@ super();@b@ this.condition = condition;@b@ this.value = value;@b@ this.secondValue = secondValue;@b@ this.typeHandler = typeHandler;@b@ this.betweenValue = true;@b@ }@b@@b@ protected Criterion(String condition, Object value, Object secondValue) {@b@ this(condition, value, secondValue, null);@b@ }@b@ }@b@}