<?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>
<!-- 引入配置文件 -->
<properties resource="init.properties"/> <!-- 指定数据连接驱动jar地址 -->
<classPathEntry location="${classPath}" /> <!-- 一个数据库一个context -->
<context id="infoGuardian">
<!-- 注释 -->
<commentGenerator >
<property name="suppressAllComments" value="false"/><!-- 是否取消注释 -->
<property name="suppressDate" value="true" /> <!-- 是否生成注释代时间戳-->
</commentGenerator> <!-- jdbc连接 -->
<jdbcConnection driverClass="${jdbc_driver}"
connectionURL="${jdbc_url}" userId="${jdbc_user}"
password="${jdbc_password}" /> <!-- 类型转换 -->
<javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver> <!-- 生成实体类地址 -->
<javaModelGenerator targetPackage="com.oop.eksp.user.model"
targetProject="${project}" >
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<property name="enableSubPackages" value="false"/>
<!-- 是否针对string类型的字段在set的时候进行trim调用 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator> <!-- 生成mapxml文件 -->
<sqlMapGenerator targetPackage="com.oop.eksp.user.data"
targetProject="${project}" >
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator> <!-- 生成mapxml对应client,也就是接口dao -->
<javaClientGenerator targetPackage="com.oop.eksp.user.data"
targetProject="${project}" type="XMLMAPPER" >
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator> <!-- 配置表信息 -->
<table schema="${jdbc_user}" tableName="s_user"
domainObjectName="UserEntity" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false">
<!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample
是否生成 example类 --> <!-- 忽略列,不生成bean 字段 -->
<ignoreColumn column="FRED" />
<!-- 指定列的java数据类型 -->
<columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />
</table> </context>
</generatorConfiguration>

自动生成Mappler.xml 和dao接口。基本的查询都有,需要一些拼接

例如:

  <select id = "selectShopCartByCustomerId" parameterType="com.hebg3.mobiledealer.modules.storeorder.entity.ShopCartExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from t_shop_cart
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if> </select>
 ShopCartExample shopCartExample = new ShopCartExample();

         shopCartExample.or().andTCustomerIdEqualTo(tCustomerId);
shopCartExample.setOrderByClause("t_dealer_id,create_date ");
 ShopCartExample shopCartExample = new ShopCartExample();

         shopCartExample.or().andTCustomerIdEqualTo(tCustomerId);
shopCartExample.setOrderByClause("t_dealer_id,create_date ");

最新文章

  1. SCNU 2015ACM新生赛决赛【F. Oyk闯机关】解题报告
  2. 漫谈C语言结构体struct、公用体union空间占用
  3. Python初学的易犯错误
  4. [转]Asp.net MVC 利用PartialView 构造自定义菜单
  5. 【python】入门学习(七)
  6. myeclipse+tomcat 工程名改名的问题 ——————完美解决方案
  7. linux下查看文件编码及修改编码
  8. linux date
  9. spring mvc接收JSON格式的参数
  10. Android应用开发-小巫CSDN博客client之显示博文具体内容
  11. 在Ubuntu 14.04 64bit上安装StarUML 2.5版本
  12. RHEL简单管理SELINUX
  13. CAN总线、自然与人
  14. 章节七、3-ArrayList和LinkedList对比
  15. activity和fragment之前运行的生命周期
  16. 机器学习 - 开发环境安装pycharm + tensorflow集成篇
  17. sql help cs
  18. Shell - 简明Shell入门05 - 条件语句(Case)
  19. Book Review 《构建之法》-2
  20. VMware vCenter Orchestrator

热门文章

  1. C#开发微信门户及应用(15)-微信菜单增加扫一扫、发图片、发地理位置功能
  2. 《C#开发常用免费WebServices集合》
  3. 微信小程序
  4. Canvas——使用定时器模拟动态加载动画!
  5. 5.1 JS中Object类型
  6. Centos6.2设置静态ip和dns
  7. LDAP注入与防御解析
  8. 细分java环境中的JDK、JVM、JRE
  9. Hibernate 系列 02 - Hibernate介绍及其环境搭建
  10. MySQL主从复制(Master-Slave)实践