标签:mapper cas add 连接 hub depend enables 工具 nts
<dependencies> <!-- Mybatis 生成工具 --> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.5</version> </dependency> <!-- Mybatis 通用mapper --> <dependency> <groupId>tk.mybatis</groupId> <artifactId>mapper-spring-boot-starter</artifactId> <version>1.1.1</version> </dependency> <!--mybatis生成带swagger2注解依赖--> <dependency> <groupId>com.github.misterchangray.mybatis.generator.plugins</groupId> <artifactId>myBatisGeneratorPlugins</artifactId> <version>1.2</version> </dependency> </dependencies>
<build>
<plugins>
<!-- mybatis 代码生成器插件 -->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>3.4.0</version>
</dependency>
<!--生成时增加swagger2注解-->
<dependency>
<groupId>com.github.misterchangray.mybatis.generator.plugins</groupId>
<artifactId>myBatisGeneratorPlugins</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<?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"> <!-- 使用 mvn mybatis-generator:generate --> <generatorConfiguration>
<context id="mysql" targetRuntime="MyBatis3" defaultModelType="flat"> <!-- 设置使用UTF-8编码格式 --> <property name="javaFileEncoding" value="UTF-8"/> <property name="beginningDelimiter" value="`"/> <property name="endingDelimiter" value="`"/> <!-- plugin --> <!--<plugin type="org.mybatis.generator.plugins.CachePlugin"/>--> <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/> <plugin type="org.mybatis.generator.plugins.ToStringPlugin"/> <plugin type="tk.mybatis.mapper.generator.MapperPlugin"> <property name="mappers" value="tk.mybatis.mapper.common.Mapper"/> <!-- caseSensitive默认false,当数据库表名区分大小写时,可以将该属性设置为true --> <property name="caseSensitive" value="false"/> </plugin> <!--swagger2--> <plugin type="mybatis.generator.plugins.GeneratorSwagger2Doc"> <property name="apiModelAnnotationPackage" value="io.swagger.annotations.ApiModel" /> <property name="apiModelPropertyAnnotationPackage" value="io.swagger.annotations.ApiModelProperty" /> </plugin> <plugin type="mybatis.generator.plugins.ExtendEntitySetter" /> <!-- 取消生成的代码注释 --> <commentGenerator type="org.mybatis.generator.internal.DefaultCommentGenerator"> <property name="suppressAllComments" value="false"/> <property name="suppressDate" value="true"/> <!-- 此处为 true 时,生成的 Model 包含对应表字段注释 --> <property name="addRemarkComments" value="true"/> </commentGenerator> <!-- 连接配置 --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="数据库路径" userId="账号" password="密码"> <property name="useActualColumnNames" value="false"/> </jdbcConnection> <!-- java类型处理器 用于处理DB中的类型到Java中的类型,默认使用JavaTypeResolverDefaultImpl; 注意一点,默认会先尝试使用Integer,Long,Short等来对应DECIMAL和 NUMERIC数据类型; --> <javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl"> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!-- javaModelGenerator是模型的生成信息,这里将指定这些Java model类的生成路径 --> <javaModelGenerator targetPackage="com.hhtl.entity" targetProject="src/main/java"> <!--实体类生成的位置--> <property name="trimStrings" value="true"/> </javaModelGenerator> <!-- 生成Mapper 配置文件 --> <sqlMapGenerator targetPackage="com.hhtl.mapper" targetProject="src/main/resources"> <!--mapper.xml生成的位置--> </sqlMapGenerator> <!-- javaClientGenerator是应用接口的生成信息 --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.hhtl.mapper" <!--mapper接口生成位置--> targetProject="src/main/java"> </javaClientGenerator> <table tableName="生成的表名" domainObjectName="表的实体类名" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> <property name="useActualColumnNames" value="false"/> <property name="selectAllOrderByClause" value="true"/> </table> </context> </generatorConfiguration>
标签:mapper cas add 连接 hub depend enables 工具 nts
原文地址:https://www.cnblogs.com/HQ0422/p/13207906.html