IDEA MyBatisCodeHelper Pro最新版合集免费(持续更新)

0. 你想要的

0.1 包下载


由于不可抗力,请移步:


各版本下载地址以及jh教程:(已更新至3.3.5(以及+2321))


1. 功能介绍

  • 通过方法名(不需要方法的返回值和参数 会自动推导出来)来生成sql 可以生成大部分单表操作的sql 只需要一个方法的名字即可 会自动补全好方法的参数和返回值 和springdatajpa的语句基本一致
  • xml sql几乎所有地方都有自动提示,sql正确性检测,插件会识别mybatis的一系列标签 如 include trim set where,在这些标签之后的sql可以自动提示数据库的字段,检测sql的正确性,从此不用担心sql写错
  • 直接从Intellij自带的数据库或者配置一个数据库生成crud代码 自动检测好 useGeneratedkey 自动配置好模块的文件夹 只用添加包名就可以生成代码了
  • xml代码格式化
  • 从java类生成建表语句
  • 数据库添加字段后可以继续生成,不会修改之前已经在接口或xml添加的自- - 定义的方法 无需再去进行手动的添加
  • mybatis接口和xml的互相跳转 支持一个mybatis接口对应多个xml
  • mybatis接口中的方法名重构支持
  • xml中的 param的自动提示 if test的自动提示 resultMap refid 等的自动提示
  • resultMap中的property的自动提示,检测,重构
  • resultMap中column自动提示,检测
  • xml中refid,resultMap等的跳转到定义
  • 检测没有使用的xml 可一键删除
  • 检测mybatis接口中方法是否有实现,没有则报红 可创建一个空的xml
  • mybatis接口中一键添加param注解
  • mybatis接口一键生成xml
  • 完整的typeAlias支持
  • param检测 检测#{ 中的内容是否有误
  • ognl 支持 if test when test foreach bind中的自动补全,跳转和检测
  • 支持spring 将mapper注入到spring中 intellij的spring注入不再报错 支持springboot
  • 一键生成mybatis接口的testcase 无需启动spring,复杂sql可进行快速测试
  • 一键生成表关联的join
  • 一键从sql语句中 导出resultMap

免费试用: http://brucege.com/pay/view

2. 下载安装

2.1 在idea中插件市场安装

  • 在idea设置中找到插件市场,搜索MyBatisCodeHelper Pro 即可找到。
    在这里插入图片描述

2.2 在jetbrains插件市场下载安装

3. 简单使用

3.1 创建一个SpringBoot项目

  • 在idea中新建项目,选择Spring Initializr,输入项目名称、组等信息,点击下一步。
    在这里插入图片描述
  • 选择MySQL Driver、Spring Web、Mybatis Framework、Lombok等依赖,点击创建
    在这里插入图片描述
  • 这样一个Spring Boot项目就建好了
    在这里插入图片描述
    -依赖参考
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

3.2 配置数据库

  • 先选择需要连接的数据库类型,这里以MySQL为例
    在这里插入图片描述
  • 填写主机地址、端口、用户、密码等必要信息,点击确定
    在这里插入图片描述
  • 这样就算是成功了
    在这里插入图片描述

3.3 一键生成实体类、mapper

  • 在表上右键,点击 Mybatis generator
    在这里插入图片描述
  • 根据需求填写配置即可
    在这里插入图片描述
  • 生成后的项目结构文件
    在这里插入图片描述
  • 生成的实体类参考
package com.domain;

public class UserTest {
    /**
    * 主键
    */
    private Long id;

    /**
    * 用户名
    */
    private String username;

    /**
    * 地址
    */
    private String address;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
  • 生成的mapper接口类参考
package com.mapper;

import com.domain.UserTest;

public interface UserTestMapper {
    int deleteByPrimaryKey(Long id);

    int insert(UserTest record);

    int insertSelective(UserTest record);

    UserTest selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(UserTest record);

    int updateByPrimaryKey(UserTest record);
}
  • 生成的mapper.xml文件参考
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mapper.UserTestMapper">
  <resultMap id="BaseResultMap" type="com.domain.UserTest">
    <!--@mbg.generated-->
    <!--@Table user_test-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="username" jdbcType="VARCHAR" property="username" />
    <result column="address" jdbcType="VARCHAR" property="address" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, username, address
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from user_test
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from user_test
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.domain.UserTest" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into user_test (username, address)
    values (#{username,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.domain.UserTest" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into user_test
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="username != null">
        username,
      </if>
      <if test="address != null">
        address,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.domain.UserTest">
    <!--@mbg.generated-->
    update user_test
    <set>
      <if test="username != null">
        username = #{username,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.domain.UserTest">
    <!--@mbg.generated-->
    update user_test
    set username = #{username,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
  • 也可以生成service层和controller层,这里不再演示,都是中文界面

在这里插入图片描述


官方文档参考:https://gejun123456.github.io/MyBatisCodeHelper-Pro

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MyBatisCodeHelper-Pro插件免费版 Features Type safe sql support, plugin can recognize mybatis dynamic sql Code Formatter Generate mybatis crud code by Intellij database table or add a database connection Generate mybatis sql based on mybatis interface method name like spring data jpa, with this, you don't have to write most sql for non join query support generate statement with if test Database generate crud could generate multiple times when you add or delete columns, plugin will auto merge code Full mybatis sql auto complete, recognize mybatis tag in xml, like where trim set include ect,provide sql completion after those tag Jump from mybatis dao interface to mapper xml each other Refactor for mybatis interface method name,refid,resultMap ect Auto complete for mybatis param,if test,foreach,resultMap,refid in sql Generate create table sql from java class Mybatis Param refactor and inspection Ognl support, if test when test ${ bind foreach collection, refactor and inspection and auto completion Jump from refid resultMap to their definition, refactor their name as well Generate page query by mapper interface method Spring support for mybatis, inject mybatis mapper to spring bean,support SpringBoot Refid,resultMap,keyProperty,property auto complete Add @param for mapper method Resultmap column complete and inspection by parse reference select statement Auto map resultMap column and property Generate mybatis mapper testcase from mybatis interface method by database connection, make you test method quicker Full inspection for mybatis, like unused sql in xml, mapper method not have sql in xml, check if resultMap property is right ect https://github.com/gejun123456/MyBatisCodeHelper-Pro to learn more. How to use view on https://github.com/gejun123456/MyBatisCodeHelper-Pro qqGroup:914051156
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值