小学生之使用Mybatis反向生成dao,entity,xml

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

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

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

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

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

  

 1 <?xml version="1.0" encoding="UTF-8"?>
 2  <!DOCTYPE generatorConfiguration
 3    PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
 4    "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
 5 <generatorConfiguration>
 6     <!--数据库驱动 -->
 7     <classPathEntry location="ojdbc14.jar" />
 8     <context id="DB2Tables" targetRuntime="MyBatis3">
 9         <commentGenerator>
10             <property name="suppressDate" value="true" />
11             <property name="suppressAllComments" value="true" />
12         </commentGenerator>
13         <!--数据库链接地址账号密码 -->
14         <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
15             connectionURL="jdbc:oracle:thin:********:orcl" userId="*******"
16             password="******">
17         </jdbcConnection>
18         <javaTypeResolver>
19             <property name="forceBigDecimals" value="false" />
20         </javaTypeResolver>
21         <!--生成Model类存放位置 -->
22         <javaModelGenerator targetPackage="happy.model"
23             targetProject="src">
24             <property name="enableSubPackages" value="true" />
25             <property name="trimStrings" value="true" />
26         </javaModelGenerator>
27         <!--生成映射文件存放位置 -->
28         <sqlMapGenerator targetPackage="happy.mapping"
29             targetProject="src">
30             <property name="enableSubPackages" value="true" />
31         </sqlMapGenerator>
32         <!--生成Dao类存放位置 -->
33         <javaClientGenerator type="XMLMAPPER"
34             targetPackage="happy.dao" targetProject="src">
35             <property name="enableSubPackages" value="true" />
36         </javaClientGenerator>
37         <!--生成对应表及类名 -->
38         <table tableName="REPORTINFO" domainObjectName="Reportinfo"
39             enableCountByExample="true" enableUpdateByExample="true"
40             enableDeleteByExample="true" enableSelectByExample="true"
41             selectByExampleQueryId="true"></table>
42     </context>
43 </generatorConfiguration>

目录结构如下图:

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

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

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

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

不信你看:

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

内容如下:

   1 package com.sugardt.autoreport.bean;
   2 
   3 import com.sugardt.autoreport.dao.util.PageDto;
   4 import java.math.BigDecimal;
   5 import java.util.ArrayList;
   6 import java.util.Date;
   7 import java.util.List;
   8 
   9 public class ReportInfoEntityExample {
  10     /**
  11      * This field was generated by MyBatis Generator.
  12      * This field corresponds to the database table AUTOREPORT.REPORTINFO
  13      *
  14      * @mbggenerated
  15      */
  16     protected String orderByClause;
  17 
  18     /**
  19      * This field was generated by MyBatis Generator.
  20      * This field corresponds to the database table AUTOREPORT.REPORTINFO
  21      *
  22      * @mbggenerated
  23      */
  24     protected boolean distinct;
  25 
  26     /**
  27      * This field was generated by MyBatis Generator.
  28      * This field corresponds to the database table AUTOREPORT.REPORTINFO
  29      *
  30      * @mbggenerated
  31      */
  32     protected List<Criteria> oredCriteria;
  33 
  34     /**
  35      * This field was generated by MyBatis Generator.
  36      * This field corresponds to the database table AUTOREPORT.REPORTINFO
  37      *
  38      * @mbggenerated
  39      */
  40     protected PageDto page;
  41 
  42     /**
  43      * This field was generated by MyBatis Generator.
  44      * This field corresponds to the database table AUTOREPORT.REPORTINFO
  45      *
  46      * @mbggenerated
  47      */
  48     private String dialect = "oracle";
  49 
  50     /**
  51      * This method was generated by MyBatis Generator.
  52      * This method corresponds to the database table AUTOREPORT.REPORTINFO
  53      *
  54      * @mbggenerated
  55      */
  56     public ReportInfoEntityExample() {
  57         oredCriteria = new ArrayList<Criteria>();
  58     }
  59 
  60     /**
  61      * This method was generated by MyBatis Generator.
  62      * This method corresponds to the database table AUTOREPORT.REPORTINFO
  63      *
  64      * @mbggenerated
  65      */
  66     public void setOrderByClause(String orderByClause) {
  67         this.orderByClause = orderByClause;
  68     }
  69 
  70     /**
  71      * This method was generated by MyBatis Generator.
  72      * This method corresponds to the database table AUTOREPORT.REPORTINFO
  73      *
  74      * @mbggenerated
  75      */
  76     public String getOrderByClause() {
  77         return orderByClause;
  78     }
  79 
  80     /**
  81      * This method was generated by MyBatis Generator.
  82      * This method corresponds to the database table AUTOREPORT.REPORTINFO
  83      *
  84      * @mbggenerated
  85      */
  86     public void setDistinct(boolean distinct) {
  87         this.distinct = distinct;
  88     }
  89 
  90     /**
  91      * This method was generated by MyBatis Generator.
  92      * This method corresponds to the database table AUTOREPORT.REPORTINFO
  93      *
  94      * @mbggenerated
  95      */
  96     public boolean isDistinct() {
  97         return distinct;
  98     }
  99 
 100     /**
 101      * This method was generated by MyBatis Generator.
 102      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 103      *
 104      * @mbggenerated
 105      */
 106     public List<Criteria> getOredCriteria() {
 107         return oredCriteria;
 108     }
 109 
 110     /**
 111      * This method was generated by MyBatis Generator.
 112      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 113      *
 114      * @mbggenerated
 115      */
 116     public void or(Criteria criteria) {
 117         oredCriteria.add(criteria);
 118     }
 119 
 120     /**
 121      * This method was generated by MyBatis Generator.
 122      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 123      *
 124      * @mbggenerated
 125      */
 126     public Criteria or() {
 127         Criteria criteria = createCriteriaInternal();
 128         oredCriteria.add(criteria);
 129         return criteria;
 130     }
 131 
 132     /**
 133      * This method was generated by MyBatis Generator.
 134      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 135      *
 136      * @mbggenerated
 137      */
 138     public Criteria createCriteria() {
 139         Criteria criteria = createCriteriaInternal();
 140         if (oredCriteria.size() == 0) {
 141             oredCriteria.add(criteria);
 142         }
 143         return criteria;
 144     }
 145 
 146     /**
 147      * This method was generated by MyBatis Generator.
 148      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 149      *
 150      * @mbggenerated
 151      */
 152     protected Criteria createCriteriaInternal() {
 153         Criteria criteria = new Criteria();
 154         return criteria;
 155     }
 156 
 157     /**
 158      * This method was generated by MyBatis Generator.
 159      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 160      *
 161      * @mbggenerated
 162      */
 163     public void clear() {
 164         oredCriteria.clear();
 165         orderByClause = null;
 166         distinct = false;
 167     }
 168 
 169     /**
 170      * This method was generated by MyBatis Generator.
 171      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 172      *
 173      * @mbggenerated
 174      */
 175     public void setPage(PageDto page) {
 176         this.page=page;
 177     }
 178 
 179     /**
 180      * This method was generated by MyBatis Generator.
 181      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 182      *
 183      * @mbggenerated
 184      */
 185     public PageDto getPage() {
 186         return page;
 187     }
 188 
 189     /**
 190      * This method was generated by MyBatis Generator.
 191      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 192      *
 193      * @mbggenerated
 194      */
 195     public void setDialect(String dialect) {
 196         this.dialect=dialect;
 197     }
 198 
 199     /**
 200      * This method was generated by MyBatis Generator.
 201      * This method corresponds to the database table AUTOREPORT.REPORTINFO
 202      *
 203      * @mbggenerated
 204      */
 205     public String getDialect() {
 206         return dialect;
 207     }
 208 
 209     /**
 210      * This class was generated by MyBatis Generator.
 211      * This class corresponds to the database table AUTOREPORT.REPORTINFO
 212      *
 213      * @mbggenerated
 214      */
 215     protected abstract static class GeneratedCriteria {
 216         protected List<Criterion> criteria;
 217 
 218         protected GeneratedCriteria() {
 219             super();
 220             criteria = new ArrayList<Criterion>();
 221         }
 222 
 223         public boolean isValid() {
 224             return criteria.size() > 0;
 225         }
 226 
 227         public List<Criterion> getAllCriteria() {
 228             return criteria;
 229         }
 230 
 231         public List<Criterion> getCriteria() {
 232             return criteria;
 233         }
 234 
 235         protected void addCriterion(String condition) {
 236             if (condition == null) {
 237                 throw new RuntimeException("Value for condition cannot be null");
 238             }
 239             criteria.add(new Criterion(condition));
 240         }
 241 
 242         protected void addCriterion(String condition, Object value, String property) {
 243             if (value == null) {
 244                 throw new RuntimeException("Value for " + property + " cannot be null");
 245             }
 246             criteria.add(new Criterion(condition, value));
 247         }
 248 
 249         protected void addCriterion(String condition, Object value1, Object value2, String property) {
 250             if (value1 == null || value2 == null) {
 251                 throw new RuntimeException("Between values for " + property + " cannot be null");
 252             }
 253             criteria.add(new Criterion(condition, value1, value2));
 254         }
 255 
 256         public Criteria andIdIsNull() {
 257             addCriterion("ID is null");
 258             return (Criteria) this;
 259         }
 260 
 261         public Criteria andIdIsNotNull() {
 262             addCriterion("ID is not null");
 263             return (Criteria) this;
 264         }
 265 
 266         public Criteria andIdEqualTo(BigDecimal value) {
 267             addCriterion("ID =", value, "id");
 268             return (Criteria) this;
 269         }
 270 
 271         public Criteria andIdNotEqualTo(BigDecimal value) {
 272             addCriterion("ID <>", value, "id");
 273             return (Criteria) this;
 274         }
 275 
 276         public Criteria andIdGreaterThan(BigDecimal value) {
 277             addCriterion("ID >", value, "id");
 278             return (Criteria) this;
 279         }
 280 
 281         public Criteria andIdGreaterThanOrEqualTo(BigDecimal value) {
 282             addCriterion("ID >=", value, "id");
 283             return (Criteria) this;
 284         }
 285 
 286         public Criteria andIdLessThan(BigDecimal value) {
 287             addCriterion("ID <", value, "id");
 288             return (Criteria) this;
 289         }
 290 
 291         public Criteria andIdLessThanOrEqualTo(BigDecimal value) {
 292             addCriterion("ID <=", value, "id");
 293             return (Criteria) this;
 294         }
 295 
 296         public Criteria andIdIn(List<BigDecimal> values) {
 297             addCriterion("ID in", values, "id");
 298             return (Criteria) this;
 299         }
 300 
 301         public Criteria andIdNotIn(List<BigDecimal> values) {
 302             addCriterion("ID not in", values, "id");
 303             return (Criteria) this;
 304         }
 305 
 306         public Criteria andIdBetween(BigDecimal value1, BigDecimal value2) {
 307             addCriterion("ID between", value1, value2, "id");
 308             return (Criteria) this;
 309         }
 310 
 311         public Criteria andIdNotBetween(BigDecimal value1, BigDecimal value2) {
 312             addCriterion("ID not between", value1, value2, "id");
 313             return (Criteria) this;
 314         }
 315 
 316         public Criteria andTypeIsNull() {
 317             addCriterion("TYPE is null");
 318             return (Criteria) this;
 319         }
 320 
 321         public Criteria andTypeIsNotNull() {
 322             addCriterion("TYPE is not null");
 323             return (Criteria) this;
 324         }
 325 
 326         public Criteria andTypeEqualTo(String value) {
 327             addCriterion("TYPE =", value, "type");
 328             return (Criteria) this;
 329         }
 330 
 331         public Criteria andTypeNotEqualTo(String value) {
 332             addCriterion("TYPE <>", value, "type");
 333             return (Criteria) this;
 334         }
 335 
 336         public Criteria andTypeGreaterThan(String value) {
 337             addCriterion("TYPE >", value, "type");
 338             return (Criteria) this;
 339         }
 340 
 341         public Criteria andTypeGreaterThanOrEqualTo(String value) {
 342             addCriterion("TYPE >=", value, "type");
 343             return (Criteria) this;
 344         }
 345 
 346         public Criteria andTypeLessThan(String value) {
 347             addCriterion("TYPE <", value, "type");
 348             return (Criteria) this;
 349         }
 350 
 351         public Criteria andTypeLessThanOrEqualTo(String value) {
 352             addCriterion("TYPE <=", value, "type");
 353             return (Criteria) this;
 354         }
 355 
 356         public Criteria andTypeLike(String value) {
 357             addCriterion("TYPE like", value, "type");
 358             return (Criteria) this;
 359         }
 360 
 361         public Criteria andTypeNotLike(String value) {
 362             addCriterion("TYPE not like", value, "type");
 363             return (Criteria) this;
 364         }
 365 
 366         public Criteria andTypeIn(List<String> values) {
 367             addCriterion("TYPE in", values, "type");
 368             return (Criteria) this;
 369         }
 370 
 371         public Criteria andTypeNotIn(List<String> values) {
 372             addCriterion("TYPE not in", values, "type");
 373             return (Criteria) this;
 374         }
 375 
 376         public Criteria andTypeBetween(String value1, String value2) {
 377             addCriterion("TYPE between", value1, value2, "type");
 378             return (Criteria) this;
 379         }
 380 
 381         public Criteria andTypeNotBetween(String value1, String value2) {
 382             addCriterion("TYPE not between", value1, value2, "type");
 383             return (Criteria) this;
 384         }
 385 
 386         public Criteria andSubtypeIsNull() {
 387             addCriterion("SUBTYPE is null");
 388             return (Criteria) this;
 389         }
 390 
 391         public Criteria andSubtypeIsNotNull() {
 392             addCriterion("SUBTYPE is not null");
 393             return (Criteria) this;
 394         }
 395 
 396         public Criteria andSubtypeEqualTo(String value) {
 397             addCriterion("SUBTYPE =", value, "subtype");
 398             return (Criteria) this;
 399         }
 400 
 401         public Criteria andSubtypeNotEqualTo(String value) {
 402             addCriterion("SUBTYPE <>", value, "subtype");
 403             return (Criteria) this;
 404         }
 405 
 406         public Criteria andSubtypeGreaterThan(String value) {
 407             addCriterion("SUBTYPE >", value, "subtype");
 408             return (Criteria) this;
 409         }
 410 
 411         public Criteria andSubtypeGreaterThanOrEqualTo(String value) {
 412             addCriterion("SUBTYPE >=", value, "subtype");
 413             return (Criteria) this;
 414         }
 415 
 416         public Criteria andSubtypeLessThan(String value) {
 417             addCriterion("SUBTYPE <", value, "subtype");
 418             return (Criteria) this;
 419         }
 420 
 421         public Criteria andSubtypeLessThanOrEqualTo(String value) {
 422             addCriterion("SUBTYPE <=", value, "subtype");
 423             return (Criteria) this;
 424         }
 425 
 426         public Criteria andSubtypeLike(String value) {
 427             addCriterion("SUBTYPE like", value, "subtype");
 428             return (Criteria) this;
 429         }
 430 
 431         public Criteria andSubtypeNotLike(String value) {
 432             addCriterion("SUBTYPE not like", value, "subtype");
 433             return (Criteria) this;
 434         }
 435 
 436         public Criteria andSubtypeIn(List<String> values) {
 437             addCriterion("SUBTYPE in", values, "subtype");
 438             return (Criteria) this;
 439         }
 440 
 441         public Criteria andSubtypeNotIn(List<String> values) {
 442             addCriterion("SUBTYPE not in", values, "subtype");
 443             return (Criteria) this;
 444         }
 445 
 446         public Criteria andSubtypeBetween(String value1, String value2) {
 447             addCriterion("SUBTYPE between", value1, value2, "subtype");
 448             return (Criteria) this;
 449         }
 450 
 451         public Criteria andSubtypeNotBetween(String value1, String value2) {
 452             addCriterion("SUBTYPE not between", value1, value2, "subtype");
 453             return (Criteria) this;
 454         }
 455 
 456         public Criteria andReportmsgurlIsNull() {
 457             addCriterion("REPORTMSGURL is null");
 458             return (Criteria) this;
 459         }
 460 
 461         public Criteria andReportmsgurlIsNotNull() {
 462             addCriterion("REPORTMSGURL is not null");
 463             return (Criteria) this;
 464         }
 465 
 466         public Criteria andReportmsgurlEqualTo(String value) {
 467             addCriterion("REPORTMSGURL =", value, "reportmsgurl");
 468             return (Criteria) this;
 469         }
 470 
 471         public Criteria andReportmsgurlNotEqualTo(String value) {
 472             addCriterion("REPORTMSGURL <>", value, "reportmsgurl");
 473             return (Criteria) this;
 474         }
 475 
 476         public Criteria andReportmsgurlGreaterThan(String value) {
 477             addCriterion("REPORTMSGURL >", value, "reportmsgurl");
 478             return (Criteria) this;
 479         }
 480 
 481         public Criteria andReportmsgurlGreaterThanOrEqualTo(String value) {
 482             addCriterion("REPORTMSGURL >=", value, "reportmsgurl");
 483             return (Criteria) this;
 484         }
 485 
 486         public Criteria andReportmsgurlLessThan(String value) {
 487             addCriterion("REPORTMSGURL <", value, "reportmsgurl");
 488             return (Criteria) this;
 489         }
 490 
 491         public Criteria andReportmsgurlLessThanOrEqualTo(String value) {
 492             addCriterion("REPORTMSGURL <=", value, "reportmsgurl");
 493             return (Criteria) this;
 494         }
 495 
 496         public Criteria andReportmsgurlLike(String value) {
 497             addCriterion("REPORTMSGURL like", value, "reportmsgurl");
 498             return (Criteria) this;
 499         }
 500 
 501         public Criteria andReportmsgurlNotLike(String value) {
 502             addCriterion("REPORTMSGURL not like", value, "reportmsgurl");
 503             return (Criteria) this;
 504         }
 505 
 506         public Criteria andReportmsgurlIn(List<String> values) {
 507             addCriterion("REPORTMSGURL in", values, "reportmsgurl");
 508             return (Criteria) this;
 509         }
 510 
 511         public Criteria andReportmsgurlNotIn(List<String> values) {
 512             addCriterion("REPORTMSGURL not in", values, "reportmsgurl");
 513             return (Criteria) this;
 514         }
 515 
 516         public Criteria andReportmsgurlBetween(String value1, String value2) {
 517             addCriterion("REPORTMSGURL between", value1, value2, "reportmsgurl");
 518             return (Criteria) this;
 519         }
 520 
 521         public Criteria andReportmsgurlNotBetween(String value1, String value2) {
 522             addCriterion("REPORTMSGURL not between", value1, value2, "reportmsgurl");
 523             return (Criteria) this;
 524         }
 525 
 526         public Criteria andReportmsgnameIsNull() {
 527             addCriterion("REPORTMSGNAME is null");
 528             return (Criteria) this;
 529         }
 530 
 531         public Criteria andReportmsgnameIsNotNull() {
 532             addCriterion("REPORTMSGNAME is not null");
 533             return (Criteria) this;
 534         }
 535 
 536         public Criteria andReportmsgnameEqualTo(String value) {
 537             addCriterion("REPORTMSGNAME =", value, "reportmsgname");
 538             return (Criteria) this;
 539         }
 540 
 541         public Criteria andReportmsgnameNotEqualTo(String value) {
 542             addCriterion("REPORTMSGNAME <>", value, "reportmsgname");
 543             return (Criteria) this;
 544         }
 545 
 546         public Criteria andReportmsgnameGreaterThan(String value) {
 547             addCriterion("REPORTMSGNAME >", value, "reportmsgname");
 548             return (Criteria) this;
 549         }
 550 
 551         public Criteria andReportmsgnameGreaterThanOrEqualTo(String value) {
 552             addCriterion("REPORTMSGNAME >=", value, "reportmsgname");
 553             return (Criteria) this;
 554         }
 555 
 556         public Criteria andReportmsgnameLessThan(String value) {
 557             addCriterion("REPORTMSGNAME <", value, "reportmsgname");
 558             return (Criteria) this;
 559         }
 560 
 561         public Criteria andReportmsgnameLessThanOrEqualTo(String value) {
 562             addCriterion("REPORTMSGNAME <=", value, "reportmsgname");
 563             return (Criteria) this;
 564         }
 565 
 566         public Criteria andReportmsgnameLike(String value) {
 567             addCriterion("REPORTMSGNAME like", value, "reportmsgname");
 568             return (Criteria) this;
 569         }
 570 
 571         public Criteria andReportmsgnameNotLike(String value) {
 572             addCriterion("REPORTMSGNAME not like", value, "reportmsgname");
 573             return (Criteria) this;
 574         }
 575 
 576         public Criteria andReportmsgnameIn(List<String> values) {
 577             addCriterion("REPORTMSGNAME in", values, "reportmsgname");
 578             return (Criteria) this;
 579         }
 580 
 581         public Criteria andReportmsgnameNotIn(List<String> values) {
 582             addCriterion("REPORTMSGNAME not in", values, "reportmsgname");
 583             return (Criteria) this;
 584         }
 585 
 586         public Criteria andReportmsgnameBetween(String value1, String value2) {
 587             addCriterion("REPORTMSGNAME between", value1, value2, "reportmsgname");
 588             return (Criteria) this;
 589         }
 590 
 591         public Criteria andReportmsgnameNotBetween(String value1, String value2) {
 592             addCriterion("REPORTMSGNAME not between", value1, value2, "reportmsgname");
 593             return (Criteria) this;
 594         }
 595 
 596         public Criteria andFbmsgurlIsNull() {
 597             addCriterion("FBMSGURL is null");
 598             return (Criteria) this;
 599         }
 600 
 601         public Criteria andFbmsgurlIsNotNull() {
 602             addCriterion("FBMSGURL is not null");
 603             return (Criteria) this;
 604         }
 605 
 606         public Criteria andFbmsgurlEqualTo(String value) {
 607             addCriterion("FBMSGURL =", value, "fbmsgurl");
 608             return (Criteria) this;
 609         }
 610 
 611         public Criteria andFbmsgurlNotEqualTo(String value) {
 612             addCriterion("FBMSGURL <>", value, "fbmsgurl");
 613             return (Criteria) this;
 614         }
 615 
 616         public Criteria andFbmsgurlGreaterThan(String value) {
 617             addCriterion("FBMSGURL >", value, "fbmsgurl");
 618             return (Criteria) this;
 619         }
 620 
 621         public Criteria andFbmsgurlGreaterThanOrEqualTo(String value) {
 622             addCriterion("FBMSGURL >=", value, "fbmsgurl");
 623             return (Criteria) this;
 624         }
 625 
 626         public Criteria andFbmsgurlLessThan(String value) {
 627             addCriterion("FBMSGURL <", value, "fbmsgurl");
 628             return (Criteria) this;
 629         }
 630 
 631         public Criteria andFbmsgurlLessThanOrEqualTo(String value) {
 632             addCriterion("FBMSGURL <=", value, "fbmsgurl");
 633             return (Criteria) this;
 634         }
 635 
 636         public Criteria andFbmsgurlLike(String value) {
 637             addCriterion("FBMSGURL like", value, "fbmsgurl");
 638             return (Criteria) this;
 639         }
 640 
 641         public Criteria andFbmsgurlNotLike(String value) {
 642             addCriterion("FBMSGURL not like", value, "fbmsgurl");
 643             return (Criteria) this;
 644         }
 645 
 646         public Criteria andFbmsgurlIn(List<String> values) {
 647             addCriterion("FBMSGURL in", values, "fbmsgurl");
 648             return (Criteria) this;
 649         }
 650 
 651         public Criteria andFbmsgurlNotIn(List<String> values) {
 652             addCriterion("FBMSGURL not in", values, "fbmsgurl");
 653             return (Criteria) this;
 654         }
 655 
 656         public Criteria andFbmsgurlBetween(String value1, String value2) {
 657             addCriterion("FBMSGURL between", value1, value2, "fbmsgurl");
 658             return (Criteria) this;
 659         }
 660 
 661         public Criteria andFbmsgurlNotBetween(String value1, String value2) {
 662             addCriterion("FBMSGURL not between", value1, value2, "fbmsgurl");
 663             return (Criteria) this;
 664         }
 665 
 666         public Criteria andFbmsgnameIsNull() {
 667             addCriterion("FBMSGNAME is null");
 668             return (Criteria) this;
 669         }
 670 
 671         public Criteria andFbmsgnameIsNotNull() {
 672             addCriterion("FBMSGNAME is not null");
 673             return (Criteria) this;
 674         }
 675 
 676         public Criteria andFbmsgnameEqualTo(String value) {
 677             addCriterion("FBMSGNAME =", value, "fbmsgname");
 678             return (Criteria) this;
 679         }
 680 
 681         public Criteria andFbmsgnameNotEqualTo(String value) {
 682             addCriterion("FBMSGNAME <>", value, "fbmsgname");
 683             return (Criteria) this;
 684         }
 685 
 686         public Criteria andFbmsgnameGreaterThan(String value) {
 687             addCriterion("FBMSGNAME >", value, "fbmsgname");
 688             return (Criteria) this;
 689         }
 690 
 691         public Criteria andFbmsgnameGreaterThanOrEqualTo(String value) {
 692             addCriterion("FBMSGNAME >=", value, "fbmsgname");
 693             return (Criteria) this;
 694         }
 695 
 696         public Criteria andFbmsgnameLessThan(String value) {
 697             addCriterion("FBMSGNAME <", value, "fbmsgname");
 698             return (Criteria) this;
 699         }
 700 
 701         public Criteria andFbmsgnameLessThanOrEqualTo(String value) {
 702             addCriterion("FBMSGNAME <=", value, "fbmsgname");
 703             return (Criteria) this;
 704         }
 705 
 706         public Criteria andFbmsgnameLike(String value) {
 707             addCriterion("FBMSGNAME like", value, "fbmsgname");
 708             return (Criteria) this;
 709         }
 710 
 711         public Criteria andFbmsgnameNotLike(String value) {
 712             addCriterion("FBMSGNAME not like", value, "fbmsgname");
 713             return (Criteria) this;
 714         }
 715 
 716         public Criteria andFbmsgnameIn(List<String> values) {
 717             addCriterion("FBMSGNAME in", values, "fbmsgname");
 718             return (Criteria) this;
 719         }
 720 
 721         public Criteria andFbmsgnameNotIn(List<String> values) {
 722             addCriterion("FBMSGNAME not in", values, "fbmsgname");
 723             return (Criteria) this;
 724         }
 725 
 726         public Criteria andFbmsgnameBetween(String value1, String value2) {
 727             addCriterion("FBMSGNAME between", value1, value2, "fbmsgname");
 728             return (Criteria) this;
 729         }
 730 
 731         public Criteria andFbmsgnameNotBetween(String value1, String value2) {
 732             addCriterion("FBMSGNAME not between", value1, value2, "fbmsgname");
 733             return (Criteria) this;
 734         }
 735 
 736         public Criteria andErramountIsNull() {
 737             addCriterion("ERRAMOUNT is null");
 738             return (Criteria) this;
 739         }
 740 
 741         public Criteria andErramountIsNotNull() {
 742             addCriterion("ERRAMOUNT is not null");
 743             return (Criteria) this;
 744         }
 745 
 746         public Criteria andErramountEqualTo(Long value) {
 747             addCriterion("ERRAMOUNT =", value, "erramount");
 748             return (Criteria) this;
 749         }
 750 
 751         public Criteria andErramountNotEqualTo(Long value) {
 752             addCriterion("ERRAMOUNT <>", value, "erramount");
 753             return (Criteria) this;
 754         }
 755 
 756         public Criteria andErramountGreaterThan(Long value) {
 757             addCriterion("ERRAMOUNT >", value, "erramount");
 758             return (Criteria) this;
 759         }
 760 
 761         public Criteria andErramountGreaterThanOrEqualTo(Long value) {
 762             addCriterion("ERRAMOUNT >=", value, "erramount");
 763             return (Criteria) this;
 764         }
 765 
 766         public Criteria andErramountLessThan(Long value) {
 767             addCriterion("ERRAMOUNT <", value, "erramount");
 768             return (Criteria) this;
 769         }
 770 
 771         public Criteria andErramountLessThanOrEqualTo(Long value) {
 772             addCriterion("ERRAMOUNT <=", value, "erramount");
 773             return (Criteria) this;
 774         }
 775 
 776         public Criteria andErramountIn(List<Long> values) {
 777             addCriterion("ERRAMOUNT in", values, "erramount");
 778             return (Criteria) this;
 779         }
 780 
 781         public Criteria andErramountNotIn(List<Long> values) {
 782             addCriterion("ERRAMOUNT not in", values, "erramount");
 783             return (Criteria) this;
 784         }
 785 
 786         public Criteria andErramountBetween(Long value1, Long value2) {
 787             addCriterion("ERRAMOUNT between", value1, value2, "erramount");
 788             return (Criteria) this;
 789         }
 790 
 791         public Criteria andErramountNotBetween(Long value1, Long value2) {
 792             addCriterion("ERRAMOUNT not between", value1, value2, "erramount");
 793             return (Criteria) this;
 794         }
 795 
 796         public Criteria andStatusIsNull() {
 797             addCriterion("STATUS is null");
 798             return (Criteria) this;
 799         }
 800 
 801         public Criteria andStatusIsNotNull() {
 802             addCriterion("STATUS is not null");
 803             return (Criteria) this;
 804         }
 805 
 806         public Criteria andStatusEqualTo(String value) {
 807             addCriterion("STATUS =", value, "status");
 808             return (Criteria) this;
 809         }
 810 
 811         public Criteria andStatusNotEqualTo(String value) {
 812             addCriterion("STATUS <>", value, "status");
 813             return (Criteria) this;
 814         }
 815 
 816         public Criteria andStatusGreaterThan(String value) {
 817             addCriterion("STATUS >", value, "status");
 818             return (Criteria) this;
 819         }
 820 
 821         public Criteria andStatusGreaterThanOrEqualTo(String value) {
 822             addCriterion("STATUS >=", value, "status");
 823             return (Criteria) this;
 824         }
 825 
 826         public Criteria andStatusLessThan(String value) {
 827             addCriterion("STATUS <", value, "status");
 828             return (Criteria) this;
 829         }
 830 
 831         public Criteria andStatusLessThanOrEqualTo(String value) {
 832             addCriterion("STATUS <=", value, "status");
 833             return (Criteria) this;
 834         }
 835 
 836         public Criteria andStatusLike(String value) {
 837             addCriterion("STATUS like", value, "status");
 838             return (Criteria) this;
 839         }
 840 
 841         public Criteria andStatusNotLike(String value) {
 842             addCriterion("STATUS not like", value, "status");
 843             return (Criteria) this;
 844         }
 845 
 846         public Criteria andStatusIn(List<String> values) {
 847             addCriterion("STATUS in", values, "status");
 848             return (Criteria) this;
 849         }
 850 
 851         public Criteria andStatusNotIn(List<String> values) {
 852             addCriterion("STATUS not in", values, "status");
 853             return (Criteria) this;
 854         }
 855 
 856         public Criteria andStatusBetween(String value1, String value2) {
 857             addCriterion("STATUS between", value1, value2, "status");
 858             return (Criteria) this;
 859         }
 860 
 861         public Criteria andStatusNotBetween(String value1, String value2) {
 862             addCriterion("STATUS not between", value1, value2, "status");
 863             return (Criteria) this;
 864         }
 865 
 866         public Criteria andErrorinfoIsNull() {
 867             addCriterion("ERRORINFO is null");
 868             return (Criteria) this;
 869         }
 870 
 871         public Criteria andErrorinfoIsNotNull() {
 872             addCriterion("ERRORINFO is not null");
 873             return (Criteria) this;
 874         }
 875 
 876         public Criteria andErrorinfoEqualTo(String value) {
 877             addCriterion("ERRORINFO =", value, "errorinfo");
 878             return (Criteria) this;
 879         }
 880 
 881         public Criteria andErrorinfoNotEqualTo(String value) {
 882             addCriterion("ERRORINFO <>", value, "errorinfo");
 883             return (Criteria) this;
 884         }
 885 
 886         public Criteria andErrorinfoGreaterThan(String value) {
 887             addCriterion("ERRORINFO >", value, "errorinfo");
 888             return (Criteria) this;
 889         }
 890 
 891         public Criteria andErrorinfoGreaterThanOrEqualTo(String value) {
 892             addCriterion("ERRORINFO >=", value, "errorinfo");
 893             return (Criteria) this;
 894         }
 895 
 896         public Criteria andErrorinfoLessThan(String value) {
 897             addCriterion("ERRORINFO <", value, "errorinfo");
 898             return (Criteria) this;
 899         }
 900 
 901         public Criteria andErrorinfoLessThanOrEqualTo(String value) {
 902             addCriterion("ERRORINFO <=", value, "errorinfo");
 903             return (Criteria) this;
 904         }
 905 
 906         public Criteria andErrorinfoLike(String value) {
 907             addCriterion("ERRORINFO like", value, "errorinfo");
 908             return (Criteria) this;
 909         }
 910 
 911         public Criteria andErrorinfoNotLike(String value) {
 912             addCriterion("ERRORINFO not like", value, "errorinfo");
 913             return (Criteria) this;
 914         }
 915 
 916         public Criteria andErrorinfoIn(List<String> values) {
 917             addCriterion("ERRORINFO in", values, "errorinfo");
 918             return (Criteria) this;
 919         }
 920 
 921         public Criteria andErrorinfoNotIn(List<String> values) {
 922             addCriterion("ERRORINFO not in", values, "errorinfo");
 923             return (Criteria) this;
 924         }
 925 
 926         public Criteria andErrorinfoBetween(String value1, String value2) {
 927             addCriterion("ERRORINFO between", value1, value2, "errorinfo");
 928             return (Criteria) this;
 929         }
 930 
 931         public Criteria andErrorinfoNotBetween(String value1, String value2) {
 932             addCriterion("ERRORINFO not between", value1, value2, "errorinfo");
 933             return (Criteria) this;
 934         }
 935 
 936         public Criteria andLastupdatetimeIsNull() {
 937             addCriterion("LASTUPDATETIME is null");
 938             return (Criteria) this;
 939         }
 940 
 941         public Criteria andLastupdatetimeIsNotNull() {
 942             addCriterion("LASTUPDATETIME is not null");
 943             return (Criteria) this;
 944         }
 945 
 946         public Criteria andLastupdatetimeEqualTo(Date value) {
 947             addCriterion("LASTUPDATETIME =", value, "lastupdatetime");
 948             return (Criteria) this;
 949         }
 950 
 951         public Criteria andLastupdatetimeNotEqualTo(Date value) {
 952             addCriterion("LASTUPDATETIME <>", value, "lastupdatetime");
 953             return (Criteria) this;
 954         }
 955 
 956         public Criteria andLastupdatetimeGreaterThan(Date value) {
 957             addCriterion("LASTUPDATETIME >", value, "lastupdatetime");
 958             return (Criteria) this;
 959         }
 960 
 961         public Criteria andLastupdatetimeGreaterThanOrEqualTo(Date value) {
 962             addCriterion("LASTUPDATETIME >=", value, "lastupdatetime");
 963             return (Criteria) this;
 964         }
 965 
 966         public Criteria andLastupdatetimeLessThan(Date value) {
 967             addCriterion("LASTUPDATETIME <", value, "lastupdatetime");
 968             return (Criteria) this;
 969         }
 970 
 971         public Criteria andLastupdatetimeLessThanOrEqualTo(Date value) {
 972             addCriterion("LASTUPDATETIME <=", value, "lastupdatetime");
 973             return (Criteria) this;
 974         }
 975 
 976         public Criteria andLastupdatetimeIn(List<Date> values) {
 977             addCriterion("LASTUPDATETIME in", values, "lastupdatetime");
 978             return (Criteria) this;
 979         }
 980 
 981         public Criteria andLastupdatetimeNotIn(List<Date> values) {
 982             addCriterion("LASTUPDATETIME not in", values, "lastupdatetime");
 983             return (Criteria) this;
 984         }
 985 
 986         public Criteria andLastupdatetimeBetween(Date value1, Date value2) {
 987             addCriterion("LASTUPDATETIME between", value1, value2, "lastupdatetime");
 988             return (Criteria) this;
 989         }
 990 
 991         public Criteria andLastupdatetimeNotBetween(Date value1, Date value2) {
 992             addCriterion("LASTUPDATETIME not between", value1, value2, "lastupdatetime");
 993             return (Criteria) this;
 994         }
 995 
 996         public Criteria andReporttimeIsNull() {
 997             addCriterion("REPORTTIME is null");
 998             return (Criteria) this;
 999         }
1000 
1001         public Criteria andReporttimeIsNotNull() {
1002             addCriterion("REPORTTIME is not null");
1003             return (Criteria) this;
1004         }
1005 
1006         public Criteria andReporttimeEqualTo(Date value) {
1007             addCriterion("REPORTTIME =", value, "reporttime");
1008             return (Criteria) this;
1009         }
1010 
1011         public Criteria andReporttimeNotEqualTo(Date value) {
1012             addCriterion("REPORTTIME <>", value, "reporttime");
1013             return (Criteria) this;
1014         }
1015 
1016         public Criteria andReporttimeGreaterThan(Date value) {
1017             addCriterion("REPORTTIME >", value, "reporttime");
1018             return (Criteria) this;
1019         }
1020 
1021         public Criteria andReporttimeGreaterThanOrEqualTo(Date value) {
1022             addCriterion("REPORTTIME >=", value, "reporttime");
1023             return (Criteria) this;
1024         }
1025 
1026         public Criteria andReporttimeLessThan(Date value) {
1027             addCriterion("REPORTTIME <", value, "reporttime");
1028             return (Criteria) this;
1029         }
1030 
1031         public Criteria andReporttimeLessThanOrEqualTo(Date value) {
1032             addCriterion("REPORTTIME <=", value, "reporttime");
1033             return (Criteria) this;
1034         }
1035 
1036         public Criteria andReporttimeIn(List<Date> values) {
1037             addCriterion("REPORTTIME in", values, "reporttime");
1038             return (Criteria) this;
1039         }
1040 
1041         public Criteria andReporttimeNotIn(List<Date> values) {
1042             addCriterion("REPORTTIME not in", values, "reporttime");
1043             return (Criteria) this;
1044         }
1045 
1046         public Criteria andReporttimeBetween(Date value1, Date value2) {
1047             addCriterion("REPORTTIME between", value1, value2, "reporttime");
1048             return (Criteria) this;
1049         }
1050 
1051         public Criteria andReporttimeNotBetween(Date value1, Date value2) {
1052             addCriterion("REPORTTIME not between", value1, value2, "reporttime");
1053             return (Criteria) this;
1054         }
1055 
1056         public Criteria andFbtimeIsNull() {
1057             addCriterion("FBTIME is null");
1058             return (Criteria) this;
1059         }
1060 
1061         public Criteria andFbtimeIsNotNull() {
1062             addCriterion("FBTIME is not null");
1063             return (Criteria) this;
1064         }
1065 
1066         public Criteria andFbtimeEqualTo(Date value) {
1067             addCriterion("FBTIME =", value, "fbtime");
1068             return (Criteria) this;
1069         }
1070 
1071         public Criteria andFbtimeNotEqualTo(Date value) {
1072             addCriterion("FBTIME <>", value, "fbtime");
1073             return (Criteria) this;
1074         }
1075 
1076         public Criteria andFbtimeGreaterThan(Date value) {
1077             addCriterion("FBTIME >", value, "fbtime");
1078             return (Criteria) this;
1079         }
1080 
1081         public Criteria andFbtimeGreaterThanOrEqualTo(Date value) {
1082             addCriterion("FBTIME >=", value, "fbtime");
1083             return (Criteria) this;
1084         }
1085 
1086         public Criteria andFbtimeLessThan(Date value) {
1087             addCriterion("FBTIME <", value, "fbtime");
1088             return (Criteria) this;
1089         }
1090 
1091         public Criteria andFbtimeLessThanOrEqualTo(Date value) {
1092             addCriterion("FBTIME <=", value, "fbtime");
1093             return (Criteria) this;
1094         }
1095 
1096         public Criteria andFbtimeIn(List<Date> values) {
1097             addCriterion("FBTIME in", values, "fbtime");
1098             return (Criteria) this;
1099         }
1100 
1101         public Criteria andFbtimeNotIn(List<Date> values) {
1102             addCriterion("FBTIME not in", values, "fbtime");
1103             return (Criteria) this;
1104         }
1105 
1106         public Criteria andFbtimeBetween(Date value1, Date value2) {
1107             addCriterion("FBTIME between", value1, value2, "fbtime");
1108             return (Criteria) this;
1109         }
1110 
1111         public Criteria andFbtimeNotBetween(Date value1, Date value2) {
1112             addCriterion("FBTIME not between", value1, value2, "fbtime");
1113             return (Criteria) this;
1114         }
1115 
1116         public Criteria andOrgcodeIsNull() {
1117             addCriterion("ORGCODE is null");
1118             return (Criteria) this;
1119         }
1120 
1121         public Criteria andOrgcodeIsNotNull() {
1122             addCriterion("ORGCODE is not null");
1123             return (Criteria) this;
1124         }
1125 
1126         public Criteria andOrgcodeEqualTo(String value) {
1127             addCriterion("ORGCODE =", value, "orgcode");
1128             return (Criteria) this;
1129         }
1130 
1131         public Criteria andOrgcodeNotEqualTo(String value) {
1132             addCriterion("ORGCODE <>", value, "orgcode");
1133             return (Criteria) this;
1134         }
1135 
1136         public Criteria andOrgcodeGreaterThan(String value) {
1137             addCriterion("ORGCODE >", value, "orgcode");
1138             return (Criteria) this;
1139         }
1140 
1141         public Criteria andOrgcodeGreaterThanOrEqualTo(String value) {
1142             addCriterion("ORGCODE >=", value, "orgcode");
1143             return (Criteria) this;
1144         }
1145 
1146         public Criteria andOrgcodeLessThan(String value) {
1147             addCriterion("ORGCODE <", value, "orgcode");
1148             return (Criteria) this;
1149         }
1150 
1151         public Criteria andOrgcodeLessThanOrEqualTo(String value) {
1152             addCriterion("ORGCODE <=", value, "orgcode");
1153             return (Criteria) this;
1154         }
1155 
1156         public Criteria andOrgcodeLike(String value) {
1157             addCriterion("ORGCODE like", value, "orgcode");
1158             return (Criteria) this;
1159         }
1160 
1161         public Criteria andOrgcodeNotLike(String value) {
1162             addCriterion("ORGCODE not like", value, "orgcode");
1163             return (Criteria) this;
1164         }
1165 
1166         public Criteria andOrgcodeIn(List<String> values) {
1167             addCriterion("ORGCODE in", values, "orgcode");
1168             return (Criteria) this;
1169         }
1170 
1171         public Criteria andOrgcodeNotIn(List<String> values) {
1172             addCriterion("ORGCODE not in", values, "orgcode");
1173             return (Criteria) this;
1174         }
1175 
1176         public Criteria andOrgcodeBetween(String value1, String value2) {
1177             addCriterion("ORGCODE between", value1, value2, "orgcode");
1178             return (Criteria) this;
1179         }
1180 
1181         public Criteria andOrgcodeNotBetween(String value1, String value2) {
1182             addCriterion("ORGCODE not between", value1, value2, "orgcode");
1183             return (Criteria) this;
1184         }
1185     }
1186 
1187     /**
1188      * This class was generated by MyBatis Generator.
1189      * This class corresponds to the database table AUTOREPORT.REPORTINFO
1190      *
1191      * @mbggenerated do_not_delete_during_merge
1192      */
1193     public static class Criteria extends GeneratedCriteria {
1194 
1195         protected Criteria() {
1196             super();
1197         }
1198     }
1199 
1200     /**
1201      * This class was generated by MyBatis Generator.
1202      * This class corresponds to the database table AUTOREPORT.REPORTINFO
1203      *
1204      * @mbggenerated
1205      */
1206     public static class Criterion {
1207         private String condition;
1208 
1209         private Object value;
1210 
1211         private Object secondValue;
1212 
1213         private boolean noValue;
1214 
1215         private boolean singleValue;
1216 
1217         private boolean betweenValue;
1218 
1219         private boolean listValue;
1220 
1221         private String typeHandler;
1222 
1223         public String getCondition() {
1224             return condition;
1225         }
1226 
1227         public Object getValue() {
1228             return value;
1229         }
1230 
1231         public Object getSecondValue() {
1232             return secondValue;
1233         }
1234 
1235         public boolean isNoValue() {
1236             return noValue;
1237         }
1238 
1239         public boolean isSingleValue() {
1240             return singleValue;
1241         }
1242 
1243         public boolean isBetweenValue() {
1244             return betweenValue;
1245         }
1246 
1247         public boolean isListValue() {
1248             return listValue;
1249         }
1250 
1251         public String getTypeHandler() {
1252             return typeHandler;
1253         }
1254 
1255         protected Criterion(String condition) {
1256             super();
1257             this.condition = condition;
1258             this.typeHandler = null;
1259             this.noValue = true;
1260         }
1261 
1262         protected Criterion(String condition, Object value, String typeHandler) {
1263             super();
1264             this.condition = condition;
1265             this.value = value;
1266             this.typeHandler = typeHandler;
1267             if (value instanceof List<?>) {
1268                 this.listValue = true;
1269             } else {
1270                 this.singleValue = true;
1271             }
1272         }
1273 
1274         protected Criterion(String condition, Object value) {
1275             this(condition, value, null);
1276         }
1277 
1278         protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
1279             super();
1280             this.condition = condition;
1281             this.value = value;
1282             this.secondValue = secondValue;
1283             this.typeHandler = typeHandler;
1284             this.betweenValue = true;
1285         }
1286 
1287         protected Criterion(String condition, Object value, Object secondValue) {
1288             this(condition, value, secondValue, null);
1289         }
1290     }
1291 }

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

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

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

原文地址:https://www.cnblogs.com/1600kun/p/5728420.html