mybatis 自动生成integer_通过mybatis-generator-core工具自动关联表生成对应model、mappers及dao层代码类完整教程...
一、前言
二、方法一(基于批处理方式)
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@generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">@b@@b@@b@ @b@ @b@@b@@b@@b@ @b@ @b@@b@ @b@@b@@b@ @b@ @b@ @b@@b@ @b@ @b@ @b@ @b@@b@@b@ @b@ @b@ @b@@b@@b@ @b@ @b@ @b@@b@@b@@b@@b@
@b@@b@ @b@@b@
如果连接oracle数据库修改部分如下<?xml version="1.0" encoding="UTF-8"?>@b@generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">@b@@b@@b@ @b@ @b@@b@@b@@b@ @b@ @b@@b@ @b@@b@@b@....@b@@b@ @b@@b@
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@generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">@b@@b@@b@ @b@ @b@@b@@b@@b@ @b@ @b@@b@ @b@@b@@b@ @b@ @b@ @b@@b@ @b@ @b@ @b@ @b@@b@@b@ @b@ @b@ @b@@b@@b@ @b@ @b@ @b@@b@@b@@b@@b@
@b@@b@ @b@@b@
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 warnings = new ArrayList();@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插件方式)
五、生成结果如下
1.dao层代码GuserMapper.javaimport 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 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@mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >@b@@b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ and ${criterion.condition}@b@ @b@ @b@ and ${criterion.condition} #{criterion.value}@b@ @b@ @b@ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}@b@ @b@ @b@ and ${criterion.condition}@b@ @b@ #{listItem}@b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ and ${criterion.condition}@b@ @b@ @b@ and ${criterion.condition} #{criterion.value}@b@ @b@ @b@ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}@b@ @b@ @b@ and ${criterion.condition}@b@ @b@ #{listItem}@b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ @b@ id, name, create_by, create_time, update_by, update_time@b@ @b@ @b@ select@b@ @b@ distinct@b@ @b@ @b@ from guser@b@ @b@ @b@ @b@ @b@ order by ${orderByClause}@b@ @b@ @b@ @b@ select @b@ @b@ from guser@b@ where id = #{id,jdbcType=INTEGER}@b@ @b@ @b@ delete from guser@b@ where id = #{id,jdbcType=INTEGER}@b@ @b@ @b@ delete from guser@b@ @b@ @b@ @b@ @b@ @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@ @b@ @b@ insert into guser@b@ @b@ @b@ id,@b@ @b@ @b@ name,@b@ @b@ @b@ create_by,@b@ @b@ @b@ create_time,@b@ @b@ @b@ update_by,@b@ @b@ @b@ update_time,@b@ @b@ @b@ @b@ @b@ #{id,jdbcType=INTEGER},@b@ @b@ @b@ #{name,jdbcType=VARCHAR},@b@ @b@ @b@ #{createBy,jdbcType=VARCHAR},@b@ @b@ @b@ #{createTime,jdbcType=DATE},@b@ @b@ @b@ #{updateBy,jdbcType=VARCHAR},@b@ @b@ @b@ #{updateTime,jdbcType=DATE},@b@ @b@ @b@ @b@ @b@ select count(*) from guser@b@ @b@ @b@ @b@ @b@ @b@ update guser@b@ @b@ @b@ id = #{record.id,jdbcType=INTEGER},@b@ @b@ @b@ name = #{record.name,jdbcType=VARCHAR},@b@ @b@ @b@ create_by = #{record.createBy,jdbcType=VARCHAR},@b@ @b@ @b@ create_time = #{record.createTime,jdbcType=DATE},@b@ @b@ @b@ update_by = #{record.updateBy,jdbcType=VARCHAR},@b@ @b@ @b@ update_time = #{record.updateTime,jdbcType=DATE},@b@ @b@ @b@ @b@ @b@ @b@ @b@ @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@ @b@ @b@ @b@ @b@ @b@ update guser@b@ @b@ @b@ name = #{name,jdbcType=VARCHAR},@b@ @b@ @b@ create_by = #{createBy,jdbcType=VARCHAR},@b@ @b@ @b@ create_time = #{createTime,jdbcType=DATE},@b@ @b@ @b@ update_by = #{updateBy,jdbcType=VARCHAR},@b@ @b@ @b@ update_time = #{updateTime,jdbcType=DATE},@b@ @b@ @b@ where id = #{id,jdbcType=INTEGER}@b@ @b@ @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@ @b@
3.model层代码Guser.java、GuserExample.javapublic 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 oredCriteria;@b@@b@ public GuserExample() {@b@ oredCriteria = new ArrayList();@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 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 criteria;@b@@b@ protected GeneratedCriteria() {@b@ super();@b@ criteria = new ArrayList();@b@ }@b@@b@ public boolean isValid() {@b@ return criteria.size() > 0;@b@ }@b@@b@ public List getAllCriteria() {@b@ return criteria;@b@ }@b@@b@ public List 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 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 dateList = new ArrayList();@b@ Iterator 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 values) {@b@ addCriterion("id in", values, "id");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andIdNotIn(List 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 values) {@b@ addCriterion("name in", values, "name");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andNameNotIn(List 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 values) {@b@ addCriterion("create_by in", values, "createBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateByNotIn(List 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 values) {@b@ addCriterionForJDBCDate("create_time in", values, "createTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andCreateTimeNotIn(List 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 values) {@b@ addCriterion("update_by in", values, "updateBy");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateByNotIn(List 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 values) {@b@ addCriterionForJDBCDate("update_time in", values, "updateTime");@b@ return (Criteria) this;@b@ }@b@@b@ public Criteria andUpdateTimeNotIn(List 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@}
mybatis 自动生成integer_通过mybatis-generator-core工具自动关联表生成对应model、mappers及dao层代码类完整教程...相关推荐
- SpringBoot精通系列-使用Mybatis Generator生成Dao层代码
导语 使用Mybatis的时候通常会创建很多的映射文件以及创建很多的Model对象,相对来说比较麻烦也有很多的重复的工作.下面就来使用一个Mybatis Dao层代码生成器. 文章目录 开始使用M ...
- 提高游戏开发效率的小工具之配置表生成工具
游戏开发中,经常会遇见各式各样的配置表,不同的字段,加上不同的类型,组成的策划们所需要的配置表,但为了达到版本内容,往往配置表格式变化反复无穷.因为在经过数个游戏项目的摧残之后,我们总结了一套比较实用 ...
- ssm(Spring+Spring mvc+mybatis)Dao层实现类——DeptDaoImpl
/** * @Title: DeptDaoImpl.java * @Package org.dao.impl * @Description: TODO该方法的主要作用: * @author A18cc ...
- IDEA项目搭建四——使用Mybatis实现Dao层
一.引入mybatis及mysql的jar包 可以从阿里云上面查找版本,db操作放在dao层所以打开该层的pom.xml文件,找到<dependencies>节点增加两个引入 <de ...
- MyBatis是啥子东西?是一个DAO层的框架
文章目录 一.MyBatis 介绍 二.入门 MyBatis 三.源码示例 第一站:查 第二站:增 第三站:删 第四站:改 四.更多使用说明 映射文件 核心配置文件 相应API方法 一.MyBatis ...
- (转)MyBatis框架的学习(六)——MyBatis整合Spring
http://blog.csdn.net/yerenyuan_pku/article/details/71904315 本文将手把手教你如何使用MyBatis整合Spring,这儿,我本人使用的MyB ...
- mybatis Dao层 Mapper层 controller层 service层 model层 entity层 简介
简介 SSM是sping+springMVC+mybatis集成的框架. MVC即model view controller. model层=entity层.存放我们的实体类,与数据库中的属性值基本保 ...
- Mybatis 原始Dao层开发
对Mybatis进行原始Dao层开发的举例子: 定义获取session工具类: package com.langsin.unit;import java.io.InputStream;import o ...
- 干掉 Postman?测试接口直接生成API文档,这工具真香!
前几天粉丝群有小伙伴问,有啥好用的API文档工具推荐,无意间发现了一款工具,这里马不停蹄的来给大家分享一下. ShowDoc一个非常适合团队的在线API文档工具,也支持用docker自建文档服务,不过 ...
最新文章
- 正值实系数多项式函数所对应的导数累加和是否非负?
- ae中英文切换_AE技巧,AE CC软件如何切换中英文版
- Extjs4.1:模式窗口的设置
- BlazeDS入门教程-很详细-赞原创作者一个
- 网速dns怎么调快_怎么设置dns?教你快速解决网速慢的问题
- whmcs精仿雨云ModuleSky主题模板
- Java基础(一)——基本语法
- XJOI 3866 写什么名字好呢
- 蒙特卡洛树搜索算法(UCT): 一个程序猿进化的故事
- 设计新手最常见的4个问题
- Ctrl + Alt + A ,唯一的截屏快捷键?
- [软件测试]怎么测试一个杯子
- 计算机的纸牌游戏打不开啥原因,win10系统游戏纸牌打不开解决方法 - Win10专业版官网...
- 带你轻松认识SSL协议中的加密套件
- 计算机主机需要ccc,计算机3C认证怎么办理,要什么资料
- qt for java_QT和Java的跨平台
- 题解:[USACO12MAR]花盆Flowerpot 【单调队列】
- beyond the ‘PHYSICAL‘ memory limit. Current usage: 1.0 GB of 1 GB physical memory used;
- 洛谷P1000 超级玛丽游戏C++题解
- 程序员离职原因的最佳回答_员工离职了还将公司的代码盗走做开发!还挖走程序员!...
热门文章
- 【Elasticsearch】使用 Elasticsearch Freeze index API 创建冻结索引
- 【kibana】kibana 7.* 设置中文 汉化
- 【ES】ES 好文档积累
- 95-140-140-源码-transform-双流操作的实现
- SpringBoot : Spring Boot中使用数据缓存 spring-boot-starter-cache
- 【安全】Ceotos 7.5.1804 安装openldap 2.4.44
- CDH Sentry介绍
- Mybatis源码解析:sql参数处理(3)
- Kubernates和Docker
- SQL Server2005探索之---正确使用索引