初始化
This commit is contained in:
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"title": "disable",
|
||||
"type": "BOOLEAN",
|
||||
"selectValue": ""
|
||||
},
|
||||
{
|
||||
"title": "support",
|
||||
"type": "SELECT",
|
||||
"selectValue": "add,edit,query,del,ui"
|
||||
}
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
##自动导入包(仅导入实体属性需要的包,通常用于实体类)
|
||||
#foreach($import in $importList)
|
||||
import $!import;
|
||||
#end
|
@ -0,0 +1,39 @@
|
||||
##(Velocity宏定义)
|
||||
|
||||
##定义设置表名后缀的宏定义,调用方式:#setTableSuffix("Test")
|
||||
#macro(setTableSuffix $suffix)
|
||||
#set($tableName = $!tool.append($tableInfo.name, $suffix))
|
||||
#end
|
||||
|
||||
##定义设置包名后缀的宏定义,调用方式:#setPackageSuffix("Test")
|
||||
#macro(setPackageSuffix $suffix)
|
||||
#if($suffix!="")package #end#if($tableInfo.savePackageName!="")$!{tableInfo.savePackageName}.#{end}$!suffix;
|
||||
#end
|
||||
|
||||
##定义直接保存路径与文件名简化的宏定义,调用方式:#save("/entity", ".java")
|
||||
#macro(save $path $fileName)
|
||||
$!callback.setSavePath($tool.append($tableInfo.savePath, $path))
|
||||
$!callback.setFileName($tool.append($tableInfo.name, $fileName))
|
||||
#end
|
||||
|
||||
##定义表注释的宏定义,调用方式:#tableComment("注释信息")
|
||||
#macro(tableComment $desc)
|
||||
/**
|
||||
* $!{tableInfo.comment}($!{tableInfo.name})$desc
|
||||
*
|
||||
* @author $!author
|
||||
* @since $!time.currTime()
|
||||
*/
|
||||
#end
|
||||
|
||||
##定义GET,SET方法的宏定义,调用方式:#getSetMethod($column)
|
||||
#macro(getSetMethod $column)
|
||||
|
||||
public $!{tool.getClsNameByFullName($column.type)} get$!{tool.firstUpperCase($column.name)}() {
|
||||
return $!{column.name};
|
||||
}
|
||||
|
||||
public void set$!{tool.firstUpperCase($column.name)}($!{tool.getClsNameByFullName($column.type)} $!{column.name}) {
|
||||
this.$!{column.name} = $!{column.name};
|
||||
}
|
||||
#end
|
@ -0,0 +1,41 @@
|
||||
##初始化区域
|
||||
|
||||
##去掉表的t_前缀
|
||||
$!tableInfo.setName($tool.getClassName($tableInfo.obj.name.replaceFirst("t_","")))
|
||||
|
||||
##参考阿里巴巴开发手册,POJO 类中布尔类型的变量,都不要加 is 前缀,否则部分框架解析会引起序列化错误
|
||||
## when use actual columns name, should set this.
|
||||
###foreach($column in $tableInfo.fullColumn)
|
||||
## $!column.setName($column.obj.name)
|
||||
###end
|
||||
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
#if($column.name.startsWith("is") && $column.type.equals("java.lang.Boolean"))
|
||||
$!column.setName($tool.firstLowerCase($column.name.substring(2)))
|
||||
#end
|
||||
#end
|
||||
|
||||
##实现动态排除列
|
||||
#set($temp = $tool.newHashSet("testCreateTime", "otherColumn"))
|
||||
#foreach($item in $temp)
|
||||
#set($newList = $tool.newArrayList())
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
#if($column.name!=$item)
|
||||
##带有反回值的方法调用时使用$tool.call来消除返回值
|
||||
$tool.call($newList.add($column))
|
||||
#end
|
||||
#end
|
||||
##重新保存
|
||||
$tableInfo.setFullColumn($newList)
|
||||
#end
|
||||
|
||||
##对importList进行篡改
|
||||
#set($temp = $tool.newHashSet())
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
#if(!$column.type.startsWith("java.lang."))
|
||||
##带有反回值的方法调用时使用$tool.call来消除返回值
|
||||
$tool.call($temp.add($column.type))
|
||||
#end
|
||||
#end
|
||||
##覆盖
|
||||
#set($importList = $temp)
|
@ -0,0 +1,27 @@
|
||||
##following code can be generated use MybatisCodeHelperPro plugin mybatis generator mingrate to template generate.
|
||||
##copy group for different project.
|
||||
#set($javamodelSrcFolder="${projectPath}/src/main/java")
|
||||
#set($modelPackageName="{{ cookiecutter.__mvn_package }}.rest.entity")
|
||||
#set($mapperSrcFolder="${projectPath}/src/main/java")
|
||||
#set($mapperPackageName="{{ cookiecutter.__mvn_package }}.rest.dao")
|
||||
#set($mapperXmlFolder="${projectPath}/src/main/resources")
|
||||
#set($mapperXmlPackage="mapper")
|
||||
#set($serviceSrcFolder="${projectPath}/src/main/java")
|
||||
#set($servicePackageName="{{ cookiecutter.__mvn_package }}.rest.service")
|
||||
#set($serviceImplSrcFolder="${projectPath}/src/main/java")
|
||||
#set($serviceImplPackageName="{{ cookiecutter.__mvn_package }}.rest.service.impl")
|
||||
#set($controllerSrcFolder="${projectPath}/src/main/java")
|
||||
#set($controllerPackageName="{{ cookiecutter.__mvn_package }}.rest.controller")
|
||||
#set($useLombok=true)
|
||||
#set($useSwagger=false)
|
||||
#set($useOpenApi=false)
|
||||
#set($addSchemaName=false)
|
||||
#set($mapperSuffix="Mapper")
|
||||
#set($daoSuffix="Dao")
|
||||
#set($useActualColumName=false)
|
||||
|
||||
#if($useActualColumName)
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
$!column.setName($column.obj.name)
|
||||
#end
|
||||
#end
|
@ -0,0 +1,31 @@
|
||||
##针对Mybatis 进行支持,主要用于生成xml文件
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
##储存列类型
|
||||
$tool.call($column.ext.put("sqlType", $tool.getField($column.obj.dataType, "typeName")))
|
||||
#if($tool.newHashSet("java.lang.String").contains($column.type))
|
||||
#set($jdbcType="VARCHAR")
|
||||
#elseif($tool.newHashSet("java.lang.Boolean", "boolean").contains($column.type))
|
||||
#set($jdbcType="BOOLEAN")
|
||||
#elseif($tool.newHashSet("java.lang.Byte", "byte").contains($column.type))
|
||||
#set($jdbcType="BYTE")
|
||||
#elseif($tool.newHashSet("java.lang.Integer", "int", "java.lang.Short", "short").contains($column.type))
|
||||
#set($jdbcType="INTEGER")
|
||||
#elseif($tool.newHashSet("java.lang.Long", "long").contains($column.type))
|
||||
#set($jdbcType="BIGINT")
|
||||
#elseif($tool.newHashSet("java.lang.Float", "float", "java.lang.Double", "double").contains($column.type))
|
||||
#set($jdbcType="NUMERIC")
|
||||
#elseif($tool.newHashSet(
|
||||
"java.util.Date", "java.sql.Timestamp", "java.time.Instant", "java.time.LocalDateTime",
|
||||
"java.time.OffsetDateTime", "java.time.ZonedDateTime").contains($column.type))
|
||||
#set($jdbcType="TIMESTAMP")
|
||||
#elseif($tool.newHashSet("java.sql.Date", "java.time.LocalDate", "java.time.LocalTime").contains($column.type))
|
||||
#set($jdbcType="TIMESTAMP")
|
||||
#else
|
||||
##其他类型
|
||||
#set($jdbcType="VARCHAR")
|
||||
#end
|
||||
$tool.call($column.ext.put("jdbcType", $jdbcType))
|
||||
#end
|
||||
|
||||
##定义宏,查询所有列
|
||||
#macro(allSqlColumn)#foreach($column in $tableInfo.fullColumn)$column.obj.name#if($velocityHasNext), #end#end#end
|
@ -0,0 +1,182 @@
|
||||
##导入宏定义
|
||||
$!{define.vm}
|
||||
$!{mybatisCodehelper.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#set($controllerName = $tool.append($tableInfo.name, "Controller"))
|
||||
##设置回调
|
||||
#set($controllerSavePath = $tool.append(${controllerSrcFolder},"/",${controllerPackageName.replace(".","/")}))
|
||||
|
||||
$!callback.setSavePath($controllerSavePath)
|
||||
$!callback.setFileName($tool.append($controllerName, ".java"))
|
||||
|
||||
##定义服务名
|
||||
#set($serviceName = $!tool.append($!tool.firstLowerCase($!tableInfo.name), "Service"))
|
||||
|
||||
##定义实体对象名
|
||||
#set($entityName = $!tool.firstLowerCase($!tableInfo.name))
|
||||
|
||||
package ${controllerPackageName};
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import {{ cookiecutter.__mvn_package }}.rest.api.ApiController;
|
||||
import {{ cookiecutter.__mvn_package }}.rest.api.R;
|
||||
import $!{modelPackageName}.$!{tableInfo.name};
|
||||
import ${servicePackageName}.$!{tableInfo.name}Service;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
##表注释(宏定义)
|
||||
#tableComment("表控制层.")
|
||||
###if(${tableInfo.comment})
|
||||
##@Tag(name = "${tableInfo.comment}")
|
||||
###end
|
||||
@Tag(name = "标准接口", description = "由表结构自动生成")
|
||||
@RestController
|
||||
@RequestMapping("db/$!tool.firstLowerCase($!tableInfo.name)")
|
||||
public class $!{tableInfo.name}Controller extends ApiController {
|
||||
/** 服务对象. */
|
||||
private final $!{tableInfo.name}Service $!{serviceName};
|
||||
|
||||
public $!{tableInfo.name}Controller($!{tableInfo.name}Service $!{serviceName}) {
|
||||
this.$!{serviceName} = $!{serviceName};
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询所有数据.
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param $!entityName 查询实体
|
||||
* @return 分页数据
|
||||
*/
|
||||
@Operation(
|
||||
summary = "${tableInfo.comment} - 分页查询所有数据",
|
||||
parameters = {
|
||||
@Parameter(name = "page", description = "分页对象"),
|
||||
@Parameter(name = "$!entityName", description = "查询实体"),
|
||||
},
|
||||
responses = @ApiResponse(description = "分页数据"),
|
||||
description = "size=-1时查询所有数据,orders配合asc排序")
|
||||
@GetMapping
|
||||
@SaCheckPermission("db:rest:get")
|
||||
public R selectAll(@Nullable PageDTO<$!{tableInfo.name}> page, @Nullable $!{tableInfo.name} $!entityName) {
|
||||
return success(this.$!{serviceName}.page(page, new QueryWrapper<>($!entityName)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据.
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@Operation(
|
||||
summary = "${tableInfo.comment} - 通过主键查询单条数据",
|
||||
parameters = {
|
||||
@Parameter(name = "id", description = "主键", schema = @Schema(type = "string")),
|
||||
},
|
||||
responses = @ApiResponse(description = "单条数据"))
|
||||
@GetMapping("{id}")
|
||||
@SaCheckPermission("db:rest:get")
|
||||
public R selectOne(@PathVariable Serializable id) {
|
||||
return success(this.$!{serviceName}.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据.
|
||||
*
|
||||
* @param $!entityName 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@Operation(
|
||||
summary = "${tableInfo.comment} - 新增数据",
|
||||
parameters = {
|
||||
@Parameter(name = "$!entityName", description = "实体对象"),
|
||||
},
|
||||
responses = @ApiResponse(description = "新增结果"))
|
||||
@PostMapping
|
||||
@SaCheckPermission("db:rest:post")
|
||||
public R insert(@RequestBody $!tableInfo.name $!entityName) {
|
||||
return success(this.$!{serviceName}.save($!entityName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增数据.
|
||||
*
|
||||
* @param $!{entityName}s 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@Operation(
|
||||
summary = "${tableInfo.comment} - 批量新增数据",
|
||||
parameters = {
|
||||
@Parameter(name = "$!{entityName}s", description = "实体对象"),
|
||||
},
|
||||
responses = @ApiResponse(description = "新增结果"))
|
||||
@PostMapping("s")
|
||||
@SaCheckPermission("db:rest:post")
|
||||
public R inserts(@RequestBody List<$!tableInfo.name> $!{entityName}s) {
|
||||
return success(this.$!{serviceName}.saveBatch($!{entityName}s));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据.
|
||||
*
|
||||
* @param $!entityName 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@Operation(
|
||||
summary = "${tableInfo.comment} - 修改数据",
|
||||
parameters = {@Parameter(name = "$!entityName", description = "实体对象")},
|
||||
responses = @ApiResponse(description = "修改结果"),
|
||||
description = "不存在的对象会新增")
|
||||
@PutMapping
|
||||
@SaCheckPermission("db:rest:put")
|
||||
public R update(@RequestBody $!tableInfo.name $!entityName) {
|
||||
return success(this.$!{serviceName}.saveOrUpdate($!entityName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量修改数据.
|
||||
*
|
||||
* @param $!{entityName}s 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@Operation(
|
||||
summary = "${tableInfo.comment} - 批量修改数据",
|
||||
parameters = {@Parameter(name = "$!{entityName}s", description = "实体对象")},
|
||||
responses = @ApiResponse(description = "修改结果"),
|
||||
description = "不存在的对象会新增")
|
||||
@PutMapping("s")
|
||||
@SaCheckPermission("db:rest:put")
|
||||
public R updates(@RequestBody List<$!tableInfo.name> $!{entityName}s) {
|
||||
return success(this.$!{serviceName}.saveOrUpdateBatch($!{entityName}s));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据.
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@Operation(
|
||||
summary = "${tableInfo.comment} - 删除数据",
|
||||
parameters = {
|
||||
@Parameter(name = "idList", description = "主键结合", schema = @Schema(type = "string"))
|
||||
},
|
||||
responses = @ApiResponse(description = "删除结果"),
|
||||
description = "主键用逗号拼接")
|
||||
@DeleteMapping
|
||||
@SaCheckPermission("db:rest:del")
|
||||
public R delete(@RequestParam("idList") List<Long> idList) {
|
||||
return success(this.$!{serviceName}.removeByIds(idList));
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
##导入宏定义
|
||||
$!{define.vm}
|
||||
$!{mybatisCodehelper.vm}
|
||||
|
||||
##设置表后缀(宏定义)
|
||||
#set($daoName = $tool.append($tableInfo.name, ${daoSuffix}))
|
||||
##设置回调
|
||||
#set($daoSavePath = $tool.append(${mapperSrcFolder},"/",${mapperPackageName.replace(".","/")}))
|
||||
|
||||
$!callback.setSavePath($daoSavePath)
|
||||
$!callback.setFileName($tool.append($daoName, ".java"))
|
||||
|
||||
package ${mapperPackageName};
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import $!{modelPackageName}.$!{tableInfo.name};
|
||||
|
||||
##表注释(宏定义)
|
||||
#tableComment("表数据库访问层.")
|
||||
public interface $!{tableInfo.name}Dao extends BaseMapper<$!tableInfo.name> {
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
##导入宏定义
|
||||
$!{define.vm}
|
||||
$!{mybatisCodehelper.vm}
|
||||
|
||||
#set($entitySavePath = $tool.append(${javamodelSrcFolder},"/",${modelPackageName.replace(".","/")}))
|
||||
|
||||
$!callback.setSavePath($entitySavePath)
|
||||
$!callback.setFileName($tool.append($tableInfo.name, ".java"))
|
||||
|
||||
##自动导入包(全局变量)
|
||||
package ${modelPackageName};
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import ltd.llvy.postgis.handler.GeometryDeserializer;
|
||||
import ltd.llvy.postgis.handler.GeometrySerializer;
|
||||
|
||||
import java.io.Serializable;
|
||||
$!autoImport
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
##表注释(宏定义)
|
||||
#tableComment("表实体类.")
|
||||
#if(${tableInfo.comment})
|
||||
@Schema(description = "${tableInfo.comment}")
|
||||
#end
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class $!{tableInfo.name} extends Model<$!{tableInfo.name}> {
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
#if(${column.comment})
|
||||
//${column.comment}
|
||||
#end
|
||||
#if($!{column.name} == "id" || $!{column.name.indexOf("Id")} != -1)
|
||||
@Schema(description = "${column.comment}", type = "string")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
#else
|
||||
@Schema(description = "${column.comment}")
|
||||
#end
|
||||
#if("password" == $!{column.name})
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
#end
|
||||
#if("version" == $!{column.name})
|
||||
@Version
|
||||
#end
|
||||
#if("deleteTime" == $!{column.name})
|
||||
@TableLogic
|
||||
#end
|
||||
#if("createTime" == $!{column.name})
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
{% if cookiecutter.platform == "postgis" -%}
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.OTHER)
|
||||
{% else %}
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.DATETIMEOFFSET)
|
||||
{% endif %}
|
||||
#end
|
||||
#if("updateTime" == $!{column.name})
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
{% if cookiecutter.platform == "postgis" -%}
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.OTHER)
|
||||
{% else %}
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.DATETIMEOFFSET)
|
||||
{% endif %}
|
||||
#end
|
||||
#if("createBy" == $!{column.name})
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
#end
|
||||
#if("updateBy" == $!{column.name})
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
#end
|
||||
#if("geom" == $!{column.name})
|
||||
@JsonSerialize(using = GeometrySerializer.class)
|
||||
@JsonDeserialize(using = GeometryDeserializer.class)
|
||||
#end
|
||||
private $!{tool.getClsNameByFullName($column.type)} $!{column.name};
|
||||
#end
|
||||
#foreach($column in $tableInfo.pkColumn)
|
||||
/**
|
||||
* 获取主键值.
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
public Serializable pkVal () {
|
||||
return this.$!column.name;
|
||||
}
|
||||
#break
|
||||
#end
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
##引入mybatis支持
|
||||
$!{mybatisCodehelper.vm}
|
||||
$!{mybatisSupport.vm}
|
||||
##设置保存名称与保存位置
|
||||
#set($XmlSavePath = $tool.append(${mapperXmlFolder},"/",${mapperXmlPackage.replace(".","/")}))
|
||||
$!callback.setSavePath($XmlSavePath)
|
||||
$!callback.setFileName($tool.append($!{tableInfo.name}, $!{mapperSuffix},".xml"))
|
||||
#set($daoName = $tool.append($tableInfo.name, ${daoSuffix}))
|
||||
##拿到主键
|
||||
#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="{{ cookiecutter.__mvn_package }}.rest.dao.$!{tableInfo.name}Dao">
|
||||
<resultMap type="{{ cookiecutter.__mvn_package }}.rest.entity.$!{tableInfo.name}" id="$!{tableInfo.name}Map">
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
<result property="$!column.name" column="$!column.obj.name" jdbcType="$!column.ext.jdbcType"/>
|
||||
#end
|
||||
</resultMap>
|
||||
</mapper>
|
@ -0,0 +1,24 @@
|
||||
##导入宏定义
|
||||
$!{define.vm}
|
||||
|
||||
##定义初始变量
|
||||
$!{mybatisCodehelper.vm}
|
||||
#set($serviceName = $tool.append($tableInfo.name, "Service"))
|
||||
##设置回调
|
||||
#set($serviceSavePath = $tool.append(${serviceSrcFolder},"/",${servicePackageName.replace(".","/")}))
|
||||
|
||||
$!callback.setSavePath($serviceSavePath)
|
||||
$!callback.setFileName($tool.append($serviceName, ".java"))
|
||||
|
||||
|
||||
|
||||
package $!{servicePackageName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import $!{modelPackageName}.$!{tableInfo.name};
|
||||
|
||||
##表注释(宏定义)
|
||||
#tableComment("表服务接口.")
|
||||
public interface $!{serviceName} extends IService
|
||||
|
||||
<$!tableInfo.name> {
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
##导入宏定义
|
||||
$!{define.vm}
|
||||
|
||||
$!{mybatisCodehelper.vm}
|
||||
#set($ServiceImplName = $tool.append($tableInfo.name, "ServiceImpl"))
|
||||
##设置回调
|
||||
##$!callback.setFileName($tool.append($ServiceImplName, ".java"))
|
||||
##$!callback.setSavePath($tool.append($tableInfo.savePath, "/service/impl"))
|
||||
#set($serviceImplSavePath = $tool.append(${serviceImplSrcFolder},"/",${serviceImplPackageName.replace(".","/")}))
|
||||
|
||||
$!callback.setSavePath($serviceImplSavePath)
|
||||
$!callback.setFileName($tool.append($ServiceImplName, ".java"))
|
||||
|
||||
#set($daoName = $tool.append($tableInfo.name, ${daoSuffix}))
|
||||
|
||||
package $!{serviceImplPackageName};
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import ${mapperPackageName}.${daoName};
|
||||
import $!{modelPackageName}.$!{tableInfo.name};
|
||||
import ${servicePackageName}.$!{tableInfo.name}Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
##表注释(宏定义)
|
||||
#tableComment("表服务实现类.")
|
||||
@Service("$!tool.firstLowerCase($tableInfo.name)Service")
|
||||
public class $!{ServiceImplName} extends ServiceImpl<$!{daoName}, $!{tableInfo.name}> implements
|
||||
|
||||
$!{tableInfo.name}Service {
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
[
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "varchar(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "char(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "tinyint(1)",
|
||||
"javaType": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "bit(1)",
|
||||
"javaType": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "(tiny|medium|long)*text",
|
||||
"javaType": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "decimal(\\(\\d+,\\d+\\))?",
|
||||
"javaType": "java.math.BigDecimal"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "integer",
|
||||
"javaType": "java.lang.Integer"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "(tiny|small|medium)*int(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.Integer"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "int4",
|
||||
"javaType": "java.lang.Integer"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "int8",
|
||||
"javaType": "java.lang.Long"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "bigint(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.Long"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "double",
|
||||
"javaType": "java.lang.Double"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "date",
|
||||
"javaType": "java.time.LocalDate"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "datetime",
|
||||
"javaType": "java.time.OffsetDateTime"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "timestamp with time zone",
|
||||
"javaType": "java.time.OffsetDateTime"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "timestamp",
|
||||
"javaType": "java.lang.Long"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "time",
|
||||
"javaType": "java.time.LocalTime"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "boolean",
|
||||
"javaType": "java.lang.Boolean"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "geometry",
|
||||
"javaType": "org.postgis.Geometry"
|
||||
}
|
||||
]
|
@ -0,0 +1,72 @@
|
||||
[
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "varchar(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "char(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "(tiny|medium|long)*text",
|
||||
"javaType": "java.lang.String"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "decimal(\\(\\d+,\\d+\\))?",
|
||||
"javaType": "java.lang.Double"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "integer",
|
||||
"javaType": "java.lang.Integer"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "(tiny|small|medium)*int(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.Integer"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "int4",
|
||||
"javaType": "java.lang.Integer"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "int8",
|
||||
"javaType": "java.lang.Long"
|
||||
},
|
||||
{
|
||||
"matchType": "REGEX",
|
||||
"columnType": "bigint(\\(\\d+\\))?",
|
||||
"javaType": "java.lang.Long"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "date",
|
||||
"javaType": "java.time.LocalDate"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "datetime",
|
||||
"javaType": "java.time.LocalDate"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "timestamp",
|
||||
"javaType": "java.time.LocalDate"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "time",
|
||||
"javaType": "java.time.LocalTime"
|
||||
},
|
||||
{
|
||||
"matchType": "ORDINARY",
|
||||
"columnType": "boolean",
|
||||
"javaType": "java.lang.Boolean"
|
||||
}
|
||||
]
|
11
{{cookiecutter.project_slug}}/EasyCode/group.json
Normal file
11
{{cookiecutter.project_slug}}/EasyCode/group.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"groupName": "MybatisPlus",
|
||||
"templateName": "MybatisPlus",
|
||||
"globalConfigName": "MybatisCodeHelperPro",
|
||||
"columnConfigName": "Default.json",
|
||||
"typeMapperName": "Default.json",
|
||||
"tableNameRegex": ".*",
|
||||
"schemaNameRegex": ".*"
|
||||
}
|
||||
]
|
12
{{cookiecutter.project_slug}}/EasyCode/velocity_implicit.vm
Normal file
12
{{cookiecutter.project_slug}}/EasyCode/velocity_implicit.vm
Normal file
@ -0,0 +1,12 @@
|
||||
#* @implicitly included *#
|
||||
#* @vtlvariable name="author" type="java.lang.String" *#
|
||||
#* @vtlvariable name="encode" type="java.lang.String" *#
|
||||
#* @vtlvariable name="modulePath" type="java.lang.String" *#
|
||||
#* @vtlvariable name="projectPath" type="java.lang.String" *#
|
||||
#* @vtlvariable name="importList" type="java.util.List<java.lang.String>" *#
|
||||
#* @vtlvariable name="callback" type="com.bruce.plugin.entity.Callback" *#
|
||||
#* @vtlvariable name="tool" type="com.bruce.plugin.tool.GlobalTool" *#
|
||||
#* @vtlvariable name="time" type="com.bruce.plugin.tool.TimeUtils" *#
|
||||
#* @vtlvariable name="tableInfo" type="com.bruce.plugin.entity.TableInfo" *#
|
||||
#* @vtlvariable name="tableInfoList" type="java.util.List<com.bruce.plugin.entity.TableInfo>" *#
|
||||
#* @vtlvariable name="generateService" type="com.bruce.plugin.tool.ExtraCodeGenerateUtils" *#
|
Reference in New Issue
Block a user