项目导入初始化
This commit is contained in:
44
zyplayer-doc-manage/src/main/resources/application.yml
Normal file
44
zyplayer-doc-manage/src/main/resources/application.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
spring:
|
||||
application:
|
||||
name: zyplayer-doc-manage
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/zyplayer-doc-manage?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true
|
||||
username: root
|
||||
password: root
|
||||
|
||||
server:
|
||||
port: 8082
|
||||
contextPath: /
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:/mapper/**/*Mapper.xml
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: com.baomidou.springboot.entity
|
||||
typeEnumsPackage: com.baomidou.springboot.entity.enums
|
||||
global-config:
|
||||
# 数据库相关配置
|
||||
db-config:
|
||||
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
|
||||
id-type: id_worker
|
||||
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
|
||||
field-strategy: not_empty
|
||||
#驼峰下划线转换
|
||||
column-underline: true
|
||||
#数据库大写下划线转换
|
||||
#capital-mode: true
|
||||
#逻辑删除配置
|
||||
logic-delete-value: 0
|
||||
logic-not-delete-value: 1
|
||||
db-type: mysql
|
||||
#刷新mapper 调试神器
|
||||
refresh: true
|
||||
# 原生配置
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
cache-enabled: false
|
||||
|
||||
|
||||
#一些测试地址
|
||||
#https://gitee.com/GeekPerson/central-platform 项目的文档
|
||||
#http://47.99.88.28:9200/swagger-resources
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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.zyplayer.doc.manage.repository.manage.mapper.ZyplayerStorageMapper">
|
||||
|
||||
<select id="selectTop" resultType="java.lang.Integer">
|
||||
select 10
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Navicat Premium Data Transfer
|
||||
|
||||
Source Server : 127.0.0.1
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50624
|
||||
Source Host : 127.0.0.1:3306
|
||||
Source Schema : zyplayer-doc-manage
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50624
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 27/11/2018 20:19:45
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for zyplayer_storage
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `zyplayer_storage`;
|
||||
CREATE TABLE `zyplayer_storage` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`doc_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`doc_value` varchar(2048) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
|
||||
`creation_time` datetime NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `key`(`doc_key`) USING BTREE COMMENT 'key唯一索引'
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -0,0 +1,39 @@
|
||||
package ${package.Controller};
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
<#if restControllerStyle>
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
<#else>
|
||||
import org.springframework.stereotype.Controller;
|
||||
</#if>
|
||||
<#if superControllerClassPackage??>
|
||||
import ${superControllerClassPackage};
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${table.comment!} 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
<#if restControllerStyle>
|
||||
@RestController
|
||||
<#else>
|
||||
@Controller
|
||||
</#if>
|
||||
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
|
||||
<#if kotlin>
|
||||
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
|
||||
<#else>
|
||||
<#if superControllerClass??>
|
||||
public class ${table.controllerName} extends ${superControllerClass} {
|
||||
<#else>
|
||||
public class ${table.controllerName} {
|
||||
</#if>
|
||||
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,41 @@
|
||||
package ${package.Controller};
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
#if(${restControllerStyle})
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
#else
|
||||
import org.springframework.stereotype.Controller;
|
||||
#end
|
||||
#if(${superControllerClassPackage})
|
||||
import ${superControllerClassPackage};
|
||||
#end
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* $!{table.comment} 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
#if(${restControllerStyle})
|
||||
@RestController
|
||||
#else
|
||||
@Controller
|
||||
#end
|
||||
@RequestMapping("#if(${package.ModuleName})/${package.ModuleName}#end/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end")
|
||||
#if(${kotlin})
|
||||
class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end
|
||||
|
||||
#else
|
||||
#if(${superControllerClass})
|
||||
public class ${table.controllerName} extends ${superControllerClass} {
|
||||
#else
|
||||
public class ${table.controllerName} {
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
#end
|
||||
150
zyplayer-doc-manage/src/main/resources/templates/entity.java.ftl
Normal file
150
zyplayer-doc-manage/src/main/resources/templates/entity.java.ftl
Normal file
@@ -0,0 +1,150 @@
|
||||
package ${package.Entity};
|
||||
|
||||
<#list table.importPackages as pkg>
|
||||
import ${pkg};
|
||||
</#list>
|
||||
<#if swagger2>
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
</#if>
|
||||
<#if entityLombokModel>
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${table.comment!}
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
<#if entityLombokModel>
|
||||
@Data
|
||||
<#if superEntityClass??>
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
<#else>
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
</#if>
|
||||
@Accessors(chain = true)
|
||||
</#if>
|
||||
<#if table.convert>
|
||||
@TableName("${table.name}")
|
||||
</#if>
|
||||
<#if swagger2>
|
||||
@ApiModel(value="${entity}对象", description="${table.comment!}")
|
||||
</#if>
|
||||
<#if superEntityClass??>
|
||||
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
|
||||
<#elseif activeRecord>
|
||||
public class ${entity} extends Model<${entity}> {
|
||||
<#else>
|
||||
public class ${entity} implements Serializable {
|
||||
</#if>
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
<#-- ---------- BEGIN 字段循环遍历 ---------->
|
||||
<#list table.fields as field>
|
||||
<#if field.keyFlag>
|
||||
<#assign keyPropertyName="${field.propertyName}"/>
|
||||
</#if>
|
||||
|
||||
<#if field.comment!?length gt 0>
|
||||
<#if swagger2>
|
||||
@ApiModelProperty(value = "${field.comment}")
|
||||
<#else>
|
||||
/**
|
||||
* ${field.comment}
|
||||
*/
|
||||
</#if>
|
||||
</#if>
|
||||
<#if field.keyFlag>
|
||||
<#-- 主键 -->
|
||||
<#if field.keyIdentityFlag>
|
||||
@TableId(value = "${field.name}", type = IdType.AUTO)
|
||||
<#elseif idType??>
|
||||
@TableId(value = "${field.name}", type = IdType.${idType})
|
||||
<#elseif field.convert>
|
||||
@TableId("${field.name}")
|
||||
</#if>
|
||||
<#-- 普通字段 -->
|
||||
<#elseif field.fill??>
|
||||
<#-- ----- 存在字段填充设置 ----->
|
||||
<#if field.convert>
|
||||
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
|
||||
<#else>
|
||||
@TableField(fill = FieldFill.${field.fill})
|
||||
</#if>
|
||||
<#elseif field.convert>
|
||||
@TableField("${field.name}")
|
||||
</#if>
|
||||
<#-- 乐观锁注解 -->
|
||||
<#if (versionFieldName!"") == field.name>
|
||||
@Version
|
||||
</#if>
|
||||
<#-- 逻辑删除注解 -->
|
||||
<#if (logicDeleteFieldName!"") == field.name>
|
||||
@TableLogic
|
||||
</#if>
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
</#list>
|
||||
<#------------ END 字段循环遍历 ---------->
|
||||
|
||||
<#if !entityLombokModel>
|
||||
<#list table.fields as field>
|
||||
<#if field.propertyType == "boolean">
|
||||
<#assign getprefix="is"/>
|
||||
<#else>
|
||||
<#assign getprefix="get"/>
|
||||
</#if>
|
||||
public ${field.propertyType} ${getprefix}${field.capitalName}() {
|
||||
return ${field.propertyName};
|
||||
}
|
||||
|
||||
<#if entityBuilderModel>
|
||||
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
|
||||
<#else>
|
||||
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
|
||||
</#if>
|
||||
this.${field.propertyName} = ${field.propertyName};
|
||||
<#if entityBuilderModel>
|
||||
return this;
|
||||
</#if>
|
||||
}
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
<#if entityColumnConstant>
|
||||
<#list table.fields as field>
|
||||
public static final String ${field.name?upper_case} = "${field.name}";
|
||||
|
||||
</#list>
|
||||
</#if>
|
||||
<#if activeRecord>
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
<#if keyPropertyName??>
|
||||
return this.${keyPropertyName};
|
||||
<#else>
|
||||
return null;
|
||||
</#if>
|
||||
}
|
||||
|
||||
</#if>
|
||||
<#if !entityLombokModel>
|
||||
@Override
|
||||
public String toString() {
|
||||
return "${entity}{" +
|
||||
<#list table.fields as field>
|
||||
<#if field_index==0>
|
||||
"${field.propertyName}=" + ${field.propertyName} +
|
||||
<#else>
|
||||
", ${field.propertyName}=" + ${field.propertyName} +
|
||||
</#if>
|
||||
</#list>
|
||||
"}";
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
151
zyplayer-doc-manage/src/main/resources/templates/entity.java.vm
Normal file
151
zyplayer-doc-manage/src/main/resources/templates/entity.java.vm
Normal file
@@ -0,0 +1,151 @@
|
||||
package ${package.Entity};
|
||||
|
||||
#foreach($pkg in ${table.importPackages})
|
||||
import ${pkg};
|
||||
#end
|
||||
#if(${swagger2})
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
#end
|
||||
#if(${entityLombokModel})
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
#end
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* $!{table.comment}
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
#if(${entityLombokModel})
|
||||
@Data
|
||||
#if(${superEntityClass})
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
#else
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
#end
|
||||
@Accessors(chain = true)
|
||||
#end
|
||||
#if(${table.convert})
|
||||
@TableName("${table.name}")
|
||||
#end
|
||||
#if(${swagger2})
|
||||
@ApiModel(value="${entity}对象", description="$!{table.comment}")
|
||||
#end
|
||||
#if(${superEntityClass})
|
||||
public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
|
||||
#elseif(${activeRecord})
|
||||
public class ${entity} extends Model<${entity}> {
|
||||
#else
|
||||
public class ${entity} implements Serializable {
|
||||
#end
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
## ---------- BEGIN 字段循环遍历 ----------
|
||||
#foreach($field in ${table.fields})
|
||||
|
||||
#if(${field.keyFlag})
|
||||
#set($keyPropertyName=${field.propertyName})
|
||||
#end
|
||||
#if("$!field.comment" != "")
|
||||
#if(${swagger2})
|
||||
@ApiModelProperty(value = "${field.comment}")
|
||||
#else
|
||||
/**
|
||||
* ${field.comment}
|
||||
*/
|
||||
#end
|
||||
#end
|
||||
#if(${field.keyFlag})
|
||||
## 主键
|
||||
#if(${field.keyIdentityFlag})
|
||||
@TableId(value = "${field.name}", type = IdType.AUTO)
|
||||
#elseif(!$null.isNull(${idType}) && "$!idType" != "")
|
||||
@TableId(value = "${field.name}", type = IdType.${idType})
|
||||
#elseif(${field.convert})
|
||||
@TableId("${field.name}")
|
||||
#end
|
||||
## 普通字段
|
||||
#elseif(${field.fill})
|
||||
## ----- 存在字段填充设置 -----
|
||||
#if(${field.convert})
|
||||
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
|
||||
#else
|
||||
@TableField(fill = FieldFill.${field.fill})
|
||||
#end
|
||||
#elseif(${field.convert})
|
||||
@TableField("${field.name}")
|
||||
#end
|
||||
## 乐观锁注解
|
||||
#if(${versionFieldName}==${field.name})
|
||||
@Version
|
||||
#end
|
||||
## 逻辑删除注解
|
||||
#if(${logicDeleteFieldName}==${field.name})
|
||||
@TableLogic
|
||||
#end
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
#end
|
||||
## ---------- END 字段循环遍历 ----------
|
||||
|
||||
#if(!${entityLombokModel})
|
||||
#foreach($field in ${table.fields})
|
||||
#if(${field.propertyType.equals("boolean")})
|
||||
#set($getprefix="is")
|
||||
#else
|
||||
#set($getprefix="get")
|
||||
#end
|
||||
|
||||
public ${field.propertyType} ${getprefix}${field.capitalName}() {
|
||||
return ${field.propertyName};
|
||||
}
|
||||
|
||||
#if(${entityBuilderModel})
|
||||
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
|
||||
#else
|
||||
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
|
||||
#end
|
||||
this.${field.propertyName} = ${field.propertyName};
|
||||
#if(${entityBuilderModel})
|
||||
return this;
|
||||
#end
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
#if(${entityColumnConstant})
|
||||
#foreach($field in ${table.fields})
|
||||
public static final String ${field.name.toUpperCase()} = "${field.name}";
|
||||
|
||||
#end
|
||||
#end
|
||||
#if(${activeRecord})
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
#if(${keyPropertyName})
|
||||
return this.${keyPropertyName};
|
||||
#else
|
||||
return null;
|
||||
#end
|
||||
}
|
||||
|
||||
#end
|
||||
#if(!${entityLombokModel})
|
||||
@Override
|
||||
public String toString() {
|
||||
return "${entity}{" +
|
||||
#foreach($field in ${table.fields})
|
||||
#if($!{foreach.index}==0)
|
||||
"${field.propertyName}=" + ${field.propertyName} +
|
||||
#else
|
||||
", ${field.propertyName}=" + ${field.propertyName} +
|
||||
#end
|
||||
#end
|
||||
"}";
|
||||
}
|
||||
#end
|
||||
}
|
||||
105
zyplayer-doc-manage/src/main/resources/templates/entity.kt.ftl
Normal file
105
zyplayer-doc-manage/src/main/resources/templates/entity.kt.ftl
Normal file
@@ -0,0 +1,105 @@
|
||||
package ${package.Entity}
|
||||
|
||||
<#list table.importPackages as pkg>
|
||||
import ${pkg}
|
||||
</#list>
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${table.comment}
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
<#if table.convert>
|
||||
@TableName("${table.name}")
|
||||
</#if>
|
||||
<#if superEntityClass??>
|
||||
class ${entity} : ${superEntityClass}<#if activeRecord><${entity}></#if> {
|
||||
<#elseif activeRecord>
|
||||
class ${entity} : Model<${entity}>() {
|
||||
<#else>
|
||||
class ${entity} : Serializable {
|
||||
</#if>
|
||||
|
||||
<#-- ---------- BEGIN 字段循环遍历 ---------->
|
||||
<#list table.fields as field>
|
||||
<#if field.keyFlag>
|
||||
<#assign keyPropertyName="${field.propertyName}"/>
|
||||
</#if>
|
||||
|
||||
<#if field.comment!?length gt 0>
|
||||
/**
|
||||
* ${field.comment}
|
||||
*/
|
||||
</#if>
|
||||
<#if field.keyFlag>
|
||||
<#-- 主键 -->
|
||||
<#if field.keyIdentityFlag>
|
||||
@TableId(value = "${field.name}", type = IdType.AUTO)
|
||||
<#elseif idType ??>
|
||||
@TableId(value = "${field.name}", type = IdType.${idType})
|
||||
<#elseif field.convert>
|
||||
@TableId("${field.name}")
|
||||
</#if>
|
||||
<#-- 普通字段 -->
|
||||
<#elseif field.fill??>
|
||||
<#-- ----- 存在字段填充设置 ----->
|
||||
<#if field.convert>
|
||||
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
|
||||
<#else>
|
||||
@TableField(fill = FieldFill.${field.fill})
|
||||
</#if>
|
||||
<#elseif field.convert>
|
||||
@TableField("${field.name}")
|
||||
</#if>
|
||||
<#-- 乐观锁注解 -->
|
||||
<#if (versionFieldName!"") == field.name>
|
||||
@Version
|
||||
</#if>
|
||||
<#-- 逻辑删除注解 -->
|
||||
<#if (logicDeleteFieldName!"") == field.name>
|
||||
@TableLogic
|
||||
</#if>
|
||||
<#if field.propertyType == "Integer">
|
||||
var ${field.propertyName}: Int? = null
|
||||
<#else>
|
||||
var ${field.propertyName}: ${field.propertyType}? = null
|
||||
</#if>
|
||||
</#list>
|
||||
<#-- ---------- END 字段循环遍历 ---------->
|
||||
|
||||
|
||||
<#if entityColumnConstant>
|
||||
companion object {
|
||||
<#list table.fields as field>
|
||||
|
||||
const val ${field.name.toUpperCase()} : String = "${field.name}"
|
||||
|
||||
</#list>
|
||||
}
|
||||
|
||||
</#if>
|
||||
<#if activeRecord>
|
||||
override fun pkVal(): Serializable {
|
||||
<#if keyPropertyName??>
|
||||
return ${keyPropertyName}
|
||||
<#else>
|
||||
return null
|
||||
</#if>
|
||||
}
|
||||
|
||||
</#if>
|
||||
override fun toString(): String {
|
||||
return "${entity}{" +
|
||||
<#list table.fields as field>
|
||||
<#if field_index==0>
|
||||
"${field.propertyName}=" + ${field.propertyName} +
|
||||
<#else>
|
||||
", ${field.propertyName}=" + ${field.propertyName} +
|
||||
</#if>
|
||||
</#list>
|
||||
"}"
|
||||
}
|
||||
}
|
||||
100
zyplayer-doc-manage/src/main/resources/templates/entity.kt.vm
Normal file
100
zyplayer-doc-manage/src/main/resources/templates/entity.kt.vm
Normal file
@@ -0,0 +1,100 @@
|
||||
package ${package.Entity};
|
||||
|
||||
#foreach($pkg in ${table.importPackages})
|
||||
import ${pkg};
|
||||
#end
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* $!{table.comment}
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
#if(${table.convert})
|
||||
@TableName("${table.name}")
|
||||
#end
|
||||
#if(${superEntityClass})
|
||||
class ${entity} : ${superEntityClass}#if(${activeRecord})<${entity}>#end() {
|
||||
#elseif(${activeRecord})
|
||||
class ${entity} : Model<${entity}>() {
|
||||
#else
|
||||
class ${entity} : Serializable {
|
||||
#end
|
||||
|
||||
## ---------- BEGIN 字段循环遍历 ----------
|
||||
#foreach($field in ${table.fields})
|
||||
#if(${field.keyFlag})
|
||||
#set($keyPropertyName=${field.propertyName})
|
||||
#end
|
||||
#if("$!field.comment" != "")
|
||||
/**
|
||||
* ${field.comment}
|
||||
*/
|
||||
#end
|
||||
#if(${field.keyFlag})
|
||||
## 主键
|
||||
#if(${field.keyIdentityFlag})
|
||||
@TableId(value = "${field.name}", type = IdType.AUTO)
|
||||
#elseif(!$null.isNull(${idType}) && "$!idType" != "")
|
||||
@TableId(value = "${field.name}", type = IdType.${idType})
|
||||
#elseif(${field.convert})
|
||||
@TableId("${field.name}")
|
||||
#end
|
||||
## 普通字段
|
||||
#elseif(${field.fill})
|
||||
## ----- 存在字段填充设置 -----
|
||||
#if(${field.convert})
|
||||
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
|
||||
#else
|
||||
@TableField(fill = FieldFill.${field.fill})
|
||||
#end
|
||||
#elseif(${field.convert})
|
||||
@TableField("${field.name}")
|
||||
#end
|
||||
## 乐观锁注解
|
||||
#if(${versionFieldName}==${field.name})
|
||||
@Version
|
||||
#end
|
||||
## 逻辑删除注解
|
||||
#if(${logicDeleteFieldName}==${field.name})
|
||||
@TableLogic
|
||||
#end
|
||||
var ${field.propertyName}: ${field.propertyType}? = null
|
||||
#end
|
||||
## ---------- END 字段循环遍历 ----------
|
||||
|
||||
|
||||
#if(${entityColumnConstant})
|
||||
companion object {
|
||||
#foreach($field in ${table.fields})
|
||||
|
||||
const val ${field.name.toUpperCase()} : String = "${field.name}"
|
||||
|
||||
#end
|
||||
}
|
||||
|
||||
#end
|
||||
#if(${activeRecord})
|
||||
override fun pkVal(): Serializable {
|
||||
#if(${keyPropertyName})
|
||||
return ${keyPropertyName}!!
|
||||
#else
|
||||
return id!!
|
||||
#end
|
||||
}
|
||||
|
||||
#end
|
||||
override fun toString(): String {
|
||||
return "${entity}{" +
|
||||
#foreach($field in ${table.fields})
|
||||
#if($!{foreach.index}==0)
|
||||
"${field.propertyName}=" + ${field.propertyName} +
|
||||
#else
|
||||
", ${field.propertyName}=" + ${field.propertyName} +
|
||||
#end
|
||||
#end
|
||||
"}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ${package.Mapper};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${superMapperClassPackage};
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${table.comment!} Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
<#if kotlin>
|
||||
interface ${table.mapperName} : ${superMapperClass}<${entity}>
|
||||
<#else>
|
||||
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,20 @@
|
||||
package ${package.Mapper};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${superMapperClassPackage};
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* $!{table.comment} Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
#if(${kotlin})
|
||||
interface ${table.mapperName} : ${superMapperClass}<${entity}>
|
||||
#else
|
||||
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||
|
||||
}
|
||||
#end
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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="${package.Mapper}.${table.mapperName}">
|
||||
|
||||
<#if enableCache>
|
||||
<!-- 开启二级缓存 -->
|
||||
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
|
||||
|
||||
</#if>
|
||||
<#if baseResultMap>
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
|
||||
<#list table.fields as field>
|
||||
<#if field.keyFlag><#--生成主键排在第一位-->
|
||||
<id column="${field.name}" property="${field.propertyName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
<#list table.commonFields as field><#--生成公共字段 -->
|
||||
<result column="${field.name}" property="${field.propertyName}" />
|
||||
</#list>
|
||||
<#list table.fields as field>
|
||||
<#if !field.keyFlag><#--生成普通字段 -->
|
||||
<result column="${field.name}" property="${field.propertyName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
|
||||
</#if>
|
||||
<#if baseColumnList>
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
<#list table.commonFields as field>
|
||||
${field.name},
|
||||
</#list>
|
||||
${table.fieldNames}
|
||||
</sql>
|
||||
|
||||
</#if>
|
||||
</mapper>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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="${package.Mapper}.${table.mapperName}">
|
||||
|
||||
#if(${enableCache})
|
||||
<!-- 开启二级缓存 -->
|
||||
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
|
||||
|
||||
#end
|
||||
#if(${baseResultMap})
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
|
||||
#foreach($field in ${table.fields})
|
||||
#if(${field.keyFlag})##生成主键排在第一位
|
||||
<id column="${field.name}" property="${field.propertyName}" />
|
||||
#end
|
||||
#end
|
||||
#foreach($field in ${table.commonFields})##生成公共字段
|
||||
<result column="${field.name}" property="${field.propertyName}" />
|
||||
#end
|
||||
#foreach($field in ${table.fields})
|
||||
#if(!${field.keyFlag})##生成普通字段
|
||||
<result column="${field.name}" property="${field.propertyName}" />
|
||||
#end
|
||||
#end
|
||||
</resultMap>
|
||||
|
||||
#end
|
||||
#if(${baseColumnList})
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
#foreach($field in ${table.commonFields})
|
||||
${field.name},
|
||||
#end
|
||||
${table.fieldNames}
|
||||
</sql>
|
||||
|
||||
#end
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
package ${package.Service};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${superServiceClassPackage};
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${table.comment!} 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
<#if kotlin>
|
||||
interface ${table.serviceName} : ${superServiceClass}<${entity}>
|
||||
<#else>
|
||||
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
|
||||
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,20 @@
|
||||
package ${package.Service};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${superServiceClassPackage};
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* $!{table.comment} 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
#if(${kotlin})
|
||||
interface ${table.serviceName} : ${superServiceClass}<${entity}>
|
||||
#else
|
||||
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
|
||||
|
||||
}
|
||||
#end
|
||||
@@ -0,0 +1,26 @@
|
||||
package ${package.ServiceImpl};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
import ${superServiceImplClassPackage};
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${table.comment!} 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Service
|
||||
<#if kotlin>
|
||||
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
|
||||
|
||||
}
|
||||
<#else>
|
||||
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
|
||||
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,26 @@
|
||||
package ${package.ServiceImpl};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
import ${superServiceImplClassPackage};
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* $!{table.comment} 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Service
|
||||
#if(${kotlin})
|
||||
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
|
||||
|
||||
}
|
||||
#else
|
||||
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
|
||||
|
||||
}
|
||||
#end
|
||||
Reference in New Issue
Block a user