当前位置:网站首页>Code generator - single table query crud - generator
Code generator - single table query crud - generator
2022-07-03 05:51:00 【SSID-cc-r】
(1) Introduce dependencies
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.4.0</version>
</dependency>
(2)generator You have to configure the file — It must be placed under the project

(3)generato.xml
<context id="DB2Tables" targetRuntime="MyBatis3">
<!-- Generation of comments -->
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!-- Database connection information -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/mybatis?serverTimezone=Asia/Shanghai"
userId="root"
password="123456">
</jdbcConnection>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- The package where the generated entity class is located -->
<javaModelGenerator targetPackage="com.ccr.entity" targetProject="./src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- The mapping file exists in the directory -->
<sqlMapGenerator targetPackage="mapper" targetProject="./src/main/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!--dao The package where the interface is located -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.ccr.dao" targetProject="./src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- surface
schema: The database where the table is located
tableName: Table name
domainObjectName: Name of entity class
-->
<table schema="mybatis" tableName="tbl_emp" domainObjectName="Emp"
enableDeleteByExample="false"
enableSelectByExample="false"
enableUpdateByExample="false"
enableCountByExample="false"/>
<table schema="mybatis" tableName="tbl_dept" domainObjectName="Dept"
enableDeleteByExample="false"
enableSelectByExample="false"
enableUpdateByExample="false"
enableCountByExample="false"/>
</context>
(4) Test code public void Test01() throws Exception{
List warnings = new ArrayList();
boolean overwrite = true;
File configFile = new File(“geberator.xml”);
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
}
边栏推荐
- NG Textarea-auto-resize
- Can altaro back up Microsoft teams?
- How does win7 solve the problem that telnet is not an internal or external command
- 2022.6.30DAY591
- Altaro set grandfather parent child (GFS) archiving
- Installation du plug - in CAD et chargement automatique DLL, Arx
- [together Shangshui Shuo series] day 7 content +day8
- Analysis of the example of network subnet division in secondary vocational school
- Txt document download save as solution
- 深度学习,从一维特性输入到多维特征输入引发的思考
猜你喜欢
![[written examination question analysis] | | get [sizeof and strlen] [pointer and array] graphic explanation + code analysis](/img/c6/8847218fa43c87e3eb51c021961eb7.jpg)
[written examination question analysis] | | get [sizeof and strlen] [pointer and array] graphic explanation + code analysis
![[teacher Zhao Yuqiang] use the catalog database of Oracle](/img/0b/73a7d12caf955dff17480a907234ad.jpg)
[teacher Zhao Yuqiang] use the catalog database of Oracle

中职网络子网划分例题解析

Linux登录MySQL出现ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
![Together, Shangshui Shuo series] day 9](/img/39/c1ba1bac82b0ed110f36423263ffd0.png)
Together, Shangshui Shuo series] day 9

How do I migrate my altaro VM backup configuration to another machine?
![[advanced pointer (1)] | detailed explanation of character pointer, pointer array, array pointer](/img/9e/a4558e8e53c9655cbc1a38e8c0536e.jpg)
[advanced pointer (1)] | detailed explanation of character pointer, pointer array, array pointer
![[set theory] relational closure (relational closure related theorem)](/img/6a/b6dca7abf592f8d8ab1d6aecc43381.jpg)
[set theory] relational closure (relational closure related theorem)

Shanghai daoning, together with American /n software, will provide you with more powerful Internet enterprise communication and security component services

Life is a process of continuous learning
随机推荐
Final review (day3)
最大似然估计,散度,交叉熵
[function explanation (Part 2)] | [function declaration and definition + function recursion] key analysis + code diagram
Introduction to redis using Lua script
Installation du plug - in CAD et chargement automatique DLL, Arx
"C and pointer" - Chapter 13 advanced pointer int * (* (* (*f) () [6]) ()
【无标题】
Source insight operation manual installation trial
Error 1045 (28000) occurs when Linux logs in MySQL: access denied for user 'root' @ 'localhost' (using password: yes)
Redis cannot connect remotely.
2022.DAY592
Linux登录MySQL出现ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
2022.7.2day594
Redhat7 system root user password cracking
1. 兩數之和
kubernetes资源对象介绍及常用命令(五)-(ConfigMap)
Qt读写Excel--QXlsx插入图表5
EMD distance - example of use
Txt document download save as solution
Today, many CTOs were killed because they didn't achieve business