Browse Source

初始化

DLC 2 months ago
parent
commit
04333ab39a

+ 44 - 0
qcs-common/pom.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>qcs-business</artifactId>
+        <groupId>com.rongwei</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>qcs-common</artifactId>
+
+    <properties>
+        <mysql.version>8.0.11</mysql.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.rongwei</groupId>
+            <artifactId>qcs-entity</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.1.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>${mysql.version}</version>
+        </dependency>
+
+    </dependencies>
+</project>

+ 158 - 0
qcs-common/src/main/java/com/rongwei/bscommon/sys/utils/CodeGeneration.java

@@ -0,0 +1,158 @@
+package com.rongwei.bscommon.sys.utils;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.InjectionConfig;
+import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.po.TableFill;
+import com.baomidou.mybatisplus.generator.config.po.TableInfo;
+import com.baomidou.mybatisplus.generator.config.rules.DateType;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.rongwei.rwcommon.base.BaseDo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author admin
+ */
+public class CodeGeneration {
+
+    //main函数
+    public static void main(String[] args) {
+
+        AutoGenerator autoGenerator = new AutoGenerator();
+        // 项目路径
+        String projectPath = System.getProperty("user.dir");
+
+        //全局配置
+        GlobalConfig gc = new GlobalConfig();
+        //生成文件输出根目录
+        gc.setOutputDir("E:\\temp");
+        //生成完成后不弹出文件框
+        gc.setOpen(false);
+        gc.setFileOverride(true);  //文件覆盖
+        gc.setActiveRecord(false);// 不需要ActiveRecord特性的请改为false
+        gc.setEnableCache(false);// XML 二级缓存
+        gc.setBaseResultMap(true);// XML ResultMap
+        gc.setBaseColumnList(false);// XML columList
+        gc.setAuthor("fpy");// 作者
+        gc.setDateType(DateType.ONLY_DATE);
+
+        // 自定义文件命名,注意 %s 会自动填充表实体属性!
+        gc.setControllerName("%sController");
+        gc.setServiceName("%sService");
+        gc.setServiceImplName("%sServiceImpl");
+        gc.setMapperName("%sDao");
+        gc.setXmlName("%sDao");
+        autoGenerator.setGlobalConfig(gc);
+
+        // 数据源配置
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setDbType(DbType.MYSQL);   //设置数据库类型,我是postgresql
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("rootfpy");
+        dsc.setUrl("jdbc:mysql://localhost:3306/incontrol?characterEncoding=utf8&failOverReadOnly=false&autoReconnect=true&roundRobinLoadBalance=true&serverTimezone=GMT%2B8&useSSL=false&allowMultiQueries=true&databaseTerm=SCHEMA");  //指定数据库
+        autoGenerator.setDataSource(dsc);
+
+        // 3、包的配置
+        PackageConfig pc = new PackageConfig();
+        // pc.setModuleName("blog"); // 生成到指定模块中
+        pc.setParent("com.rongwei");
+        pc.setEntity("bsentity.domain");
+        pc.setMapper("bscommon.sys.dao");
+        pc.setService("bscommon.sys.service");
+        pc.setServiceImpl("bscommon.sys.service.impl");
+        pc.setController("bsserver.controller");
+        autoGenerator.setPackageInfo(pc);
+
+        // 自定义模板
+        TemplateConfig templateConfig = new TemplateConfig();
+        templateConfig.setController("/gentemplates/controller.java.vm");
+        templateConfig.setEntity("/gentemplates/entity.java.vm");
+        templateConfig.setMapper("/gentemplates/mapper.java.vm");
+        templateConfig.setService("/gentemplates/service.java.vm");
+        templateConfig.setServiceImpl("/gentemplates/serviceImpl.java.vm");
+        autoGenerator.setTemplate(templateConfig);
+
+        // 4、策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setSuperEntityClass(BaseDo.class);
+        strategy.setRestControllerStyle(true);
+        // 设置要映射的表名(重要,需要修改的地方)
+        strategy.setInclude("srm_balance");
+        strategy.setNaming(NamingStrategy.underline_to_camel); // 自动转换表名的驼峰命名法
+        strategy.setColumnNaming(NamingStrategy.no_change); // 自动转换列名的驼峰命名法
+        strategy.setEntityLombokModel(true); // 是否使用lombox
+        strategy.setLogicDeleteFieldName("deleted"); // 配置逻辑删除字段
+        // 自动填充策略
+        TableFill gmtCreate =  new TableFill("create", FieldFill.INSERT);
+        TableFill gmtModified =  new TableFill("updated", FieldFill.INSERT);
+        ArrayList<TableFill> tableFills = new ArrayList<>();
+        tableFills.add(gmtCreate);
+        tableFills.add(gmtModified);
+//        strategy.setTableFillList(tableFills);
+        // 乐观锁
+        strategy.setVersionFieldName("version");
+
+        autoGenerator.setStrategy(strategy);
+
+        // 自定义配置
+        InjectionConfig cfg = new InjectionConfig() {
+            @Override
+            public void initMap() {
+                // to do nothing
+            }
+        };
+        //自定义输出配置
+        List<FileOutConfig> focList = new ArrayList<>();
+        String controllerParentPath = projectPath + "\\business-server\\src\\main\\java\\com\\rongwei\\bsserver\\controller\\";
+        String entityParentPath = projectPath + "\\business-entity\\src\\main\\java\\com\\rongwei\\bsentity\\domain\\";
+        String commonPath = projectPath + "\\business-common\\src\\main\\java\\com\\rongwei\\bscommon\\sys\\";
+        // 自定义配置会被优先输出
+        focList.add(new FileOutConfig("/gentemplates/controller.java.vm") {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                return controllerParentPath + tableInfo.getEntityName() + "Controller" + StringPool.DOT_JAVA;
+            }
+        });
+        focList.add(new FileOutConfig("/gentemplates/entity.java.vm") {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                return entityParentPath + tableInfo.getEntityName() + "Do" + StringPool.DOT_JAVA;
+            }
+        });
+        focList.add(new FileOutConfig("/gentemplates/mapper.java.vm") {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                return commonPath + "dao\\" + tableInfo.getEntityName() + "Dao" + StringPool.DOT_JAVA;
+            }
+        });
+        focList.add(new FileOutConfig("/gentemplates/service.java.vm") {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                return commonPath + "service\\" + tableInfo.getEntityName() + "Service" + StringPool.DOT_JAVA;
+            }
+        });
+        focList.add(new FileOutConfig("/gentemplates/serviceImpl.java.vm") {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                return commonPath + "service\\impl\\" + tableInfo.getEntityName() + "ServiceImpl" + StringPool.DOT_JAVA;
+            }
+        });
+        cfg.setFileOutConfigList(focList);
+
+        autoGenerator.setCfg(cfg);
+
+        autoGenerator.execute(); // 执行
+    }
+
+}

+ 39 - 0
qcs-common/src/main/resources/gentemplates/controller.java.ftl

@@ -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>

+ 40 - 0
qcs-common/src/main/resources/gentemplates/controller.java.vm

@@ -0,0 +1,40 @@
+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

+ 152 - 0
qcs-common/src/main/resources/gentemplates/entity.java.ftl

@@ -0,0 +1,152 @@
+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>
+
+<#if entitySerialVersionUID>
+    private static final long serialVersionUID = 1L;
+</#if>
+<#-- ----------  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>
+}

+ 156 - 0
qcs-common/src/main/resources/gentemplates/entity.java.vm

@@ -0,0 +1,156 @@
+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}Do extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
+#elseif(${activeRecord})
+public class ${entity}Do extends Model<${entity}> {
+#else
+public class ${entity}Do implements Serializable {
+#end
+
+#if(${entitySerialVersionUID})
+    private static final long serialVersionUID=1L;
+#end
+
+## ----------  BEGIN 字段循环遍历  ----------
+#foreach($field in ${table.fields})
+## ----------  BEGIN BaseDo中的字段不需要展示  ----------
+#if($field.propertyName != "deleted" && $field.propertyName != "remark" && $field.propertyName != "createdate" && $field.propertyName != "createuserid" && $field.propertyName != "createusername" && $field.propertyName != "modifydate" && $field.propertyName != "modifyuserid" && $field.propertyName != "modifyusername")
+#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
+## ----------  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
+}

+ 115 - 0
qcs-common/src/main/resources/gentemplates/entity.kt.ftl

@@ -0,0 +1,115 @@
+package ${package.Entity}
+
+<#list table.importPackages as pkg>
+import ${pkg}
+</#list>
+<#if swagger2>
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+</#if>
+/**
+ * <p>
+ * ${table.comment}
+ * </p>
+ *
+ * @author ${author}
+ * @since ${date}
+ */
+<#if table.convert>
+@TableName("${table.name}")
+</#if>
+<#if swagger2>
+    @ApiModel(value="${entity}对象", description="${table.comment!}")
+</#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>
+<#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>
+    <#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>
+        "}"
+    }
+}

+ 114 - 0
qcs-common/src/main/resources/gentemplates/entity.kt.vm

@@ -0,0 +1,114 @@
+package ${package.Entity};
+
+#foreach($pkg in ${table.importPackages})
+import ${pkg};
+#end
+#if(${swagger2})
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+#end
+/**
+ * <p>
+ * $!{table.comment}
+ * </p>
+ *
+ * @author ${author}
+ * @since ${date}
+ */
+#if(${table.convert})
+@TableName("${table.name}")
+#end
+#if(${swagger2})
+@ApiModel(value="${entity}对象", description="$!{table.comment}")
+#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" != "")
+    #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
+    #if(${field.propertyType} == "Integer")
+    var ${field.propertyName}: Int? = null
+    #else
+    var ${field.propertyName}: ${field.propertyType}? = null
+    #end
+#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 null
+#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
+        "}"
+    }
+}

+ 20 - 0
qcs-common/src/main/resources/gentemplates/mapper.java.ftl

@@ -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>

+ 20 - 0
qcs-common/src/main/resources/gentemplates/mapper.java.vm

@@ -0,0 +1,20 @@
+package ${package.Mapper};
+
+import ${package.Entity}.${entity}Do;
+import ${superMapperClassPackage};
+
+/**
+ * <p>
+ * $!{table.comment} Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since ${date}
+ */
+#if(${kotlin})
+interface ${table.mapperName} : ${superMapperClass}<${entity}Do>
+#else
+public interface ${table.mapperName} extends ${superMapperClass}<${entity}Do> {
+
+}
+#end

+ 39 - 0
qcs-common/src/main/resources/gentemplates/mapper.xml.ftl

@@ -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>

+ 39 - 0
qcs-common/src/main/resources/gentemplates/mapper.xml.vm

@@ -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>

+ 20 - 0
qcs-common/src/main/resources/gentemplates/service.java.ftl

@@ -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>

+ 20 - 0
qcs-common/src/main/resources/gentemplates/service.java.vm

@@ -0,0 +1,20 @@
+package ${package.Service};
+
+import ${package.Entity}.${entity}Do;
+import ${superServiceClassPackage};
+
+/**
+ * <p>
+ * $!{table.comment} 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since ${date}
+ */
+#if(${kotlin})
+interface ${table.serviceName} : ${superServiceClass}<${entity}Do>
+#else
+public interface ${table.serviceName} extends ${superServiceClass}<${entity}Do> {
+
+}
+#end

+ 26 - 0
qcs-common/src/main/resources/gentemplates/serviceImpl.java.ftl

@@ -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>

+ 26 - 0
qcs-common/src/main/resources/gentemplates/serviceImpl.java.vm

@@ -0,0 +1,26 @@
+package ${package.ServiceImpl};
+
+import ${package.Entity}.${entity}Do;
+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}Do>(), ${table.serviceName} {
+
+}
+#else
+public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}Do> implements ${table.serviceName} {
+
+}
+#end

+ 33 - 0
qcs-entity/pom.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>qcs-business</artifactId>
+        <groupId>com.rongwei</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>qcs-entity</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.rongwei</groupId>
+            <artifactId>rw-common-config</artifactId>
+            <version>1.1-SNAPSHOT</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.rongwei</groupId>
+                    <artifactId>rw-common-license</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>com.rongwei</groupId>
+            <artifactId>rw-common-utils</artifactId>
+            <version>1.1-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>

+ 87 - 0
qcs-server/pom.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>qcs-business</artifactId>
+        <groupId>com.rongwei</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>qcs-server</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.rongwei</groupId>
+            <artifactId>qcs-common</artifactId>
+            <version>1.0-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- Spring Cloud Begin -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.nacos</groupId>
+            <artifactId>nacos-client</artifactId>
+            <version>1.4.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-freemarker</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-jdbc</artifactId>
+        </dependency>
+
+        <!-- druid -->
+        <dependency>
+            <groupId>com.github.drtrang</groupId>
+            <artifactId>druid-spring-boot2-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 21 - 0
qcs-server/src/main/java/com/rongwei/BusinessServerApplication.java

@@ -0,0 +1,21 @@
+package com.rongwei;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+@EnableAsync
+@SpringBootApplication
+@EnableDiscoveryClient
+@EnableFeignClients
+@MapperScan("com.rongwei.*.*.dao")
+public class BusinessServerApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(BusinessServerApplication.class, args);
+    }
+
+}

+ 13 - 0
qcs-server/src/main/resources/bootstrap-dev.yml

@@ -0,0 +1,13 @@
+spring:
+  cloud:
+    nacos:
+      config:
+        file-extension: yaml
+        server-addr: 127.0.0.1:8848
+        namespace: cd047569-9470-4dfb-8663-b113d01cd30f
+        ext-config[0]:
+          data-id: common-config.yaml
+      discovery:
+        server-addr: 127.0.0.1:8848
+        namespace: cd047569-9470-4dfb-8663-b113d01cd30f
+

+ 10 - 0
qcs-server/src/main/resources/bootstrap-pro.yml

@@ -0,0 +1,10 @@
+spring:
+  cloud:
+    nacos:
+      config:
+        file-extension: yaml
+        server-addr: 127.0.0.1:8848
+        namespace: 75f91d9a-0dd2-4dd9-98f6-61a221d396f1
+      discovery:
+        server-addr: 127.0.0.1:8848
+        namespace: 75f91d9a-0dd2-4dd9-98f6-61a221d396f1

+ 53 - 0
qcs-server/src/main/resources/bootstrap.yml

@@ -0,0 +1,53 @@
+spring:
+  profiles:
+    active: dev
+  application:
+    name: qcsBusiness
+  jta:
+    atomikos:
+      properties:
+        log-base-name: rwbusinesslog
+  servlet:
+    multipart:
+      max-file-size: 100MB
+      max-request-size: 1000MB
+server:
+  port: 9689
+
+management:
+  endpoints:
+    web:
+      exposure:
+        include: "*"
+feign:
+  client:
+    config:
+      default:
+        connectTimeout: 5000
+        readTimeout: 5000
+  sentinel:
+    enabled: true
+jwt:
+  token-header: Authorization
+  expire: 14400
+  rsa-secret: xx1WET12^%3^(WE45
+client:
+  id: ace-auth
+  secret: 123456
+  token-header: x-client-token
+  expire: 14400
+  rsa-secret: x2318^^(*WRYQWR(QW&T
+mybatis-plus:
+  configuration:
+    #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
+    map-underscore-to-camel-case: false
+  #basepackage: com.rongwei.rwadmin.system.dao
+  xmlLocation: classpath:mybatis/**/*Dao.xml
+  mapperLocations: "classpath:mybatis/**/*Dao.xml"
+  typeAliasesPackage: com.rongwei.bsentity.domain
+  global-config:
+    db-config:
+      logic-delete-value: 1
+      logic-not-delete-value: 0
+      column-like: true

+ 36 - 0
qcs-server/src/main/resources/logback-spring.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration  scan="true" scanPeriod="60 seconds" debug="false">
+    <contextName>logback</contextName>
+    <!--输出到控制台-->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <!--按天生成日志-->
+    <appender name="logFile"  class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <Prudent>true</Prudent>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <FileNamePattern>
+                business-log/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log
+            </FileNamePattern>
+        </rollingPolicy>
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <Pattern>
+                %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level -%msg%n
+            </Pattern>
+        </layout>
+    </appender>
+
+    <logger name="com.bootdo" additivity="false">
+        <appender-ref ref="console"/>
+        <appender-ref ref="logFile" />
+    </logger>
+
+    <root level="error">
+        <appender-ref ref="console"/>
+        <appender-ref ref="logFile" />
+    </root>
+
+</configuration>