IDEA使用mybatis实现generator自动生成MSSQLSERVER数据库表映射

时间:2025-04-06 13:44:54
  • <?xml version="1.0" encoding="UTF-8"?>
  • <!DOCTYPE generatorConfiguration
  • PUBLIC "-////DTD MyBatis Generator Configuration 1.0//EN"
  • "/dtd/mybatis-generator-config_1_0.dtd">
  • <generatorConfiguration>
  • <properties resource=""></properties>
  • <classPathEntry location="${}" />
  • <context id="context1" targetRuntime="MyBatis3">
  • <!--<commentGenerator>
  • <!– 去除自动生成的注释 –>
  • <property name="suppressAllComments" value="true" />
  • </commentGenerator>-->
  • <!-- 是否生成注释 去除自动生成的注释-->
  • <commentGenerator>
  • <property name="suppressDate" value="true"/>
  • <property name="suppressAllComments" value="true"/>
  • </commentGenerator>
  • <!-- 数据库连接配置 -->
  • <jdbcConnection driverClass=""
  • connectionURL="jdbc:sqlserver://127.0.0.1;DatabaseName=airport_etc"
  • userId="airportetc"
  • password="airportetc"/>
  • <!-- 非必需,类型处理器,在数据库类型和java类型之间的转换控制-->
  • <javaTypeResolver>
  • <property name="forceBigDecimals" value="false"/>
  • </javaTypeResolver>
  • <!--配置生成的实体包
  • targetPackage:生成的实体包位置,默认存放在src目录下
  • targetProject:目标工程名
  • -->
  • <javaModelGenerator targetPackage=""
  • targetProject="${}/dclot-etc-srv/src/main/java" />
  • <!-- 实体包对应映射文件位置及名称,默认存放在src目录下 -->
  • <sqlMapGenerator targetPackage="mappers" targetProject="${}/dclot-etc-srv/src/main/resources" />
  • <!--生成Dao类存放位置-->
  • <javaClientGenerator type="xmlmapper" targetPackage="" targetProject="${}/dclot-etc-srv/src/main/java">
  • <property name="enableSubPackages" value="true"/>
  • </javaClientGenerator>
  • <!--生成对应表及类名-->
  • <!-- 配置表
  • schema:不用填写
  • tableName: 表名
  • enableCountByExample、enableSelectByExample、enableDeleteByExample、enableUpdateByExample、selectByExampleQueryId:
  • 去除自动生成的例子
  • -->
  • <table catalog="" schema="" tableName="sys_parklot" domainObjectName="SysParklot"></table>
  • </context>
  • </generatorConfiguration>