当前位置:网站首页>idea插件Easy Code的简单使用
idea插件Easy Code的简单使用
2022-06-22 05:35:00 【xiaozhuxuejava】
idea插件Easy Code的简单使用
本博客使用github图床,可能图片有时加载缓慢,若图片加载失败请转至
https://blog.csdn.net/qq_54650406/article/details/124955763?spm=1001.2014.3001.5501
前言:我们知道mybatis-plus有自己的代码生成模板,但是有些版本每次都需要引入代码和maven依赖,此时可能会有些不方便,因此我们可以使用idea的一个插件Easy Code
1. Easy Code插件的下载
我们直接在idea的plugins插件市场里下载即可


2. EasyCode模板的配置
具体的步骤为Settings ->Other Settings ->Easy Code ->Template

首先我们可以进行一些模板配置,下面举一些我平时比较常用的模板
2.1 entity实体类模板
##导入宏定义
$!{
define.vm}
##保存文件(宏定义)
#save("/entity", ".java")
##包路径(宏定义)
#setPackageSuffix("entity")
##自动导入包(全局变量)
$!{
autoImport.vm}
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
##表注释(宏定义)
#tableComment("表实体类")
@SuppressWarnings("serial")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("$!{tableInfo.obj.name}")
public class $!{
tableInfo.name} {
#foreach($column in $tableInfo.pkColumn)
#if(${
column.comment})//${column.comment}#end
@TableId
private $!{
tool.getClsNameByFullName($column.type)} $!{
column.name};
#end
#foreach($column in $tableInfo.otherColumn)
#if(${
column.comment})//${column.comment}#end
private $!{
tool.getClsNameByFullName($column.type)} $!{
column.name};
#end
}
2.2 mapper接口模板
##导入宏定义
$!{
define.vm}
##设置表后缀(宏定义)
#setTableSuffix("Mapper")
##保存文件(宏定义)
#save("/mapper", "Mapper.java")
##包路径(宏定义)
#setPackageSuffix("mapper")
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
##表注释(宏定义)
#tableComment("表数据库访问层")
public interface $!{
tableName} extends BaseMapper<$!tableInfo.name> {
}
2.3 service接口模板
##导入宏定义
$!{
define.vm}
##设置表后缀(宏定义)
#setTableSuffix("Service")
##保存文件(宏定义)
#save("/service", "Service.java")
##包路径(宏定义)
#setPackageSuffix("service")
import com.baomidou.mybatisplus.extension.service.IService;
##表注释(宏定义)
#tableComment("表服务接口")
public interface $!{
tableName} extends IService<$!tableInfo.name> {
}
2.4 serviceImpl实现类模板
##导入宏定义
$!{
define.vm}
##设置表后缀(宏定义)
#setTableSuffix("ServiceImpl")
##保存文件(宏定义)
#save("/service/Impl", "ServiceImpl.java")
##包路径(宏定义)
#setPackageSuffix("service.Impl")
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
##表注释(宏定义)
#tableComment("表服务实现类")
@Service("$!tool.firstLowerCase($tableInfo.name)Service")
public class $!{
tableName} extends ServiceImpl<$!{
tableInfo.name}Mapper, $!{
tableInfo.name}> implements $!{
tableInfo.name}Service {
}
3. EasyCode的基本使用
3.1 idea连接数据库
- 找到Database
- 点击左上角的+
- 选择Data Source
- 选择MySQL

- 完善你的数据库信息

同时我们应该注意左下角的MySQL Driver,我们初次连接数据库的时候idea可能会提示我们需要下载
MySQL Driver ,我们按照idea的提示直接下载即可

- 测试Test Connection
出现Successful则代表我们连接成功了


3.2 正式使用


- Package是包名
- Path是路径
- RemovePre是可以去除表的前缀
- Template是我们之前配置好的模板,选择我们需要的即可
边栏推荐
- A reminder to cross-border sellers who are still "shopping"!
- Redis connection error: err client send auth, but no password is set 2 solutions
- 串口(RS - 232)
- Assertion based validation
- redis连接错误:ERR Client sent AUTH, but no password is set解决方案2个
- Vulkan 预旋转处理设备方向
- Global and Chinese carbon conductive filler market demand trend and future prospect report 2022-2027
- 以太网通信协议
- Clion installation Download
- 亚马逊和独立站,不是简单的二选一
猜你喜欢

vscode 远程连接错误:Server status check failed - waiting and retrying

Go language uses zap log Library

串口(RS - 232)

GrabCut分析

Remove then add string from variable of Makefile

n个整数的无序数组,找到每个元素后面比它大的第一个数,要求时间复杂度为O(N)

Data storage (Advanced)

Hide symbol of dynamic library

Learning method 4 for promotion of big factories: play learning method

C指針的理解
随机推荐
QEMU ARM interrupt system architecture
GrabCut分析
Test platform for combinational logic blocks
c files always get rebuild when make -------- . PHONY in Makefile
Introduction to golang Viper Library
Combinatorial logic described using SystemVerilog gate model
redis连接错误:ERR Client sent AUTH, but no password is set解决方案2个
Which is the trend of cross-border policy frequent adjustment of "independent stations & platforms"?
Development forecast and investment risk outlook report of China's GaAs industry during the 14th Five Year Plan period 2022-2027
Vscode remote connection error: server status check failed - waiting and retrying
Vue des nombres élevés du point de vue de l'espace vectoriel (1) - - Introduction à la série
EPP (enhanced parallel port)
我不建议你工作太拼命
MATLAB系统辨识
BinaryFormatter 保存和加载游戏数据 For Unity
AUTOSAR from getting started to mastering 100 lectures (150) -soa architecture and Application
Non transitive dice (spring daily question 51)
Research Report on global and Chinese active Ethernet access device industry demand trend and investment prospect 2022-2027
Global and Chinese aluminum electrolytic capacitor market survey and future development strategic planning report 2022-2027
MySQL basic interview questions