- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章MyBatis-Plus通过插件将数据库表生成Entiry,Mapper.xml,Mapper.class的方式由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
创建maven项目,修改pom.xml文件,如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<project xmlns=
"http://maven.apache.org/pom/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/xmlschema-instance"
xsi:schemalocation=
"http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelversion>
4.0
.
0
</modelversion>
<parent>
<groupid>com.xxxx</groupid>
<artifactid>parent-pom</artifactid>
<version>
1.0
.
0
-snapshot</version>
</parent>
<groupid>com.xxxx</groupid>
<artifactid>mapper-creator</artifactid>
<version>
1.0
-snapshot</version>
<properties>
<configuration.outputdir>d:\demo-mapper-folder</configuration.outputdir>
<datasource.url>jdbc:mysql:
//192.168.18.140:8066/testdb?useunicode=true&characterencoding=utf-8</datasource.url>
<datasource.username>root</datasource.username>
<datasource.password>
123456
</datasource.password>
<packageinfo.parent>com.xxxx.demotwo</packageinfo.parent>
</properties>
<build>
<plugins>
<plugin>
<groupid>com.baomidou</groupid>
<artifactid>mybatisplus-maven-plugin</artifactid>
<version>
1.0
</version>
<configuration>
<!-- 输出目录(默认java.io.tmpdir) -->
<outputdir>${configuration.outputdir}</outputdir>
<!-- 是否覆盖同名文件(默认
false
) -->
<fileoverride>
true
</fileoverride>
<!-- mapper.xml 中添加二级缓存配置(默认
true
) -->
<enablecache>
true
</enablecache>
<!-- 开发者名称 -->
<author>zuoquan tu</author>
<!-- 是否开启 activerecord 模式(默认
true
) -->
<activerecord>
false
</activerecord>
<!-- 数据源配置,( **必配** ) -->
<datasource>
<drivername>com.mysql.jdbc.driver</drivername>
<url>${datasource.url}</url>
<username>${datasource.username}</username>
<password>${datasource.password}</password>
</datasource>
<strategy>
<!-- 字段生成策略,四种类型,从名称就能看出来含义:
nochange(默认),
underline_to_camel,(下划线转驼峰)
remove_prefix,(去除第一个下划线的前部分,后面保持不变)
remove_prefix_and_camel(去除第一个下划线的前部分,后面转驼峰) -->
<naming>underline_to_camel</naming>
<!-- 表前缀 -->
<!--<tableprefix>bmd_</tableprefix>-->
<!--entity中的id生成策略(默认 id_worker)-->
<idgentype>uuid</idgentype>
<!--自定义超类-->
<!--<superserviceclass>com.baomidou.base.baseservice</superserviceclass>-->
<!-- 要包含的表 与exclude 二选一配置-->
<!--<include>-->
<!--<property>sec_user</property>-->
<!--<property>table1</property>-->
<!--</include>-->
<!-- 要排除的表 -->
<!--<exclude>-->
<!--<property>schema_version</property>-->
<!--</exclude>-->
</strategy>
<packageinfo>
<!-- 父级包名称,如果不写,下面的service等就需要写全包名(默认com.baomidou) -->
<parent>${packageinfo.parent}</parent>
<!--service包名(默认service)-->
<service>service</service>
<!--serviceimpl包名(默认service.impl)-->
<serviceimpl>service.impl</serviceimpl>
<!--entity包名(默认entity)-->
<entity>entity</entity>
<!--mapper包名(默认mapper)-->
<mapper>mapper</mapper>
<!--xml包名(默认mapper.xml)-->
<xml>mapper</xml>
</packageinfo>
<template>
<!-- 定义controller模板的路径 -->
<!--<controller>/template/controller1.java.vm</controller>-->
</template>
</configuration>
<dependencies>
<dependency>
<groupid>mysql</groupid>
<artifactid>mysql-connector-java</artifactid>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
|
项目运行步骤 。
a、修改pom.xml中的properties中的各各参数的值,以适应自己项目中的配置 。
b、在maven的setting.xml中添加:
1
2
3
|
<plugingroups>
<plugingroup>com.baomidou</plugingroup>
</plugingroups>
|
c、执行以下maven命令:
mvn mp:code 。
执行完成之后,即可看到弹出一个文件夹,里面包含了要生成的表的entity,mapper,mapper.xml等 。
总结 。
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对我的支持。如果你想了解更多相关内容请查看下面相关链接 。
原文链接:https://blog.csdn.net/tototuzuoquan/article/details/80374881 。
最后此篇关于MyBatis-Plus通过插件将数据库表生成Entiry,Mapper.xml,Mapper.class的方式的文章就讲到这里了,如果你想了解更多关于MyBatis-Plus通过插件将数据库表生成Entiry,Mapper.xml,Mapper.class的方式的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
1.概述 转载:MyBatis 二级缓存全详解 上一篇文章中我们介绍到了 MyBatis 一级缓存其实就是 SqlSession 级别的缓存,什么是 SqlSession 级别的缓存呢?一级缓存的本质
1.概述 转载:核心配置综述之StatementHandler 2.MyBatis 四大组件之StatementHandler StatementHandler 是四大组件中最重要的一个对象,负责操作
1.概述 转载:MyBatis 启动流程 MyBatis 是第一个支持自定义 SQL、存储过程和高级映射的类持久框架。MyBatis 消除了大部分 JDBC 的样板代码、手动设置参数以及检索结果。My
1.概述 转载:MyBatis 基础搭建及架构概述 2.MyBatis 是什么? MyBatis是第一个支持自定义SQL、存储过程和高级映射的类持久框架。MyBatis消除了大部分JDBC的样板代码、
1.概述 转载:核心配置综述之 ParameterHandler MyBatis 四大核心组件我们已经了解到了两种,一个是 Executor ,它是MyBatis 解析SQL请求首先会经过的第一道关卡
1.概述 转载:核心配置综述之 ResultSetHandler 我们之前介绍过了MyBatis 四大核心配置之 Executor、StatementHandler、 ParameterHandler
如果我使用mybatis,我可以很容易地得到更新的行数,就像 update table set desc = 'xxx' where name = ? 但是,如果我想获取更新的行数,而不是计数,我该如
如何在MyBatis 3中使用小于等于 SELECT * FROM( SELECT * FROM TABLE1 WHERE COL1 =#{COL1,jdbc
我将 mybatis3.0.6 与 java 一起使用 哪个性能更好? [select id="getData" parameterType="Integer" resultType="Integer
我无法在 mybatis 中使用动态排序类型创建 SQL,如下例 select user_profile.user_profile_id, user_profile.first_name
这是一个流行的例子。 insert into ACCOUNT ( ACC_ID, ACC_FIRST_NAME, ACC_LAST_NAME, ACC_EMAIL )values (
我下载了MyBatis,文件夹中有一个mybatis-3.0.4-javadoc.jar,我解压并打开它,但它几乎是空的。 哪里可以找到MyBatis的API文档? 最佳答案 http://repo1
我正在尝试为 ArrayList 编写类型处理程序,但这给了我错误,任何人都可以帮助我。 我想将 ArrayList 作为 VARCHAR 存储在数据库中并将其检索为 ArrayList。 packa
目录 依赖 配置 CodeGenerator mybatis-plus-generator + clickhouse 自动生成代码 依赖
目录 三者实现对比 使用fluent mybatis 来实现上面的功能 换成mybatis原生实现效果 换成mybatis plus
例如,我有查询从员工中选择 ID、姓名、年龄、地址,而不是拥有员工对象列表。我希望有一个 map 列表,如 list{ map{ ("id", 123), ("name","jac
我在使 MyBatis (3.4.6) 工作时遇到一些麻烦。 我已将 mybatis-config.xml 文件放置在项目的 src/main/resources 文件夹中,但是当我运行单元测试时,出
我现在使用 Mybatis 和 spring-boot。我没有添加mybatis-config.xml。我根据说明通过 application.properties 为数据源和 mybatis 进行所
这是我的第一篇文章,用我糟糕的英语...... 我使用的是MyBatis3.0 在查询中,我使用 SqlBuilder 的方法如下: public class DataStatisticSqlBuil
主题:MyBatis:Boolean Paraeter:MyBatis 正在使用 Getter 内容: 大家好, 我一直在寻找解决我近乎简单的 MyBatis 问题的方法: 给定代码(仅必要部分):
我是一名优秀的程序员,十分优秀!