$!callback.setFileName($tool.append($tableInfo.obj.name, ".java"))
$!callback.setSavePath($tool.append($tableInfo.savePath, "/entity"))
#if($tableInfo.savePackageName)package $!{
tableInfo.savePackageName}.#{
end}entity;
##使用全局变量实现默认包导入
$!autoImport
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
####使用宏定义实现类注释信息
###tableComment("实体类")
/**
* @description $!{tableInfo.comment}($tableInfo.obj.name)表实体类
*
* @author $author
* @date $!time.currTime()
*/
@Data
public class $!{
tableInfo.obj.name} implements Serializable {
## private static final long serialVersionUID = $!tool.serial();
private static final long serialVersionUID = 1L;
#foreach($column in $tableInfo.fullColumn)
#if(${
column.comment})/**
* ${column.comment}
*/#end
@ApiModelProperty(value = " ${column.comment}")
private $!{
tool.getClsNameByFullName($column.type)} $!tool.firstLowerCase($!{
column.obj.name});
#end
###foreach($column in $tableInfo.fullColumn)
####使用宏定义实现get,set方法
###getSetMethod($column)
###end
}
##定义初始变量
#set($tableName = $tool.append($tableInfo.obj.name, "Mapper"))
##设置回调
$!callback.setFileName($tool.append($tableName, ".java"))
$!callback.setSavePath($tool.append($tableInfo.savePath, "/mappers"))
##拿到主键
#if(!$tableInfo.pkColumn.isEmpty())
#set($pk = $tableInfo.pkColumn.get(0))
#end
#if($tableInfo.savePackageName)package $!{
tableInfo.savePackageName}.#{
end}mappers;
import $!{
tableInfo.savePackageName}.entity.$!{
tableInfo.obj.name};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* $!{tableInfo.comment}($!{tableInfo.name})表数据库访问层
*
* @author $!author
* @since $!time.currTime()
*/
@Mapper
public interface $!{
tableName} extends BaseMapper<$!{
tableInfo.obj.name}> {
}
##定义初始变量
#set($tableName = $tool.append("I",$tableInfo.name, "Service"))
##设置回调
$!callback.setFileName($tool.append($tableName, ".java"))
$!callback.setSavePath($tool.append($tableInfo.savePath, "/interfaces"))
##拿到主键
#if(!$tableInfo.pkColumn.isEmpty())
#set($pk = $tableInfo.pkColumn.get(0))
#end
#if($tableInfo.savePackageName)package $!{
tableInfo.savePackageName}.#{
end}interfaces;
import $!{
tableInfo.savePackageName}.entity.$!{
tableInfo.obj.name};
/**
* $!{tableInfo.comment}($!{tableInfo.name})表服务接口
*
* @author $!author
* @since $!time.currTime()
*/
public interface $!{
tableName} extends IServiceBase<$!{
tableInfo.obj.name}>{
}
##定义初始变量
#set($tableName = $tool.append("I",$tableInfo.name, "Service"))
##设置回调
$!callback.setFileName($tool.append($tableName, ".java"))
$!callback.setSavePath($tool.append($tableInfo.savePath, "/interfaces"))
#if($tableInfo.savePackageName)package $!{
tableInfo.savePackageName}.#{
end}interfaces;
import com.baomidou.mybatisplus.extension.service.IService;
import $!{
tableInfo.savePackageName}.entity.$!tableInfo.obj.name;
/**
* $!{tableInfo.comment}($!{tableInfo.name})表服务接口
*
* @author $!author
* @since $!time.currTime()
*/
public interface $!{
tableName} extends IService<$!tableInfo.obj.name> {
}
##定义初始变量
#set($tableName = $tool.append($tableInfo.name, "Service"))
##设置回调
$!callback.setFileName($tool.append($tableName, ".java"))
$!callback.setSavePath($tool.append($tableInfo.savePath, "/services"))
##拿到主键
#if(!$tableInfo.pkColumn.isEmpty())
#set($pk = $tableInfo.pkColumn.get(0))
#end
#if($tableInfo.savePackageName)package $!{
tableInfo.savePackageName}.#{
end}services;
import $!{
tableInfo.savePackageName}.entity.$!{
tableInfo.obj.name};
import $!{
tableInfo.savePackageName}.mappers.$!{
tableInfo.obj.name}Mapper;
import $!{
tableInfo.savePackageName}.services.$!{
tableInfo.name}Service;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
/**
* $!{tableInfo.comment}($!{tableInfo.name})表服务实现类
*
* @author $!author
* @since $!time.currTime()
*/
@Service("$!tool.firstLowerCase($!{tableInfo.name})Service")
@Slf4j
public class $!{
tableName} extends ServiceBase<$!{
tableInfo.obj.name}Mapper,$!{
tableInfo.obj.name}> implements I$!{
tableInfo.name}Service {
}
##拿到主键
#if(!$tableInfo.pkColumn.isEmpty())
#set($pk = $tableInfo.pkColumn.get(0))
#end
#if($tableInfo.savePackageName)package $!{
tableInfo.savePackageName}.#{
end}services;
import $!{
tableInfo.savePackageName}.entity.$!{
tableInfo.obj.name};
import $!{
tableInfo.savePackageName}.mappers.$!{
tableInfo.obj.name}Mapper;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
/**
* $!{tableInfo.comment}($!{tableInfo.name})表服务实现类
*
* @author $!author
* @since $!time.currTime()
*/
@Service("$!tool.firstLowerCase($!{tableInfo.name})Service")
@Slf4j
public class $!{
tableName} extends ServiceImpl<$!{
tableInfo.obj.name}Mapper,$!{
tableInfo.obj.name}> implements I$!{
tableInfo.name}Service {
}
##引入mybatis支持
$!mybatisSupport
##设置保存名称与保存位置
$!callback.setFileName($tool.append($!{
tableInfo.name}, "Dao.xml"))
$!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))
##拿到主键
#if(!$tableInfo.pkColumn.isEmpty())
#set($pk = $tableInfo.pkColumn.get(0))
#end
<?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="$!{tableInfo.savePackageName}.mappers.$!{tableInfo.obj.name}Mapper">
</mapper>
这个是可以导入模板的,如果有想要的可以私聊我 (QQ: 858815475)以及想要生成实体类,mapper,以及service的接口和实现 免费在线解答
连接数据库以及如何使用