tk.mybaits相关配置
Posted 来自China的神秘人
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tk.mybaits相关配置相关的知识,希望对你有一定的参考价值。
插件
<plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.7</version> <configuration> <configurationFile>src/main/resources/generatorConfig_tk.xml</configurationFile> <overwrite>true</overwrite> <verbose>true</verbose> </configuration> <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <!-- 驱动版本选择,和上面的一致 --> <version>8.0.21</version> </dependency> <dependency> <groupId>tk.mybatis</groupId> <artifactId>mapper</artifactId> <version>4.1.5</version> </dependency> </dependencies> </plugin>
配置
<!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="database.properties"/> <context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat"> <property name="beginningDelimiter" value="`"/> <property name="endingDelimiter" value="`"/> <plugin type="tk.mybatis.mapper.generator.MapperPlugin"> <property name="mappers" value="tk.mybatis.mapper.common.Mapper"/> <property name="caseSensitive" value="true"/> <property name="lombok" value="Getter,Setter,ToString"/> </plugin> <jdbcConnection driverClass="${jdbc.driver}" connectionURL="${jdbc.url}" userId="${jdbc.username}" password="${jdbc.password}"> <property name="nullCatalogMeansCurrent" value="true"/> </jdbcConnection> <!-- 实体类 --> <javaModelGenerator targetPackage="com.spring.model" targetProject="src/main/java"/> <!-- mapper.xml文件 --> <sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources"/> <!-- mapper接口 --> <javaClientGenerator targetPackage="com.spring.mapper" targetProject="src/main/java" type="XMLMAPPER"/> <!-- 数据库哪一张表 --> <table tableName="user_tb"/> </context> </generatorConfiguration>
以上是关于tk.mybaits相关配置的主要内容,如果未能解决你的问题,请参考以下文章
Express实战 - 应用案例- realworld-API - 路由设计 - mongoose - 数据验证 - 密码加密 - 登录接口 - 身份认证 - token - 增删改查API(代码片段