<!-- mybatis generator 自动生成代码插件 -->
<plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version> <configuration> <configurationFile>${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite> <verbose>true</verbose> </configuration> <executions>
<execution> <id>Generate MyBatis Artifacts</id> <goals> <goal>generate</goal>
</goals> </execution> </executions> <dependencies> <dependency> <groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId> <version>1.3.2</version>
</dependency> </dependencies>
</plugin>
下载jar包后
增加配置文件generatorConfig.xml:
<?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">
<generatorConfiguration>
<!-- 数据库驱动:选择你的本地硬盘上面的数据库驱动包-->
<classPathEntry
location="D:\software\apache-maven-3.5.2\repository\mysql\mysql-connector-java\5.1.30\mysql-connector-java-5.1.30.jar"/>
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<!-- <jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://dev-mysql-m.a.pa.com/haofang_agent_db" userId="dev" password="dev">
</jdbcConnection> -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://10.28.80.37:3306/importdb" userId="test" password="test">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.pingan.haofang.agent.saas.importdata.domain" targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="resources.mybatis.mapper.importdata" targetProject="src/main">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.pingan.haofang.agent.saas.importdata.mapper"
targetProject="src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<table tableName="community" domainObjectName="Community" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="common_field_json" domainObjectName="CommonFieldJson" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="common_media" domainObjectName="CommonMedia" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="community" domainObjectName="Community" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="community_map" domainObjectName="CommunityMap" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="community_building" domainObjectName="CommunityBuilding" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="community_details" domainObjectName="CommunityDetails" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="community_house_sz" domainObjectName="CommunityHouse" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="community_unit" domainObjectName="CommunityUnit" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<!--<table tableName="t_agent_saas_dict_community" domainObjectName="DictCommunity" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="t_agent_saas_dict_house" domainObjectName="DictHouse" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
<table tableName="t_agent_saas_dict_building" domainObjectName="DictBuilding" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
-->
</context>
</generatorConfiguration>
无需其他关联配置
启动:
mybatis分页:
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@Override
public PageInfo<DictBuildingWithBLOBs> getBuildingByPage(BuildingQueryDto queryDto) {
PageHelper.startPage(queryDto.getPageNo(),queryDto.getPageSize());
return new PageInfo(dictBuildingMapper.queryBuilding());
}
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.1.2</version>
</dependency>
- 大小: 97.3 KB
分享到:
相关推荐
代码自动生成器,自动生PO类,能生成mapper映射文件(其中包括基本的增删改查功能)、能生成mapper接口,用于加快开发项目开发,欲善其事必先利其器,已经打包成图像界面 启动命令: cd E:\mybatis-generator-gui-...
MyBatisPlus自带了一个代码生成器mybatis-plus-generator,可基于数据库库表,结合模板技术,自动生成程序源码,不过默认情况下,只支持Entity、Mapper、Service、Controller这些层次。如果想生成未预置的代码,如vo...
反射生成dto service serviceimpl mapper model类,自动生成代码集成mybats-plus 让开发更高效
eclipse 插件,使用MyBatis Generator 可自动生成数据库对应的bean(有中文注释),mapper.xml和mapper dao 接口文件,可直接使用查询数据库,此插件在eclipse mars.2 版本下亲测可用,
mybatis 生成 pojo mapper dao 的工具包
NULL 博文链接:https://godsend-jin.iteye.com/blog/2221906
3、可大大提高开发效率,数据表创建完以后,自动生成entity,mapper.xml,dao,service,controller,vo,dto相关代码。 4、本项目集成了spring,aop,mybatis plus,swagger2,异常处理,分页,freemarker等多种技术。 5、操作...
4.MyBatis、TkMyBatis、MyBatisPlus 支持生成Entity、Mapper、Xml、Service、ServiceImpl、Controller 5.Entity、Mapper、Xml、Service、ServiceImpl、Controller可以使用自定义命名风格 1.配置 application....
一直以来根据数据库表结构自动生成JavaBean、自动生成MyBaits的Mapper映射配置文件、自动生成数据库设计文档都是一件让人很头痛的事情,既浪费时间又很繁琐,看着几十上百个表的成千上万个字段,真是一件让人痛苦的...
通过设置 generatorConfig.xml 设置,自动生成实体类,生成对应mapper接口和增加、删除、查询、修改的操作数据方法
使用java代码,自动生成mybatis使用的mapper、dto 、xml
java7 源码 Dubbo-Spring-Mybatis-Generator Ability (quickly build Dubbo-Spring-Mybatis rpc project in ...快速生成spring-boot-duboo-rpc ...生成的代码目录结构 ...对象自动生成DtoConvertUtil工具类 避免写烦人
1. 此项目是SSM,使用代码生成器(mybatis-generator)自动生成dao、entity、mapper.xml ,需要自己写controller、service、serviceImpl。不是mybatis-plus-generator自动生成的代码。 2. 使用的日志是log4j 3.简单...
mybatisplus自动生成,controler,entity,dto,mapper,service,xml各个服务层代码
mybatisplus生成器,自动生成controller,dto,entity,mapper,service,xml
可以下载导入自己看看,mapper和dto结合的方式,这代码一般可以用来交个java的课程作业,或者自己学习swagger等相关的都能用得上,您正在寻找一个使用Java编写的具有Spring Boot、Swagger、Redis、MyBatis和Restful...
mybatis-generator,自动生成实体类、dao和mapper文件 resource目录下的GenerateScripts目录下的文件,在mall-generator项目下的pom.xml文件中配置各个数据库配置文件,会自动生成相对应的代码。 配置完文件之后,在...
第六步:写mapper接口与mapper映射文 写五个mapper接口 写五个mapper.xml 第七步:写MyBatisSessionFactory类 第八步:写exception与service(接口与实现类) 第九步:测试(让控制器、业务层、数据访问层三层...
spring-boot-plus是一套前后端分离单体...快速生成后台代码: entity/dto/query/vo/controller/service/mapper/xml 集成Swagger/Knife4j,可自动生成api文档 集成Redis缓存 集成HikariCP连接池,JDBC性能和慢查询检测
该项目是物资管理系统,主要分为: 系统管理(控制面板、用户管理、菜单权限、角色管理、部门管理) 业务管理(入库记录、物资去处、...SpringBoot, Shiro ,Swagger-UI,mybatis,JWT,Mysql,通用mapper,Vue.js+element-ui