本小学生刚进公司的时候,就一顿装逼,不管别人问我啥我都会说:"会"!毕竟在公司吗,什么都要装,不要别人看出你的底细。不过有一天,听说用Mybatis可以反向生成dao(第一次听说),顿时就来了兴趣,所以私下跟网上查了查资料,自己整理了一份:

  首先一个jar包:mybatis-generator-core-1.3.3.jar

  下载地址:https://github.com/mybatis/generator/releases

  然后需要一个数据库驱动包:ojdbc14.jar(我用的是oracle)

  接着需要一个xml配置文件:generatorConfig.xml

  

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--数据库驱动 -->
<classPathEntry location="ojdbc14.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true" />
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--数据库链接地址账号密码 -->
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:********:orcl" userId="*******"
password="******">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!--生成Model类存放位置 -->
<javaModelGenerator targetPackage="happy.model"
targetProject="src">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!--生成映射文件存放位置 -->
<sqlMapGenerator targetPackage="happy.mapping"
targetProject="src">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!--生成Dao类存放位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="happy.dao" targetProject="src">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!--生成对应表及类名 -->
<table tableName="REPORTINFO" domainObjectName="Reportinfo"
enableCountByExample="true" enableUpdateByExample="true"
enableDeleteByExample="true" enableSelectByExample="true"
selectByExampleQueryId="true"></table>
</context>
</generatorConfiguration>

目录结构如下图:

不要在意图片上的马赛克,找到项目src目录即可

然后在该目录下按住shift加鼠标右键,选择在此目录打开命令窗口

输入一段命令:java -jar mybatis-generator-core-1.3.3.jar -configfile generatorConfig.xml -overwrite

出现如图所示的信息就表示成功了!!!!

不信你看:

下面主要说一下生成的这个文件:ReportinfoExample.java

内容如下:

 package com.sugardt.autoreport.bean;

 import com.sugardt.autoreport.dao.util.PageDto;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; public class ReportInfoEntityExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
protected String orderByClause; /**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
protected boolean distinct; /**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
protected List<Criteria> oredCriteria; /**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
protected PageDto page; /**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
private String dialect = "oracle"; /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public ReportInfoEntityExample() {
oredCriteria = new ArrayList<Criteria>();
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public String getOrderByClause() {
return orderByClause;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public boolean isDistinct() {
return distinct;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public void setPage(PageDto page) {
this.page=page;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public PageDto getPage() {
return page;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public void setDialect(String dialect) {
this.dialect=dialect;
} /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public String getDialect() {
return dialect;
} /**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria; protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
} public boolean isValid() {
return criteria.size() > 0;
} public List<Criterion> getAllCriteria() {
return criteria;
} public List<Criterion> getCriteria() {
return criteria;
} protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
} protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
} protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
} public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
} public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
} public Criteria andIdEqualTo(BigDecimal value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
} public Criteria andIdNotEqualTo(BigDecimal value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
} public Criteria andIdGreaterThan(BigDecimal value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
} public Criteria andIdGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
} public Criteria andIdLessThan(BigDecimal value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
} public Criteria andIdLessThanOrEqualTo(BigDecimal value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
} public Criteria andIdIn(List<BigDecimal> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
} public Criteria andIdNotIn(List<BigDecimal> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
} public Criteria andIdBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
} public Criteria andIdNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
} public Criteria andTypeIsNull() {
addCriterion("TYPE is null");
return (Criteria) this;
} public Criteria andTypeIsNotNull() {
addCriterion("TYPE is not null");
return (Criteria) this;
} public Criteria andTypeEqualTo(String value) {
addCriterion("TYPE =", value, "type");
return (Criteria) this;
} public Criteria andTypeNotEqualTo(String value) {
addCriterion("TYPE <>", value, "type");
return (Criteria) this;
} public Criteria andTypeGreaterThan(String value) {
addCriterion("TYPE >", value, "type");
return (Criteria) this;
} public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("TYPE >=", value, "type");
return (Criteria) this;
} public Criteria andTypeLessThan(String value) {
addCriterion("TYPE <", value, "type");
return (Criteria) this;
} public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("TYPE <=", value, "type");
return (Criteria) this;
} public Criteria andTypeLike(String value) {
addCriterion("TYPE like", value, "type");
return (Criteria) this;
} public Criteria andTypeNotLike(String value) {
addCriterion("TYPE not like", value, "type");
return (Criteria) this;
} public Criteria andTypeIn(List<String> values) {
addCriterion("TYPE in", values, "type");
return (Criteria) this;
} public Criteria andTypeNotIn(List<String> values) {
addCriterion("TYPE not in", values, "type");
return (Criteria) this;
} public Criteria andTypeBetween(String value1, String value2) {
addCriterion("TYPE between", value1, value2, "type");
return (Criteria) this;
} public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("TYPE not between", value1, value2, "type");
return (Criteria) this;
} public Criteria andSubtypeIsNull() {
addCriterion("SUBTYPE is null");
return (Criteria) this;
} public Criteria andSubtypeIsNotNull() {
addCriterion("SUBTYPE is not null");
return (Criteria) this;
} public Criteria andSubtypeEqualTo(String value) {
addCriterion("SUBTYPE =", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeNotEqualTo(String value) {
addCriterion("SUBTYPE <>", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeGreaterThan(String value) {
addCriterion("SUBTYPE >", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeGreaterThanOrEqualTo(String value) {
addCriterion("SUBTYPE >=", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeLessThan(String value) {
addCriterion("SUBTYPE <", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeLessThanOrEqualTo(String value) {
addCriterion("SUBTYPE <=", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeLike(String value) {
addCriterion("SUBTYPE like", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeNotLike(String value) {
addCriterion("SUBTYPE not like", value, "subtype");
return (Criteria) this;
} public Criteria andSubtypeIn(List<String> values) {
addCriterion("SUBTYPE in", values, "subtype");
return (Criteria) this;
} public Criteria andSubtypeNotIn(List<String> values) {
addCriterion("SUBTYPE not in", values, "subtype");
return (Criteria) this;
} public Criteria andSubtypeBetween(String value1, String value2) {
addCriterion("SUBTYPE between", value1, value2, "subtype");
return (Criteria) this;
} public Criteria andSubtypeNotBetween(String value1, String value2) {
addCriterion("SUBTYPE not between", value1, value2, "subtype");
return (Criteria) this;
} public Criteria andReportmsgurlIsNull() {
addCriterion("REPORTMSGURL is null");
return (Criteria) this;
} public Criteria andReportmsgurlIsNotNull() {
addCriterion("REPORTMSGURL is not null");
return (Criteria) this;
} public Criteria andReportmsgurlEqualTo(String value) {
addCriterion("REPORTMSGURL =", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlNotEqualTo(String value) {
addCriterion("REPORTMSGURL <>", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlGreaterThan(String value) {
addCriterion("REPORTMSGURL >", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlGreaterThanOrEqualTo(String value) {
addCriterion("REPORTMSGURL >=", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlLessThan(String value) {
addCriterion("REPORTMSGURL <", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlLessThanOrEqualTo(String value) {
addCriterion("REPORTMSGURL <=", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlLike(String value) {
addCriterion("REPORTMSGURL like", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlNotLike(String value) {
addCriterion("REPORTMSGURL not like", value, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlIn(List<String> values) {
addCriterion("REPORTMSGURL in", values, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlNotIn(List<String> values) {
addCriterion("REPORTMSGURL not in", values, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlBetween(String value1, String value2) {
addCriterion("REPORTMSGURL between", value1, value2, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgurlNotBetween(String value1, String value2) {
addCriterion("REPORTMSGURL not between", value1, value2, "reportmsgurl");
return (Criteria) this;
} public Criteria andReportmsgnameIsNull() {
addCriterion("REPORTMSGNAME is null");
return (Criteria) this;
} public Criteria andReportmsgnameIsNotNull() {
addCriterion("REPORTMSGNAME is not null");
return (Criteria) this;
} public Criteria andReportmsgnameEqualTo(String value) {
addCriterion("REPORTMSGNAME =", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameNotEqualTo(String value) {
addCriterion("REPORTMSGNAME <>", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameGreaterThan(String value) {
addCriterion("REPORTMSGNAME >", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameGreaterThanOrEqualTo(String value) {
addCriterion("REPORTMSGNAME >=", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameLessThan(String value) {
addCriterion("REPORTMSGNAME <", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameLessThanOrEqualTo(String value) {
addCriterion("REPORTMSGNAME <=", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameLike(String value) {
addCriterion("REPORTMSGNAME like", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameNotLike(String value) {
addCriterion("REPORTMSGNAME not like", value, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameIn(List<String> values) {
addCriterion("REPORTMSGNAME in", values, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameNotIn(List<String> values) {
addCriterion("REPORTMSGNAME not in", values, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameBetween(String value1, String value2) {
addCriterion("REPORTMSGNAME between", value1, value2, "reportmsgname");
return (Criteria) this;
} public Criteria andReportmsgnameNotBetween(String value1, String value2) {
addCriterion("REPORTMSGNAME not between", value1, value2, "reportmsgname");
return (Criteria) this;
} public Criteria andFbmsgurlIsNull() {
addCriterion("FBMSGURL is null");
return (Criteria) this;
} public Criteria andFbmsgurlIsNotNull() {
addCriterion("FBMSGURL is not null");
return (Criteria) this;
} public Criteria andFbmsgurlEqualTo(String value) {
addCriterion("FBMSGURL =", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlNotEqualTo(String value) {
addCriterion("FBMSGURL <>", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlGreaterThan(String value) {
addCriterion("FBMSGURL >", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlGreaterThanOrEqualTo(String value) {
addCriterion("FBMSGURL >=", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlLessThan(String value) {
addCriterion("FBMSGURL <", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlLessThanOrEqualTo(String value) {
addCriterion("FBMSGURL <=", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlLike(String value) {
addCriterion("FBMSGURL like", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlNotLike(String value) {
addCriterion("FBMSGURL not like", value, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlIn(List<String> values) {
addCriterion("FBMSGURL in", values, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlNotIn(List<String> values) {
addCriterion("FBMSGURL not in", values, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlBetween(String value1, String value2) {
addCriterion("FBMSGURL between", value1, value2, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgurlNotBetween(String value1, String value2) {
addCriterion("FBMSGURL not between", value1, value2, "fbmsgurl");
return (Criteria) this;
} public Criteria andFbmsgnameIsNull() {
addCriterion("FBMSGNAME is null");
return (Criteria) this;
} public Criteria andFbmsgnameIsNotNull() {
addCriterion("FBMSGNAME is not null");
return (Criteria) this;
} public Criteria andFbmsgnameEqualTo(String value) {
addCriterion("FBMSGNAME =", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameNotEqualTo(String value) {
addCriterion("FBMSGNAME <>", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameGreaterThan(String value) {
addCriterion("FBMSGNAME >", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameGreaterThanOrEqualTo(String value) {
addCriterion("FBMSGNAME >=", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameLessThan(String value) {
addCriterion("FBMSGNAME <", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameLessThanOrEqualTo(String value) {
addCriterion("FBMSGNAME <=", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameLike(String value) {
addCriterion("FBMSGNAME like", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameNotLike(String value) {
addCriterion("FBMSGNAME not like", value, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameIn(List<String> values) {
addCriterion("FBMSGNAME in", values, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameNotIn(List<String> values) {
addCriterion("FBMSGNAME not in", values, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameBetween(String value1, String value2) {
addCriterion("FBMSGNAME between", value1, value2, "fbmsgname");
return (Criteria) this;
} public Criteria andFbmsgnameNotBetween(String value1, String value2) {
addCriterion("FBMSGNAME not between", value1, value2, "fbmsgname");
return (Criteria) this;
} public Criteria andErramountIsNull() {
addCriterion("ERRAMOUNT is null");
return (Criteria) this;
} public Criteria andErramountIsNotNull() {
addCriterion("ERRAMOUNT is not null");
return (Criteria) this;
} public Criteria andErramountEqualTo(Long value) {
addCriterion("ERRAMOUNT =", value, "erramount");
return (Criteria) this;
} public Criteria andErramountNotEqualTo(Long value) {
addCriterion("ERRAMOUNT <>", value, "erramount");
return (Criteria) this;
} public Criteria andErramountGreaterThan(Long value) {
addCriterion("ERRAMOUNT >", value, "erramount");
return (Criteria) this;
} public Criteria andErramountGreaterThanOrEqualTo(Long value) {
addCriterion("ERRAMOUNT >=", value, "erramount");
return (Criteria) this;
} public Criteria andErramountLessThan(Long value) {
addCriterion("ERRAMOUNT <", value, "erramount");
return (Criteria) this;
} public Criteria andErramountLessThanOrEqualTo(Long value) {
addCriterion("ERRAMOUNT <=", value, "erramount");
return (Criteria) this;
} public Criteria andErramountIn(List<Long> values) {
addCriterion("ERRAMOUNT in", values, "erramount");
return (Criteria) this;
} public Criteria andErramountNotIn(List<Long> values) {
addCriterion("ERRAMOUNT not in", values, "erramount");
return (Criteria) this;
} public Criteria andErramountBetween(Long value1, Long value2) {
addCriterion("ERRAMOUNT between", value1, value2, "erramount");
return (Criteria) this;
} public Criteria andErramountNotBetween(Long value1, Long value2) {
addCriterion("ERRAMOUNT not between", value1, value2, "erramount");
return (Criteria) this;
} public Criteria andStatusIsNull() {
addCriterion("STATUS is null");
return (Criteria) this;
} public Criteria andStatusIsNotNull() {
addCriterion("STATUS is not null");
return (Criteria) this;
} public Criteria andStatusEqualTo(String value) {
addCriterion("STATUS =", value, "status");
return (Criteria) this;
} public Criteria andStatusNotEqualTo(String value) {
addCriterion("STATUS <>", value, "status");
return (Criteria) this;
} public Criteria andStatusGreaterThan(String value) {
addCriterion("STATUS >", value, "status");
return (Criteria) this;
} public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("STATUS >=", value, "status");
return (Criteria) this;
} public Criteria andStatusLessThan(String value) {
addCriterion("STATUS <", value, "status");
return (Criteria) this;
} public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("STATUS <=", value, "status");
return (Criteria) this;
} public Criteria andStatusLike(String value) {
addCriterion("STATUS like", value, "status");
return (Criteria) this;
} public Criteria andStatusNotLike(String value) {
addCriterion("STATUS not like", value, "status");
return (Criteria) this;
} public Criteria andStatusIn(List<String> values) {
addCriterion("STATUS in", values, "status");
return (Criteria) this;
} public Criteria andStatusNotIn(List<String> values) {
addCriterion("STATUS not in", values, "status");
return (Criteria) this;
} public Criteria andStatusBetween(String value1, String value2) {
addCriterion("STATUS between", value1, value2, "status");
return (Criteria) this;
} public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("STATUS not between", value1, value2, "status");
return (Criteria) this;
} public Criteria andErrorinfoIsNull() {
addCriterion("ERRORINFO is null");
return (Criteria) this;
} public Criteria andErrorinfoIsNotNull() {
addCriterion("ERRORINFO is not null");
return (Criteria) this;
} public Criteria andErrorinfoEqualTo(String value) {
addCriterion("ERRORINFO =", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoNotEqualTo(String value) {
addCriterion("ERRORINFO <>", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoGreaterThan(String value) {
addCriterion("ERRORINFO >", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoGreaterThanOrEqualTo(String value) {
addCriterion("ERRORINFO >=", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoLessThan(String value) {
addCriterion("ERRORINFO <", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoLessThanOrEqualTo(String value) {
addCriterion("ERRORINFO <=", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoLike(String value) {
addCriterion("ERRORINFO like", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoNotLike(String value) {
addCriterion("ERRORINFO not like", value, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoIn(List<String> values) {
addCriterion("ERRORINFO in", values, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoNotIn(List<String> values) {
addCriterion("ERRORINFO not in", values, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoBetween(String value1, String value2) {
addCriterion("ERRORINFO between", value1, value2, "errorinfo");
return (Criteria) this;
} public Criteria andErrorinfoNotBetween(String value1, String value2) {
addCriterion("ERRORINFO not between", value1, value2, "errorinfo");
return (Criteria) this;
} public Criteria andLastupdatetimeIsNull() {
addCriterion("LASTUPDATETIME is null");
return (Criteria) this;
} public Criteria andLastupdatetimeIsNotNull() {
addCriterion("LASTUPDATETIME is not null");
return (Criteria) this;
} public Criteria andLastupdatetimeEqualTo(Date value) {
addCriterion("LASTUPDATETIME =", value, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeNotEqualTo(Date value) {
addCriterion("LASTUPDATETIME <>", value, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeGreaterThan(Date value) {
addCriterion("LASTUPDATETIME >", value, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeGreaterThanOrEqualTo(Date value) {
addCriterion("LASTUPDATETIME >=", value, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeLessThan(Date value) {
addCriterion("LASTUPDATETIME <", value, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeLessThanOrEqualTo(Date value) {
addCriterion("LASTUPDATETIME <=", value, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeIn(List<Date> values) {
addCriterion("LASTUPDATETIME in", values, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeNotIn(List<Date> values) {
addCriterion("LASTUPDATETIME not in", values, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeBetween(Date value1, Date value2) {
addCriterion("LASTUPDATETIME between", value1, value2, "lastupdatetime");
return (Criteria) this;
} public Criteria andLastupdatetimeNotBetween(Date value1, Date value2) {
addCriterion("LASTUPDATETIME not between", value1, value2, "lastupdatetime");
return (Criteria) this;
} public Criteria andReporttimeIsNull() {
addCriterion("REPORTTIME is null");
return (Criteria) this;
} public Criteria andReporttimeIsNotNull() {
addCriterion("REPORTTIME is not null");
return (Criteria) this;
} public Criteria andReporttimeEqualTo(Date value) {
addCriterion("REPORTTIME =", value, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeNotEqualTo(Date value) {
addCriterion("REPORTTIME <>", value, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeGreaterThan(Date value) {
addCriterion("REPORTTIME >", value, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeGreaterThanOrEqualTo(Date value) {
addCriterion("REPORTTIME >=", value, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeLessThan(Date value) {
addCriterion("REPORTTIME <", value, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeLessThanOrEqualTo(Date value) {
addCriterion("REPORTTIME <=", value, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeIn(List<Date> values) {
addCriterion("REPORTTIME in", values, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeNotIn(List<Date> values) {
addCriterion("REPORTTIME not in", values, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeBetween(Date value1, Date value2) {
addCriterion("REPORTTIME between", value1, value2, "reporttime");
return (Criteria) this;
} public Criteria andReporttimeNotBetween(Date value1, Date value2) {
addCriterion("REPORTTIME not between", value1, value2, "reporttime");
return (Criteria) this;
} public Criteria andFbtimeIsNull() {
addCriterion("FBTIME is null");
return (Criteria) this;
} public Criteria andFbtimeIsNotNull() {
addCriterion("FBTIME is not null");
return (Criteria) this;
} public Criteria andFbtimeEqualTo(Date value) {
addCriterion("FBTIME =", value, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeNotEqualTo(Date value) {
addCriterion("FBTIME <>", value, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeGreaterThan(Date value) {
addCriterion("FBTIME >", value, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeGreaterThanOrEqualTo(Date value) {
addCriterion("FBTIME >=", value, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeLessThan(Date value) {
addCriterion("FBTIME <", value, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeLessThanOrEqualTo(Date value) {
addCriterion("FBTIME <=", value, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeIn(List<Date> values) {
addCriterion("FBTIME in", values, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeNotIn(List<Date> values) {
addCriterion("FBTIME not in", values, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeBetween(Date value1, Date value2) {
addCriterion("FBTIME between", value1, value2, "fbtime");
return (Criteria) this;
} public Criteria andFbtimeNotBetween(Date value1, Date value2) {
addCriterion("FBTIME not between", value1, value2, "fbtime");
return (Criteria) this;
} public Criteria andOrgcodeIsNull() {
addCriterion("ORGCODE is null");
return (Criteria) this;
} public Criteria andOrgcodeIsNotNull() {
addCriterion("ORGCODE is not null");
return (Criteria) this;
} public Criteria andOrgcodeEqualTo(String value) {
addCriterion("ORGCODE =", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeNotEqualTo(String value) {
addCriterion("ORGCODE <>", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeGreaterThan(String value) {
addCriterion("ORGCODE >", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeGreaterThanOrEqualTo(String value) {
addCriterion("ORGCODE >=", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeLessThan(String value) {
addCriterion("ORGCODE <", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeLessThanOrEqualTo(String value) {
addCriterion("ORGCODE <=", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeLike(String value) {
addCriterion("ORGCODE like", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeNotLike(String value) {
addCriterion("ORGCODE not like", value, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeIn(List<String> values) {
addCriterion("ORGCODE in", values, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeNotIn(List<String> values) {
addCriterion("ORGCODE not in", values, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeBetween(String value1, String value2) {
addCriterion("ORGCODE between", value1, value2, "orgcode");
return (Criteria) this;
} public Criteria andOrgcodeNotBetween(String value1, String value2) {
addCriterion("ORGCODE not between", value1, value2, "orgcode");
return (Criteria) this;
}
} /**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria { protected Criteria() {
super();
}
} /**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table AUTOREPORT.REPORTINFO
*
* @mbggenerated
*/
public static class Criterion {
private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() {
return condition;
} public Object getValue() {
return value;
} public Object getSecondValue() {
return secondValue;
} public boolean isNoValue() {
return noValue;
} public boolean isSingleValue() {
return singleValue;
} public boolean isBetweenValue() {
return betweenValue;
} public boolean isListValue() {
return listValue;
} public String getTypeHandler() {
return typeHandler;
} protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
} protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
} protected Criterion(String condition, Object value) {
this(condition, value, null);
} protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
} protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

里面封装了一些方法,与数据库操作更方便了,个人觉得比hibernate简单许多,例如:

需要带条件查询的话,hibernate需要自己写sql或者hql语句,这里反而不用,如下图所示:

具体里面的内容,大家可以自己去实践操作!!!!

小学生之使用Mybatis反向生成dao,entity,xml的更多相关文章

  1. mybatis 反向生成步骤

    Mybatis 反向生成. 反向生成的步骤: 反向生成的文件 打开文件夹显示 3.打开generator.xml文件 更改配置信息  路径一般情况下用英文  中文的路径有些会识别不了  或产生乱码 4 ...

  2. MyBatis Generator生成DAO——序列化

    MyBatis Generator生成DAO 的时候,生成的类都是没有序列化的. 还以为要手工加入(開始是手工加入的),今天遇到分页的问题,才发现生成的时候能够加入插件. 既然分页能够有插件.序列化是 ...

  3. 使用MyBatis Generator生成DAO

    虽然MyBatis很方便,但是想要手写全部的mapper还是很累人的,好在MyBatis官方推出了自动化工具,可以根据数据库和定义好的配置直接生成DAO层及以下的全部代码,非常方便. 需要注意的是,虽 ...

  4. 关于Mybatis 反向生成后 查询结果全部为null 解决办法

    今天遇到了一个问题,就是mybatis通过反向生成工具 生成的pojo类(实体类) xml文件 以及Mapper之后查询时结果为null 我写的代码怎么看都没有错 就是没有结果 后来在排除错误的时候发 ...

  5. mybatis逆向生成dao mapper和example.java文件

    mabatis插件 <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>myba ...

  6. 5.20 mybatis反向生成的映射文件xml(如果需要自己定义其他sql语句时如下)

    解决mybatis-generator 生成的mapper.xml覆盖自定义sql的问题 mybatis-generator是个好工具,一建即可生成基本增删改成功能的mapper.xml.但这些是不够 ...

  7. mybatis反向生成sql,基本的增删改查

    用到的几个文件 MyBatisGeneratorProxy.java package com.timestech.wsgk.test.tools; import static org.mybatis. ...

  8. 关于mybatis反向生成为什么有时候实体类会变成两个

    一般来说,将TEXT字段,从一张操作频繁的表中拆分出去,成为一个Key-Value结构的独立表是 好处颇多的. 其有利之处主要体现在下面三个方面: PS:以下的讨论对象均基于Innodb引擎 1. 便 ...

  9. MyBatis逆向工程生成dao层增删改查方法解释使用(转载)

    int countByExample(BUserExample example); //根据条件查询数量 /** * 示例 * public int countByExample() { * BUse ...

随机推荐

  1. 如何根据Jquery实现两级联动

    <script language="javascript" type="text/javascript" > $(function (){      ...

  2. $_GLOBALS超全局数组和global定义的全局变量区别?

    全局变量:主程序中定义的变量(函数外部),只能在主程序中使用,在函数内部不能调用 背景:解决在函数内部调用全局变量的问题 解决方法: 1.在函数内部声名全局变量 <?php public $va ...

  3. checkbox复选框全选批量删除

    多选框全选实现批量删除 html代码 <body> <form action="" method="post" name="Form ...

  4. gdb调试memcached

    1.memcached安装前,要安装libevent 2.memcached在configure中 加上  CPPFLAGS='-ggdb3'选项 例如 本机  ./configure -prefix ...

  5. GIve Me A Welcome Hug!

    类似于初来乍到,和大家打个招呼,并矫情的希望路人也能回赠我一个welcome hug. 到了这种园子那一定是做CS相关的了,一直以为如果能够坚持写技术博客,那一定会对自己的内力有十足的提升.借用一位前 ...

  6. some words that I always make mistake

    发音相似容易混淆的词汇 alteration  英 [ɔːltə'reɪʃ(ə)n; 'ɒl-]  美 [,ɔltə'reʃən]  n. 修改,改变:变更 alteration /ˌɔːltəˈre ...

  7. infinitescroll 通过无限制分页(json方式完整代码)

    @{ ViewBag.Title = " ";} <style type="text/css"> #infscr-loading { text-al ...

  8. Steps

    uva846:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  9. 作了点有意义 的事,加入CLOUDSTACK官方文档的中文翻译工作

    https://www.transifex.com/ 昨天到今天,作了个部署构架方面的翻译.

  10. Visual Studio如何删除多余的空行

    原文:Visual Studio如何删除多余的空行 如何在Visual  Studio中删除多余的空格: 适用于:Visual Studio2008 &2010 1.       Ctrl + ...