Skip to content

Instantly share code, notes, and snippets.

@yangl
Last active February 9, 2017 08:17
Show Gist options
  • Save yangl/a09fe7877f91709ec0784943c596db8d to your computer and use it in GitHub Desktop.
Save yangl/a09fe7877f91709ec0784943c596db8d to your computer and use it in GitHub Desktop.
mybatis-plus使用例子,详见http://mp.baomidou.com
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>2.0.1</version>
</dependency>
<plugin>
<groupId>com.baomidou</groupId>
<artifactId>mybatisplus-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<!-- 输出目录(默认java.io.tmpdir) -->
<outputDir>/Users/YANGL/huajiao</outputDir>
<!-- 是否覆盖同名文件(默认false) -->
<fileOverride>true</fileOverride>
<!-- mapper.xml 中添加二级缓存配置(默认true) -->
<enableCache>true</enableCache>
<!-- 开发者名称 -->
<author>机器人</author>
<!-- 是否开启 ActiveRecord 模式(默认true) -->
<activeRecord>true</activeRecord>
<!-- 数据源配置,( **必配** ) -->
<dataSource>
<driverName>com.mysql.jdbc.Driver</driverName>
<url>jdbc:mysql://101.201.74.42:3306/huajiao?useUnicode=true&amp;useSSL=false</url>
<username>root</username>
<password>uxin.com</password>
</dataSource>
<strategy>
<!-- 字段生成策略,四种类型,从名称就能看出来含义:
nochannge(默认),
underline_to_camel,(下划线转驼峰)
remove_prefix,(去除第一个下划线的前部分,后面保持不变)
remove_prefix_and_camel(去除第一个下划线的前部分,后面转驼峰) -->
<naming>underline_to_camel</naming>
<!-- 表前缀 -->
<tablePrefix></tablePrefix>
<!--Entity中的ID生成策略(默认 id_worker)-->
<idGenType>id_worker</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>com.uxin.huajiao</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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment