mybatis自动生成的html,MyBatis-Generator代码生成插件自用修改版

MyBatis自动生成Mapper插件,配置完可根据自动生成Dao接口、xml文件、实体类。可满足大部分sql需求

3202475928.jpg

生成的Dao接口效果public interface MessageMapper {

int deleteByPrimaryKey(Integer id);

int selectCountByMap(Map map);

Message selectByMap(Map map);

List selectListByMap(Map map);

int insert(Message record);

int insertSelective(Message record);

Message selectByPrimaryKey(Integer id);

int updateByPrimaryKeySelective(Message record);

int updateByPrimaryKeyWithBLOBs(Message record);

int updateByPrimaryKey(Message record);

}

使用教程

1.将mybatis-generator-kecikeci.jar和mysql-connector-java-5.1.42.jar放到资源文件目录resources下

306955201.png

2.pom.xml文件中配置插件

${project.basedir}/src/main/kotlin

${project.basedir}/src/test/kotlin

org.springframework.boot

spring-boot-maven-plugin

org.mybatis.generator

mybatis-generator-maven-plugin

1.3.5

com.kecikeci

mybatis-generator-kecikeci

1.0

system

${project.basedir}/src/main/resources/mybatis-generator-kecikeci.jar

3.新建generatorConfig.xml配置,需pom.xml中先引入mybatis的包<?xml version="1.0" encoding="UTF-8" ?>

/p>

"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"

"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >

connectionURL="jdbc:mysql://127.0.0.1:3306/springboot4kt?characterEncoding=utf-8"

userId="root" password="root" />

tableName="message"

enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false">

name="useActualColumnNames"

value="true" />

将其中的包名、数据库链接、表名,改成自己的

4.配置Maven生成器mybatis-generator:generate -e

3078976226.png

源码已开源,基础代码是引用的别人的,致敬!我添加了selectListByMap和selectByMap,去除了些没用的代码。

觉得好用,请点星~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值