diff --git a/README.md b/README.md index 06fd742772b6b09f98432e6eb251de1823b675f7..9fda52ee3c7e5efa190bab0e499938541528846b 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ coderMaker 立足于低代码平台,致力于解决软件开发过程中的效 3. 不做任何脚手架,不依赖任何特定框架版本 4. 按开发者习惯支持多模式生成 5. 兼容并蓄,在codemaker的组件化架构设计中一切业务组件,中间件,脚手架都是组件都是可配置可融入到代码生成流程的。 +6. 生成即可运行 #### 功能列表 1. 提供数据库字段文本转sql脚本的能力 @@ -37,7 +38,7 @@ coderMaker 立足于低代码平台,致力于解决软件开发过程中的效 1. 粉红色为codeMaker提供的平台能力工程 2. 浅蓝色为生成代码架构的模板工程 -[模块详细说明](MODULE.md) +[模块详细说明](doc/md/MODULE.md) ##### 2. 架构图 1. v1版本 @@ -49,6 +50,9 @@ coderMaker 立足于低代码平台,致力于解决软件开发过程中的效 3. v3预览版本 ![image](doc/img/天画-低代码平台(codeMaker)-v3-预览版.png) + 3. v3版本 +![image](doc/img/天画-低代码平台(codeMaker)-v3版本.png) + ##### 3. 使用流程图 1. v1版本 ![image](doc/img/天画-快速生成springboot微服务工程流程图.png) @@ -77,21 +81,23 @@ coderMaker 立足于低代码平台,致力于解决软件开发过程中的效 ##### 版本3的技术方案设计 [codeMaker-支持动态调用时序代码生成](https://mp.weixin.qq.com/s?__biz=MzI2OTE2OTc3MQ==&mid=2247484106&idx=1&sn=acacbf015246351c7662c900d878e6af&chksm=eae527cedd92aed8de8452dd83061bc729a3007d30d3bbe786abca08c7337530f214a8334f98&token=1918485743&lang=zh_CN#rd) +[codeMaker-组件化架构升级实战](https://blog.csdn.net/u010504064/article/details/122480997) #### 使用手册 codeMaker支持多模式进行代码生成,具体看下列文档 -##### [纯数据库模式](USEDBYONLYDB.md) +##### [纯数据库模式](doc/md/USEDBYONLYDB.md) -##### [基于PlantUML 的动态DDD模式](USEDBYDYNAMICDDD.md) +##### [基于PlantUML 的动态DDD模式](doc/md/USEDBYDYNAMICDDD.md) -##### [基于PlantUML 的动态DDD+数据库模式](USEDBYDBANDDDD.md) +##### [基于PlantUML 的动态DDD+数据库模式](doc/md/USEDBYDBANDDDD.md) -##### [基于PlantUML 的动态DDD+数据库+plantUML调用时序图文档模式](USEDBYDBANDPLANTUML.md) +##### [基于PlantUML 的动态DDD+数据库+plantUML调用时序图文档模式](doc/md/USEDBYDBANDPLANTUML.md) -##### 基于PlantUML 的动态DDD+基于PlantUML的E-R数据模型模式(todo) +##### [基于全文档模式](doc/md/USEDBYALLDOC.md) +##### [基于JavsScript项目模式](doc/md/USEDBYJAVSSCRIPT.md) -#### [版本变更-详细内容](CHANGELIST.md) +#### [版本变更-详细内容](doc/md/CHANGELIST.md) ##### 版本-1.0.0 @@ -125,18 +131,21 @@ codeMaker支持多模式进行代码生成,具体看下列文档 简介: 进行组件化架构升级,开放低代码模型和扩展接口能力,重构codemaker-core模块,移动到codemaker-parent模块统一维护, 增加springcloud-feign应用框架代码生成能力 +##### 版本-1.3.0 +简介: 以生成即可运行为目标完成组件化架构升级,以组件市场的方式融合各种java组件和技术栈, +增加两种生成模式,对接javsScript引擎细化生成逻辑 #### 项目计划 1. 参考todoList文件内容 -2. [参考changeList文件内容](CHANGELIST.md) +2. [参考changeList文件内容](doc/md/CHANGELIST.md) #### 配置文件说明 -[组件注册流程与二次开发说明文档](COMPOENTREGIST.md) +[组件注册流程与二次开发说明文档](doc/md/COMPOENTREGIST.md) -[开发使用详细配置内容](CONFIG.md) +[开发使用详细配置内容](doc/md/CONFIG.md) -[构建DDD-plantUML领域文档使用说明](DDDPLANTUMLDOC.md) +[构建DDD-plantUML领域文档使用说明](doc/md/DDDPLANTUMLDOC.md) #### 代码生成服务使用流程 ##### 1.应用级项目生成 @@ -155,21 +164,6 @@ codeMaker支持多模式进行代码生成,具体看下列文档 4. 执行完毕查看codemaker-dynamicddd工程模块下的代码是否已经生成 ##### 3.接口文档 -[API.md](API.md) - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支,需求todo参考todoList文档 -3. 提交代码 -4. 新建 Pull Request - +[API.md](doc/md/API.md) -#### 码云特技 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) \ No newline at end of file diff --git a/codemaker-cola/cola-domain/pom.xml b/codemaker-cola/cola-domain/pom.xml index 3e2db3053ed576f5cd1981b8c420ad239d7df514..1669e45efb774ac3c8c4d346080d3c178a174c84 100644 --- a/codemaker-cola/cola-domain/pom.xml +++ b/codemaker-cola/cola-domain/pom.xml @@ -35,7 +35,6 @@ org.projectlombok lombok - 1.18.8 diff --git a/codemaker-cola/pom.xml b/codemaker-cola/pom.xml index 39b10d2ed35f2268d4411cf4c5ab706b23122058..9e3cf775a660d585b768405a4ce534f3bc31a4bf 100644 --- a/codemaker-cola/pom.xml +++ b/codemaker-cola/pom.xml @@ -114,11 +114,6 @@ 1.2.72 - - com.dtflys.forest - forest-spring-boot-starter - 1.5.16 - commons-lang diff --git a/codemaker-core/.idea/.gitignore b/codemaker-core/.idea/.gitignore deleted file mode 100644 index 5c98b428844d9f7d529e2b6fb918d15bf072f3df..0000000000000000000000000000000000000000 --- a/codemaker-core/.idea/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Default ignored files -/workspace.xml \ No newline at end of file diff --git a/codemaker-core/codermaker-core.iml b/codemaker-core/codermaker-core.iml deleted file mode 100644 index 7db19df1967ddd6ad7117771b3089f052d137b69..0000000000000000000000000000000000000000 --- a/codemaker-core/codermaker-core.iml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/ErPictureBean.java b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/ErPictureBean.java index 91ef5054d452dc5dee93de6dc3002404c2718b36..0f29c1e55361b87620258f67a07821c09dd30e4d 100644 --- a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/ErPictureBean.java +++ b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/ErPictureBean.java @@ -6,7 +6,7 @@ import java.util.Map; * Description:e-r图示例 * date: 2020/10/20 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/TableBean.java b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/TableBean.java index f2fc2bc21d732aeed564172edbb2b9b4167cbe70..8e17b94ad2bcd3db4498322190faba408ebfe122 100644 --- a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/TableBean.java +++ b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/bean/TableBean.java @@ -5,7 +5,7 @@ import java.util.List; /** * Created on 2018-7-19. * - * @author: fanchunshuai + * @author: shenshuai * @version: V1.0 * @Desc:表信息描述 */ diff --git a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureService.java b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureService.java index 91b6a06f015b5dae45ea9034bcdb28c740ad17d9..13a5ff9ec9f76b2e242f7efe97b11d8ac109ebc7 100644 --- a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureService.java +++ b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureService.java @@ -9,7 +9,7 @@ import java.util.List; * Description: 生成e-r图的服务接口 * date: 2020/10/20 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceHelper.java b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceHelper.java index 04a5f8e9a09e99a83d850610959e213b91c56590..67e8d7c09324596d848325bd4b0a93a12da1cc43 100644 --- a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceHelper.java +++ b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceHelper.java @@ -16,7 +16,7 @@ import java.util.stream.Collectors; * Description: 辅助类 * date: 2020/10/20 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceImpl.java b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceImpl.java index cf3c9b2031b8ab8590cf7fc8d84ab051dd7dfb49..a503c85dc23b8d64df4201c67b080719cda26917 100644 --- a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceImpl.java +++ b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureServiceImpl.java @@ -11,7 +11,7 @@ import java.util.Map; * Description: * date: 2020/10/20 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureWriteService.java b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureWriteService.java index 3a9eea608bcb18a7df5958b418d8d8c31e14c1e6..dc4910ef16f8ec2de8f03ddab321ba4bfc470dc3 100644 --- a/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureWriteService.java +++ b/codemaker-dberPicture/src/main/java/com/coderman/codemaker/dbergenerate/service/ErPictureWriteService.java @@ -11,7 +11,7 @@ import java.util.Map; * Description: * date: 2020/10/20 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dberparse/pom.xml b/codemaker-dberparse/pom.xml index 38d1c10ae753cdec03cced288ade1ecdbeccec85..d1fa26a2625b7cf377a7c604669aaa88ca79f3d6 100644 --- a/codemaker-dberparse/pom.xml +++ b/codemaker-dberparse/pom.xml @@ -6,7 +6,7 @@ com.coderman.codermaker.dberparse codemaker-dberparse - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT codemaker-dberparse diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Constants.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Constants.java index 768be8a596379caea181b573949f0dea35ba0ab8..aa9cb4c0b7fc1aa06536372d8c7778b5cb4bdd6d 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Constants.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Constants.java @@ -4,7 +4,7 @@ package com.coderman.codemaker.dberparse; * Description: * date: 2021/8/19 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPantUMLParseService.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPlantUMLParseService.java similarity index 55% rename from codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPantUMLParseService.java rename to codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPlantUMLParseService.java index 5b046270f3c56aac23851855d9a8f2625416c840..e2d13e84c83b78b72073f2226cb2a4a976e70c6b 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPantUMLParseService.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPlantUMLParseService.java @@ -1,5 +1,6 @@ package com.coderman.codemaker.dberparse; +import com.coderman.codemaker.dberparse.bean.EntityBean; import com.coderman.codemaker.dberparse.bean.ParseRequestBean; import java.util.List; @@ -8,15 +9,24 @@ import java.util.List; * Description: * date: 2021/8/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ -public interface ERPantUMLParseService { +public interface ERPlantUMLParseService { /** * e-r图解析入口 * @param contentList * @return 解析完成的DDL语句 */ List parseERPlantUML(List contentList); + + /** + * 根据plantuml 内容构建数据库表模型 + * @param contentList + * @return + */ + List getPlantUmlContextBean(List contentList); + + } diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPantUMLParseServiceImpl.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPlantUMLParseServiceImpl.java similarity index 52% rename from codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPantUMLParseServiceImpl.java rename to codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPlantUMLParseServiceImpl.java index 3e528cd99063a5e7aff5bbc940dc6bff9f6ef277..8d358c9bedfb0bc1282c249a907fd8bcc15fc1de 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPantUMLParseServiceImpl.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/ERPlantUMLParseServiceImpl.java @@ -1,131 +1,139 @@ package com.coderman.codemaker.dberparse; -import com.alibaba.fastjson.JSON; import com.coderman.codemaker.dberparse.bean.EntityBean; import com.coderman.codemaker.dberparse.bean.EntityFieldBean; -import com.coderman.codemaker.dberparse.bean.ParseRequestBean; import com.coderman.codemaker.dberparse.enums.ColumnTypeEnums; import org.apache.commons.lang.StringUtils; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * Description: * date: 2021/8/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ -public class ERPantUMLParseServiceImpl implements ERPantUMLParseService { +public class ERPlantUMLParseServiceImpl implements ERPlantUMLParseService { @Override public List parseERPlantUML(List contentList) { List list = getPlantUmlContextBean(contentList); - System.out.println(JSON.toJSONString(list)); List ddlList = new ArrayList<>(); - list.stream().forEach(tableEntity-> ddlList.add(getDDLSQL(tableEntity))); + if(CollectionUtils.isEmpty(list)){ + return ddlList; + } + list.stream().forEach(tableEntity -> ddlList.add(getDDLSQL(tableEntity))); return ddlList; } /** * 通过表字段模型构建DDL sql + * * @param tableBean * @return */ - private String getDDLSQL(EntityBean tableBean){ + private String getDDLSQL(EntityBean tableBean) { StringBuilder sqlBuilder = new StringBuilder(); - sqlBuilder.append("CREATE TABLE `" + tableBean.getTableName()+"`("); - for (EntityFieldBean entityFieldBean : tableBean.getColumnBeanList()){ - sqlBuilder.append("`" + entityFieldBean.getColumnName() + "` "); + sqlBuilder.append("CREATE TABLE `" + tableBean.getTableName() + "`(\n"); + for (EntityFieldBean entityFieldBean : tableBean.getColumnBeanList()) { + sqlBuilder.append("\t`" + entityFieldBean.getColumnName() + "` "); sqlBuilder.append(entityFieldBean.getColumnType()); - if(entityFieldBean.getColumnName().equals("id")){ + if (entityFieldBean.getColumnName().equals("id")) { sqlBuilder.append(" NOT NULL AUTO_INCREMENT "); - }else { - sqlBuilder.append(" NOT NULL DEFAULT "+entityFieldBean.getDefaultValue()); + } else { + sqlBuilder.append(" NOT NULL DEFAULT " + entityFieldBean.getDefaultValue()); } - sqlBuilder.append(" COMMENT '"+entityFieldBean.getColumnDesc()+"',"); + sqlBuilder.append(" COMMENT '" + entityFieldBean.getColumnDesc().trim() + "',\n"); } - if(!CollectionUtils.isEmpty(tableBean.getIndexBeanList())){ - for (EntityFieldBean indexFieldBean : tableBean.getIndexBeanList()){ - if(indexFieldBean.getPkey() != null && indexFieldBean.getPkey()){ - sqlBuilder.append(" PRIMARY KEY (`"+indexFieldBean.getColumnName()+"`),"); + if (!CollectionUtils.isEmpty(tableBean.getIndexBeanList())) { + for (EntityFieldBean indexFieldBean : tableBean.getIndexBeanList()) { + if (indexFieldBean.getPkey() != null && indexFieldBean.getPkey()) { + sqlBuilder.append(" PRIMARY KEY (`" + indexFieldBean.getColumnName() + "`),\n"); continue; } - if(indexFieldBean.getUKey() != null && indexFieldBean.getUKey()){ + if (indexFieldBean.getUKey() != null && indexFieldBean.getUKey()) { String uKeyName = getUkeyIndexName(indexFieldBean.getColumnName()); String uColumnNames = getUkeyColumnName(indexFieldBean.getColumnName()); - sqlBuilder.append(" UNIQUE KEY `"+uKeyName+"` ("+uColumnNames+") COMMENT '联合唯一索引',"); + sqlBuilder.append(" UNIQUE KEY `" + uKeyName + "` (" + uColumnNames + ") COMMENT '联合唯一索引',\n"); continue; } - sqlBuilder.append(" KEY `idx_"+indexFieldBean.getColumnName()+"` (`"+indexFieldBean.getColumnName()+"`),"); + sqlBuilder.append(" KEY `idx_" + indexFieldBean.getColumnName() + "` (`" + indexFieldBean.getColumnName() + "`),\n"); } } - sqlBuilder = sqlBuilder.deleteCharAt(sqlBuilder.length()-1); - sqlBuilder.append(") ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = '"+tableBean.getTableDesc()+"';\n"); - System.out.println(sqlBuilder.toString()); + sqlBuilder = sqlBuilder.deleteCharAt(sqlBuilder.length() - 1); + sqlBuilder.append(") \nENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = '" + tableBean.getTableDesc() + "';\n\n"); + return sqlBuilder.toString(); } - - private String getUkeyIndexName(String columns){ - String [] arr = columns.split(","); + private String getUkeyIndexName(String columns) { + String[] arr = columns.split(","); StringBuilder builder = new StringBuilder("uniq"); - for (String col : arr){ - builder.append("_"+col.substring(0,1)); + for (String col : arr) { + builder.append("_" + col.substring(0, 1)); } return builder.toString(); } /** * 处理联合主键 + * * @param columns * @return */ - private String getUkeyColumnName(String columns){ - String [] arr = columns.split(","); + private String getUkeyColumnName(String columns) { + String[] arr = columns.split(","); StringBuilder builder = new StringBuilder(); - for (String col : arr){ - builder.append("`"+col+"`,"); + for (String col : arr) { + builder.append("`" + col + "`,"); } - return builder.deleteCharAt(builder.length()-1).toString(); + return builder.deleteCharAt(builder.length() - 1).toString(); } /** * 解析plantUML文件内容 + * * @return */ - private List getPlantUmlContextBean(List contentList){ + public List getPlantUmlContextBean(List contentList) { + if(CollectionUtils.isEmpty(contentList)){ + return null; + } + List elementList = new ArrayList<>(); List entityBeanList = new ArrayList<>(); //对entity进行解析 - for(String str : contentList){ - if(StringUtils.isEmpty(str) || str.contains("@startuml") || str.contains("package")){ + for (String str : contentList) { + if (StringUtils.isEmpty(str) || str.contains("@startuml") || str.contains("package")) { continue; } - if(str.trim().contains("{")){ + if (str.trim().contains("{")) { elementList.add(str.trim()); continue; } - if(str.trim().contains("}")){ + if (str.trim().contains("}")) { elementList.add(str.trim()); - parseClassElement(elementList,entityBeanList); + parseClassElement(elementList, entityBeanList); elementList.clear(); continue; } - if(str.trim().contains(":") || (str.trim().contains("key") && str.trim().contains("extend"))){ + if (str.trim().contains(":") || (str.trim().contains("key") && str.trim().contains("extend"))) { elementList.add(str.trim()); } } @@ -136,38 +144,37 @@ public class ERPantUMLParseServiceImpl implements ERPantUMLParseService { /** * 解析文件内容整体路由 + * * @param elementList * @param entityBeanList */ - private void parseClassElement(List elementList, List entityBeanList){ + private void parseClassElement(List elementList, List entityBeanList) { EntityBean columnBean = buildClassBean(elementList); entityBeanList.add(columnBean); } - /** * 解析class类型数据 + * * @param elementList * @return */ - private EntityBean buildClassBean(List elementList ){ + private EntityBean buildClassBean(List elementList) { EntityBean entityBean = new EntityBean(); - String[] array = elementList.get(0).trim().replace("{","").trim().split(" "); + String[] array = elementList.get(0).trim().replace("{", "") + .replace("entity", "") + .replace("as ", "") + .replace("\"", "").trim().split(" "); - String classMetaInfoArr = array[1]; - List columnBeanList = getColumnBeanList(elementList.subList(1,elementList.size())); - List indexBeanList = getIndexBeanList(elementList.subList(1,elementList.size())); + List columnBeanList = getColumnBeanList(elementList.subList(1, elementList.size())); + List indexBeanList = getIndexBeanList(elementList.subList(1, elementList.size())); entityBean.setColumnBeanList(columnBeanList); entityBean.setIndexBeanList(indexBeanList); - if(classMetaInfoArr.contains("-")){ - entityBean.setTableName(classMetaInfoArr.split("-")[0].replace("\"","")); - entityBean.setTableDesc(classMetaInfoArr.split("-")[1].replace("\"","")); - }else { - entityBean.setTableName(classMetaInfoArr.replace("\"","")); - entityBean.setTableDesc(array[2].replace("\"","")); - } + + entityBean.setTableName(array[0]); + entityBean.setTableDesc(array[1]); return entityBean; } @@ -175,42 +182,43 @@ public class ERPantUMLParseServiceImpl implements ERPantUMLParseService { /** * 获取表字段信息 + * * @param elementList * @return */ - private List getColumnBeanList(List elementList){ + private List getColumnBeanList(List elementList) { List fieldBeanList = new ArrayList<>(); - for (String fieldStr : elementList){ - if(fieldStr.contains("key") && fieldStr.contains("extend")){ + for (String fieldStr : elementList) { + if (fieldStr.contains("key") && fieldStr.contains("extend")) { break; } - if(!fieldStr.trim().contains(":")){ + if (!fieldStr.trim().contains(":")) { continue; } String[] fieldArr = fieldStr.trim().split(":"); EntityFieldBean entityFieldBean = new EntityFieldBean(); - String [] tagArr = fieldArr[1].split("/"); + String[] tagArr = fieldArr[1].split("/"); entityFieldBean.setColumnDesc(tagArr[0]); entityFieldBean.setColumnName(fieldArr[0]); - if(tagArr.length == 2) { + if (tagArr.length == 2) { entityFieldBean.setColumnType(tagArr[1]); } - if(tagArr.length == 3) { + if (tagArr.length == 3) { entityFieldBean.setDefaultValue(tagArr[1]); entityFieldBean.setColumnType(tagArr[2]); } - if (StringUtils.isEmpty(entityFieldBean.getDefaultValue())){ - if(ColumnTypeEnums.isInt(entityFieldBean.getColumnType())){ + if (StringUtils.isEmpty(entityFieldBean.getDefaultValue())) { + if (ColumnTypeEnums.isInt(entityFieldBean.getColumnType())) { entityFieldBean.setDefaultValue("0"); } - if(ColumnTypeEnums.isVarchar(entityFieldBean.getColumnType())){ + if (ColumnTypeEnums.isVarchar(entityFieldBean.getColumnType())) { entityFieldBean.setDefaultValue("''"); } - if(ColumnTypeEnums.isDate(entityFieldBean.getColumnType())){ + if (ColumnTypeEnums.isDate(entityFieldBean.getColumnType())) { entityFieldBean.setDefaultValue("'2000-01-01 00:00:00'"); } } @@ -222,38 +230,39 @@ public class ERPantUMLParseServiceImpl implements ERPantUMLParseService { /** * 获取索引信息 + * * @param elementList * @return */ - private List getIndexBeanList(List elementList){ + private List getIndexBeanList(List elementList) { List indexBeanList = new ArrayList<>(); - int index = 0; - for (int i = 0;i < elementList.size();i ++){ + int index = 0; + for (int i = 0; i < elementList.size(); i++) { - if(elementList.get(i).contains("key") && elementList.get(i).contains("extend")){ - index = i+1; + if (elementList.get(i).contains("key") && elementList.get(i).contains("extend")) { + index = i + 1; break; } } - for (String fieldStr : elementList.subList(index,elementList.size())){ - EntityFieldBean indexFieldBean =new EntityFieldBean(); - if(!fieldStr.contains(":")){ + for (String fieldStr : elementList.subList(index, elementList.size())) { + EntityFieldBean indexFieldBean = new EntityFieldBean(); + if (!fieldStr.contains(":")) { continue; } - String [] indexArr = fieldStr.split(":"); - if(indexArr[0].toLowerCase().equals(Constants.PKEY)){ + String[] indexArr = fieldStr.split(":"); + if (indexArr[0].toLowerCase().equals(Constants.PKEY)) { indexFieldBean.setPkey(true); indexFieldBean.setColumnName(indexArr[1]); indexBeanList.add(indexFieldBean); } - if(indexArr[0].toLowerCase().equals(Constants.UKEY)){ + if (indexArr[0].toLowerCase().equals(Constants.UKEY)) { indexFieldBean.setUKey(true); indexFieldBean.setColumnName(indexArr[1]); indexBeanList.add(indexFieldBean); } - if(indexArr[0].toLowerCase().equals(Constants.KEY)){ + if (indexArr[0].toLowerCase().equals(Constants.KEY)) { indexFieldBean.setColumnName(indexArr[1]); indexBeanList.add(indexFieldBean); } @@ -262,4 +271,20 @@ public class ERPantUMLParseServiceImpl implements ERPantUMLParseService { return indexBeanList; } + /** + * 判断字符串中是否包含中文 + * + * @param str 待校验字符串 + * @return 是否为中文 + * @warn 不能校验是否为中文标点符号 + */ + public static boolean isContainChinese(String str) { + Pattern p = Pattern.compile("[\u4e00-\u9fa5]"); + Matcher m = p.matcher(str); + if (m.find()) { + return true; + } + return false; + } + } diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Main.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Main.java index 79bbda892f523e323a694b29d31216d89e1d6d91..adb236bc3d4e8c40ddf1d8e9bcecf6c2c069c47b 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Main.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/Main.java @@ -1,6 +1,5 @@ package com.coderman.codemaker.dberparse; -import com.coderman.codemaker.dberparse.bean.ParseRequestBean; import org.apache.commons.io.FileUtils; import org.springframework.util.ResourceUtils; @@ -12,13 +11,13 @@ import java.util.List; * Description: * date: 2021/8/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ public class Main { public static void main(String[] args) { - ERPantUMLParseService erPantUMLParseService = new ERPantUMLParseServiceImpl(); + ERPlantUMLParseService erPantUMLParseService = new ERPlantUMLParseServiceImpl(); erPantUMLParseService.parseERPlantUML(readPlantUMLContent()); } diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityBean.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityBean.java index 2d5960bf107222e4181e77837b64b1309cc10a06..e9a53a55131ea8b772316ffd592320e7aca926df 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityBean.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityBean.java @@ -6,7 +6,7 @@ import java.util.List; * Description: * date: 2021/8/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 表entity模型 diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityFieldBean.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityFieldBean.java index ca9b0c293e65769c5af8b735cd3e80fb055de101..e5b1af611855d0f0949124e4427492b199d3ab29 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityFieldBean.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/EntityFieldBean.java @@ -4,7 +4,7 @@ package com.coderman.codemaker.dberparse.bean; * Description: * date: 2021/8/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 表字段模型 diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/ParseRequestBean.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/ParseRequestBean.java index b3ceb58c46e4f2f73f59428b1f18b026ffb1c770..5dc43bb692bf7744bd944c4d678b82317f347f3b 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/ParseRequestBean.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/bean/ParseRequestBean.java @@ -6,7 +6,7 @@ import java.util.List; * Description: * date: 2021/8/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/enums/ColumnTypeEnums.java b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/enums/ColumnTypeEnums.java index f28748d2869b62a9b7b8a45013cf86e32cc264c3..3834a9cf1ab0a911cf94d79a5190691fe7a259f6 100644 --- a/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/enums/ColumnTypeEnums.java +++ b/codemaker-dberparse/src/main/java/com/coderman/codemaker/dberparse/enums/ColumnTypeEnums.java @@ -4,7 +4,7 @@ package com.coderman.codemaker.dberparse.enums; * Description: * date: 2021/8/13 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dbops/pom.xml b/codemaker-dbops/pom.xml index b06a11eac393de7af9e0cae3c0d08a9b5c61a543..b9a7ee5221a3565a7ed88ee01d66fc42ab07e69b 100644 --- a/codemaker-dbops/pom.xml +++ b/codemaker-dbops/pom.xml @@ -73,7 +73,7 @@ com.coderman.codermaker.dberparse codemaker-dberparse - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT diff --git a/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/controller/GeneratorSqlDDLController.java b/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/controller/GeneratorSqlDDLController.java index e92c8abcc2ce4a83f1bc2694817d1b213b79d376..c9a625a21c83c1ed9759bdab75bc2c245d7323ae 100644 --- a/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/controller/GeneratorSqlDDLController.java +++ b/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/controller/GeneratorSqlDDLController.java @@ -1,6 +1,5 @@ package com.coderman.codemaker.dbops.controller; -import com.coderman.codemaker.dberparse.bean.ParseRequestBean; import com.coderman.codemaker.dbops.service.DBErParseService; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -17,7 +16,7 @@ import java.io.IOException; * Description: * date: 2021/8/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseService.java b/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseService.java index 071ba1b23ea95363194a95b4ce2659131bc39fe6..54e8d3a536c7263c9bdf903adb436bcc61c47328 100644 --- a/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseService.java +++ b/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseService.java @@ -10,7 +10,7 @@ import java.util.List; * Description: * date: 2021/8/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseServiceImpl.java b/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseServiceImpl.java index 05d43719987b1d97a7830d679aa5aea3b4bbe8e2..290f84ed0bae71081782e05d1db4b76000aa3dcb 100644 --- a/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseServiceImpl.java +++ b/codemaker-dbops/src/main/java/com/coderman/codemaker/dbops/service/DBErParseServiceImpl.java @@ -1,7 +1,7 @@ package com.coderman.codemaker.dbops.service; -import com.coderman.codemaker.dberparse.ERPantUMLParseService; -import com.coderman.codemaker.dberparse.ERPantUMLParseServiceImpl; +import com.coderman.codemaker.dberparse.ERPlantUMLParseService; +import com.coderman.codemaker.dberparse.ERPlantUMLParseServiceImpl; import com.coderman.codemaker.dberparse.bean.ParseRequestBean; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Value; @@ -18,23 +18,23 @@ import java.util.List; * Description: * date: 2021/8/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Service @Component public class DBErParseServiceImpl implements DBErParseService{ - private ERPantUMLParseService erPantUMLParseService = new ERPantUMLParseServiceImpl(); + private ERPlantUMLParseService erPantUMLParseService = new ERPlantUMLParseServiceImpl(); @Value("${sqlfile.path}") private String path; @Override public List parseERPlantUML(List contentList,String fileName) throws IOException { List sqlContent = erPantUMLParseService.parseERPlantUML(contentList); File file = new File(path+"/"+fileName+".sql"); - if(!file.exists()){ + /* if(!file.exists()){ file.createNewFile(); - } + }*/ FileUtils.writeLines(file,sqlContent); return sqlContent; } diff --git a/codemaker-dbops/src/main/resources/application.properties b/codemaker-dbops/src/main/resources/application.properties index f3448209531f6fc82c1bf93d4b4a3ab9e7c9c0be..355715b4c1c1d5e25e169f7209d4f2d4273a8ead 100644 --- a/codemaker-dbops/src/main/resources/application.properties +++ b/codemaker-dbops/src/main/resources/application.properties @@ -1,2 +1,2 @@ server.port=8097 -sqlfile.path=/Users/dasouche/scworkspace/sourceSpace/code-maker/codemaker-dbops/er-sql \ No newline at end of file +sqlfile.path=/Users/shenshuai/scworkspace/myspace/code-maker/codemaker-dbops/er-sql \ No newline at end of file diff --git a/codemaker-dbops/src/main/resources/er-plantuml/express-db.puml b/codemaker-dbops/src/main/resources/er-plantuml/express-db.puml new file mode 100644 index 0000000000000000000000000000000000000000..634fcc0bbafdd0db08287b42adec11b6b828a306 --- /dev/null +++ b/codemaker-dbops/src/main/resources/er-plantuml/express-db.puml @@ -0,0 +1,109 @@ +@startuml +' hide the spot +hide circle + +' avoid problems with angled crows feet +skinparam linetype ortho + +entity "address_list 发件人常用地址" as address_list { + id: 主键/bigint(20) unsigned + province_id: 所在省份ID/varchar(20) + city_id: 所在城市ID/varchar(20) + area_id: 所在区域ID/varchar(20) + street_id: 所在街道ID/varchar(20) + site_code: 快递站点编码/varchar(30) + address_detail: 具体地址/varchar(256) + user_id: 用户ID/varchar(20) + is_often: 是否是常用地址/int(11) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity "express_items 快递物品信息" as express_items { + id: 主键/bigint(20) unsigned + item_type: 物品类型/int(11) + forecast_weight: 预估重量/int(11) + remark: 备注/varchar(256) + volume: 物品体积/int(11) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity "express_order 快递订单信息" as express_order { + id: 主键/bigint(20) unsigned + addresser_user_id: 发件人id/varchar(20) + addresser_user_name: 发件人姓名/varchar(20) + addresser_telphone: 发件人电话/varchar(20) + send_address: 发件人地址/varchar(256) + recipient_user_id: 收件人id/varchar(20) + recipient_user_name: 收件人姓名/varchar(20) + recipient_telphone: 收件人电话/varchar(20) + order_status: 订单状态/int(11) + receive_address: 收件人地址/varchar(256) + price: 订单金额/bigint(20) + order_code: 订单编号/varchar(64) + order_source: 订单来源/varchar(64) + express_order_bus_type: 订单业务类型/int(11) + express_item_id: 物品ID/bigint(11) + date_create: 订单创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) + mark_content: 快递备注/varchar(256) +} + + +entity "express_order_trace 快递订单轨迹信息" as express_order_trace { + id: 主键/bigint(20) unsigned + + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + + +entity "express_site 快递站点信息" as express_site { + id: 主键/bigint(20) unsigned + province_id: 所在省份ID/varchar(20) + city_id: 所在城市ID/varchar(20) + area_id: 所在区域ID/varchar(20) + street_id: 所在街道ID/varchar(20) + site_code: 快递站点编码/varchar(30) + address_detail: 具体地址/varchar(256) + owner_name: 快递网点负责人姓名/varchar(20) + tel_phone: 快递网点负责人电话/varchar(20) + cooperation_type: 合作方式/int(11) +} + +entity "express_trace 快递物流轨迹信息" as express_trace { + id: 主键/bigint(20) unsigned + order_code: 快递订单号/varchar(64) + address_name: 快递到达地点/varchar(128) + desc: 物流轨迹描述/varchar(256) + source_code: 物流轨迹上传来源/varchar(64) + arrive_date: 快递到达时间/timestamp + date_create: 轨迹创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity "price_config 快递价格配置" as price_config { + id: 主键/bigint(20) unsigned + start_province: 发送省份/varchar(20) + end_province: 接收省份/varchar(20) + weight_basic: 基本重量/int(11) + price_basic: 基本价格/int(11) + over_weight_price: 超重价格/int(11) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +@enduml \ No newline at end of file diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AdminAuthorityFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AdminAuthorityFacadeTest.java index 2710ca23fc909106b6ab2eae0364045e8634917f..d95e136408a993d9316449e3fbf36009afc3291f 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AdminAuthorityFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AdminAuthorityFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AuthorityFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AuthorityFacadeTest.java index 3f8fd91011902831dd93540839bd139c01c35723..d8c436379a1714be8dd496359dfec6fea43309aa 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AuthorityFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/AuthorityFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataAuthorityFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataAuthorityFacadeTest.java index be14c566214167cfabd7d84353165c44b1b9aca1..2cd15cc10dfe475dff1c551a29763efaceecec6a 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataAuthorityFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataAuthorityFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataColumnConfigFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataColumnConfigFacadeTest.java index 7bc39bb00fdc5eefa57ab7ad59ad6fe02ae5e9e6..7fdbd6426a4776719d969c0deffc56b9201202a6 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataColumnConfigFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/DataColumnConfigFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/MenuFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/MenuFacadeTest.java index 3df2a46861a96355735368f6faaf310b0766df65..62269fc8b7abfbd482bdba88dc83b420fd066310 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/MenuFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/MenuFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/ModuleFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/ModuleFacadeTest.java index 2150995b06f15a4db14792271933949b0ca57104..21e55c2b0b932235702735cfef3e6106eb9020d6 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/ModuleFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/ModuleFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleFacadeTest.java index e7fe7668fb265daa8033883ead83b4cac9ba4720..6404b291fb78e383b0febfbe189bbc6f1f01d5af 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleGroupFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleGroupFacadeTest.java index 82b6aeeeb4c7e4e3b2c6c6c6989dcea2f4a211e8..0568867bc6d43f7c10c1838d512eedc09f804e26 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleGroupFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/RoleGroupFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemAuthorityFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemAuthorityFacadeTest.java index 5e16a012018f01d766b4a436cb70a20f69b9df63..bb5422f62e05e0a7201cc8d418cd782204191d8e 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemAuthorityFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemAuthorityFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemFacadeTest.java index 80cba05d944965c9b1db82179ba7b4da59eedca5..b1245df56f7f061c5caef9a2b01a45ffe46958bc 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/SystemFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserGroupFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserGroupFacadeTest.java index ad394fe0b49b1a99a0a7e94176493879b180f447..9aafefa6f86a3bdeff176b23a111245a2b0b9e87 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserGroupFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserGroupFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserRoleMappingFacadeTest.java b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserRoleMappingFacadeTest.java index 3b1d96d7c5b08d530bbd25b614af825522d4c859..7ffcd69f3afab3424d25a5eaca643c46cad1bad7 100644 --- a/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserRoleMappingFacadeTest.java +++ b/codemaker-dubbo/dubbo-core/src/test/java/com/coderman/infosys/authtest/UserRoleMappingFacadeTest.java @@ -24,7 +24,7 @@ import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-dynamicddd/pom.xml b/codemaker-dynamicddd/pom.xml deleted file mode 100644 index 71906c06442da093abe63572d0376e6a13116db3..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/pom.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - 4.0.0 - - com.coderman.dynamicddd - codemaker-dynamicddd - 1.0-SNAPSHOT - - codemaker-dynamicddd - - http://www.example.com - - - UTF-8 - 1.8 - 1.8 - 1.8 - 2.1.9.RELEASE - 1.2.0.Final - - - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - - - - - com.alibaba.spring - spring-context-support - 1.0.5 - - - - org.mapstruct - mapstruct - ${mapstruct.version} - - - org.mapstruct - mapstruct-processor - ${mapstruct.version} - - - org.mapstruct - mapstruct-jdk8 - ${mapstruct.version} - - - - - commons-collections - commons-collections - 3.2.1 - - - - com.alibaba - fastjson - 1.2.72 - - - - commons-lang - commons-lang - 2.4 - - - - org.slf4j - slf4j-api - 1.7.28 - - - org.slf4j - slf4j-ext - 1.7.28 - - - - org.slf4j - slf4j-log4j12 - 1.7.28 - - - - org.springframework.boot - spring-boot-starter-log4j2 - ${spring-boot.version} - - - - org.aspectj - aspectjweaver - 1.9.4 - - - - org.aspectj - aspectjrt - 1.8.13 - - - - org.assertj - assertj-core - 3.9.1 - - - - - - - - junit - junit - 4.11 - test - - - - org.projectlombok - lombok - 1.18.8 - - - - org.springframework.boot - spring-boot - - - org.slf4j - slf4j-api - - - - - - - - diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AbstractCmd.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AbstractCmd.java deleted file mode 100644 index 4c6f6c2778a84db55810aee05fa55fe87094cebe..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AbstractCmd.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.command; - -import java.util.Date; - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:抽象命令类类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Data -@ToString -public class AbstractCmd { - - /** +操作时间 **/ - public Date operateTime; - /** +操作人ID **/ - public Long userId; - /** +命令类 **/ - public Class commandClass; - /** +命令数据 **/ - public String payLoad;; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserAuthCmd.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserAuthCmd.java deleted file mode 100644 index 171da4f6c30011288818601b6b2116499b5ced8b..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserAuthCmd.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.command; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:增加用户权限类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Data -@ToString -public class AddUserAuthCmd extends AbstractCmd{ - - /** 用户ID **/ - private Long userId; - /** 权限类型 **/ - private int authorityType; - /** 权限数据内容 **/ - private String json; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserCmd.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserCmd.java deleted file mode 100644 index 0597d0c45eaef7fd0414a54abcae2465a1032149..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserCmd.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.command; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:增加用户命令类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Data -@ToString -public class AddUserCmd extends AbstractCmd{ - - /** 用户名 **/ - private String userName; - /** 用户ID **/ - private Long userId; - /** 所属组织 **/ - private Long departmentId; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserGroupCmd.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserGroupCmd.java deleted file mode 100644 index 8ba24edaae66e29b7061da1e86107ba4ee5c78fe..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/AddUserGroupCmd.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.command; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:增加用户组命令类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Data -@ToString -public class AddUserGroupCmd extends AbstractCmd{ - - /** 组名 **/ - private String groupName; - /** 用户ID **/ - private Long userId; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/UpdateUserAuthCmd.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/UpdateUserAuthCmd.java deleted file mode 100644 index c83c015f47a532735cae584575644e1b90c9c6a3..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/command/UpdateUserAuthCmd.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.command; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:更新用户权限类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Data -@ToString -public class UpdateUserAuthCmd extends AbstractCmd{ - - /** 用户ID **/ - private Long userId; - /** 角色ID **/ - private Long roleId; - /** 权限数据内容 **/ - private String json; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/CmdExeService.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/CmdExeService.java deleted file mode 100644 index a48783e79ea4113782f99024d7aa38a2d0949626..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/CmdExeService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.exe; - -import com.lightsnail.snailapp.usercrm.app.command.AbstractCmd; - - -/** - * @Description:命令执行接口接口 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -public interface CmdExeService{ - /** - * - * @Description:命令执行入口 - * @return String - */ - String exe(AbstractCmd abstractCmd); -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserAuthCmdExe.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserAuthCmdExe.java deleted file mode 100644 index 2defff6bb358d3cc617c0627e748e6ff559ff31c..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserAuthCmdExe.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.exe; - -import com.lightsnail.snailapp.usercrm.app.command.AbstractCmd; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; -import com.lightsnail.snailapp.usercrm.app.exe.UserAuthCmdExe; - -/** - * @Description:用户权限cmd处理类接口实现类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Service -public class UserAuthCmdExe implements CmdExeService{ - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Override - public String exe(AbstractCmd abstractCmd){ - return null; - } - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserCmdExe.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserCmdExe.java deleted file mode 100644 index 83483f6da7532d58a1454115918b7a44506ade3a..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserCmdExe.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.exe; - -import com.lightsnail.snailapp.usercrm.app.command.AbstractCmd; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; -import com.lightsnail.snailapp.usercrm.app.exe.UserCmdExe; - -/** - * @Description:用户cmd处理类接口实现类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Service -public class UserCmdExe implements CmdExeService{ - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Override - public String exe(AbstractCmd abstractCmd){ - return null; - } - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserGroupCmdExe.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserGroupCmdExe.java deleted file mode 100644 index 5a53540262d4fd80b5f92e274b841d304d8124b6..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/app/exe/UserGroupCmdExe.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.lightsnail.snailapp.usercrm.app.exe; - -import com.lightsnail.snailapp.usercrm.app.command.AbstractCmd; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; -import com.lightsnail.snailapp.usercrm.app.exe.UserGroupCmdExe; - -/** - * @Description:用户组cmd处理类接口实现类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Service -public class UserGroupCmdExe implements CmdExeService{ - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Override - public String exe(AbstractCmd abstractCmd){ - return null; - } - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/AdminAuthorityBO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/AdminAuthorityBO.java deleted file mode 100644 index f1a96be0593add1549b56a1c929b93cc49143aa2..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/AdminAuthorityBO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:行政权限类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class AdminAuthorityBO extends AuthorityBO{ - - /** 组织部门 **/ - private Long departmentId; - /** 城市 **/ - private Long cityId; - /** 职位 **/ - private Long jobId; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/AuthorityBO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/AuthorityBO.java deleted file mode 100644 index d99963b9010fb2a9a4a25dfdaa457fc920bc02de..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/AuthorityBO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:权限类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class AuthorityBO { - - /** 权限类型 **/ - private Integer authorityType; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/DataAuthorityBO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/DataAuthorityBO.java deleted file mode 100644 index 5c0e1e9655666ae806b9f1ad16a65196aa20fb9c..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/DataAuthorityBO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:数据权限类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class DataAuthorityBO extends AuthorityBO { - - /** 系统标示 **/ - private String systemName; - /** 表名 **/ - private String tableName; - /** 字段名 **/ - private String columnName; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/RoleBO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/RoleBO.java deleted file mode 100644 index 236539e7ed6900ca85483583cfc2e15116722e72..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/RoleBO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:角色类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class RoleBO { - - /** 角色名称 **/ - private String roleName; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/SystemAuthorityBO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/SystemAuthorityBO.java deleted file mode 100644 index 24967fee7da2402e7389901e9372f2fd2a0c350f..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/SystemAuthorityBO.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:系统菜单权限类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class SystemAuthorityBO extends AuthorityBO{ - - /** 系统标示 **/ - private String systemName; - /** 功能 **/ - private String funcName; - /** 菜单 **/ - private String categoryName; - /** 按钮 **/ - private String menuName; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/SystemConfig.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/SystemConfig.java deleted file mode 100644 index 884b2422c9267aa22cabecfdb26ea54c2a1aea6c..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/SystemConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:系统设置类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class SystemConfig { - - /** 变量名 **/ - private String varName; - /** 变量描述 **/ - private String varDesc; - /** 变量值 **/ - private String value; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/UserBO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/UserBO.java deleted file mode 100644 index 2929b5beeafabf94bfbe4a7aae548215499f675c..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/UserBO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:用户信息类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class UserBO { - - /** 用户名 **/ - private String userName; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/UserGroupBO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/UserGroupBO.java deleted file mode 100644 index bb6de7367e95989d0eb8020472654765b6a4e709..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/domain/bo/UserGroupBO.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.lightsnail.snailapp.usercrm.domain.bo; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:用户组类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:10 - * @version v1.0 - */ -@Data -@ToString -public class UserGroupBO { - - /** 组名 **/ - private String groupName; - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/DepartmentServiceAdapter.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/DepartmentServiceAdapter.java deleted file mode 100644 index 88b9fd8f586da582e31290b9d6dda4be0f94ab68..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/DepartmentServiceAdapter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.lightsnail.snailapp.usercrm.infrast.acl; - -import com.lightsnail.snailapp.usercrm.infrast.acl.res.dto.DepartmentResponseDTO; -import java.util.List; -import com.lightsnail.snailapp.usercrm.infrast.acl.req.dto.DepartmentQueryDTO; - - -/** - * @Description:部门查询服务适配器接口 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -public interface DepartmentServiceAdapter{ - /** - * - * @Description:查询所有有效的部门 - * @return List - */ - List queryAllDepartment(DepartmentQueryDTO queryDto); - /** - * - * @Description:查询子部门 - * @return List - */ - List queryDepartmentsList(Long pId); -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/impl/DepartmentServiceAdapterImpl.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/impl/DepartmentServiceAdapterImpl.java deleted file mode 100644 index 5e7e4266c941eaf48bbdd3a82f3abd741d27e00b..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/impl/DepartmentServiceAdapterImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.lightsnail.snailapp.usercrm.infrast.acl.impl; - -import com.lightsnail.snailapp.usercrm.infrast.acl.res.dto.DepartmentResponseDTO; -import java.util.List; -import com.lightsnail.snailapp.usercrm.infrast.acl.req.dto.DepartmentQueryDTO; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; -import com.lightsnail.snailapp.usercrm.infrast.acl.DepartmentServiceAdapter; - -/** - * @Description:部门查询服务适配器接口实现类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Service -public class DepartmentServiceAdapterImpl implements DepartmentServiceAdapter{ - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Override - public List queryAllDepartment(DepartmentQueryDTO queryDto){ - return null; - } - - @Override - public List queryDepartmentsList(Long pId){ - return null; - } - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/req/dto/DepartmentQueryDTO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/req/dto/DepartmentQueryDTO.java deleted file mode 100644 index d3a6d6a70034b4f2464500242884e9cd7ca3c15d..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/req/dto/DepartmentQueryDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.lightsnail.snailapp.usercrm.infrast.acl.req.dto; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Data -@ToString -public class DepartmentQueryDTO { - - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/res/dto/DepartmentResponseDTO.java b/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/res/dto/DepartmentResponseDTO.java deleted file mode 100644 index f9ceac515ebafc9099ba8fb96d8e959e62eab9f5..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/main/java/com/lightsnail/snailapp/usercrm/infrast/acl/res/dto/DepartmentResponseDTO.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.lightsnail.snailapp.usercrm.infrast.acl.res.dto; - - -import lombok.Data; -import lombok.ToString; - - /** - * @Description:类 - * @Author:fanchunshuai - * @CreateTime:2021-07-07 00:05:11 - * @version v1.0 - */ -@Data -@ToString -public class DepartmentResponseDTO { - - - -} \ No newline at end of file diff --git a/codemaker-dynamicddd/src/test/java/org/example/AppTest.java b/codemaker-dynamicddd/src/test/java/org/example/AppTest.java deleted file mode 100644 index 6a1d2d79f7878de5144c8a33c09e56d788dfdacb..0000000000000000000000000000000000000000 --- a/codemaker-dynamicddd/src/test/java/org/example/AppTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.example; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -/** - * Unit test for simple App. - */ -public class AppTest -{ - /** - * Rigorous Test :-) - */ - @Test - public void shouldAnswerWithTrue() - { - assertTrue( true ); - } -} diff --git a/codemaker-parent/codemaker-api/pom.xml b/codemaker-parent/codemaker-api/pom.xml index cf8fe0975ff92ced3721baeec46ca330fc9170a2..b5d5bf53697a93914d2a2d2361eb189aabaa0f7d 100644 --- a/codemaker-parent/codemaker-api/pom.xml +++ b/codemaker-parent/codemaker-api/pom.xml @@ -6,11 +6,11 @@ com.coderman.codemaker codemaker-parent - 1.2.2-SNAPSHOT + 1.3.0-SNAPSHOT com.coderman.codemaker codemaker-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT jar codemaker-api @@ -60,8 +60,31 @@ fastjson 1.2.72 + + org.springframework + spring-context + + + + com.coderman.utils + coderman-utils + 1.0.4-SNAPSHOT + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/TemplateFileEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/TemplateFileEnum.java deleted file mode 100644 index 4fbbc5ed79d2cece572b492f370bd9e1e6cf33f8..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/TemplateFileEnum.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.coderman.codemaker.enums; - -/** - * description: TemplateFileEnum
- * date: 2020/7/7 23:44
- * author: coderman
- * version: 1.0
- * 设置要生成的模板文件的类型 - */ -public enum TemplateFileEnum { - ENTITY("entity"), - MAPPER("mapper"), - POM("pom"), - CONTROLLER("controller"), - MAPPER_XML("mapperxml"), - SERVICE("service"), - SERVICE_IMPL("serviceImpl"), - VO("vo"), - BASE_CONTROLLER("baseController"), - SPRING_APPLICATION_CONTEXT("SpringApplicationContext"), - TEST("test"), - APPLICATION("application"), - DTO("dto"), - FACADE("facade"), - DATA_OBJECT("do"), - FACADE_IMPL("facadeImpl"), - BUSINESS_OBJECT("bo"), - CONVERT("convert"), - DTOBO_CONVERT("dtoboconvert"), - DTO2DTO_CONVERT("dto2dtoconvert"), - DOBO_CONVERT("doboconvert"), - FACADE_AOP("facadeaop"), - GATAWAY("gataway"), - REPOSITORY("repository"), - REPOSITORY_IMPL("repositoryimpl"), - FACTORY("factory"), - ENUM("enum"), - API_ENUM("apienum"), - MESSAGE_BODY("msgbody"), - EVENT_BODY("event"), - GATAWAY_IMPL("gatawayimpl"), - ACL("acl"), - ACL_IMPL("aclimpl"), - ACL_REQ("aclreq"), - ACL_RES("aclres"), - ACL_PARAM("aclparam"), - CMD("cmd"), - EXE("exe"), - EXE_IMPL("exeimpl"), - EXE_ABSTRACT("abstractexe"), - VALUE_OBJECT("valueobject"), - BUSINESS_OBJECT_DDD("boddd"), - FACADE_DDD("facadeddd"), - FACADE_IMPL_DDD("facadeimplddd"), - CONTROLLER_DDD("controllerddd"), - VO_DDD("voddd"), - VOBO_CONVERT("voboconvert"), - DTO_DDD("dtoddd"), - MQ_CONSUMER("mqconsumer"), - MQ_HANDLER("mqhandler"), - MQ_LISTENER("mqlistener"), - MQ_PRODUCER("mqproducer"), - APP_EVENT_PUBLISHER("AppEventPublisher"), - BASE_EVENT("BaseEvent"), - MAPPER_DDD("mapperddd"), - MAPPER_XML_DDD("mapperxmlddd"), - API_HTTP("http"), - API_RPC("rpc"), - CACHE("cache"), - - FEIGN("feign"), - FEIGN_DDD("feignddd"), - FEIGN_CONTROLLER("feigncontroller"), - FEIGN_CONTROLLER_DDD("feigncontrollerddd"), - - - ; - private String tempFileName; - TemplateFileEnum(String tempFileName){ - this.tempFileName = tempFileName; - } - - public String getTempFileName() { - return tempFileName; - } - - - /** - * 判断类名是否是bo,vo,dto,entity - * @param className - * @return - */ - public static boolean isClassModel(String className){ - String classType = className.toLowerCase(); - return classType.endsWith(TemplateFileEnum.VO.getTempFileName()) - || classType.endsWith(TemplateFileEnum.BUSINESS_OBJECT.getTempFileName()) - || classType.endsWith(TemplateFileEnum.DTO.getTempFileName()) - || classType.endsWith(TemplateFileEnum.DATA_OBJECT.getTempFileName()) - || classType.endsWith(TemplateFileEnum.ENTITY.getTempFileName()); - } -} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/annotations/ElementTag.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/annotations/ElementTag.java new file mode 100644 index 0000000000000000000000000000000000000000..129484ea9418f10252e947e700ab4e0eaab47e63 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/annotations/ElementTag.java @@ -0,0 +1,33 @@ +package com.tianhua.codemaker.annotations; + +import com.tianhua.codemaker.enums.ClassEnum; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ElementTag { + /** + * 代码元素类型---TemplateFileEnum + * @return + */ + String elementName() default ""; + + /** + * 代码元素类型---ClassEnum + * @return + */ + ClassEnum clazzType() default ClassEnum.CLASS; + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DomainElementHandler.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/DomainElementHandler.java similarity index 59% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DomainElementHandler.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/DomainElementHandler.java index 51e7f02208dc50c4ab6f9b4e9c2f59139cd17597..2f61ce4102e2fef3a5c8e37da84b27ce75b871d2 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DomainElementHandler.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/DomainElementHandler.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.app.dynamicddd; +package com.tianhua.codemaker.api; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; /** * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompDecorateService.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompDecorateService.java similarity index 76% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompDecorateService.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompDecorateService.java index 01d984818ae65c689154b0889cd9be29f45e68a9..40eb847a1f16af617e6212b284136fb3753005de 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompDecorateService.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompDecorateService.java @@ -1,14 +1,14 @@ -package com.coderman.codemaker.api; +package com.tianhua.codemaker.api; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; /** * Description: 组件规则定义完成之后,需要将 * 组件包相关的类接口枚举注解等应用到对应的代码元素上 * date: 2021/11/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompRegistService.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompRegistService.java similarity index 85% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompRegistService.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompRegistService.java index 546dbbc5860a0d77fd2c7a9a13027564454f5f58..3dd92a5e8c73b354c26d943d6ba6062bd523ed16 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompRegistService.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompRegistService.java @@ -1,6 +1,6 @@ -package com.coderman.codemaker.api; +package com.tianhua.codemaker.api; -import com.coderman.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; /** * Description:组件注册服务接口,这里主要用来将相对独立的工具类注册到组件中 @@ -12,7 +12,7 @@ import com.coderman.codemaker.bean.component.ComponentContextBean; * * date: 2021/12/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompScanService.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompScanService.java similarity index 74% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompScanService.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompScanService.java index 3cbdc2d1e8175bd5af5bf2e044dd5096ad3f1f01..0ca9d7e20691b01be569ef3ad60c3dda34543b5e 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/api/ICompScanService.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/ICompScanService.java @@ -1,6 +1,6 @@ -package com.coderman.codemaker.api; +package com.tianhua.codemaker.api; -import com.coderman.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; import java.util.List; import java.util.Map; @@ -10,7 +10,7 @@ import java.util.Map; * * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/IJavsAdapterSerivce.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/IJavsAdapterSerivce.java new file mode 100644 index 0000000000000000000000000000000000000000..64ba35ed6978a458f0381720b599d6594f8821a8 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/IJavsAdapterSerivce.java @@ -0,0 +1,27 @@ +package com.tianhua.codemaker.api; + +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; + +/** + * Description: + * date: 2022/3/10 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public interface IJavsAdapterSerivce { + /** + * codeMaker适配javs翻译引擎 + * @param plantUmlContextBean + * @param javsScriptProjectPath + */ + void translateJavsScript(PlantUmlContextBean plantUmlContextBean, String javsScriptProjectPath); + + /** + * 基于plantuml文档生成javs脚本项目 + * @param plantUmlContextBean + * @param javsScriptProjectPath + */ + void generateJavsScriptProject(PlantUmlContextBean plantUmlContextBean,String javsScriptProjectPath); +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/IValidateService.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/IValidateService.java new file mode 100644 index 0000000000000000000000000000000000000000..96f7baf26068ad7f674d4942148f0b41ad4a7631 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/api/IValidateService.java @@ -0,0 +1,22 @@ +package com.tianhua.codemaker.api; + +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; + +/** + * Description:参数校验逻辑植入服务接口 + * + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public interface IValidateService { + + /** + * 统一参数校验模式 + * @param plantUmlContextBean + */ + void dealValidate(PlantUmlContextBean plantUmlContextBean); + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/ClassContentBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/ClassContentBean.java similarity index 96% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/ClassContentBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/ClassContentBean.java index 9f36bf77c9d3f38049805e4e18ce69f7f641b0fc..ec5bed85d3d8fb8a57007f7656041dafbcdf5283 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/ClassContentBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/ClassContentBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean; +package com.tianhua.codemaker.bean; /** * Description: * date: 2021/6/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -91,4 +91,5 @@ public class ClassContentBean { public void setClassContent(String classContent) { this.classContent = classContent; } + } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/ColumnBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/ColumnBean.java similarity index 96% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/ColumnBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/ColumnBean.java index 549205944cbe5598447a25d7af909446a2b5afee..73bd6bb10f6a447b5dc957cbfd5cf16b70a0c944 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/ColumnBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/ColumnBean.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.bean; +package com.tianhua.codemaker.bean; -import com.coderman.codemaker.bean.plantuml.FieldBean; -import com.coderman.codemaker.enums.VisibilityEnum; +import com.tianhua.codemaker.bean.plantuml.FieldBean; +import com.tianhua.codemaker.enums.VisibilityEnum; /** * Created on 2018-7-19. diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/GeneratorSettingBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/GeneratorSettingBean.java similarity index 97% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/GeneratorSettingBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/GeneratorSettingBean.java index e3f087d904526fa0d9f53150ec81400fb9fa6d1d..a7fba7f298efafb2ebd4edbd604ac764e478be1b 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/GeneratorSettingBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/GeneratorSettingBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean; +package com.tianhua.codemaker.bean; /** diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/GlobalConstant.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/GlobalConstant.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/GlobalConstant.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/GlobalConstant.java index 521a58c907ad1b8d2dec3248f028b1b324e10b32..9626aea4b01be9879f40cd82ab6ca4189e5af667 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/GlobalConstant.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/GlobalConstant.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean; +package com.tianhua.codemaker.bean; /** * Description: * date: 2021/7/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -78,6 +78,11 @@ public class GlobalConstant { */ public static final String EXPORT_ACL_KEY = "exportaclkey"; + /** + * plantuml bo中的特殊属性-标示 api参数是否需要校验 + */ + public static final String VALIDATE_KEY = "validatekey"; + @@ -103,7 +108,10 @@ public class GlobalConstant { * api doc文件名称 */ public static final String API_DOC = "api-doc"; - + /** + * plantuml doc文件名称 + */ + public static final String PLANT_UML_DOC = "uml-doc"; public static final String PACKAGE_$ = "${package}"; @@ -112,6 +120,10 @@ public class GlobalConstant { */ public static final String SINGLE_CLASS_COMMON = "singleClass"; + /** + * 存放配置文件模板的文件目录名 + */ + public static final String CONFIG = "config"; /** * 组件配置文件key--version */ @@ -149,6 +161,14 @@ public class GlobalConstant { */ public static final String COMP_DESC = "compDesc"; + /** + * pom类型 + */ + public static final String COMP_GAV_TYPE = "type"; + /** + * pom类型 + */ + public static final String COMP_GAV_SCOPE = "scope"; /** * 组件类型 @@ -180,6 +200,20 @@ public class GlobalConstant { * 需要扫描的方法列表前缀 */ public static final String COMP_CLASS_METHOD_PRE = "method"; + /** + * 需要扫描的配置文件内容 + */ + public static final String COMP_CONFIG_NAME = "configName"; + + /** + * 需要扫描的排除GA + */ + public static final String COMP_EXCLUSION_GA_LIST = "exclusionGAList"; + /** + * 需要扫描的方法列表前缀 + */ + public static final String COMP_FIELD_PRE = "field"; + /** * 需要扫描的注解列表前缀 @@ -187,6 +221,19 @@ public class GlobalConstant { public static final String COMP_ANNOTATION_PRE = "annotation"; + + /** + * 注解需要修饰的地方 + */ + public static final String COMP_MODIFY_ON = "modifyOn"; + + + /** + * 注解tag别名 + */ + public static final String COMP_ANNOTATION_ALIAS = "classAlias"; + + /** * 扫描组件的文件前缀 */ @@ -197,6 +244,13 @@ public class GlobalConstant { */ public static final String COMP_COMPONENT_SINGLE_CLASS_PATH = COMP_COMPONENT_PATH_PRE + "singleClass"; + /** + * 注解标签扫描路径 + */ + public static final String COMP_COMPONENT_ANNOTATION_TAG_PATH = COMP_COMPONENT_PATH_PRE + "annotationClass"; + + + /** * 配置的包依赖 */ @@ -211,4 +265,41 @@ public class GlobalConstant { public static final String REQUEST_VO = "requestvo"; public static final String RESPONSE_VO = "responsevo"; + + + + public static final String CUSTOM_CLASS = "customclass"; + + + + + /**--------模块名---------**/ + + public static final String API = "-api"; + + public static final String APP = "-app"; + + public static final String CLIENT = "-client"; + + public static final String DOMAIN = "-domain"; + + public static final String START = "-start"; + + public static final String ADAPTER = "-adapter"; + + public static final String COMMON = "-common"; + + public static final String CORE = "-core"; + + public static final String INFRAST = "-infrast"; + + public static final String FEIGN_API = "-feignapi"; + + public static final String FEIGN_PROVIDER = "-feignprovider"; + + public static final String PROVIDER = "-provider"; + + public static final String SPRING_BOOT = "-springboot"; + + public static String PARENT = "parent"; } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/MapperMethodConstant.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/MapperMethodConstant.java similarity index 92% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/MapperMethodConstant.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/MapperMethodConstant.java index aad3bfd020cbd3c3f76bac607091abb128e2ed63..8f3c4b74ee45b3320f0f471ceecf898e32216c52 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/MapperMethodConstant.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/MapperMethodConstant.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean; +package com.tianhua.codemaker.bean; import java.util.HashSet; import java.util.Set; @@ -7,7 +7,7 @@ import java.util.Set; * Description: mapperxml默认方法名 * date: 2021/10/27 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/TableBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/TableBean.java similarity index 92% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/TableBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/TableBean.java index 177601f85dbb89c1ebd9fbccb0cf6bac145132ee..3b45081f35ad2e74824a58160ea4b509560798fd 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/TableBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/TableBean.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.bean; +package com.tianhua.codemaker.bean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.FieldBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.FieldBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; @@ -13,7 +13,7 @@ import java.util.List; /** * Created on 2018-7-19. * - * @author: fanchunshuai + * @author: shenshuai * @version: V1.0 * @Desc:表信息描述 */ @@ -66,6 +66,8 @@ public class TableBean { * 插入sql value替换字符串 */ private String insertColumnNames; + + /** * 修改sql value替换字符串 */ @@ -109,7 +111,7 @@ public class TableBean { * @param packageName * @return */ - public InterfaceBean convertToMapperInterface(String packageName,List columnBeanList){ + public InterfaceBean convertToMapperInterface(String packageName,List columnBeanList, boolean useMybatisPlus){ InterfaceBean interfaceBean = new InterfaceBean(); interfaceBean.setClassName(this.getHumpClassName()+"Mapper"); interfaceBean.setPackageName(packageName); @@ -118,7 +120,11 @@ public class TableBean { String doPackageName = packageName.replace("mapper","dataobject"); String importDO = doPackageName+"."+this.getHumpClassName()+"DO"; interfaceBean.setImportClassList(Lists.newArrayList(importDO)); - interfaceBean.setMethodBeanList(getDefaultMapperMethod()); + if(useMybatisPlus){ + interfaceBean.setMethodBeanList(Lists.newArrayList()); + }else { + interfaceBean.setMethodBeanList(getDefaultMapperMethod()); + } interfaceBean.setTableBean(this); interfaceBean.setColumnBeanList(columnBeanList); diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/WriteContentBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/WriteContentBean.java similarity index 48% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/WriteContentBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/WriteContentBean.java index 23fa9738f41a313f8651c0f3e1bad525ec5a9fbf..f26144817e56eb80d0bcb05ef2e695c652e7122c 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/WriteContentBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/WriteContentBean.java @@ -1,14 +1,16 @@ -package com.coderman.codemaker.bean; +package com.tianhua.codemaker.bean; -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; import lombok.Builder; import lombok.Data; +import org.apache.commons.lang3.StringUtils; /** * Description: * date: 2021/7/2 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -20,6 +22,19 @@ public class WriteContentBean { private String humpClassName; private String classPackageName; + /** + * 是否是自定义的代码元素 + */ + private boolean customCodeElement; + + public boolean isCustomCodeElement() { + return customCodeElement; + } + + public void setCustomCodeElement(boolean customCodeElement) { + this.customCodeElement = customCodeElement; + } + private AbstractClassBean abstractClassBean; public AbstractClassBean getAbstractClassBean() { @@ -68,6 +83,38 @@ public class WriteContentBean { return classContentBean; } + /** + * 将writeContentbean对象转换为classcontentBean对象 + * @param moduleCode + * @param modulePath + * @return + */ + public ClassContentBean buildClassContentBean(String moduleCode, String modulePath){ + ClassContentBean classContentBean = new ClassContentBean(); + classContentBean.setClassContent(this.getContent()); + classContentBean.setHumpClassName(this.getHumpClassName()); + classContentBean.setClassPackageName(this.getClassPackageName()); + String classSuffix = TemplateFileEnum.getClassSuffix(this.getTemplateName()); + if(StringUtils.isNotEmpty(classSuffix)){ + classContentBean.setClassSuffix(classSuffix); + }else { + classContentBean.setClassSuffix(""); + } + + classContentBean.setModulePath(modulePath); + String defaultChildPackageName = TemplateFileEnum.getChildPackageName(this.getTemplateName()); + + String childPackageName; + if(defaultChildPackageName.startsWith(moduleCode)){ + childPackageName = defaultChildPackageName; + }else { + childPackageName = moduleCode + "." + defaultChildPackageName; + + } + classContentBean.setChildPackageName(childPackageName); + + return classContentBean; + } } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiDocBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiDocBean.java similarity index 96% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiDocBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiDocBean.java index d5a3d32258ace7102f3bd0fe243f83fc723c9e31..045c4cf85d2ecc766b2e23ad74f84a9e88454675 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiDocBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiDocBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.apidoc; +package com.tianhua.codemaker.bean.apidoc; import java.util.List; @@ -6,7 +6,7 @@ import java.util.List; * Description: 支持http rpc的接口文档模型 * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiModuleBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiModuleBean.java similarity index 69% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiModuleBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiModuleBean.java index 5782ef28f21aaef9d41e52b1216c3f9d382721f8..7e7f50e38dc5f4966b44babbb747116e01278ec6 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiModuleBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiModuleBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.apidoc; +package com.tianhua.codemaker.bean.apidoc; /** * Description:模块/接口类级别的文档描述 * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiParamBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiParamBean.java similarity index 93% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiParamBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiParamBean.java index 7e7dce1a3221f438c68ed609d7dd94fb2f99c6b1..34b9f8844f4ea5ea0c2bffcb1d8c919708bc7b68 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/apidoc/ApiParamBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/apidoc/ApiParamBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.apidoc; +package com.tianhua.codemaker.bean.apidoc; /** * Description: * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/component/ComponentConfigBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/component/ComponentConfigBean.java similarity index 61% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/component/ComponentConfigBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/component/ComponentConfigBean.java index b500b202c6614ca74f7ce25096996240944167e6..070597658fd1d4638fca12c1608206a2ad0472e0 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/component/ComponentConfigBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/component/ComponentConfigBean.java @@ -1,19 +1,24 @@ -package com.coderman.codemaker.bean.component; +package com.tianhua.codemaker.bean.component; +import lombok.Data; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * Description: * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ +@Data public class ComponentConfigBean { /** @@ -25,6 +30,11 @@ public class ComponentConfigBean { private String version; + + private String type; + + private String scope; + private String desc; /** @@ -63,6 +73,17 @@ public class ComponentConfigBean { */ private String compDesc; + /** + * 组件配置名称 + * + */ + private String configName; + + /** + * 组件要排除的依赖项 + */ + private String exclusionGAList; + /** * 接口列表 */ @@ -86,118 +107,17 @@ public class ComponentConfigBean { /** * 方法列表 */ - private List methodList = new ArrayList<>(); - - public String getArtifactId() { - return artifactId; - } - - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } - - public String getGroupId() { - return groupId; - } - - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public String getJarPath() { - return jarPath; - } - - public void setJarPath(String jarPath) { - this.jarPath = jarPath; - } - - - public String getPackageName() { - return packageName; - } - - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - public List getInterfaceList() { - return interfaceList; - } - - public List getClassList() { - return classList; - } + private Map> methodMap = new HashMap<>(); - public String getClassType() { - return classType; - } - - public void setClassType(String classType) { - this.classType = classType; - } - - - public List getMethodList() { - return methodList; - } - - public List getEnumList() { - return enumList; - } - - public List getAnnotationList() { - return annotationList; - } - - public String getCompSite() { - return compSite; - } - - public void setCompSite(String compSite) { - this.compSite = compSite; - } - - public String getCompDesc() { - return compDesc; - } - - public void setCompDesc(String compDesc) { - this.compDesc = compDesc; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - - public String getCompType() { - return compType; - } + /** + * 属性列表 + */ + private Map> fieldMap = new HashMap<>(); - public void setCompType(String compType) { - this.compType = compType; - } + /** + * 组件配置内容 + */ + private List configList = new ArrayList<>(); public void addClass(String clazz){ if(StringUtils.isNotEmpty(this.getPackageName())){ @@ -228,12 +148,32 @@ public class ComponentConfigBean { this.enumList.add(enumClass); } - public void addMethod(String methodStr){ - if(StringUtils.isNotEmpty(methodStr)){ - this.methodList.add(methodStr); + public void addMethod(String className, String methodStr){ + List methodList = this.methodMap.get(className); + if(CollectionUtils.isEmpty(methodList)){ + methodList = new ArrayList<>(); + methodList.add(methodStr); + methodMap.put(className, methodList); + return; } + methodList.add(methodStr); + methodMap.put(className, methodList); } + public void addField(String className, String fieldStr){ + List fieldList = this.fieldMap.get(className); + + if(CollectionUtils.isEmpty(fieldList)){ + fieldList = new ArrayList<>(); + fieldList.add(fieldStr); + fieldMap.put(className, fieldList); + return; + } + fieldList.add(fieldStr); + fieldMap.put(className, fieldList); + } + + /** * 构建需要读取的jar包绝对路径,带jar的 @@ -271,4 +211,6 @@ public class ComponentConfigBean { ", compDesc='" + compDesc + '\'' + '}'; } + + } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/component/ComponentContextBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/component/ComponentContextBean.java similarity index 76% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/component/ComponentContextBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/component/ComponentContextBean.java index e47afc782a82eec1cc0150ea6aded01ba07779db..9531db7cd5d68c9de75eaf1c168e4a69aca2721f 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/component/ComponentContextBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/component/ComponentContextBean.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.bean.component; +package com.tianhua.codemaker.bean.component; -import com.coderman.codemaker.bean.plantuml.AnnotationBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.EnumBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.AnnotationBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.EnumBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; import org.apache.commons.collections4.CollectionUtils; import java.util.List; @@ -13,7 +13,7 @@ import java.util.Optional; * Description:组件上下文bean * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -50,6 +50,19 @@ public class ComponentContextBean { */ private List annotationList; + /** + * 组件配置信息 + */ + private ComponentConfigBean componentConfigBean; + + public ComponentConfigBean getComponentConfigBean() { + return componentConfigBean; + } + + public void setComponentConfigBean(ComponentConfigBean componentConfigBean) { + this.componentConfigBean = componentConfigBean; + } + public List getAnnotationList() { return annotationList; } @@ -124,6 +137,21 @@ public class ComponentContextBean { return null; } + /** + * 获取目标interface信息 + * @param className + * @return + */ + public InterfaceBean getTargetInterface(String className){ + if(CollectionUtils.isEmpty(this.getInterfaceBeanList())){ + return null; + } + Optional classBeanOptional = this.getInterfaceBeanList().stream().filter(classBean -> classBean.getClassName().equals(className)).findFirst(); + if(classBeanOptional.isPresent()){ + return classBeanOptional.get(); + } + return null; + } /** * 获取目标class信息 diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/AnnotationTagBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/AnnotationTagBean.java new file mode 100644 index 0000000000000000000000000000000000000000..e06897cbf6c16bba6ab4592a06f29121aba05f50 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/AnnotationTagBean.java @@ -0,0 +1,51 @@ +package com.tianhua.codemaker.bean.config; + +import com.tianhua.codemaker.enums.dynamic.AnnotationModifyOnEnum; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +/** + * Description: + * date: 2022/1/24 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Data +public class AnnotationTagBean { + /** + * 注解所在包 + */ + private String packageName; + /** + * 注解在plantuml 文档中的别名 + */ + private String classAlias; + /** + * 注解在方法或者类上的展示形式 + */ + private String annotation; + + /** + * 注解类名称 + */ + private String className; + + /** + * 注解需要装饰的目标 + */ + private String modifyOn; + + + public boolean modifyOnThis(){ + if(StringUtils.isEmpty(modifyOn)){ + return true; + } + + return modifyOn.equals(AnnotationModifyOnEnum.THIS.getCode()); + } + + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/ConfigFileBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/ConfigFileBean.java new file mode 100644 index 0000000000000000000000000000000000000000..5b04bbb1715b994fb7a05aab92a0547b2a4f749b --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/ConfigFileBean.java @@ -0,0 +1,84 @@ +package com.tianhua.codemaker.bean.config; + +/** + * Description:文件配置bean + * date: 2022/1/23 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class ConfigFileBean { + + /** + * 文件名 + */ + private String configFileName; + + /** + * 文件后缀 + */ + private String configFileSuffix; + + /** + * 所属模块 + */ + private String moduleName; + + /** + * ftl文件模板名称 + */ + private String templateName; + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public ConfigFileBean(){} + + public ConfigFileBean(String configFileName, String configFileSuffix, String moduleName){ + this.configFileName = configFileName; + this.configFileSuffix = configFileSuffix; + this.moduleName = moduleName; + } + + + /** + * 构建配置文件实例 + * @param configFileName + * @param configFileSuffix + * @param moduleName + * @return + */ + public static ConfigFileBean getInstance(String configFileName, String configFileSuffix, String moduleName){ + return new ConfigFileBean(configFileName,configFileSuffix,moduleName); + } + + public String getConfigFileSuffix() { + return configFileSuffix; + } + + public void setConfigFileSuffix(String configFileSuffix) { + this.configFileSuffix = configFileSuffix; + } + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } + + public String getConfigFileName() { + return configFileName; + } + + public void setConfigFileName(String configFileName) { + this.configFileName = configFileName; + } +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/FtlBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/FtlBean.java new file mode 100644 index 0000000000000000000000000000000000000000..b8cfcd2f7595e5b61a97d05b29d7533ee06bd753 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/FtlBean.java @@ -0,0 +1,72 @@ +package com.tianhua.codemaker.bean.config; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class FtlBean { + /** + * 模块名称 + */ + private String moduleName; + /** + * class类型 + */ + private String classType; + /** + * 代码元素模板名称 + */ + private String codeTempFileName; + + /** + * 自定义模板配置字符串 + */ + private String ftlStr; + + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } + + public String getClassType() { + return classType; + } + + public void setClassType(String classType) { + this.classType = classType; + } + + public String getCodeTempFileName() { + return codeTempFileName; + } + + public void setCodeTempFileName(String codeTempFileName) { + this.codeTempFileName = codeTempFileName; + } + + public String getFtlStr() { + return ftlStr; + } + + public void setFtlStr(String ftlStr) { + this.ftlStr = ftlStr; + } + + public static FtlBean getInstance(String ftlStr){ + String [] arr = ftlStr.split(":"); + FtlBean ftlBean = new FtlBean(); + ftlBean.setFtlStr(ftlStr); + ftlBean.setClassType(arr[1]); + ftlBean.setCodeTempFileName(arr[0]); + ftlBean.setModuleName(arr[2]); + return ftlBean; + } +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/GAVBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/GAVBean.java new file mode 100644 index 0000000000000000000000000000000000000000..cd9461d1511b23223df19ade564dca154eb79f81 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/GAVBean.java @@ -0,0 +1,36 @@ +package com.tianhua.codemaker.bean.config; + +import lombok.Data; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Data +public class GAVBean { + private String groupId; + private String artifactId; + private String version; + + private String type; + + private String scope; + + private String exclusionGAContent; + + + /** + * 所属服务组件名称 + */ + private String componentName; + + public GAVBean(){} + public GAVBean(String componentName){ + this.componentName = componentName; + } + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/PomBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/PomBean.java new file mode 100644 index 0000000000000000000000000000000000000000..6a6376659f583a810b60cf019deea5342960338b --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/PomBean.java @@ -0,0 +1,167 @@ +package com.tianhua.codemaker.bean.config; + +import com.tianhua.codemaker.bean.WriteContentBean; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class PomBean { + + /** + * 模块前缀 + */ + private String modulePrefix; + + private String appName; + + + /** + * pom.url + */ + private String url; + + + /** + * 模块名称 + */ + private String moduleName; + + + private String groupId; + private String artifactId; + private String version; + + + private String templateCode; + + private String moduleCode; + + /** + * 依赖的mv + */ + private List dependencyList; + + + public Map buildVarMap(){ + Map map = new HashMap<>(); + map.put("modulePrefix",modulePrefix); + map.put("groupId",groupId); + map.put("artifactId",artifactId); + map.put("version",version); + map.put("appName",appName); + map.put("dependencyList",dependencyList); + return map; + } + + public WriteContentBean buildWriteContentBean(String content,String templateCode){ + return WriteContentBean.builder() + .customCodeElement(true) + .content(content) + .templateName(templateCode).build(); + } + + + public String getModuleCode() { + return moduleCode; + } + + public void setModuleCode(String moduleCode) { + this.moduleCode = moduleCode; + } + + public String getTemplateCode() { + return templateCode; + } + + public void setTemplateCode(String templateCode) { + this.templateCode = templateCode; + } + + public String getAppName() { + return appName; + } + + public void setAppName(String appName) { + this.appName = appName; + } + + public String getModulePrefix() { + return modulePrefix; + } + + public void setModulePrefix(String modulePrefix) { + this.modulePrefix = modulePrefix; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public String getArtifactId() { + return artifactId; + } + + public void setArtifactId(String artifactId) { + this.artifactId = artifactId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public List getDependencyList() { + return dependencyList; + } + + public void setDependencyList(List dependencyList) { + this.dependencyList = dependencyList; + } + + + public void buildModule(String aliasName, String moduleCode){ + this.setModuleName(aliasName+ moduleCode); + this.setModulePrefix(aliasName); + this.setModuleCode(moduleCode.replace("-","")); + } + + public void buildGAV(String groupId, String artifactId, String version){ + this.setGroupId(groupId); + this.setArtifactId(artifactId); + this.setVersion(version); + } + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/ProjectBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/ProjectBean.java new file mode 100644 index 0000000000000000000000000000000000000000..f9c5a9f6991d745883ac4cff61fe90ed9b9d9c54 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/config/ProjectBean.java @@ -0,0 +1,38 @@ +package com.tianhua.codemaker.bean.config; + +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import lombok.Data; + +import java.util.Map; + +/** + * Description:项目基本配置服务 + * date: 2022/3/9 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Data +public class ProjectBean { + /** + * 全局包名 + */ + private String packageName; + + /** + * 应用名 + */ + private String applicationName; + + /** + * 数据库名 + */ + private String dataBaseName; + + /** + * 业务配置信息 + */ + private Map configFileMap; + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AclElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AclElementBean.java similarity index 67% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AclElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AclElementBean.java index c9de3a24f8cad12d5b1ee199d002f2778faf11dd..d6c9da7ad2b48a6773e414923fe37493356dc7f3 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AclElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AclElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 防腐层元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AggregateElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AggregateElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AggregateElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AggregateElementBean.java index 72ced9ddfc83c9ffa6eee4c0c72d964c383d31af..04de27e15a6aa6af2ec33662273b24791d01f6f7 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AggregateElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AggregateElementBean.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * 聚合根元素 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AppListenerElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AppListenerElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AppListenerElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AppListenerElementBean.java index c743178d865c7235ad84d9f1497328b0e28c4155..70f0156e02bf07da86ba3796638fe319f0152a1c 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/AppListenerElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/AppListenerElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 监听器元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/CacheElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/CacheElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/CacheElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/CacheElementBean.java index 4d4bbb47d36d440892a05082b943de033f2e1b65..dc4ce5a636545479de5a1795b9876d42d65efaf4 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/CacheElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/CacheElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 缓存服务元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/CommandElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/CommandElementBean.java similarity index 67% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/CommandElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/CommandElementBean.java index ecc49a9715b417152e7216e4335856e1f6ff4d72..54901529e4ad6e70da938d7303ec6b3cab60b59b 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/CommandElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/CommandElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description:命令实体 * date: 2021/7/5 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainBoElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainBoElementBean.java similarity index 71% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainBoElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainBoElementBean.java index c4ddfc4915bfc72153687d9079b72c421bdda6b6..c0a2fa5a28d5204ff04d8ffe058828b126189e24 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainBoElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainBoElementBean.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * 业务模块实体,领域实体元素 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainEventElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainEventElementBean.java similarity index 66% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainEventElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainEventElementBean.java index da5b0308ebe3dcdb642f60e80531ce2e66fcd5dc..cfa5f50327d7eb4f1670b9b4943a32c3c2428d91 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainEventElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainEventElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainMsgBodyElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainMsgBodyElementBean.java similarity index 66% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainMsgBodyElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainMsgBodyElementBean.java index 1f0cb6f861bd20dd637842ec40ef8fc18a0f7f0b..754102a5611026276011ab18e107052635fd22b9 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DomainMsgBodyElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DomainMsgBodyElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/30 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DynamicMapperElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DynamicMapperElementBean.java similarity index 70% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DynamicMapperElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DynamicMapperElementBean.java index 6a8785119e2a4d5f1b0179f29cc590ae526c7dff..f482084465dcaa1de797339335f5f603f1cc2da3 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DynamicMapperElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DynamicMapperElementBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: @@ -6,7 +6,7 @@ package com.coderman.codemaker.bean.dddelement; * * 动态mapper元素 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DynamicMapperXmlElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DynamicMapperXmlElementBean.java similarity index 70% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DynamicMapperXmlElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DynamicMapperXmlElementBean.java index 8547c781f6fda99efdce5b399fd284f35d0d143e..b8a63e33c9cda562a287c98e0759dc2c3fd7c904 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/DynamicMapperXmlElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/DynamicMapperXmlElementBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: @@ -6,7 +6,7 @@ package com.coderman.codemaker.bean.dddelement; * * 动态mapperxml元素 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ElementBean.java similarity index 83% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ElementBean.java index 5f811e435e44d8cf918b6477e129bafbcf2c715b..4da0d5daf2de58bb4aafc0f565574011fc28e0ef 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ElementBean.java @@ -1,6 +1,8 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; -import com.coderman.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.bean.plantuml.*; import org.apache.commons.collections4.CollectionUtils; import java.util.ArrayList; @@ -10,7 +12,7 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -19,6 +21,44 @@ public abstract class ElementBean { protected List classBeanList; protected List interfaceBeanList; protected List enumBeanList; + protected List pomBeanList; + + /** + * 模块名称 + */ + protected String moduleName; + + + /** + * 自定义ftl模板配置bean + */ + protected FtlBean ftlBean; + + + + public FtlBean getFtlBean() { + return ftlBean; + } + + public void setFtlBean(FtlBean ftlBean) { + this.ftlBean = ftlBean; + } + + public String getModuleName() { + return moduleName; + } + + public void setModuleName(String moduleName) { + this.moduleName = moduleName; + } + + public List getPomBeanList() { + return pomBeanList; + } + + public void setPomBeanList(List pomBeanList) { + this.pomBeanList = pomBeanList; + } public String getPackageName() { return packageName; @@ -88,6 +128,9 @@ public abstract class ElementBean { for (ClassBean classBean : newClassBeanList){ if(!classBean.getClassName().endsWith("Impl")){ List methodBeanList = new ArrayList<>(); + if(CollectionUtils.isEmpty(classBean.getMethodBeanList())){ + continue; + } for (MethodBean oldBean : classBean.getMethodBeanList()){ StringBuilder contentBuilder = new StringBuilder(""); if(!CollectionUtils.isEmpty(oldBean.getInvokeMethodList())){ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ExecutorElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ExecutorElementBean.java similarity index 66% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ExecutorElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ExecutorElementBean.java index bc022c1bfd09f70459b4d94f0fc353a0576440e3..d90d06ac6907d167b8a8db0bc0f2879035b76ee9 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ExecutorElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ExecutorElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/7/5 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/FactoryElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/FactoryElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/FactoryElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/FactoryElementBean.java index 5918ff8c5de222ab978c33ed94247a213fe96699..1b5cdbcbf033fe288452b049da16e2d0fd424d51 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/FactoryElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/FactoryElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 工厂元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/GatawayElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/GatawayElementBean.java similarity index 69% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/GatawayElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/GatawayElementBean.java index 6f4cb6eecfe989e1f02351144d56650453b3d950..13170c4f652f129247a5c8fa218b727a0641a7a2 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/GatawayElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/GatawayElementBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: @@ -6,7 +6,7 @@ package com.coderman.codemaker.bean.dddelement; * * 领域网关元素 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/InfrastAclElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/InfrastAclElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/InfrastAclElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/InfrastAclElementBean.java index 4cdfbb346693ed023fa6e07c9a0e44af5921e9f1..2fcf09275f83f5d8d001e897b9a7075def6400c9 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/InfrastAclElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/InfrastAclElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 防腐层元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqConsumerElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqConsumerElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqConsumerElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqConsumerElementBean.java index 8abaed82bb0f96dcc5d8f0be57576a5c2e68314d..e76ec01051214d3fb932c7d6051db738add621d4 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqConsumerElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqConsumerElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 监听器元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqHandlerElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqHandlerElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqHandlerElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqHandlerElementBean.java index 11d18809ac3c99673db58b8b629562531dd4979a..c81c563bdc0c495a1c0b4cab563f47e661809f4b 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqHandlerElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqHandlerElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 监听器元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqProducerElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqProducerElementBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqProducerElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqProducerElementBean.java index 968238e69431ee369590175fc4be8b39715ff96d..2d06737e0d5d04b0bff8ea5eea2c5ea0926e9879 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/MqProducerElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/MqProducerElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/28 * 监听器元素 - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/PackageElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/PackageElementBean.java similarity index 66% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/PackageElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/PackageElementBean.java index 2901c785a5a58c883f2bcc89e5689057b35e6850..20f3fd04248e82aaaef703b0e2379a4798cda266 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/PackageElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/PackageElementBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/RepositoryElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/RepositoryElementBean.java similarity index 69% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/RepositoryElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/RepositoryElementBean.java index c8af71739928364789d734796bbb533a857c1e9b..6279c067cff2c27a1c2441c427a3c117a772de9a 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/RepositoryElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/RepositoryElementBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: @@ -6,7 +6,7 @@ package com.coderman.codemaker.bean.dddelement; * * 仓库元素 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ServiceElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ServiceElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..8dc80cfca3294e77ee2a36896ddd7efedc9f662c --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ServiceElementBean.java @@ -0,0 +1,14 @@ +package com.tianhua.codemaker.bean.dddelement; + +/** + * Description: + * date: 2021/6/28 + * + * 领域服务元素 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class ServiceElementBean extends ElementBean { +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ValueObjectElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ValueObjectElementBean.java similarity index 70% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ValueObjectElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ValueObjectElementBean.java index d95428333ae29b05be3ce90ce26d87e000cd4cbb..1a30cb1680b0ace52a011bf4ca48bba8b2f81781 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelement/ValueObjectElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelement/ValueObjectElementBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.dddelement; +package com.tianhua.codemaker.bean.dddelement; /** * Description: @@ -6,7 +6,7 @@ package com.coderman.codemaker.bean.dddelement; * 值对象实体 元素 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/ControllerElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/ControllerElementBean.java similarity index 59% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/ControllerElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/ControllerElementBean.java index b2beb00678a602466e528e46d6a85e4a77d754cf..ccc40233d825352ff8676f48aeb8f5adaec1a2ce 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/ControllerElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/ControllerElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DoBoConvertElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DoBoConvertElementBean.java similarity index 59% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DoBoConvertElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DoBoConvertElementBean.java index ec3c2ed2348adb72c3deae1dd1350257803f3b56..daa75133e7dccd3d60166f299ac1a87359cdad4d 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DoBoConvertElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DoBoConvertElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/Dto2DtoConvertElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/Dto2DtoConvertElementBean.java similarity index 54% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/Dto2DtoConvertElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/Dto2DtoConvertElementBean.java index 88f6b5b831beed1419c55be8bdf4cf3b4c7352c2..d2c1a513a6f6e28ec6586de0e25f62f7e4cd750d 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/Dto2DtoConvertElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/Dto2DtoConvertElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素, * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DtoBoConvertElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DtoBoConvertElementBean.java similarity index 59% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DtoBoConvertElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DtoBoConvertElementBean.java index f8d9d58ffafcb495197ae0e335e1328ff2382b00..d8a52dd22a1cb1ab6aab0505ca08d6bbcebe3963 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DtoBoConvertElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DtoBoConvertElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DtoElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DtoElementBean.java similarity index 58% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DtoElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DtoElementBean.java index 5282cc6e6c34f70f64646ffbf489eab2a92312d7..6d91742ef3130391ad7e838f8aa9717f572acea5 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/DtoElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/DtoElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/EnumElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/EnumElementBean.java similarity index 60% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/EnumElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/EnumElementBean.java index 74e2f2f7d48774b22397120603a73dabc8ebe07f..d456706bc346be29f2e4bdfa88012852c7758eef 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/EnumElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/EnumElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素valueobject.enum派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FacadeElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FacadeElementBean.java similarity index 58% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FacadeElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FacadeElementBean.java index cac10ec87fe91e942fcc61ff90ee269040542e02..729561baf9c2433fb5746ede1845958a807ce0be 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FacadeElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FacadeElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FacadeImplElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FacadeImplElementBean.java similarity index 59% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FacadeImplElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FacadeImplElementBean.java index 4a0f2f93b32de835348764556ad6945acfb852d7..d2b367c893f5c2b97ca0cff912855daa12ff6d4f 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FacadeImplElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FacadeImplElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FeignControllerElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FeignControllerElementBean.java similarity index 59% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FeignControllerElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FeignControllerElementBean.java index db5d14dacb07db917601e1f87334cd439f811b31..d5e659c40a11099dc93f772eee5f9f2ff89d826d 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FeignControllerElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FeignControllerElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FeignElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FeignElementBean.java similarity index 58% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FeignElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FeignElementBean.java index 06fd9c3e86577a628e2fcaf601ee81e171cff409..f34c751ecc99e3956804f7dafdc2a3eb57f51a47 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/FeignElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/FeignElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/GatawayImplElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/GatawayImplElementBean.java similarity index 56% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/GatawayImplElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/GatawayImplElementBean.java index 5b361f37849d0c5da3e18ea68d00d5871073927b..1f92635e4514a68c753cff9685cc59354172311f 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/GatawayImplElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/GatawayImplElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 由gataway接口派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/InfrastAclImplElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/InfrastAclImplElementBean.java similarity index 57% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/InfrastAclImplElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/InfrastAclImplElementBean.java index 681b2b7167c6b844de08cba39d7084157d79b8ed..cb284b0a1b020b058dd58b83b928d46b6b31481c 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/InfrastAclImplElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/InfrastAclImplElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 由infrastacl接口派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/RepositoryImplElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/RepositoryImplElementBean.java similarity index 57% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/RepositoryImplElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/RepositoryImplElementBean.java index d4b78f73775996efd6b9be8fce47af312908a21f..07ccecf23e21856f0ca7bbb8acdce6af6652276e 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/RepositoryImplElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/RepositoryImplElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 由repository接口派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/ServiceImplElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/ServiceImplElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..2a752a66ad511591d20b24297b68139e87382431 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/ServiceImplElementBean.java @@ -0,0 +1,16 @@ +package com.tianhua.codemaker.bean.dddelementderive; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * 派生元素,由领域实体元素bo派生而来 + * date: 2021/6/28 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class ServiceImplElementBean extends ElementBean { + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/VoBoConvertElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/VoBoConvertElementBean.java similarity index 59% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/VoBoConvertElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/VoBoConvertElementBean.java index 45ffcedc143c2e1f82ace9158c294f00d3e0ca89..99ff6f747d1b7a9a3111367a05f69d1e3bc3b2c5 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/VoBoConvertElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/VoBoConvertElementBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * 派生元素,由领域实体元素bo派生而来 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/VoElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/VoElementBean.java similarity index 49% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/VoElementBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/VoElementBean.java index b38951658091aedf67b3fde0584f3d94bb566132..f591b4de4d511d2b94498819e4962e40d21c22f0 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/dddelementderive/VoElementBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/dddelementderive/VoElementBean.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.bean.dddelementderive; +package com.tianhua.codemaker.bean.dddelementderive; -import com.coderman.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; /** * Description: * date: 2021/7/9 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/invoke/InvokeContextBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/invoke/InvokeContextBean.java similarity index 94% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/invoke/InvokeContextBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/invoke/InvokeContextBean.java index b9fe9fca803a73d6b7ba13e534a73f1339899cae..a80b4594755e12591f79fdf36eeef10906045f21 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/invoke/InvokeContextBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/invoke/InvokeContextBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.invoke; +package com.tianhua.codemaker.bean.invoke; -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.dynamic.InvokeSceneTypeEnum; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.dynamic.InvokeSceneTypeEnum; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; import org.apache.commons.lang3.StringUtils; @@ -12,7 +12,7 @@ import org.apache.commons.lang3.StringUtils; * Description: 调用时序上下文 * date: 2021/10/16 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/invoke/InvokeRowBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/invoke/InvokeRowBean.java similarity index 96% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/invoke/InvokeRowBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/invoke/InvokeRowBean.java index 735c9a212cdeb3093e0e50695fbe028794e6dd9e..a202b0af726b4145aed45dd0a1d10a1c24ffc067 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/invoke/InvokeRowBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/invoke/InvokeRowBean.java @@ -1,8 +1,8 @@ -package com.coderman.codemaker.bean.invoke; +package com.tianhua.codemaker.bean.invoke; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.FieldBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.FieldBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; import org.apache.commons.lang3.StringUtils; import java.util.Objects; @@ -11,7 +11,7 @@ import java.util.Objects; * Description:动态绘制的调用代码行 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/AbstractClassBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/AbstractClassBean.java similarity index 79% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/AbstractClassBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/AbstractClassBean.java index faca6aed64f754ada113f66e9daac449d77b3d44..e410a9aa0308a5d3472d5c8b80221cc75c240779 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/AbstractClassBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/AbstractClassBean.java @@ -1,18 +1,18 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.enums.CompTypeEnum; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.bean.segment.SegmentBean; +import com.tianhua.codemaker.enums.CompTypeEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.enums.TemplateFileEnum; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.apache.commons.collections4.CollectionUtils; -import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -22,11 +22,16 @@ import java.util.stream.Collectors; * 抽象plantuml 类 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ public abstract class AbstractClassBean { + + /** + * 类或者接口的范型信息 + */ + private PatternBean patternBean; /** * 类名 */ @@ -51,6 +56,18 @@ public abstract class AbstractClassBean { */ private List methodBeanList; + + /** + * 父类方法列表 + */ + private List superMethodBeanList; + + /** + * 父类属性列表 + * + */ + private List superFieldBeanList; + /** * 需要引入的class包名 */ @@ -108,7 +125,16 @@ public abstract class AbstractClassBean { /** * 在动态调用中产生的引用包 */ - private List dynamicImportPackageList; + private List dynamicImportPackageList = new ArrayList<>(); + + + private List thisClassImportPackageList = new ArrayList<>(); + + /** + * 子类需要导入的包 + */ + private List childClassImportPackageList = new ArrayList<>(); + /** @@ -144,6 +170,53 @@ public abstract class AbstractClassBean { */ private String context = ""; + /** + * plantUML的扩展注解标示 + */ + private List annotationTagList; + + /** + * 代码片段列表 + */ + private List codeSegmentBeanList = new ArrayList<>(); + + + public PatternBean getPatternBean() { + return patternBean; + } + + public void setPatternBean(PatternBean patternBean) { + this.patternBean = patternBean; + } + + public List getSuperMethodBeanList() { + return superMethodBeanList; + } + + public void setSuperMethodBeanList(List superMethodBeanList) { + this.superMethodBeanList = superMethodBeanList; + } + + public List getSuperFieldBeanList() { + return superFieldBeanList; + } + + public void setSuperFieldBeanList(List superFieldBeanList) { + this.superFieldBeanList = superFieldBeanList; + } + + public List getCodeSegmentBeanList() { + return codeSegmentBeanList; + } + + public List getAnnotationTagList() { + return annotationTagList; + } + + public void setAnnotationTagList(List annotationTagList) { + this.annotationTagList = annotationTagList; + } + public String getCompName() { return compName; } @@ -212,9 +285,6 @@ public abstract class AbstractClassBean { return dynamicImportPackageList; } - public void setDynamicImportPackageList(List dynamicImportPackageList) { - this.dynamicImportPackageList = dynamicImportPackageList; - } public String getBodtoConvertInterface() { return bodtoConvertInterface; @@ -340,6 +410,22 @@ public abstract class AbstractClassBean { } + public List getThisClassImportPackageList() { + return thisClassImportPackageList; + } + + public void setThisClassImportPackageList(List thisClassImportPackageList) { + this.thisClassImportPackageList = thisClassImportPackageList; + } + + public List getChildClassImportPackageList() { + return childClassImportPackageList; + } + + public void setChildClassImportPackageList(List childClassImportPackageList) { + this.childClassImportPackageList = childClassImportPackageList; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -505,7 +591,6 @@ public abstract class AbstractClassBean { public MethodBean getOrAddMethodBean(String currentMethod){ Optional methodBeanOptional = getMatchMethodBean(currentMethod); if(methodBeanOptional.isPresent()){ - methodBeanOptional.get().initInvokeRowContentList(); return methodBeanOptional.get(); } if(!currentMethod.contains("(")){ @@ -518,7 +603,6 @@ public abstract class AbstractClassBean { methodBean.buildParamArr(); methodBean.setReturnClass("void"); methodBean.setVisibility("public"); - methodBean.initInvokeRowContentList(); this.getMethodBeanList().add(methodBean); return methodBean; } @@ -553,6 +637,22 @@ public abstract class AbstractClassBean { } + /** + * 将classBean转换为WrteContentBean为后续的写文件做准备 + * @param content + * @param templateFileCode + * @return + */ + public WriteContentBean buildWriteContentBeanV2(String content, String templateFileCode, boolean custom){ + return WriteContentBean.builder().content(content) + .templateName(templateFileCode) + .customCodeElement(custom) + .humpClassName(this.getClassName()) + .classPackageName(this.getPackageName()) + .build(); + } + + /** * 由当前对象派生到新对象 * @param className @@ -586,6 +686,42 @@ public abstract class AbstractClassBean { } } + /** + * 给方法增加导入类 + * @param importClassList + */ + public void addImportClassBatch(List importClassList){ + if(CollectionUtils.isEmpty(importClassList)){ + return; + } + importClassList.stream().forEach(this::addImportClass); + } + + public void addDynamicImportClass(String packageName){ + if(this.getDynamicImportPackageList().contains(packageName)){ + return; + } + this.getDynamicImportPackageList().add(packageName); + } + + + public void addThisImportClass(String packageName){ + if(this.getThisClassImportPackageList().contains(packageName)){ + return; + } + this.getThisClassImportPackageList().add(packageName); + } + + + public void addChildImportClass(String packageName){ + if(this.getChildClassImportPackageList().contains(packageName)){ + return; + } + this.getChildClassImportPackageList().add(packageName); + } + + + /** * 为class增加fieldBean,根据名称判断是否存在,已存在则忽略 * @param fieldBean @@ -601,5 +737,12 @@ public abstract class AbstractClassBean { this.getFieldBeanList().add(fieldBean); } + /** + * 增加代码段 + * @param segmentBean + */ + public void addCodeSegment(SegmentBean segmentBean){ + this.codeSegmentBeanList.add(segmentBean); + } } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/AnnotationBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/AnnotationBean.java similarity index 68% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/AnnotationBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/AnnotationBean.java index 3cf50dcf5c582e865723766e352e108bb7835cae..047c1f10c4ca2bd2e25d034645ff1a4976fc59fe 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/AnnotationBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/AnnotationBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; /** * Description:枚举模型 * date: 2021/11/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/ClassBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ClassBean.java similarity index 67% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/ClassBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ClassBean.java index e1c043e0b80b2c42ab795c291acaca70180d45d4..95d8f3267be9f03e67aff0edf85136b3db3739b0 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/ClassBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ClassBean.java @@ -1,4 +1,6 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; + +import org.apache.commons.collections4.CollectionUtils; import java.util.HashMap; import java.util.Map; @@ -8,7 +10,7 @@ import java.util.Map; * class 类信息 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -20,8 +22,13 @@ public class ClassBean extends AbstractClassBean { varMap.put("table",this.getTableBean()); varMap.put("columns",this.getColumnBeanList()); varMap.put("fields",this.getFieldBeanList()); + if(CollectionUtils.isNotEmpty(this.getMethodBeanList())){ + this.getMethodBeanList().stream().forEach(methodBean -> methodBean.getSimplMethodName()); + } + varMap.put("methods",this.getMethodBeanList()); varMap.put("imports",this.getImportClassList()); + return varMap; } } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/EnumBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/EnumBean.java similarity index 97% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/EnumBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/EnumBean.java index 34d6a7796b6d1decf45f830013a328ef390da62f..9ffc42f0d52fdc6b4ee7695b52685bd0d7df5d82 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/EnumBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/EnumBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; import java.util.HashMap; import java.util.List; @@ -8,7 +8,7 @@ import java.util.Map; * Description: 枚举类 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/ExtendFieldBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ExtendFieldBean.java similarity index 83% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/ExtendFieldBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ExtendFieldBean.java index 2817399b52cf4be1fd58b12feb87fb2f6aafc896..6aff42fc0576e873cb1dcab093074e981ed9f47f 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/ExtendFieldBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ExtendFieldBean.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; /** * Description:从plantUMl中解析出的扩展属性上下文 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -35,7 +35,18 @@ public class ExtendFieldBean { */ private String[] voKeyList; + /** + * bo对应的校验对象列表 + */ + private String [] validateKeyList; + public String[] getValidateKeyList() { + return validateKeyList; + } + + public void setValidateKeyList(String[] validateKeyList) { + this.validateKeyList = validateKeyList; + } public String[] getInvokeFileKey() { return invokeFileKey; @@ -108,4 +119,8 @@ public class ExtendFieldBean { public void buildInvokeFileKeyArr(String invokeFileKey){ this.setInvokeFileKey(invokeFileKey.replace("String","").replace("string","").trim().split(",")); } + + public void buildValidteKeyArr(String invokeFileKey){ + this.setValidateKeyList(invokeFileKey.replace("String","").replace("string","").trim().split(",")); + } } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/FieldBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/FieldBean.java similarity index 90% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/FieldBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/FieldBean.java index 6c4f0bde0c828c47eb64e0ab0ec862e25adf4262..7981ab31984e51dc4968ce03e6375856a06527fc 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/FieldBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/FieldBean.java @@ -1,8 +1,8 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; import com.alibaba.fastjson.annotation.JSONField; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.enums.VisibilityEnum; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.enums.VisibilityEnum; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; @@ -12,7 +12,7 @@ import java.util.List; * Description: * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -57,6 +57,18 @@ public class FieldBean { */ private String originFieldStr; + /** + * vo/dto/do等模型属性上的扩展注解标示 + */ + private List annotationTagList = new ArrayList<>(); + + public List getAnnotationTagList() { + return annotationTagList; + } + + public void setAnnotationTagList(List annotationTagList) { + this.annotationTagList = annotationTagList; + } public String getOriginFieldStr() { return originFieldStr; @@ -216,6 +228,11 @@ public class FieldBean { || this.fieldName.toLowerCase().contains(GlobalConstant.EXPORT_ACL_KEY); } + @JSONField(serialize = false) + public boolean isValidateKey(){ + return this.desc.toLowerCase().contains(GlobalConstant.VALIDATE_KEY) + || this.fieldName.toLowerCase().contains(GlobalConstant.VALIDATE_KEY); + } /** * 根据条件判断是否是简单类型--非扩展字段信息判断 @@ -233,6 +250,7 @@ public class FieldBean { && !this.isQueryVoKey() && !this.isQueryDtoKey() && !this.isExportAclKey() + && !this.isValidateKey() && !this.isMethod(); } @@ -349,4 +367,11 @@ public class FieldBean { classBean.setFieldBeanList(fieldBeanList); return classBean; } + + public void addAnnotationTag(String annotation){ + if(this.annotationTagList.contains(annotation)){ + return; + } + this.annotationTagList.add(annotation); + } } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/InterfaceBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/InterfaceBean.java similarity index 64% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/InterfaceBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/InterfaceBean.java index 74fd684e67ddbff284a2e739889557f5e00ecc04..c92a626f5e74fbbe8ff31b8fc1ee931063c32abf 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/InterfaceBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/InterfaceBean.java @@ -1,4 +1,6 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; + +import org.apache.commons.collections4.CollectionUtils; import java.util.HashMap; import java.util.Map; @@ -9,7 +11,7 @@ import java.util.Map; * 领域接口 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -18,6 +20,9 @@ public class InterfaceBean extends AbstractClassBean{ Map varMap = new HashMap<>(); varMap.put("class",this); varMap.put("fields",this.getFieldBeanList()); + if(CollectionUtils.isNotEmpty(this.getMethodBeanList())){ + this.getMethodBeanList().stream().forEach(methodBean -> methodBean.getSimplMethodName()); + } varMap.put("methods",this.getMethodBeanList()); varMap.put("imports",this.getImportClassList()); return varMap; diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/MethodBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/MethodBean.java similarity index 85% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/MethodBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/MethodBean.java index 2f6853af074f46840d0b8419b3a73dbe0bedec1f..a6e511bd6197b1c1fec6321548a8f0b32fb502c2 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/MethodBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/MethodBean.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; import com.alibaba.fastjson.annotation.JSONField; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.apidoc.ApiDocBean; -import com.coderman.codemaker.bean.apidoc.ApiParamBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.enums.VisibilityEnum; -import com.coderman.codemaker.utils.StringHandleUtils; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.apidoc.ApiDocBean; +import com.tianhua.codemaker.bean.apidoc.ApiParamBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.VisibilityEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -17,7 +17,7 @@ import java.util.*; * Description: * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -84,15 +84,14 @@ public class MethodBean { /** * 方法调用内容,根据调用流程图-plantUML解析而来 */ - private LinkedList invokeMethodList; + private LinkedList invokeMethodList = new LinkedList<>(); /** * 方法调用内容,根据调用流程图-plantUML解析而来 * 与invokeMethodList保持一致 * 帮助去除重复和进行上下文调用分析辅助动态绘制 */ - private List invokeRowBeanList; - + private List invokeRowBeanList = new ArrayList<>(); /** * 方法文档 @@ -104,11 +103,16 @@ public class MethodBean { */ private String [] paramArr; + /** + * 参数列表 + */ + private List paramBeanList; /** + * list 扩展性比较强 * 对于mapper和controller需要增加参数注解的进行动态构建参数注解 */ - private String [] paramAnnotationArr; + private List paramAnnotationList = new ArrayList<>(5); /** * 所属类名 @@ -135,6 +139,47 @@ public class MethodBean { */ private boolean modelExtendMethod; + /** + * plantUML的扩展注解标示 + */ + private List annotationTagList; + + + + private String simpleMethodNameInfo; + + public String getSimpleMethodNameInfo() { + return simpleMethodNameInfo; + } + + public void setSimpleMethodNameInfo(String simpleMethodNameInfo) { + this.simpleMethodNameInfo = simpleMethodNameInfo; + } + + public List getParamBeanList() { + return paramBeanList; + } + + public void setParamBeanList(List paramBeanList) { + this.paramBeanList = paramBeanList; + } + + public List getParamAnnotationList() { + return paramAnnotationList; + } + + public void setParamAnnotationList(List paramAnnotationList) { + this.paramAnnotationList = paramAnnotationList; + } + + public List getAnnotationTagList() { + return annotationTagList; + } + + public void setAnnotationTagList(List annotationTagList) { + this.annotationTagList = annotationTagList; + } + public boolean isModelExtendMethod() { return modelExtendMethod; } @@ -167,13 +212,6 @@ public class MethodBean { this.annotation = annotation; } - public String[] getParamAnnotationArr() { - return paramAnnotationArr; - } - - public void setParamAnnotationArr(String[] paramAnnotationArr) { - this.paramAnnotationArr = paramAnnotationArr; - } public List getInvokeRowBeanList() { return invokeRowBeanList; @@ -401,6 +439,7 @@ public class MethodBean { newBean.setParamArr(this.getParamArr()); newBean.setStatic(this.isStatic()); newBean.setPathValue(this.getPathValue()); + newBean.setAnnotationTagList(this.getAnnotationTagList()); newBean.setMethodName(refreshMethodName()); return newBean; @@ -411,14 +450,14 @@ public class MethodBean { * @return */ public String refreshMethodName(){ - if(this.getParamAnnotationArr() == null || this.getParamAnnotationArr().length == 0){ + if(CollectionUtils.isEmpty(this.paramAnnotationList)){ return this.getMethodName(); } String preMethod = this.getMethodName().split("\\(")[0]; StringBuilder builder = new StringBuilder(preMethod); List paramList = new ArrayList<>(); - for (int i = 0;i < this.getParamArr().length;i++){ - String annotation = this.getParamAnnotationArr()[i]; + for (int i = 0;i < this.getParamArr().length;i ++){ + String annotation = this.paramAnnotationList.get(i); String param = this.getParamArr()[i]; paramList.add(annotation + " " + param); } @@ -462,10 +501,12 @@ public class MethodBean { */ public String getSimplMethodName(){ if(this.getMethodName().contains("()")){ - return this.getMethodName().replace("()",""); + this.simpleMethodNameInfo = this.getMethodName().replace("()",""); + return this.simpleMethodNameInfo; } else { - return this.getMethodName().split("\\(")[0]; + this.simpleMethodNameInfo = this.getMethodName().split("\\(")[0]; + return this.simpleMethodNameInfo; } } @@ -503,19 +544,16 @@ public class MethodBean { } + /** - * 初始化 + * 简化版本构建方法调用内容 + * 代码段场景+分层场景使用 + * @param invokeRowContent */ - public void initInvokeRowContentList(){ - if(CollectionUtils.isEmpty(invokeRowBeanList)){ - this.setInvokeRowBeanList(new ArrayList<>()); - } - if(CollectionUtils.isEmpty(invokeMethodList)){ - this.setInvokeMethodList(new LinkedList<>()); - } + public void addInvokeRowContentSimple(String invokeRowContent){ + this.invokeMethodList.add(invokeRowContent); } - /** * 解析方法返回参数类型,是否包含vo,dto,bo * @return @@ -690,4 +728,18 @@ public class MethodBean { || this.methodName.toLowerCase().contains(GlobalConstant.EXPORT_ACL_KEY); } + public void addParamAnnotation(String paramAnnotation, int index){ + this.paramAnnotationList.add(paramAnnotation); + if(StringUtils.isEmpty(this.paramAnnotationList.get(index))){ + this.paramAnnotationList.set(index,paramAnnotation); + }else { + if(this.paramAnnotationList.get(index).contains(paramAnnotation)){ + return; + } + String paramAnno = paramAnnotation + " " + this.paramAnnotationList.get(index); + this.paramAnnotationList.set(index,paramAnno); + } + } + + } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/PackageBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PackageBean.java similarity index 94% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/PackageBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PackageBean.java index 2877b4f529ffb05138c389049cdd02a3e11492ca..5664fbb69136e7c8504a6211d1c9008b781966c5 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/PackageBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PackageBean.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; import java.util.List; @@ -6,7 +6,7 @@ import java.util.List; * Description: * date: 2021/7/2 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ParamBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ParamBean.java new file mode 100644 index 0000000000000000000000000000000000000000..18a73e42f5d4e087f540556f3b0fd7e4c17dfba3 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/ParamBean.java @@ -0,0 +1,67 @@ +package com.tianhua.codemaker.bean.plantuml; + +/** + * Description: + * date: 2022/3/14 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class ParamBean { + + + public ParamBean(){} + public ParamBean(String paramClass, String paramName){ + this.paramClass = paramClass; + this.paramName = paramName; + } + + /** + * 参数类型 + */ + private String paramClass; + + /** + * 参数类型 + */ + private String paramName; + + + /** + * 是否是范型参数 + */ + private boolean genericType; + + + public String getParamName() { + return paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public String getParamClass() { + return paramClass; + } + + public void setParamClass(String paramClass) { + this.paramClass = paramClass; + } + + + public boolean isGenericType() { + return genericType; + } + + public void setGenericType(boolean genericType) { + this.genericType = genericType; + } + + public static ParamBean getInstance(String paramClass, String paramName, Boolean genericType){ + ParamBean paramBean = new ParamBean(paramClass,paramName); + paramBean.setGenericType(genericType); + return paramBean; + } +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PatternBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PatternBean.java new file mode 100644 index 0000000000000000000000000000000000000000..295fa527f1b1aae7d8ef300a29fed2fbf51131ef --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PatternBean.java @@ -0,0 +1,55 @@ +package com.tianhua.codemaker.bean.plantuml; + +/** + * Description:范型模型 + * date: 2022/3/14 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class PatternBean { + + /** + * 范型类型标示 + * 或者类名 + */ + public String tagClass; + + /** + * 范型类继承的父类 + * ? extends T + */ + public boolean withExtends; + + /** + * 范型类的父类 + * ? super T + */ + public Boolean withSuper; + + + public String getTagClass() { + return tagClass; + } + + public void setTagClass(String tagClass) { + this.tagClass = tagClass; + } + + public boolean isWithExtends() { + return withExtends; + } + + public void setWithExtends(boolean withExtends) { + this.withExtends = withExtends; + } + + public Boolean getWithSuper() { + return withSuper; + } + + public void setWithSuper(Boolean withSuper) { + this.withSuper = withSuper; + } +} diff --git a/codemaker-parent/codemaker-core/src/test/java/Test.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PatternMethodBean.java similarity index 35% rename from codemaker-parent/codemaker-core/src/test/java/Test.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PatternMethodBean.java index 60257b4f1ad52a7fd0475d92c7515816942980db..ad8a9035a168916a4923e2076c71c274733e236a 100644 --- a/codemaker-parent/codemaker-core/src/test/java/Test.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PatternMethodBean.java @@ -1,13 +1,14 @@ +package com.tianhua.codemaker.bean.plantuml; + /** * Description: - * date: 2021/11/22 + * date: 2022/3/14 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ -public class Test { - public static void main(String[] args) { +public class PatternMethodBean { + - } } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/PlantUmlContextBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PlantUmlContextBean.java similarity index 53% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/PlantUmlContextBean.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PlantUmlContextBean.java index 01eae19065cb49e7f60155e0e4d5b58a21e88856..5ebfad485d70874a5523d68a0047ec24330a065c 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/bean/plantuml/PlantUmlContextBean.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/plantuml/PlantUmlContextBean.java @@ -1,8 +1,11 @@ -package com.coderman.codemaker.bean.plantuml; +package com.tianhua.codemaker.bean.plantuml; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; import com.google.common.collect.Sets; +import org.apache.commons.lang3.StringUtils; import java.util.*; @@ -10,20 +13,23 @@ import java.util.*; * Description: * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ public class PlantUmlContextBean { - private Map classBeanMap = new HashMap<>(); + private Map classBeanMap = new HashMap<>(); - private Map enumBeanMap = new HashMap<>(); + private Map enumBeanMap = new HashMap<>(); private Map interfaceBeanMap = new HashMap<>(); - private Map packageBeanMap = new HashMap<>(); + /** + * pom相关配置 + */ + public Map pomBeanMap = new HashMap<>(); /** * 派生类上下文 @@ -33,7 +39,7 @@ public class PlantUmlContextBean { /** * 扫描到的依赖组件 */ - private Map compContextBeanMap; + private Map compContextBeanMap = new HashMap<>(); /** @@ -44,9 +50,7 @@ public class PlantUmlContextBean { /** * app应用类型 */ - private String applicationType; - - + private String applicationType; /** * 动态调用时序图文件 @@ -58,7 +62,21 @@ public class PlantUmlContextBean { * key:调用方的类名.方法名 * value:被调用方的类名.方法名 */ - private Map> dynamicInvokeChainMap = new HashMap<>(); + private Map> dynamicInvokeChainMap = new HashMap<>(); + + + /** + * 自定义代码元素配置bean对象,在对应elementHandler做路由标示 + */ + private FtlBean ftlBean; + + public FtlBean getFtlBean() { + return ftlBean; + } + + public void setFtlBean(FtlBean ftlBean) { + this.ftlBean = ftlBean; + } public Map> getDynamicInvokeChainMap() { return dynamicInvokeChainMap; @@ -72,6 +90,10 @@ public class PlantUmlContextBean { this.derivedPlantUmlContextBean = derivedPlantUmlContextBean; } + public Map getPomBeanMap() { + return pomBeanMap; + } + public Map getClassBeanMap() { return classBeanMap; } @@ -84,26 +106,26 @@ public class PlantUmlContextBean { return interfaceBeanMap; } - public void addClassBean(ClassBean classBean){ - this.classBeanMap.put(classBean.getClassName(),classBean); + public void addClassBean(ClassBean classBean) { + this.classBeanMap.put(classBean.getClassName(), classBean); } - public void addInterfaceBean(InterfaceBean interfaceBean){ + public void addInterfaceBean(InterfaceBean interfaceBean) { - this.interfaceBeanMap.put(interfaceBean.getClassName(),interfaceBean); + this.interfaceBeanMap.put(interfaceBean.getClassName(), interfaceBean); } - public void addEnumBean(EnumBean enumBean){ - this.enumBeanMap.put(enumBean.getClassName(),enumBean); + public void addPomBean(PomBean pomBean) { + if(StringUtils.isEmpty(pomBean.getModuleCode())){ + return; + } + this.pomBeanMap.put(pomBean.getModuleCode(), pomBean); } - public Map getPackageBeanMap() { - return packageBeanMap; + public void addEnumBean(EnumBean enumBean) { + this.enumBeanMap.put(enumBean.getClassName(), enumBean); } - public void addPacakge(PackageBean packageBean){ - this.packageBeanMap.put(packageBean.getPackageName(),packageBean); - } public List getDynamicInvokeFileList() { return dynamicInvokeFileList; @@ -111,12 +133,13 @@ public class PlantUmlContextBean { /** * 解析多个调用时序图文件名称 + * * @param plantUMLFileName */ - public void addDynamicInvokeFile(String plantUMLFileName){ - if(plantUMLFileName.contains(",")){ - String [] arr = plantUMLFileName.split(","); - for (String fileName : arr){ + public void addDynamicInvokeFile(String plantUMLFileName) { + if (plantUMLFileName.contains(",")) { + String[] arr = plantUMLFileName.split(","); + for (String fileName : arr) { dynamicInvokeFileList.add(fileName.trim()); } return; @@ -126,25 +149,26 @@ public class PlantUmlContextBean { /** * 记录调用时序图中的调用方信息 + * * @param invokeContextBean * @return 是否保存成功 */ - public boolean addInvokeMethod(InvokeContextBean invokeContextBean){ + public boolean addInvokeMethod(InvokeContextBean invokeContextBean) { - String key = invokeContextBean.getInvokerClassBean().getClassName()+"."+invokeContextBean.getInvokerMethodBean().getMethodName(); + String key = invokeContextBean.getInvokerClassBean().getClassName() + "." + invokeContextBean.getInvokerMethodBean().getMethodName(); Set providerMethodSet = this.dynamicInvokeChainMap.get(key); - if(providerMethodSet == null){ + if (providerMethodSet == null) { providerMethodSet = Sets.newHashSet(); } - String value = invokeContextBean.getProviderClassName()+invokeContextBean.getProviderClassMethod(); + String value = invokeContextBean.getProviderClassName() + invokeContextBean.getProviderClassMethod(); - if(providerMethodSet.contains(value)){ + if (providerMethodSet.contains(value)) { return false; } providerMethodSet.add(value); - this.getDynamicInvokeChainMap().put(key,providerMethodSet); + this.getDynamicInvokeChainMap().put(key, providerMethodSet); return true; } @@ -170,7 +194,13 @@ public class PlantUmlContextBean { return compContextBeanMap; } - public void setCompContextBeanMap(Map compContextBeanMap) { - this.compContextBeanMap = compContextBeanMap; + public void addCompContextBean(String key, ComponentContextBean componentContextBean) { + this.compContextBeanMap.put(key, componentContextBean); } + + + public void addCompContextBeanBatch(Map componentContextBeanMap) { + this.compContextBeanMap.putAll(componentContextBeanMap); + } + } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/segment/SegmentBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/segment/SegmentBean.java new file mode 100644 index 0000000000000000000000000000000000000000..25d3d0cb24f4ee9b727726f2f543baee112d6105 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/bean/segment/SegmentBean.java @@ -0,0 +1,113 @@ +package com.tianhua.codemaker.bean.segment; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Description;代码片段模型 + * date; 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class SegmentBean { + + public SegmentBean(){} + public SegmentBean(String identifer){ + this.identifer = identifer; + } + + public SegmentBean(String identifer, String code){ + this.identifer = identifer; + this.code = code; + } + /** + * 代码段内容 + */ + private String code; + /** + * 代码段中需要导入的包 + */ + private List packageNameList = new ArrayList<>(); + /** + * 代码段类型标示 + */ + private String identifer; + /** + * 代码段模板 + */ + private String segmentTemplate; + + /** + * 代码段模板对应的变量列表map + */ + private Map templateVarMap; + + /** + * 关联的代码类名称 + */ + private String relationClassName; + + + + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public List getPackageNameList() { + return packageNameList; + } + + public void setPackageNameList(List packageNameList) { + this.packageNameList = packageNameList; + } + + public String getIdentifer() { + return identifer; + } + + public void setIdentifer(String identifer) { + this.identifer = identifer; + } + + public String getSegmentTemplate() { + return segmentTemplate; + } + + public void setSegmentTemplate(String segmentTemplate) { + this.segmentTemplate = segmentTemplate; + } + + public Map getTemplateVarMap() { + return templateVarMap; + } + + public void setTemplateVarMap(Map templateVarMap) { + this.templateVarMap = templateVarMap; + } + + public String getRelationClassName() { + return relationClassName; + } + + public void setRelationClassName(String relationClassName) { + this.relationClassName = relationClassName; + } + + + public static SegmentBean getInstance(String identifer, String code ){ + return new SegmentBean(identifer, code); + } + + public void importPackageName(String packageName){ + this.packageNameList.add(packageName); + } + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/AdapterPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/AdapterPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..da21d30ceea9ba14a8841c5021ff272b15f2f3d0 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/AdapterPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class AdapterPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/AppPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/AppPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..5221215d9d0c5b988cf328e0889ef22e5189fafc --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/AppPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class AppPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/CustomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/CustomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..1c944ef33aa32a531b789a5c760965b0b65540a4 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/CustomElementBean.java @@ -0,0 +1,16 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class CustomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/DomainPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/DomainPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..06422b47013119a2c027ed3f8cb9d1857f85d6a2 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/DomainPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class DomainPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/FeignApiPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/FeignApiPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..4f10abb9e4e937af07d475675bfa979070fd7a9e --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/FeignApiPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class FeignApiPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/FeignProviderPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/FeignProviderPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..9c535e632a3bb8090695a8d3d6e389dd02f1bb12 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/FeignProviderPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class FeignProviderPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/InfrastPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/InfrastPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..b4f2a2ec3c68c25c284099cafce868c4f2d43788 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/InfrastPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class InfrastPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/ParentPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/ParentPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..6b8727eb66268fe29a1ded68838064772fb6d952 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/ParentPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class ParentPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/PomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/PomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..a7459ed06a80e1457ccc546d8325cb06ce3d4db6 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/PomElementBean.java @@ -0,0 +1,16 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class PomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/StartPomElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/StartPomElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..92a16b0976fb55026904b151ee90a6d8b8ccdf60 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/StartPomElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class StartPomElementBean extends ElementBean { + + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/ValidatorElementBean.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/ValidatorElementBean.java new file mode 100644 index 0000000000000000000000000000000000000000..df7bb760cfa6ce7202d2e223e79b43024846dd30 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/bean/ValidatorElementBean.java @@ -0,0 +1,17 @@ +package com.tianhua.codemaker.custom.bean; + +import com.tianhua.codemaker.bean.dddelement.ElementBean; + +/** + * Description: + * 自定义代码元素实现 + * date: 2021/6/28 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Deprecated +public class ValidatorElementBean extends ElementBean { + +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/package-info.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..9ac5422a86e78313c87a2ac49d4a12c6fe08d3c7 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/custom/package-info.java @@ -0,0 +1 @@ +package com.tianhua.codemaker.custom; \ No newline at end of file diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ClassEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ClassEnum.java similarity index 35% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ClassEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ClassEnum.java index e2beb3766fedda6cb1607d3f893350cb74cfdf43..667eb5ed80315eb476274d6ec95bc68dcab5229e 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ClassEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ClassEnum.java @@ -1,10 +1,12 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; + +import java.util.Objects; /** * Description: * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -13,6 +15,10 @@ public enum ClassEnum { CLASS("class"), INTERFACE("interface"), ENUM("enum"), + POM("pom"), + PROPERTIES("properties"), + YML("YML"), + ; private String classType; ClassEnum(String classType){ @@ -22,4 +28,22 @@ public enum ClassEnum { public String getClassType() { return classType; } + + public static boolean isClass(String classType){ + return Objects.equals(classType,ClassEnum.CLASS.getClassType()); + } + + public static boolean isInterface(String classType){ + return Objects.equals(classType,ClassEnum.INTERFACE.getClassType()); + } + + public static boolean isEnum(String classType){ + return Objects.equals(classType,ClassEnum.ENUM.getClassType()); + } + + public static boolean isPom(String classType){ + return Objects.equals(classType,ClassEnum.POM.getClassType()); + } + + } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ClassRelationEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ClassRelationEnum.java similarity index 98% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ClassRelationEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ClassRelationEnum.java index 4df1655c1ac0ede9182b766c50a3be9608580363..1764f95b76ea6761e5247c1e26a4e29cf0b26eb0 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ClassRelationEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ClassRelationEnum.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; import com.google.common.collect.Sets; import org.apache.commons.lang3.StringUtils; @@ -12,7 +12,7 @@ import java.util.concurrent.atomic.AtomicReference; * Description: * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CodeElementEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CodeElementEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..9a312094389c6cbba2cd1662060da1f22fc480e2 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CodeElementEnum.java @@ -0,0 +1,78 @@ +package com.tianhua.codemaker.enums; + +/** + * description: TemplateFileEnum
+ * date: 2020/7/7 23:44
+ * author: coderman
+ * version: 1.0
+ * 代码元素类型枚举 + */ +public enum CodeElementEnum { + ENTITY("entity", ClassEnum.CLASS.getClassType()), + MAPPER("mapper", ClassEnum.INTERFACE.getClassType()), + POM("pom",""), + CONTROLLER("controller",ClassEnum.CLASS.getClassType()), + MAPPER_XML("mapperxml",""), + SERVICE_CLASS("serviceclasss",ClassEnum.CLASS.getClassType()), + SERVICE_INTERFACE("serviceinterface",ClassEnum.INTERFACE.getClassType()), + + SERVICE_IMPL("serviceImpl",ClassEnum.CLASS.getClassType()), + VO("vo",ClassEnum.CLASS.getClassType()), + TEST("test",ClassEnum.CLASS.getClassType()), + DTO("dto",ClassEnum.CLASS.getClassType()), + FACADE("facade",ClassEnum.INTERFACE.getClassType()), + DATA_OBJECT("do",ClassEnum.CLASS.getClassType()), + FACADE_IMPL("facadeImpl",ClassEnum.CLASS.getClassType()), + BUSINESS_OBJECT("bo",ClassEnum.CLASS.getClassType()), + CONVERT("convert",ClassEnum.INTERFACE.getClassType()), + DTOBO_CONVERT("dtoboconvert",ClassEnum.INTERFACE.getClassType()), + DTO2DTO_CONVERT("dto2dtoconvert",ClassEnum.INTERFACE.getClassType()), + DOBO_CONVERT("doboconvert",ClassEnum.INTERFACE.getClassType()), + GATAWAY("gataway",ClassEnum.INTERFACE.getClassType()), + REPOSITORY("repository",ClassEnum.INTERFACE.getClassType()), + REPOSITORY_IMPL("repositoryimpl",ClassEnum.CLASS.getClassType()), + FACTORY("factory",ClassEnum.CLASS.getClassType()), + ENUM("enum",ClassEnum.ENUM.getClassType()), + API_ENUM("apienum",ClassEnum.ENUM.getClassType()), + MESSAGE_BODY("msgbody",ClassEnum.CLASS.getClassType()), + EVENT_BODY("event",ClassEnum.CLASS.getClassType()), + GATAWAY_IMPL("gatawayimpl",ClassEnum.CLASS.getClassType()), + ACL_IMPL("aclimpl",ClassEnum.CLASS.getClassType()), + ACL_REQ("aclreq",ClassEnum.CLASS.getClassType()), + ACL_RES("aclres",ClassEnum.CLASS.getClassType()), + ACL_PARAM("aclparam",ClassEnum.CLASS.getClassType()), + CMD("cmd",ClassEnum.CLASS.getClassType()), + EXE("exe",ClassEnum.INTERFACE.getClassType()), + EXE_IMPL("exeimpl",ClassEnum.CLASS.getClassType()), + EXE_ABSTRACT("abstractexe" ,ClassEnum.CLASS.getClassType()), + VALUE_OBJECT("valueobject", ClassEnum.CLASS.getClassType()), + VOBO_CONVERT("voboconvert",ClassEnum.INTERFACE.getClassType()), + + MQ_CONSUMER("mqconsumer",ClassEnum.CLASS.getClassType()), + MQ_HANDLER("mqhandler",ClassEnum.CLASS.getClassType()), + MQ_LISTENER("mqlistener",ClassEnum.CLASS.getClassType()), + MQ_PRODUCER("mqproducer",ClassEnum.CLASS.getClassType()), + + + + FEIGN("feign",ClassEnum.INTERFACE.getClassType()), + + + ; + private String code; + + private String classType; + + CodeElementEnum(String code,String classType){ + this.code = code; + this.classType = classType; + } + + public String getCode() { + return code; + } + + public String getClassType() { + return classType; + } +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CodeSegmentEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CodeSegmentEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..0ba3f8ea62d7a2f7112c67c494bec54a14635173 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CodeSegmentEnum.java @@ -0,0 +1,37 @@ +package com.tianhua.codemaker.enums; + +/** + * Description: + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public enum CodeSegmentEnum { + VALIDATE("validate","校验标示") + ; + + private String tag; + private String desc; + CodeSegmentEnum(String tag, String desc){ + this.tag = tag; + this.desc = desc; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/CompTypeEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CompTypeEnum.java similarity index 91% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/CompTypeEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CompTypeEnum.java index 0b6cc82ee9ebc629a825d4115a480251d11878ad..d3f2bcc821b7c793df41d6d1ee6b19876aa58ce7 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/CompTypeEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/CompTypeEnum.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; /** * Description:组件类型 * date: 2021/12/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ConfigFileEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ConfigFileEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..174d339e73af10fb9c4294d6aaae25d6b950db14 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ConfigFileEnum.java @@ -0,0 +1,27 @@ +package com.tianhua.codemaker.enums; + +/** + * Description: + * date: 2022/3/30 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public enum ConfigFileEnum { + + PROPERTIES("properties"), + YML("yml"), + CONFIG("config"), + SH("sh"), + ; + + private String fileExtName; + ConfigFileEnum(String fileExtName){ + this.fileExtName = fileExtName; + } + + public String getFileExtName() { + return fileExtName; + } +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/DomainDerivedElementEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/DomainDerivedElementEnum.java similarity index 94% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/DomainDerivedElementEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/DomainDerivedElementEnum.java index fff2bc3ac62d3ceef45e9274710e8decf61e5a9b..0725049203c0818e96667651be3d3f00d5ad1069 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/DomainDerivedElementEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/DomainDerivedElementEnum.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; /** * Description:领域派生类枚举 * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/DomainElementEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/DomainElementEnum.java similarity index 93% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/DomainElementEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/DomainElementEnum.java index d6d9ec2d0eb78a6e16236012655c9fbfba76cd91..650da1e9879e001195fdc73cc53de5ecfaf3b641 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/DomainElementEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/DomainElementEnum.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; /** * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -30,6 +30,7 @@ public enum DomainElementEnum { MQ_HANDLER("mqhandler","消息处理器"), CACHE("cache","缓存"), + SERVICE_IMPL("serviceimpl","领域服务实现"), GATAWAY_IMPL("gatawayimpl","领域网关服务实现"), REPOSITORY_IMPL("repositoryimpl","领域仓库实现"), ACL_IMPL("aclimpl","适配器防腐层实现"), diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/MethodReturnClassTypeEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/MethodReturnClassTypeEnum.java similarity index 96% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/MethodReturnClassTypeEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/MethodReturnClassTypeEnum.java index e71b7080abdef3eceee0e24f70f1409b572b1fa7..26d3880c95d13d4083585a4ab74898c4f7827744 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/MethodReturnClassTypeEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/MethodReturnClassTypeEnum.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; /** * Description:方法返回类型 * date: 2021/10/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ModuleEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ModuleEnum.java similarity index 80% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ModuleEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ModuleEnum.java index 187ff700318e9b776b1c94182d252bedc7691868..89ba06e47c5d64711c1895e2b9746222857b9466 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/ModuleEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/ModuleEnum.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; -import com.coderman.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.GlobalConstant; import com.google.common.collect.Sets; import java.util.Set; @@ -10,7 +10,7 @@ import java.util.Set; * Description: 项目模块枚举 * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -18,17 +18,18 @@ public enum ModuleEnum { /** * */ - SPRING_BOOT_WEB("springboot","codemaker-springboot", - Sets.newHashSet(TemplateFileEnum.APPLICATION.getTempFileName(), + SPRING_BOOT_WEB("springboot","springboot", + Sets.newHashSet( TemplateFileEnum.MAPPER_XML.getTempFileName(), TemplateFileEnum.MAPPER.getTempFileName(), TemplateFileEnum.MAPPER_DDD.getTempFileName(), TemplateFileEnum.MAPPER_XML_DDD.getTempFileName(), - TemplateFileEnum.CONTROLLER.getTempFileName(), TemplateFileEnum.CONTROLLER_DDD.getTempFileName(), TemplateFileEnum.SERVICE_IMPL.getTempFileName(), TemplateFileEnum.SERVICE.getTempFileName(), + TemplateFileEnum.SERVICE_DDD.getTempFileName(), + TemplateFileEnum.SERVICE_IMPL_DDD.getTempFileName(), TemplateFileEnum.VO.getTempFileName(), TemplateFileEnum.VO_DDD.getTempFileName(), TemplateFileEnum.DTO_DDD.getTempFileName(), @@ -39,6 +40,7 @@ public enum ModuleEnum { TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), TemplateFileEnum.TEST.getTempFileName(), + TemplateFileEnum.TEST_DDD.getTempFileName(), TemplateFileEnum.VALUE_OBJECT.getTempFileName(), TemplateFileEnum.ENUM.getTempFileName(), TemplateFileEnum.CMD.getTempFileName(), @@ -53,7 +55,7 @@ public enum ModuleEnum { TemplateFileEnum.ACL_IMPL.getTempFileName(), TemplateFileEnum.ACL_PARAM.getTempFileName(), TemplateFileEnum.DTOBO_CONVERT.getTempFileName(), - TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), + //TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), TemplateFileEnum.VOBO_CONVERT.getTempFileName(), TemplateFileEnum.FACTORY.getTempFileName(), TemplateFileEnum.MESSAGE_BODY.getTempFileName(), @@ -65,13 +67,11 @@ public enum ModuleEnum { TemplateFileEnum.MQ_PRODUCER.getTempFileName(), TemplateFileEnum.MQ_LISTENER.getTempFileName(), TemplateFileEnum.MQ_HANDLER.getTempFileName(), + TemplateFileEnum.PARENT_POM.getTempFileName(), TemplateFileEnum.MQ_HANDLER.getTempFileName(), TemplateFileEnum.CACHE.getTempFileName(), - - TemplateFileEnum.BASE_EVENT.getTempFileName(), - TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName(), - GlobalConstant.SINGLE_CLASS_COMMON, - TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName())), + GlobalConstant.SINGLE_CLASS_COMMON) + ), @@ -86,6 +86,7 @@ public enum ModuleEnum { TemplateFileEnum.DTO_DDD.getTempFileName(), TemplateFileEnum.DTO.getTempFileName(), TemplateFileEnum.API_ENUM.getTempFileName(), + TemplateFileEnum.API_POM.getTempFileName(), GlobalConstant.SINGLE_CLASS_COMMON )), @@ -93,7 +94,7 @@ public enum ModuleEnum { * */ SC_FEIGN_PROVIDER("springcloud","springcloud-provider", - Sets.newHashSet(TemplateFileEnum.APPLICATION.getTempFileName(), + Sets.newHashSet( TemplateFileEnum.MAPPER_XML.getTempFileName(), TemplateFileEnum.MAPPER.getTempFileName(), TemplateFileEnum.MAPPER_DDD.getTempFileName(), @@ -103,15 +104,15 @@ public enum ModuleEnum { TemplateFileEnum.CONTROLLER_DDD.getTempFileName(), TemplateFileEnum.SERVICE_IMPL.getTempFileName(), TemplateFileEnum.SERVICE.getTempFileName(), - /* TemplateFileEnum.VO.getTempFileName(), - TemplateFileEnum.VO_DDD.getTempFileName(),*/ + TemplateFileEnum.SERVICE_DDD.getTempFileName(), + TemplateFileEnum.SERVICE_IMPL_DDD.getTempFileName(), TemplateFileEnum.DTO_DDD.getTempFileName(), TemplateFileEnum.DTO.getTempFileName(), TemplateFileEnum.ENTITY.getTempFileName(), TemplateFileEnum.DATA_OBJECT.getTempFileName(), TemplateFileEnum.BUSINESS_OBJECT.getTempFileName(), TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), - + TemplateFileEnum.TEST_DDD.getTempFileName(), TemplateFileEnum.TEST.getTempFileName(), TemplateFileEnum.VALUE_OBJECT.getTempFileName(), TemplateFileEnum.ENUM.getTempFileName(), @@ -127,10 +128,6 @@ public enum ModuleEnum { TemplateFileEnum.ACL_IMPL.getTempFileName(), TemplateFileEnum.ACL_PARAM.getTempFileName(), TemplateFileEnum.DTOBO_CONVERT.getTempFileName(), - TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), -/* - TemplateFileEnum.VOBO_CONVERT.getTempFileName(), -*/ TemplateFileEnum.FACTORY.getTempFileName(), TemplateFileEnum.MESSAGE_BODY.getTempFileName(), TemplateFileEnum.EVENT_BODY.getTempFileName(), @@ -148,15 +145,13 @@ public enum ModuleEnum { TemplateFileEnum.FEIGN_DDD.getTempFileName(), TemplateFileEnum.FEIGN_CONTROLLER.getTempFileName(), TemplateFileEnum.FEIGN_CONTROLLER_DDD.getTempFileName(), + TemplateFileEnum.PROVIDER_POM.getTempFileName(), - TemplateFileEnum.BASE_EVENT.getTempFileName(), - TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName(), - GlobalConstant.SINGLE_CLASS_COMMON, - TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName())), - - - - + //TemplateFileEnum.BASE_EVENT.getTempFileName(), + //TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName(), + GlobalConstant.SINGLE_CLASS_COMMON + //TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName() + )), @@ -169,6 +164,8 @@ public enum ModuleEnum { TemplateFileEnum.DTO_DDD.getTempFileName(), TemplateFileEnum.DTO.getTempFileName(), TemplateFileEnum.API_ENUM.getTempFileName(), + TemplateFileEnum.API_POM.getTempFileName(), + GlobalConstant.SINGLE_CLASS_COMMON )), /** @@ -181,6 +178,8 @@ public enum ModuleEnum { TemplateFileEnum.MAPPER_XML_DDD.getTempFileName(), TemplateFileEnum.DATA_OBJECT.getTempFileName(), + TemplateFileEnum.COMMON_POM.getTempFileName(), + GlobalConstant.SINGLE_CLASS_COMMON )), /** @@ -194,12 +193,11 @@ public enum ModuleEnum { TemplateFileEnum.CONVERT.getTempFileName(), TemplateFileEnum.SERVICE_IMPL.getTempFileName(), TemplateFileEnum.TEST.getTempFileName(), - TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName(), + TemplateFileEnum.TEST_DDD.getTempFileName(), TemplateFileEnum.FACADE_IMPL.getTempFileName(), TemplateFileEnum.FACADE_IMPL_DDD.getTempFileName(), - - TemplateFileEnum.APPLICATION.getTempFileName(), - TemplateFileEnum.FACADE_AOP.getTempFileName(), + TemplateFileEnum.SERVICE_DDD.getTempFileName(), + TemplateFileEnum.SERVICE_IMPL_DDD.getTempFileName(), TemplateFileEnum.VALUE_OBJECT.getTempFileName(), TemplateFileEnum.ENUM.getTempFileName(), TemplateFileEnum.CMD.getTempFileName(), @@ -218,30 +216,28 @@ public enum ModuleEnum { TemplateFileEnum.MESSAGE_BODY.getTempFileName(), TemplateFileEnum.EVENT_BODY.getTempFileName(), TemplateFileEnum.ACL_PARAM.getTempFileName(), - - TemplateFileEnum.BASE_EVENT.getTempFileName(), - TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName(), - TemplateFileEnum.MQ_CONSUMER.getTempFileName(), TemplateFileEnum.MQ_PRODUCER.getTempFileName(), TemplateFileEnum.MQ_LISTENER.getTempFileName(), TemplateFileEnum.MQ_HANDLER.getTempFileName(), TemplateFileEnum.CACHE.getTempFileName(), + TemplateFileEnum.CORE_POM.getTempFileName(), GlobalConstant.SINGLE_CLASS_COMMON - )), /** * */ - COLA_FEIGN_API("cola","cola-feign-api", Sets.newHashSet( + COLA_FEIGN_API("cola","cola-feignapi", Sets.newHashSet( TemplateFileEnum.FEIGN.getTempFileName(), TemplateFileEnum.FEIGN_DDD.getTempFileName(), TemplateFileEnum.DTO_DDD.getTempFileName(), TemplateFileEnum.DTO.getTempFileName(), TemplateFileEnum.API_ENUM.getTempFileName(), + TemplateFileEnum.FEIGN_API_POM.getTempFileName(), + GlobalConstant.SINGLE_CLASS_COMMON )), @@ -250,11 +246,13 @@ public enum ModuleEnum { */ COLA_ADAPTER("cola","cola-adapter", Sets.newHashSet( TemplateFileEnum.CONTROLLER.getTempFileName(), - TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), + //TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), TemplateFileEnum.VO.getTempFileName(), TemplateFileEnum.CONTROLLER_DDD.getTempFileName(), TemplateFileEnum.VOBO_CONVERT.getTempFileName(), + TemplateFileEnum.CONVERT.getTempFileName(), TemplateFileEnum.VO_DDD.getTempFileName(), + TemplateFileEnum.ADAPTER_POM.getTempFileName(), GlobalConstant.SINGLE_CLASS_COMMON )), @@ -273,9 +271,10 @@ public enum ModuleEnum { TemplateFileEnum.VALUE_OBJECT.getTempFileName(), TemplateFileEnum.MESSAGE_BODY.getTempFileName(), TemplateFileEnum.EVENT_BODY.getTempFileName(), - TemplateFileEnum.BASE_EVENT.getTempFileName(), TemplateFileEnum.ENUM.getTempFileName(), - GlobalConstant.SINGLE_CLASS_COMMON + TemplateFileEnum.DOMAIN_POM.getTempFileName(), + GlobalConstant.SINGLE_CLASS_COMMON, + TemplateFileEnum.SERVICE_DDD.getTempFileName() )), /** @@ -287,6 +286,8 @@ public enum ModuleEnum { TemplateFileEnum.FACADE.getTempFileName(), TemplateFileEnum.FACADE_DDD.getTempFileName(), TemplateFileEnum.API_ENUM.getTempFileName(), + TemplateFileEnum.ENUM.getTempFileName(), + TemplateFileEnum.CLIENT_POM.getTempFileName(), GlobalConstant.SINGLE_CLASS_COMMON )), @@ -298,12 +299,13 @@ public enum ModuleEnum { TemplateFileEnum.REPOSITORY_IMPL.getTempFileName(), TemplateFileEnum.MAPPER_XML.getTempFileName(), TemplateFileEnum.MAPPER_XML_DDD.getTempFileName(), - + TemplateFileEnum.CONVERT.getTempFileName(), TemplateFileEnum.MAPPER.getTempFileName(), TemplateFileEnum.MAPPER_DDD.getTempFileName(), TemplateFileEnum.DATA_OBJECT.getTempFileName(), TemplateFileEnum.DOBO_CONVERT.getTempFileName(), TemplateFileEnum.SERVICE_IMPL.getTempFileName(), + TemplateFileEnum.SERVICE_IMPL_DDD.getTempFileName(), TemplateFileEnum.ACL.getTempFileName(), TemplateFileEnum.ACL_IMPL.getTempFileName(), TemplateFileEnum.ACL_PARAM.getTempFileName(), @@ -313,6 +315,7 @@ public enum ModuleEnum { TemplateFileEnum.MQ_CONSUMER.getTempFileName(), TemplateFileEnum.MQ_PRODUCER.getTempFileName(), TemplateFileEnum.MQ_HANDLER.getTempFileName(), + TemplateFileEnum.INFRAST_POM.getTempFileName(), GlobalConstant.SINGLE_CLASS_COMMON )), @@ -320,7 +323,8 @@ public enum ModuleEnum { * */ COLA_APP("cola","cola-app", Sets.newHashSet( - TemplateFileEnum.TEST.getTempFileName(), + //todo test + //TemplateFileEnum.TEST.getTempFileName(), TemplateFileEnum.FACADE_IMPL.getTempFileName(), TemplateFileEnum.FACADE_IMPL_DDD.getTempFileName(), @@ -329,11 +333,9 @@ public enum ModuleEnum { TemplateFileEnum.EXE_ABSTRACT.getTempFileName(), TemplateFileEnum.EXE.getTempFileName(), TemplateFileEnum.EXE_IMPL.getTempFileName(), - TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName(), TemplateFileEnum.DTOBO_CONVERT.getTempFileName(), - TemplateFileEnum.FACADE_AOP.getTempFileName(), - TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName(), TemplateFileEnum.MQ_LISTENER.getTempFileName(), + TemplateFileEnum.APP_POM.getTempFileName(), GlobalConstant.SINGLE_CLASS_COMMON )), @@ -343,6 +345,7 @@ public enum ModuleEnum { */ COLA_API_DOC("cola","api-doc", Sets.newHashSet( TemplateFileEnum.API_HTTP.getTempFileName(), + TemplateFileEnum.PARENT_POM.getTempFileName(), TemplateFileEnum.API_RPC.getTempFileName() )), @@ -350,6 +353,9 @@ public enum ModuleEnum { * */ COLA_START("cola","cola-start", Sets.newHashSet( + TemplateFileEnum.START_POM.getTempFileName(), + TemplateFileEnum.TEST_DDD.getTempFileName(), + GlobalConstant.SINGLE_CLASS_COMMON )), @@ -358,14 +364,18 @@ public enum ModuleEnum { * */ DUBBO_API_DOC("dubbo","api-doc", Sets.newHashSet( - TemplateFileEnum.API_RPC.getTempFileName() - )), + TemplateFileEnum.API_RPC.getTempFileName(), + TemplateFileEnum.PARENT_POM.getTempFileName() + + )), /** * */ SPRINGBOOT_API_DOC("springboot","api-doc", Sets.newHashSet( - TemplateFileEnum.API_HTTP.getTempFileName() + TemplateFileEnum.API_HTTP.getTempFileName(), + TemplateFileEnum.PARENT_POM.getTempFileName() + )), /** @@ -373,7 +383,9 @@ public enum ModuleEnum { */ SC_API_DOC("springcloud","api-doc", Sets.newHashSet( TemplateFileEnum.API_HTTP.getTempFileName(), - TemplateFileEnum.API_RPC.getTempFileName() + TemplateFileEnum.API_RPC.getTempFileName(), + TemplateFileEnum.PARENT_POM.getTempFileName() + )), ; @@ -397,4 +409,17 @@ public enum ModuleEnum { public Set getTemplateFileSet() { return templateFileSet; } + + /** + * 增加自定义代码元素 + */ + public static void addCustomTemplateFile(String appName,String moduleName, String templateCode){ + String module = appName + "-" + moduleName; + for (ModuleEnum moduleEnum : ModuleEnum.values()){ + if(moduleEnum.getAppName().equals(appName) && moduleEnum.getModuleName().equals(module)){ + moduleEnum.getTemplateFileSet().add(templateCode); + } + } + } + } diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/TemplateFileEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/TemplateFileEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..5af808eb3e8e1cce6dc1add72e15c7f88add83dd --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/TemplateFileEnum.java @@ -0,0 +1,168 @@ +package com.tianhua.codemaker.enums; + +/** + * description: TemplateFileEnum
+ * date: 2020/7/7 23:44
+ * author: coderman
+ * version: 1.0
+ * 设置要生成的模板文件的类型 + */ +public enum TemplateFileEnum { + ENTITY("entity","dao.dataobject",".java","infrast"), + MAPPER("mapper","dao.mapper",".java","infrast"), + POM("pom","",".xml","resources"), + CONTROLLER("controller","controller",".java","adapter"), + MAPPER_XML("mapperxml","",".xml","resource"), + SERVICE("service","service",".java","app,domain"), + SERVICE_DDD("serviceddd","service",".java","app,domain"), + SERVICE_IMPL_DDD("serviceimplddd","serviceimpl",".java","app,domain,infrast"), + SERVICE_IMPL("serviceImpl","serviceimpl",".java","app,domain,infrast"), + VO("vo","vo",".java","adapter"), + BASE_CONTROLLER("baseController","",".java","adapter"), + SPRING_APPLICATION_CONTEXT("SpringApplicationContext","",".java","support"), + TEST("test","",".java","test"), + TEST_DDD("testddd","",".java","test"), + APPLICATION("application","",".java","start"), + DTO("dto","api.dto",".java","client,feignapi,api"), + FACADE("facade","api.facade",".java","client,api"), + DATA_OBJECT("do","dao.dataobject",".java","infrast"), + FACADE_IMPL("facadeImpl","facadeimpl",".java","app"), + BUSINESS_OBJECT("bo","bo",".java","domain"), + CONVERT("convert","convert",".java","adapter,app,infrast"), + DTOBO_CONVERT("dtoboconvert","convert",".java","app"), + DTO2DTO_CONVERT("dto2dtoconvert","convert",".java","app"), + DOBO_CONVERT("doboconvert","convert",".java","infrast"), + FACADE_AOP("facadeaop","",".java","app"), + GATAWAY("gataway","gataway",".java","domain"), + REPOSITORY("repository","repository",".java","domain"), + REPOSITORY_IMPL("repositoryimpl","repositoryimpl",".java","infrast"), + FACTORY("factory","factory",".java","app,domain,infrast"), + ENUM("enum","enum",".java","domain,client"), + API_ENUM("apienum","api.enum",".java","api,feignapi"), + MESSAGE_BODY("msgbody","bo.msgbody",".java","domain"), + EVENT_BODY("event","bo.event",".java","domain"), + GATAWAY_IMPL("gatawayimpl","repositoryimpl",".java","infrast"), + ACL("acl","acl",".java","infrast"), + ACL_IMPL("aclimpl","acl.aclimpl",".java","infrast"), + ACL_REQ("aclreq","acl.param.req",".java","infrast"), + ACL_RES("aclres","acl.param.res",".java","infrast"), + ACL_PARAM("aclparam","acl.param",".java","infrast"), + CMD("cmd","command",".java","app"), + EXE("exe","executor",".java","app"), + EXE_IMPL("exeimpl","exeimpl",".java","app"), + EXE_ABSTRACT("abstractexe","executor",".java","app"), + VALUE_OBJECT("valueobject","bo.valueobject",".java","domain"), + BUSINESS_OBJECT_DDD("boddd","bo",".java","domain"), + FACADE_DDD("facadeddd","api.facade",".java","client,api"), + FACADE_IMPL_DDD("facadeimplddd","facadeimpl",".java","client,api"), + CONTROLLER_DDD("controllerddd","adapter.controller",".java","adapter,feignprovider"), + VO_DDD("voddd","adapter.vo",".java","adapter"), + VOBO_CONVERT("voboconvert","convert",".java","adapter"), + DTO_DDD("dtoddd","api.dto",".java","client,api"), + MQ_CONSUMER("mqconsumer","mq.consumer",".java","infrast"), + MQ_HANDLER("mqhandler","mq.handler",".java","infrast"), + MQ_LISTENER("mqlistener","mq.listener",".java","infrast"), + MQ_PRODUCER("mqproducer","mq.producer",".java","infrast"), + APP_EVENT_PUBLISHER("AppEventPublisher","",".java","domain"), + BASE_EVENT("BaseEvent","",".java",""), + MAPPER_DDD("mapperddd","dao.mapper",".java","infrast"), + MAPPER_XML_DDD("mapperxmlddd","",".xml","resources"), + API_HTTP("http","http",".md","api-doc"), + API_RPC("rpc","rpc",".md","api-doc"), + SQL("sql","sql",".sql","sql-doc"), + CACHE("cache","cache",".java","infrast"), + + FEIGN("feign","api.feign",".java","feignapi"), + FEIGN_DDD("feignddd","api.feign",".java","feignapi"), + FEIGN_CONTROLLER("feigncontroller","api.feign.controller",".java","feignprovider"), + FEIGN_CONTROLLER_DDD("feigncontrollerddd","api.feign.controller",".java","feignprovider"), + + + CLIENT_POM("clientpom","",".xml","client"), + DOMAIN_POM("domainpom", "",".xml","domain"), + INFRAST_POM("infrastpom","",".xml","infrast"), + API_POM("apipom","",".xml","api"), + CORE_POM("corepom","",".xml","core"), + COMMON_POM("commonpom","",".xml","common"), + APP_POM("apppom","",".xml","app"), + PARENT_POM("parentpom","",".xml","parent"), + START_POM("startpom","",".xml","start"), + ADAPTER_POM("adapterpom","",".xml","adapter"), + FEIGN_API_POM("feignapipom","",".xml","feignapi"), + PROVIDER_POM("providerpom","",".xml","provider"), + + ; + private String tempFileName; + /** + * 最后一级子包名,也是代码元素别名 + */ + private String childPackageName; + + /** + * 类后缀 + */ + private String classSuffix; + + /** + * 所属层 + * todo + */ + private String layerCodes; + + TemplateFileEnum(String tempFileName, String childPackageName, String classSuffix, String layerCodes){ + this.tempFileName = tempFileName; + this.childPackageName = childPackageName; + this.classSuffix = classSuffix; + this.layerCodes = layerCodes; + } + + public String getTempFileName() { + return tempFileName; + } + + public String getChildPackageName() { + return childPackageName; + } + + public String getClassSuffix() { + return classSuffix; + } + + /** + * 判断类名是否是bo,vo,dto,entity + * @param className + * @return + */ + public static boolean isClassModel(String className){ + String classType = className.toLowerCase(); + return classType.endsWith(TemplateFileEnum.VO.getTempFileName()) + || classType.endsWith(TemplateFileEnum.BUSINESS_OBJECT.getTempFileName()) + || classType.endsWith(TemplateFileEnum.DTO.getTempFileName()) + || classType.endsWith(TemplateFileEnum.DATA_OBJECT.getTempFileName()) + || classType.endsWith(TemplateFileEnum.ENTITY.getTempFileName()); + } + + public static String getChildPackageName(String templateCode){ + for (TemplateFileEnum templateFileEnum : TemplateFileEnum.values()){ + if(templateFileEnum.getTempFileName().equals(templateCode)){ + return templateFileEnum.getChildPackageName(); + } + } + return templateCode; + } + + + /** + * 获取模板文件名后缀 + * @param templateCode + * @return + */ + public static String getClassSuffix(String templateCode){ + for (TemplateFileEnum templateFileEnum : TemplateFileEnum.values()){ + if(templateFileEnum.getTempFileName().equals(templateCode)){ + return templateFileEnum.getClassSuffix(); + } + } + return null; + } +} diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/VisibilityEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/VisibilityEnum.java similarity index 95% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/VisibilityEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/VisibilityEnum.java index 1bbcab1fba69a523e8a24d0340c6e199889bfa9b..b7247918f955cd8271c1079080b7e1dfe3f470c1 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/VisibilityEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/VisibilityEnum.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.enums; +package com.tianhua.codemaker.enums; /** * Description: * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/AnnotationModifyOnEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/AnnotationModifyOnEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..d384dcabee90f8b9f1fea16fb0cbb36ec1b025df --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/AnnotationModifyOnEnum.java @@ -0,0 +1,36 @@ +package com.tianhua.codemaker.enums.dynamic; + +/** + * Description:动态注解需要修饰的类型 + * date: 2021/10/16 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public enum AnnotationModifyOnEnum { + THIS("this", "当前类"), + CHILD("child", "子类"), + ; + private String code; + private String desc; + + + AnnotationModifyOnEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + + public String getCode() { + return code; + } + + public String getDesc() { + return desc; + } + + + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/DecorateTypeEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/DecorateTypeEnum.java similarity index 92% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/DecorateTypeEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/DecorateTypeEnum.java index 0b13ed47ed4814691193ae96454f46194232395a..563dca82edba50c320c2255aec1b77fb6d1a319e 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/DecorateTypeEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/DecorateTypeEnum.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.enums.dynamic; +package com.tianhua.codemaker.enums.dynamic; /** * Description: * date: 2021/11/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/InvokeLayerTypeEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/InvokeLayerTypeEnum.java similarity index 95% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/InvokeLayerTypeEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/InvokeLayerTypeEnum.java index 63cdd453a6fee7e3bcbf4e99c4a1e39b0d59466c..62bae6b5e5bd4063d940144a62c14b6dcd1a90be 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/InvokeLayerTypeEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/InvokeLayerTypeEnum.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.enums.dynamic; +package com.tianhua.codemaker.enums.dynamic; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.enums.TemplateFileEnum; import com.google.common.collect.Sets; import java.util.Set; @@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicReference; * Description: 调用层有哪些调用入口枚举 * date: 2021/10/16 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/InvokeSceneTypeEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/InvokeSceneTypeEnum.java similarity index 98% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/InvokeSceneTypeEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/InvokeSceneTypeEnum.java index 579a1f8bde6b6998bb671ea91255e2a7854b3271..90bca05a4502083068338dfcb90eb7dd9386f9ef 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/InvokeSceneTypeEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/InvokeSceneTypeEnum.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.enums.dynamic; +package com.tianhua.codemaker.enums.dynamic; import org.apache.commons.lang3.StringUtils; @@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils; * Description:调用场景枚举 * date: 2021/10/16 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/ReadWriteTypeEnum.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/ReadWriteTypeEnum.java similarity index 98% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/ReadWriteTypeEnum.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/ReadWriteTypeEnum.java index 68eb26251cd8b398f46a0411f8c375eed918a7b2..99cd92d8f5dc98617dc8b1ae2c2c7dc341e99119 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/enums/dynamic/ReadWriteTypeEnum.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/enums/dynamic/ReadWriteTypeEnum.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.enums.dynamic; +package com.tianhua.codemaker.enums.dynamic; import com.google.common.collect.Sets; import org.apache.commons.lang3.StringUtils; @@ -10,7 +10,7 @@ import java.util.concurrent.atomic.AtomicReference; * Description:读写类型枚举 * date: 2021/10/16 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/service/ImportPackageService.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/service/ImportPackageService.java new file mode 100644 index 0000000000000000000000000000000000000000..55cc3349c69883e91eae27a0e3b5968158b6daa2 --- /dev/null +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/service/ImportPackageService.java @@ -0,0 +1,58 @@ +package com.tianhua.codemaker.service; + +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; + +/** + * Description: + * date: 2022/1/26 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public interface ImportPackageService { + + /** + * 处理需要导入的包 + * + * @param abstractClassBean + * @param plantUmlContextBean + */ + void dealImportClass(AbstractClassBean abstractClassBean, PlantUmlContextBean plantUmlContextBean); + + + /** + * 设置包名 + * + * @param abstractClassBean + * @param defaultChildPackage 当plantUML中没有包名则使用配置的全局包名+子包名 + */ + void setPackageName(AbstractClassBean abstractClassBean, String defaultChildPackage); + + + /** + * 在动态调用中处理引用包 + * + * @param invokerClassBean + * @param plantUmlContextBean + * @param importClassName + */ + void dealImportPackage(AbstractClassBean invokerClassBean, PlantUmlContextBean plantUmlContextBean, String importClassName); + + + String getMatchPackageDefault(String targetClass); + + + /** + * 设置包名 + * @param abstractClassBean + * @param moduleTag 当前类元素所在模块 + * 返回的包路径简化为 + * 全局包路径+模块标示+plantUMLPackage + */ + public void setPackageNameWithModule(AbstractClassBean abstractClassBean, String moduleTag); + + +} + diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/utils/StringHandleUtils.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/utils/StringHandleUtils.java similarity index 98% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/utils/StringHandleUtils.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/utils/StringHandleUtils.java index 2847a642f6a6e7dd8fe42681f8f61e0cb8a4ef1f..c183ca22ee0856263d1635e9c17a59cb22ecd520 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/utils/StringHandleUtils.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/utils/StringHandleUtils.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.utils; +package com.tianhua.codemaker.utils; import com.google.common.collect.Sets; import org.apache.commons.lang3.StringUtils; @@ -12,7 +12,7 @@ import java.util.regex.Pattern; * Description: * date: 2021/10/12 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/utils/StringHelperUtils.java b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/utils/StringHelperUtils.java similarity index 97% rename from codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/utils/StringHelperUtils.java rename to codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/utils/StringHelperUtils.java index 809a64a4f88a1d72f37d2ae10dbfa6ef3cf5c2eb..6b77cbd9f07612b5191e723aaaecdd6f5503384c 100644 --- a/codemaker-parent/codemaker-api/src/main/java/com/coderman/codemaker/utils/StringHelperUtils.java +++ b/codemaker-parent/codemaker-api/src/main/java/com/tianhua/codemaker/utils/StringHelperUtils.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.utils; +package com.tianhua.codemaker.utils; import java.util.regex.Pattern; @@ -6,7 +6,7 @@ import java.util.regex.Pattern; * Description: * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/pom.xml b/codemaker-parent/codemaker-apiImpl/pom.xml index 542e84495fd31a7af6e74bde4da1c993d278e079..5dc1668cf64bafce0afe21134a765debef4017d7 100644 --- a/codemaker-parent/codemaker-apiImpl/pom.xml +++ b/codemaker-parent/codemaker-apiImpl/pom.xml @@ -6,11 +6,11 @@ com.coderman.codemaker codemaker-parent - 1.2.2-SNAPSHOT + 1.3.0-SNAPSHOT com.coderman.codemaker codemaker-apiImpl - 1.0-SNAPSHOT + 1.1-SNAPSHOT jar @@ -29,7 +29,7 @@ com.coderman.codemaker codemaker-api - 1.0-SNAPSHOT + 1.1-SNAPSHOT @@ -59,20 +59,22 @@ org.projectlombok lombok - 1.18.12 - - com.coderman.utils - coderman-utils - 1.0.4-SNAPSHOT - - - + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/package-info.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/package-info.java deleted file mode 100644 index f4f11691452197e99efde04019b9ee0bbecfb73d..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.coderman.codemaker.component; \ No newline at end of file diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassFactory.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassFactory.java similarity index 68% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassFactory.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassFactory.java index 8368a146baa40c2dc75f95e589172dffdc124447..020f3721468ee71698a0fc00f7396a61a0a0b5d9 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassFactory.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassFactory.java @@ -1,6 +1,9 @@ -package com.coderman.codemaker.classloader; +package com.tianhua.codemaker.classloader; -import com.coderman.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.enums.VisibilityEnum; +import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -14,27 +17,26 @@ import java.util.regex.Pattern; * Description: * date: 2021/11/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Service public class CompClassFactory { - /** * 批量转换 * @param classList - * @param compName + * @param componentConfigBean * @return */ - public List convert2ClassBean(List> classList,String compName){ + public List convert2ClassBean(List> classList, ComponentConfigBean componentConfigBean){ if(CollectionUtils.isEmpty(classList)){ return new ArrayList<>(); } List list = new ArrayList<>(); for (Class clazz : classList){ - list.add(buildClassBean(clazz,compName)); + list.add(buildClassBean(clazz, componentConfigBean)); } return list; } @@ -57,17 +59,29 @@ public class CompClassFactory { } /** - * 通过类加载将类的信息转换到代码模型上 + * + * 通过类加载+动态配置将类的信息转换到代码模型上 * @param clazz + * @param componentConfigBean * @return */ - private ClassBean buildClassBean(Class clazz,String compName){ + private ClassBean buildClassBean(Class clazz, ComponentConfigBean componentConfigBean){ ClassBean classBean = new ClassBean(); classBean.setPackageName(clazz.getCanonicalName()); classBean.setClassName(clazz.getSimpleName()); - classBean.setCompName(compName); - classBean.setFieldBeanList(buildFieldBeanList(clazz.getDeclaredFields())); - classBean.setMethodBeanList(buildMethodBeanList(clazz.getDeclaredMethods())); + classBean.setCompName(componentConfigBean.getServiceName()); + + if(componentConfigBean.getFieldMap().isEmpty()){ + classBean.setFieldBeanList(buildFieldBeanList(clazz.getDeclaredFields())); + }else { + classBean.setFieldBeanList(buildFieldBeanList(componentConfigBean.getFieldMap().get(clazz.getSimpleName()))); + } + + if(componentConfigBean.getMethodMap().isEmpty()){ + classBean.setMethodBeanList(buildMethodBeanList(clazz.getDeclaredMethods())); + }else { + classBean.setMethodBeanList(buildMethodBeanList(componentConfigBean.getMethodMap().get(clazz.getSimpleName()))); + } return classBean; } @@ -291,4 +305,79 @@ public class CompClassFactory { return paramList; } + + /** + * 构建方法列表 + * @param methodStrList + * @return + */ + private List buildMethodBeanList(List methodStrList){ + if(CollectionUtils.isEmpty(methodStrList)){ + return Lists.newArrayList(); + } + List methodBeanList = new ArrayList<>(); + for (String method : methodStrList){ + MethodBean methodBean = new MethodBean(); + if(method.contains("void")){ + methodBean.setReturnClass("void"); + + }else { + String returnClass = method.replace("private","") + .replace("public","") + .replace("protected","") + .replace("final","") + .replace("volatile","") + .replace("static","").trim().split(" ")[0]; + methodBean.setReturnClass(returnClass); + } + methodBean.setStatic(method.contains("static")); + String [] methodArr = method.split(" "); + for (String str : methodArr){ + if(str.contains("(")){ + String methodName = str.split("\\(")[0]; + methodBean.setMethodName(methodName+method.substring(method.indexOf("("))); + methodBean.buildParamArr(); + } + } + methodBeanList.add(methodBean); + } + return methodBeanList; + } + + + /** + * 构建属性列表 + * @param fieldStrList + * @return + */ + private List buildFieldBeanList(List fieldStrList){ + if(CollectionUtils.isEmpty(fieldStrList)){ + return Lists.newArrayList(); + } + List fieldBeanList = new ArrayList<>(); + for (String fieldStr : fieldStrList){ + FieldBean fieldBean = new FieldBean(); + if(fieldStr.trim().contains(VisibilityEnum.PRIVATE.getVisibility())){ + fieldBean.setVisibility(VisibilityEnum.PRIVATE.getVisibility()); + } + if(fieldStr.trim().contains(VisibilityEnum.PUBLIC.getVisibility())){ + fieldBean.setVisibility(VisibilityEnum.PUBLIC.getVisibility()); + } + if(fieldStr.trim().contains(VisibilityEnum.PROTECT.getVisibility())){ + fieldBean.setVisibility(VisibilityEnum.PROTECT.getVisibility()); + } + String [] fieldArr = fieldStr.trim().split(" "); + fieldBean.setFieldSimpleName(fieldArr[fieldArr.length - 1]); + + for (int i = fieldArr.length - 2;i > 0;i --){ + if(StringUtils.isEmpty(fieldArr[i].trim())){ + continue; + } + fieldBean.setFieldType(fieldArr[i]); + fieldBean.setFieldName(fieldArr[i] + " " + fieldBean.getFieldSimpleName()); + break; + } + } + return fieldBeanList; + } } diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassLoadService.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassLoadService.java similarity index 89% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassLoadService.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassLoadService.java index 0bac3fb722a843bf96f595409ad2ab2a1fdbdd8c..d7fd1f710ac133b416fee2d10a2b46c5fab7e82e 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassLoadService.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassLoadService.java @@ -1,13 +1,10 @@ -package com.coderman.codemaker.classloader; - -import com.coderman.codemaker.bean.component.ComponentConfigBean; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.AnnotationBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.EnumBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.utils.clazz.ClassUtils; -import org.apache.commons.lang3.ClassLoaderUtils; +package com.tianhua.codemaker.classloader; + +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.AnnotationBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -26,7 +23,7 @@ import java.util.jar.JarFile; * Description: * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -55,7 +52,7 @@ public class CompClassLoadService { ComponentContextBean componentContextBean = new ComponentContextBean(); CompClassLoader classLoader = buildClassLoader(componentConfigBean); List> classList = classLoader.loadClassList(componentConfigBean.getClassList()); - List classBeanList = compClassFactory.convert2ClassBean(classList, componentConfigBean.getServiceName()); + List classBeanList = compClassFactory.convert2ClassBean(classList, componentConfigBean); componentContextBean.setClassBeanList(classBeanList); @@ -71,11 +68,10 @@ public class CompClassLoadService { try { return loadComp(componentConfigBean); } catch (IOException e) { - e.printStackTrace(); + return componentContextBean; } catch (ClassNotFoundException e) { - e.printStackTrace(); + return componentContextBean; } - } return componentContextBean; } @@ -163,7 +159,7 @@ public class CompClassLoadService { } else if(clazz.isInterface()){ interfaceClassList.add(clazz); - }else if(clazz.isArray() || clazz.isMemberClass()){ + }else if(clazz.isArray()){ classList.add(clazz); }else if(clazz.isEnum()){ enumClassList.add(clazz); @@ -174,7 +170,7 @@ public class CompClassLoadService { } } } - List classBeanList = compClassFactory.convert2ClassBean(classList,componentConfigBean.getServiceName()); + List classBeanList = compClassFactory.convert2ClassBean(classList,componentConfigBean); List interfaceBeanList = compClassFactory.convert2InterfaceBean(interfaceClassList,componentConfigBean.getServiceName()); List annotationBeanList = compClassFactory.convert2AnnotationBeanClass(annotationClassList); //todo 枚举 diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassLoader.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassLoader.java similarity index 95% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassLoader.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassLoader.java index 674a39abc4c04f46865e716d6288259eea78d968..86b8013dbc5737f24d6d0355d4ad8a00238c8287 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/classloader/CompClassLoader.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/classloader/CompClassLoader.java @@ -1,7 +1,6 @@ -package com.coderman.codemaker.classloader; +package com.tianhua.codemaker.classloader; import com.alibaba.fastjson.JSON; -import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import java.io.IOException; @@ -17,7 +16,7 @@ import java.util.List; * Description: * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -71,6 +70,9 @@ public class CompClassLoader extends URLClassLoader { List> list = new ArrayList<>(); for (String classNamePath : classList){ Class clazz = loadTargetClass(classNamePath); + if(clazz == null){ + continue; + } list.add(clazz); } return list; diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/CompPropReadService.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/CompPropReadService.java similarity index 50% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/CompPropReadService.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/CompPropReadService.java index 11a9fba4b5fc20142b45eff8d14e4d1a7990d04a..f62c7ca522fbdfa551bbdf7d2dd1ac5a11ccb5f9 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/CompPropReadService.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/CompPropReadService.java @@ -1,8 +1,12 @@ -package com.coderman.codemaker.component; +package com.tianhua.codemaker.component; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.component.ComponentConfigBean; -import lombok.extern.slf4j.Slf4j; +import com.google.common.collect.Lists; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.enums.ConfigFileEnum; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; @@ -15,13 +19,13 @@ import java.util.*; * Description: * date: 2021/11/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Service -//@Slf4j public class CompPropReadService { + /** * 从配置文件中构建组件bean * @return @@ -30,12 +34,12 @@ public class CompPropReadService { try { Properties properties = readPropertiesFile(componentPath); if(properties == null){ + //System.out.println("加载组件配置失败,componentPath = "+componentPath); System.out.println("加载组件配置失败,componentPath = "+componentPath); return null; } ComponentConfigBean componentBean = new ComponentConfigBean(); - Object packageValue = properties.getProperty(GlobalConstant.COMP_PACKAGE); if(packageValue == null){ componentBean.setPackageName(""); @@ -59,6 +63,12 @@ public class CompPropReadService { if(entry.getKey().toString().equals(GlobalConstant.COMP_TYPE)){ componentBean.setCompType(entry.getValue().toString()); } + if(entry.getKey().toString().equals(GlobalConstant.COMP_GAV_TYPE)){ + componentBean.setType(entry.getValue().toString()); + } + if(entry.getKey().toString().equals(GlobalConstant.COMP_GAV_SCOPE)){ + componentBean.setScope(entry.getValue().toString()); + } if(entry.getKey().toString().equals(GlobalConstant.COMP_SITE)){ componentBean.setCompSite(entry.getValue().toString()); } @@ -68,7 +78,9 @@ public class CompPropReadService { if(entry.getKey().toString().equals(GlobalConstant.COMP_SINGLE_CLASS_TYPE)){ componentBean.setClassType(entry.getValue().toString()); } - + if(entry.getKey().toString().equals(GlobalConstant.COMP_SINGLE_CLASS_TYPE)){ + componentBean.setClassType(entry.getValue().toString()); + } if(entry.getKey().toString().startsWith(GlobalConstant.COMP_CLASS_PRE)){ componentBean.addClass(entry.getValue().toString()); } @@ -82,8 +94,37 @@ public class CompPropReadService { componentBean.addEnum(entry.getValue().toString()); } - if(entry.getKey().toString().startsWith(GlobalConstant.COMP_CLASS_METHOD_PRE)){ - componentBean.addMethod(entry.getValue().toString()); + if(entry.getKey().toString().startsWith(GlobalConstant.COMP_CONFIG_NAME)){ + componentBean.setConfigName(entry.getValue().toString()); + } + + if(entry.getKey().toString().startsWith(GlobalConstant.COMP_EXCLUSION_GA_LIST)){ + componentBean.setExclusionGAList(entry.getValue().toString()); + } + + if(entry.getKey().toString().contains(".")){ + String [] classKeyArr = entry.getKey().toString().split("\\."); + if(classKeyArr[1].startsWith(GlobalConstant.COMP_CLASS_METHOD_PRE)){ + componentBean.addMethod(classKeyArr[0], entry.getValue().toString()); + } + if(classKeyArr[1].startsWith(GlobalConstant.COMP_FIELD_PRE)){ + componentBean.addField(classKeyArr[0], entry.getValue().toString()); + } + } + } + + //如果组件需要有配置内容配置到目标工程的配置文件中 + if(StringUtils.isNotEmpty(componentBean.getConfigName())){ + int index = componentPath.lastIndexOf("/")+1; + String configPath = componentPath.substring(0,index)+"config.properties"; + List configList = getConfigList(configPath); + if(CollectionUtils.isEmpty(configList)){ + //todo yml配置支持 + configPath = componentPath.substring(0,index)+"config.yml"; + configList = getConfigList(configPath); + componentBean.setConfigList(configList); + }else { + componentBean.setConfigList(configList); } } return componentBean; @@ -93,6 +134,36 @@ public class CompPropReadService { return null; } + /** + * 读取组件的自身配置 + * @param filePath + * @return + */ + private List getConfigList(String filePath){ + List list = new ArrayList<>(); + try { + + if(filePath.endsWith(ConfigFileEnum.PROPERTIES.getFileExtName())){ + Properties configProperties = readPropertiesFile(filePath); + if(configProperties == null){ + System.out.println("not find component filePath = "+filePath); + return list; + } + for (Map.Entry entry : configProperties.entrySet()){ + list.add(entry.getKey().toString()+"="+entry.getValue().toString()); + } + }else { + return readCommonConfigFile(filePath); + } + + } catch (IOException e) { + return list; + } + return list; + + } + + /** * 读取组件配置文件 * @param filePath @@ -103,6 +174,7 @@ public class CompPropReadService { InputStream inputStream = null; try { ClassPathResource classPathResource = new ClassPathResource(filePath); + inputStream = classPathResource.getInputStream(); Properties props = new Properties(); props.load(new InputStreamReader(inputStream, "UTF-8")); @@ -116,4 +188,27 @@ public class CompPropReadService { } } } + + + + /** + * 读取组件配置文件 + * @param filePath + * @return + * @throws IOException + */ + public List readCommonConfigFile(String filePath) throws IOException { + InputStream inputStream = null; + try { + ClassPathResource classPathResource = new ClassPathResource(filePath); + return FileUtils.readLines(classPathResource.getFile(),"UTF-8"); + } catch (Exception e) { + //log("读取组件配置失败,filePath={}",filePath); + return Lists.newArrayList(); + } finally { + if (inputStream != null) { + inputStream.close(); + } + } + } } diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/decorate/AppCompDecorateServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/decorate/AppCompDecorateServiceImpl.java similarity index 44% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/decorate/AppCompDecorateServiceImpl.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/decorate/AppCompDecorateServiceImpl.java index 4f1997d94ca37179de57232605470a5fd4ef4354..83e04abb5367da26336f85921f2acd09cdd38f32 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/decorate/AppCompDecorateServiceImpl.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/decorate/AppCompDecorateServiceImpl.java @@ -1,17 +1,16 @@ -package com.coderman.codemaker.component.decorate; - -import com.coderman.codemaker.api.ICompDecorateService; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.constant.ApiConstant; -import com.coderman.codemaker.element.ElementDecorateHandler; -import com.coderman.codemaker.enums.TemplateFileEnum; +package com.tianhua.codemaker.component.decorate; + +import com.tianhua.codemaker.api.ICompDecorateService; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.constant.ApiConstant; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import com.tianhua.codemaker.enums.TemplateFileEnum; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; -import java.util.Optional; /** * 装饰可以按一个组件一个组件的装饰实现也可以按应用维度一次性装饰多个组件到代码上下文模型中 @@ -19,7 +18,7 @@ import java.util.Optional; * 这里对controller和facade接口方法返回值和方法page参数用apiresult组件进行包装 * date: 2021/11/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -50,58 +49,6 @@ public class AppCompDecorateServiceImpl implements ICompDecorateService { apiClassBeanMap.put(ApiConstant.CLASS_API_RESULT_DATA_DTO, resultDataDtoClassBean); apiClassBeanMap.put(ApiConstant.CLASS_API_PAGE_DTO, pageDTOClassBean); eleFacadeDecorateHandler.decorateElement(apiClassBeanMap, plantUmlContextBean); - - eleFeignDecorateHandler.decorateElement(apiClassBeanMap, plantUmlContextBean); - } - - /** - * 包装controller - * @param abstractClassBean - * @param plantUmlContextBean - *//* - private void decorateControllerApiResult(AbstractClassBean abstractClassBean, PlantUmlContextBean plantUmlContextBean) { - if (abstractClassBean == null) { - return; - } - plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k, v) -> { - if (k.toLowerCase().endsWith(TemplateFileEnum.CONTROLLER.getTempFileName())) { - v.getImportClassList().add(abstractClassBean.getPackageName()); - //导入分页对象 - Optional methodBeanOptional = v.getMethodBeanList().stream().filter(methodBean -> methodBean.getReturnClass().contains(ApiConstant.CLASS_API_PAGE_VO)).findFirst(); - if(methodBeanOptional.isPresent()){ - - } - v.getMethodBeanList().forEach(methodBean -> methodBean.setReturnClass(ApiConstant.CLASS_API_RESULT_DATA_DTO+"<"+methodBean.getReturnClass()+">")); - } - }); - } - - *//** - * 包装facadeimpl - * @param abstractClassBean - * @param plantUmlContextBean - *//* - private void decorateFacadeImpl(AbstractClassBean abstractClassBean, PlantUmlContextBean plantUmlContextBean) { - if (abstractClassBean == null) { - return; - } - plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k, v) -> { - //装饰dubbo注解 - if (k.toLowerCase().endsWith(TemplateFileEnum.FACADE_IMPL.getTempFileName().toLowerCase()) && abstractClassBean.getPackageName().contains("dubbo")) { - v.setAnnotation("@" + abstractClassBean.getClassName()); - v.getImportClassList().add(abstractClassBean.getPackageName()); - - } - }); - - plantUmlContextBean.getDerivedPlantUmlContextBean().getInterfaceBeanMap().forEach((k, v) -> { - if (k.toLowerCase().endsWith(TemplateFileEnum.FACADE.getTempFileName().toLowerCase())) { - v.getImportClassList().add(abstractClassBean.getPackageName()); - v.getMethodBeanList().forEach(methodBean -> methodBean.setReturnClass(ApiConstant.CLASS_API_RESULT_DATA_DTO+"<"+methodBean.getReturnClass()+">")); - } - }); - - }*/ } diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/decorate/DefaultCompDecorateServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/decorate/DefaultCompDecorateServiceImpl.java similarity index 81% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/decorate/DefaultCompDecorateServiceImpl.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/decorate/DefaultCompDecorateServiceImpl.java index 6aacd349efcc059bb7fa6c5bf6238b79b02f1607..e8093b522c16525ad916dc5f13dd324e419a6083 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/decorate/DefaultCompDecorateServiceImpl.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/decorate/DefaultCompDecorateServiceImpl.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.component.decorate; - -import com.coderman.codemaker.api.ICompDecorateService; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.constant.ArchConstant; -import com.coderman.codemaker.element.ElementDecorateHandler; -import com.coderman.codemaker.factory.SpringClassBeanFactory; +package com.tianhua.codemaker.component.decorate; + +import com.tianhua.codemaker.api.ICompDecorateService; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.constant.ArchConstant; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import com.tianhua.codemaker.factory.SpringClassBeanFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -19,7 +19,7 @@ import java.util.Map; * * date: 2021/11/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/package-info.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..1c22f58eb2fdbbccf19ff76ef0f00e9eb5e959a8 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/package-info.java @@ -0,0 +1 @@ +package com.tianhua.codemaker.component; \ No newline at end of file diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/regist/CompSingleClassRegistServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/regist/CompSingleClassRegistServiceImpl.java similarity index 84% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/regist/CompSingleClassRegistServiceImpl.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/regist/CompSingleClassRegistServiceImpl.java index f86d0c9b81e8d80f6e4153bee2a61dad1fa3264a..294a5143efc4fc8a074c0093278e57490e6cf518 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/regist/CompSingleClassRegistServiceImpl.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/regist/CompSingleClassRegistServiceImpl.java @@ -1,15 +1,14 @@ -package com.coderman.codemaker.component.regist; - -import com.alibaba.fastjson.JSON; -import com.coderman.codemaker.api.ICompRegistService; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.component.ComponentConfigBean; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.component.CompPropReadService; -import com.coderman.codemaker.enums.ClassEnum; +package com.tianhua.codemaker.component.regist; + +import com.tianhua.codemaker.api.ICompRegistService; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.component.CompPropReadService; +import com.tianhua.codemaker.enums.ClassEnum; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -19,7 +18,6 @@ import org.springframework.stereotype.Component; import java.io.File; import java.io.IOException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -27,7 +25,7 @@ import java.util.List; * Description: * date: 2021/12/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -54,7 +52,9 @@ public class CompSingleClassRegistServiceImpl implements ICompRegistService { for (File file : singleClassCompFile.listFiles()){ ComponentConfigBean componentConfigBean = compPropReadService.buildFromProp(path+"/"+file.getName()); - + if(componentConfigBean == null){ + continue; + } if(ClassEnum.CLASS.getClassType().equals(componentConfigBean.getClassType())){ classBeanList.add(buildClassBean(componentConfigBean, file.getName().split("\\.")[0])); } @@ -77,7 +77,7 @@ public class CompSingleClassRegistServiceImpl implements ICompRegistService { classBean.setPackageName(componentConfigBean.getPackageName()); classBean.setClassName(className); classBean.setCompName(GlobalConstant.SINGLE_CLASS_COMMON); - classBean.setMethodBeanList(buildMethodBeanList(componentConfigBean.getMethodList())); + classBean.setMethodBeanList(buildMethodBeanList(componentConfigBean.getMethodMap().get(className))); return classBean; } @@ -89,7 +89,7 @@ public class CompSingleClassRegistServiceImpl implements ICompRegistService { interfaceBean.setClassName(className); interfaceBean.setCompName(GlobalConstant.SINGLE_CLASS_COMMON); - interfaceBean.setMethodBeanList(buildMethodBeanList(componentConfigBean.getMethodList())); + interfaceBean.setMethodBeanList(buildMethodBeanList(componentConfigBean.getMethodMap().get(className))); return interfaceBean; } diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/scan/AppCompScanServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/scan/AppCompScanServiceImpl.java similarity index 76% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/scan/AppCompScanServiceImpl.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/scan/AppCompScanServiceImpl.java index b721eb27ff1a984ad7b1ecfa8be01cf8a2b1f89b..e80cf741cc993d3f87d06608480536d779fedbce 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/scan/AppCompScanServiceImpl.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/scan/AppCompScanServiceImpl.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.component.scan; +package com.tianhua.codemaker.component.scan; -import com.coderman.codemaker.api.ICompScanService; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.component.ComponentConfigBean; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.classloader.CompClassLoadService; -import com.coderman.codemaker.component.CompPropReadService; +import com.tianhua.codemaker.api.ICompScanService; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.classloader.CompClassLoadService; +import com.tianhua.codemaker.component.CompPropReadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -21,7 +21,7 @@ import java.util.Map; * 这里扫描apiresult组件进行接口方法返回值和方法page参数的包装 * date: 2021/11/25 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -45,6 +45,7 @@ public class AppCompScanServiceImpl implements ICompScanService { ComponentContextBean componentContextBean = compClassLoadService.loadComponent(componentConfigBean); componentContextBean.setComponentName(compName); componentContextBean.setCompType(componentConfigBean.getCompType()); + componentContextBean.setComponentConfigBean(componentConfigBean); componentContextBeanMap.put(compName,componentContextBean); } return componentContextBeanMap; diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/scan/DefaultCompScanServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/scan/DefaultCompScanServiceImpl.java similarity index 75% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/scan/DefaultCompScanServiceImpl.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/scan/DefaultCompScanServiceImpl.java index 219aafbcf4308de2901def48b3a34f2bd7938356..64fc5083fb6a1f6978fbf22f210573e821d1dcf5 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/component/scan/DefaultCompScanServiceImpl.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/component/scan/DefaultCompScanServiceImpl.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.component.scan; - -import com.coderman.codemaker.api.ICompScanService; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.component.ComponentConfigBean; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.classloader.CompClassLoadService; -import com.coderman.codemaker.component.CompPropReadService; +package com.tianhua.codemaker.component.scan; + +import com.tianhua.codemaker.api.ICompScanService; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.classloader.CompClassLoadService; +import com.tianhua.codemaker.component.CompPropReadService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -18,7 +18,7 @@ import java.util.Map; * Description:组件扫描注册服务类 * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -46,6 +46,7 @@ public class DefaultCompScanServiceImpl implements ICompScanService { } ComponentContextBean componentContextBean = compClassLoadService.loadComponent(componentConfigBean); componentContextBean.setComponentName(compName); + componentContextBean.setComponentConfigBean(componentConfigBean); componentContextBeanMap.put(compName,componentContextBean); } return componentContextBeanMap; diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ApiConstant.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ApiConstant.java similarity index 83% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ApiConstant.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ApiConstant.java index 4a6b3870bea2b5e9d1eef7e6138e7bbbb1319d78..51ca20e7c48389af5005bbe8ba44f213a7c5fb27 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ApiConstant.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ApiConstant.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.constant; +package com.tianhua.codemaker.constant; /** * Description: api 相关包装类 * date: 2021/11/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ArchConstant.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ArchConstant.java similarity index 87% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ArchConstant.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ArchConstant.java index 27024fe00953ad6e6b7c0a02bf864efb447271a0..305ac64cfcb784db212e42fc593e85c81500840a 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ArchConstant.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ArchConstant.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.constant; +package com.tianhua.codemaker.constant; /** * Description:依赖的中间件框架的相关常量 * date: 2021/11/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ArchSpringConstant.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ArchSpringConstant.java similarity index 91% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ArchSpringConstant.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ArchSpringConstant.java index fdee05207e793782ced6118ff3995d5556587b28..e65611632b2044a95ebba6f07bd5c987de71813e 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/constant/ArchSpringConstant.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/constant/ArchSpringConstant.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.constant; +package com.tianhua.codemaker.constant; /** * Description: * date: 2021/12/13 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/EleNodeCmpDecorateHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/EleNodeCmpDecorateHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..55afc76ecbef2128434f5c75a85b64b80e46e2ab --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/EleNodeCmpDecorateHandler.java @@ -0,0 +1,45 @@ +package com.tianhua.codemaker.custom.decorate.liteflow; + +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * Description: NodeComponent代码元素包装 + * date: 2021/11/26 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "eleNodeCmpDecorateHandler") +public class EleNodeCmpDecorateHandler implements ElementDecorateHandler { + private static final String NODE_COMPONENT = "NodeComponent"; + + @Override + public void decorateElement(Map classCompMap, PlantUmlContextBean plantUmlContextBean) { + AbstractClassBean nodeCompClassBean = classCompMap.get(NODE_COMPONENT); + if (nodeCompClassBean != null) { + decorateNodeComponent(nodeCompClassBean, plantUmlContextBean); + } + } + /** + * 装饰SlotBO类 + * @param abstractClassBean + * @param plantUmlContextBean + */ + private void decorateNodeComponent(AbstractClassBean abstractClassBean, PlantUmlContextBean plantUmlContextBean) { + plantUmlContextBean.getClassBeanMap().forEach((k, v) -> { + if (k.toLowerCase().endsWith("cmp")) { + //继承liteflow的NodeComponent类 + v.setRelationClassStr(" extends " + NODE_COMPONENT); + v.addImportClass(abstractClassBean.getPackageName()); + v.setMethodBeanList(abstractClassBean.getMethodBeanList()); + + } + }); + } +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/EleSlotBODecorateHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/EleSlotBODecorateHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..0d105525e154c368968da9601f11fd4cedaf1a06 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/EleSlotBODecorateHandler.java @@ -0,0 +1,46 @@ +package com.tianhua.codemaker.custom.decorate.liteflow; + +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import org.springframework.stereotype.Component; + +import java.util.Map; + +/** + * Description: slotBO代码元素包装 + * date: 2021/11/26 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "eleSlotBODecorateHandler") +public class EleSlotBODecorateHandler implements ElementDecorateHandler { + private static final String ABS_SLOT = "AbsSlot"; + + @Override + public void decorateElement(Map classCompMap, PlantUmlContextBean plantUmlContextBean) { + AbstractClassBean slotClassBean = classCompMap.get(ABS_SLOT); + if (slotClassBean != null) { + decorateSlotBO(slotClassBean, plantUmlContextBean); + } + } + + /** + * 装饰SlotBO类 + * @param abstractClassBean + * @param plantUmlContextBean + */ + private void decorateSlotBO(AbstractClassBean abstractClassBean, PlantUmlContextBean plantUmlContextBean) { + plantUmlContextBean.getClassBeanMap().forEach((k, v) -> { + if (k.toLowerCase().endsWith("slotbo")) { + //继承liteflow的AbsSlot类 + v.setRelationClassStr(" extends " + ABS_SLOT); + v.addImportClass(abstractClassBean.getPackageName()); + } + }); + } + +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/LiteFlowDecorateServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/LiteFlowDecorateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..baa7cad6358df2d1732f3eb2fd283afe850a3a74 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/liteflow/LiteFlowDecorateServiceImpl.java @@ -0,0 +1,47 @@ +package com.tianhua.codemaker.custom.decorate.liteflow; + +import com.tianhua.codemaker.api.ICompDecorateService; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * Description:将代码模型中的SlotBO和Cmp元素通过liteflow组件装饰 + * date: 2022/3/1 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "liteFlowDecorateService") +public class LiteFlowDecorateServiceImpl implements ICompDecorateService { + private static final String NODE_COMPONENT = "NodeComponent"; + private static final String ABS_SLOT = "AbsSlot"; + + @Resource(name = "eleSlotBODecorateHandler") + private ElementDecorateHandler eleSlotBODecorateHandler; + + @Resource(name = "eleNodeCmpDecorateHandler") + private ElementDecorateHandler eleNodeCmpDecorateHandler; + + @Override + public void decorateComp(ComponentContextBean componentContextBean, PlantUmlContextBean plantUmlContextBean) { + ClassBean compClassBean = componentContextBean.getTargetClass(NODE_COMPONENT); + Map compBeanMap = new HashMap<>(); + compBeanMap.put(NODE_COMPONENT, compClassBean); + + ClassBean absSlotClassBean = componentContextBean.getTargetClass(ABS_SLOT); + Map slotBeanMap = new HashMap<>(); + slotBeanMap.put(ABS_SLOT, absSlotClassBean); + + eleNodeCmpDecorateHandler.decorateElement(compBeanMap, plantUmlContextBean); + eleSlotBODecorateHandler.decorateElement(slotBeanMap, plantUmlContextBean); + } +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/mybatisplus/MapperPlusDecorateHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/mybatisplus/MapperPlusDecorateHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..481d17234953b235b9d2668e728e9e101f376ebd --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/mybatisplus/MapperPlusDecorateHandler.java @@ -0,0 +1,102 @@ +package com.tianhua.codemaker.custom.decorate.mybatisplus; + +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.google.common.collect.Lists; +import org.springframework.stereotype.Component; + +import java.sql.Array; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Description:适配mybatis-plus + * 将mapper接口增加父类BaseMapper + * date: 2022/3/1 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "mapperplusDecorateHandler") +public class MapperPlusDecorateHandler implements ElementDecorateHandler { + private static final String BASE_MAPPER = "BaseMapper"; + + @Override + public void decorateElement(Map classCompMap, PlantUmlContextBean plantUmlContextBean) { + AbstractClassBean baseMapperBean = classCompMap.get(BASE_MAPPER); + if (baseMapperBean != null) { + decorateMapper(baseMapperBean, plantUmlContextBean); + } + } + + /** + * 装饰mapper + * @param abstractClassBean + * @param plantUmlContextBean + */ + private void decorateMapper(AbstractClassBean abstractClassBean, PlantUmlContextBean plantUmlContextBean) { + plantUmlContextBean.getInterfaceBeanMap().forEach((k,v)->{ + if (k.toLowerCase().endsWith(TemplateFileEnum.MAPPER.getTempFileName())) { + ClassBean doClass = plantUmlContextBean.getClassBeanMap().get(k.replace("Mapper","") + "DO"); + if(doClass != null){ + v.setRelationClassStr(" extends BaseMapper<" + doClass.getClassName() + ">"); + v.addImportClass(abstractClassBean.getPackageName()+".BaseMapper"); + //清空mapper方法 + v.setMethodBeanList(Lists.newArrayList()); + + + List superMethodList = new ArrayList<>(); + superMethodList.add(getInsertMethod()); + superMethodList.add(getSelectByIdMethod()); + superMethodList.add(getUpdateByIdMethod()); + v.setSuperMethodBeanList(superMethodList); + } + } + }); + } + + + private MethodBean getInsertMethod(){ + MethodBean methodBean = new MethodBean(); + methodBean.setMethodName("insert(T entity)"); + methodBean.setReturnClass("Integer"); + methodBean.setDesc("插入一条记录"); + methodBean.setVisibility("public"); + methodBean.buildParamArr(); + List paramBeanList = new ArrayList<>(); + paramBeanList.add(ParamBean.getInstance("T","entity",true)); + methodBean.setParamBeanList(paramBeanList); + return methodBean; + } + + private MethodBean getUpdateByIdMethod(){ + MethodBean methodBean = new MethodBean(); + methodBean.setMethodName("updateById(T entity)"); + methodBean.setReturnClass("Integer"); + methodBean.setDesc("修改一条记录"); + methodBean.setVisibility("public"); + methodBean.buildParamArr(); + List paramBeanList = new ArrayList<>(); + paramBeanList.add(ParamBean.getInstance("T","entity",true)); + methodBean.setParamBeanList(paramBeanList); + return methodBean; + } + private MethodBean getSelectByIdMethod(){ + MethodBean methodBean = new MethodBean(); + methodBean.setMethodName("T selectById(Serializable id)"); + methodBean.setReturnClass("T"); + methodBean.setGenericReturnType("T"); + methodBean.setDesc("查询一条记录"); + methodBean.setVisibility("public"); + methodBean.buildParamArr(); + List paramBeanList = new ArrayList<>(); + paramBeanList.add(ParamBean.getInstance("Serializable","id",true)); + methodBean.setParamBeanList(paramBeanList); + return methodBean; + } + + +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/mybatisplus/MybatisPlusDecorateServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/mybatisplus/MybatisPlusDecorateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..01a0f6815cfae0fad540b7368ea17b4867a8219c --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/decorate/mybatisplus/MybatisPlusDecorateServiceImpl.java @@ -0,0 +1,38 @@ +package com.tianhua.codemaker.custom.decorate.mybatisplus; + +import com.tianhua.codemaker.api.ICompDecorateService; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; + +/** + * Description:将代码模型中的mapper元素通过mybatis-plus组件装饰 + * date: 2022/3/1 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "mybatisPlusDecorateService") +public class MybatisPlusDecorateServiceImpl implements ICompDecorateService { + private static final String BASE_MAPPER = "BaseMapper"; + + @Resource(name = "mapperplusDecorateHandler") + private ElementDecorateHandler mapperDecorateHandler; + + @Override + public void decorateComp(ComponentContextBean componentContextBean, PlantUmlContextBean plantUmlContextBean) { + InterfaceBean baseMapper = componentContextBean.getTargetInterface(BASE_MAPPER); + Map interfaceBeanMap = new HashMap<>(); + interfaceBeanMap.put(BASE_MAPPER, baseMapper); + + mapperDecorateHandler.decorateElement(interfaceBeanMap, plantUmlContextBean); + } +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/CmpElementHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/CmpElementHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..0dca6ca5f1ae91f6a97097be66e5f61f015d1271 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/CmpElementHandler.java @@ -0,0 +1,60 @@ +package com.tianhua.codemaker.custom.elementhandler; + +import com.tianhua.codemaker.annotations.ElementTag; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.custom.bean.CustomElementBean; +import com.tianhua.codemaker.service.ImportPackageService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * Description:自定义代码元素cmp元素处理器 + * date: 2021/7/8 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + * + */ +@Component(value = "cmpElementHandler") +@ElementTag(elementName = "cmp") +public class CmpElementHandler implements DomainElementHandler { + + @Autowired + private ImportPackageService importPackageService; + + @Override + public CustomElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { + FtlBean ftlBean = plantUmlContextBean.getFtlBean(); + List classBeanList = new ArrayList<>(); + plantUmlContextBean.getClassBeanMap().forEach((k,v)->{ + if(v.getClassName().toLowerCase().endsWith(ftlBean.getCodeTempFileName())) { + String moduleTag = ftlBean.getModuleName(); + if(StringUtils.isEmpty(v.getPlantUMLPackage())){ + moduleTag = moduleTag+".cmp"; + }else if(v.getPlantUMLPackage().contains(moduleTag)){ + moduleTag = ""; + } + + importPackageService.setPackageNameWithModule(v,moduleTag); + + String className = v.getClassName().substring(0,1).toUpperCase().concat(v.getClassName().substring(1)); + v.setClassName(className); + importPackageService.dealImportClass(v,plantUmlContextBean); + v.getMethodBeanList().forEach(methodBean -> methodBean.buildDoc()); + + classBeanList.add(v); + } + }); + CustomElementBean validatorElementBean = new CustomElementBean(); + validatorElementBean.setClassBeanList(classBeanList); + return validatorElementBean; + } +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/PomElementHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/PomElementHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..01d57619b6ba37d5312fe9eba0275eda218692e2 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/PomElementHandler.java @@ -0,0 +1,34 @@ +package com.tianhua.codemaker.custom.elementhandler; + +import com.tianhua.codemaker.annotations.ElementTag; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.custom.bean.PomElementBean; +import com.google.common.collect.Lists; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/7/8 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + * + */ +@Component(value = "pomElementHandler") +@ElementTag(elementName = "clientpom,infrastpom,feignapipom," + + "domainpom,apppom,adapterpom,startpom,parentpom,apipom,corepom,commonpom,providerpom") +public class PomElementHandler implements DomainElementHandler { + + @Override + public PomElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { + FtlBean ftlBean = plantUmlContextBean.getFtlBean(); + PomElementBean clientPomElementBean = new PomElementBean(); + PomBean pomBean = plantUmlContextBean.getPomBeanMap().get(ftlBean.getModuleName()); + clientPomElementBean.setPomBeanList(Lists.newArrayList(pomBean)); + return clientPomElementBean; + } +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/ValidatorElementHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/ValidatorElementHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..28d40898279729879c298b176ad32439720cbecd --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/elementhandler/ValidatorElementHandler.java @@ -0,0 +1,60 @@ +package com.tianhua.codemaker.custom.elementhandler; + +import com.tianhua.codemaker.annotations.ElementTag; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.custom.bean.CustomElementBean; +import com.tianhua.codemaker.service.ImportPackageService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * Description:校验层走自定义代码元素处理器 + * date: 2021/7/8 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + * + */ +@Component(value = "validatorElementHandler") +@ElementTag(elementName = "validator") +public class ValidatorElementHandler implements DomainElementHandler { + + @Autowired + private ImportPackageService importPackageService; + + @Override + public CustomElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { + FtlBean ftlBean = plantUmlContextBean.getFtlBean(); + List classBeanList = new ArrayList<>(); + plantUmlContextBean.getClassBeanMap().forEach((k,v)->{ + if(v.getClassName().toLowerCase().endsWith(ftlBean.getCodeTempFileName())) { + String moduleTag = ftlBean.getModuleName(); + if(StringUtils.isEmpty(v.getPlantUMLPackage())){ + moduleTag = moduleTag+".validator"; + }else if(v.getPlantUMLPackage().contains(moduleTag)){ + moduleTag = ""; + } + + importPackageService.setPackageNameWithModule(v,moduleTag); + + String className = v.getClassName().substring(0,1).toUpperCase().concat(v.getClassName().substring(1)); + v.setClassName(className); + importPackageService.dealImportClass(v,plantUmlContextBean); + v.getMethodBeanList().forEach(methodBean -> methodBean.buildDoc()); + + classBeanList.add(v); + } + }); + CustomElementBean validatorElementBean = new CustomElementBean(); + validatorElementBean.setClassBeanList(classBeanList); + return validatorElementBean; + } +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/package-info.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..9ac5422a86e78313c87a2ac49d4a12c6fe08d3c7 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/custom/package-info.java @@ -0,0 +1 @@ +package com.tianhua.codemaker.custom; \ No newline at end of file diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/ElementDecorateHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/ElementDecorateHandler.java similarity index 68% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/ElementDecorateHandler.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/ElementDecorateHandler.java index b2293c75f2eaf7c144e03b06332e34193f7376fb..17699b52151f8dee4ffb7393724ae254adaf082a 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/ElementDecorateHandler.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/ElementDecorateHandler.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.element; +package com.tianhua.codemaker.element; -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; import java.util.Map; @@ -9,7 +9,7 @@ import java.util.Map; * Description:代码元素装饰处理器,抽象接口 * date: 2021/11/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleControllerDecorateHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleControllerDecorateHandler.java similarity index 91% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleControllerDecorateHandler.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleControllerDecorateHandler.java index 62bea3584df24b5335658e7001805288f95ee192..575c902dd8047463365b3e2fe60d569c8bb3e0fe 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleControllerDecorateHandler.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleControllerDecorateHandler.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.element.impl; - -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.constant.ApiConstant; -import com.coderman.codemaker.constant.ArchConstant; -import com.coderman.codemaker.constant.ArchSpringConstant; -import com.coderman.codemaker.element.ElementDecorateHandler; -import com.coderman.codemaker.enums.ModuleEnum; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.enums.dynamic.DecorateTypeEnum; +package com.tianhua.codemaker.element.impl; + +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.constant.ApiConstant; +import com.tianhua.codemaker.constant.ArchConstant; +import com.tianhua.codemaker.constant.ArchSpringConstant; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import com.tianhua.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.dynamic.DecorateTypeEnum; import org.springframework.stereotype.Component; import java.util.Map; @@ -17,7 +17,7 @@ import java.util.Optional; * Description: controller代码元素包装 * date: 2021/11/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -56,9 +56,6 @@ public class EleControllerDecorateHandler implements ElementDecorateHandler { decorateController(requestParamBean, plantUmlContextBean, DecorateTypeEnum.METHOD_ANNOTATION); } - - - //如果applicationType=springcloud则对controller进行实现接口包装 if (plantUmlContextBean.getApplicationType().equals(ModuleEnum.SC_FEIGN_API.getAppName())) { decorateControllerImpl(plantUmlContextBean); diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleFacadeDecorateHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleFacadeDecorateHandler.java similarity index 88% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleFacadeDecorateHandler.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleFacadeDecorateHandler.java index dbcd410795cea6b2136484dde1c969815d9a4b1d..cafc5c0c4bae6c77e9a24fef06aad15947f13b8c 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleFacadeDecorateHandler.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleFacadeDecorateHandler.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.element.impl; +package com.tianhua.codemaker.element.impl; -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.constant.ApiConstant; -import com.coderman.codemaker.constant.ArchConstant; -import com.coderman.codemaker.element.ElementDecorateHandler; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.enums.dynamic.DecorateTypeEnum; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.constant.ApiConstant; +import com.tianhua.codemaker.constant.ArchConstant; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.dynamic.DecorateTypeEnum; import org.springframework.stereotype.Component; import java.util.Map; @@ -17,7 +17,7 @@ import java.util.Optional; * Description: controller代码元素包装 * date: 2021/11/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleFeignDecorateHandler.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleFeignDecorateHandler.java similarity index 87% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleFeignDecorateHandler.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleFeignDecorateHandler.java index 7b7bd542d215eda76bf699f3539a98fd91012bd8..92f69d4529ea97f1487908fd651091de585f6ed4 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/element/impl/EleFeignDecorateHandler.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/element/impl/EleFeignDecorateHandler.java @@ -1,14 +1,13 @@ -package com.coderman.codemaker.element.impl; - -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.constant.ApiConstant; -import com.coderman.codemaker.constant.ArchConstant; -import com.coderman.codemaker.constant.ArchSpringConstant; -import com.coderman.codemaker.element.ElementDecorateHandler; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.enums.dynamic.DecorateTypeEnum; +package com.tianhua.codemaker.element.impl; + +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.constant.ApiConstant; +import com.tianhua.codemaker.constant.ArchSpringConstant; +import com.tianhua.codemaker.element.ElementDecorateHandler; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.dynamic.DecorateTypeEnum; import org.springframework.stereotype.Component; import java.util.Map; @@ -18,7 +17,7 @@ import java.util.Optional; * Description: controller代码元素包装 * date: 2021/11/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/factory/SpringClassBeanFactory.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/factory/SpringClassBeanFactory.java similarity index 84% rename from codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/factory/SpringClassBeanFactory.java rename to codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/factory/SpringClassBeanFactory.java index 87019c73620f082487d0de1944e0436a188b2e22..fd4829155cc041a3ae709f25415e728116e662f6 100644 --- a/codemaker-parent/codemaker-apiImpl/src/main/java/com/coderman/codemaker/factory/SpringClassBeanFactory.java +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/factory/SpringClassBeanFactory.java @@ -1,13 +1,11 @@ -package com.coderman.codemaker.factory; +package com.tianhua.codemaker.factory; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; -import com.coderman.codemaker.bean.plantuml.AnnotationBean; -import com.coderman.codemaker.constant.ArchConstant; -import com.coderman.codemaker.constant.ArchSpringConstant; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.AnnotationBean; +import com.tianhua.codemaker.constant.ArchSpringConstant; import org.springframework.stereotype.Service; -import javax.swing.*; import java.util.HashMap; import java.util.Map; @@ -15,7 +13,7 @@ import java.util.Map; * Description: * date: 2021/12/13 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateAopImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateAopImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..86dab16090686cd8b207ceafcbb3c5192d75ea52 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateAopImpl.java @@ -0,0 +1,195 @@ +package com.tianhua.codemaker.validate; + +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.bean.segment.SegmentBean; +import com.tianhua.codemaker.enums.CodeSegmentEnum; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; +import com.google.common.collect.Lists; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Description:通过aop+自定义注解实现 + * + * 参考:https://www.cnblogs.com/zhangruifeng/p/13460060.html + * + * https://www.jianshu.com/p/816c90b6ddc5 + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +@Component(value = "validateAopService") +public class ValidateAopImpl implements IValidateService { + @Override + public void dealValidate(PlantUmlContextBean plantUmlContextBean) { + Map validateSegmentMap = new HashMap<>(); + plantUmlContextBean.getClassBeanMap().forEach((s, classBean) -> { + if (classBean.getClassName().toLowerCase().endsWith(DomainElementEnum.BO.getElement()) && !classBean.getClassName().equals("PageBO")) { + ExtendFieldBean extendFieldBean = classBean.getExtendFieldBean(); + Map dtoValidateSegmentMap = getSegmentMap(extendFieldBean.getDtoKeyList(),extendFieldBean.getValidateKeyList()); + Map voValidateSegmentMap = getSegmentMap(extendFieldBean.getVoKeyList(), extendFieldBean.getValidateKeyList()); + validateSegmentMap.putAll(dtoValidateSegmentMap); + validateSegmentMap.putAll(voValidateSegmentMap); + } + }); + + + if(validateSegmentMap.isEmpty()){ + return; + } + relateValidateSegment(plantUmlContextBean, validateSegmentMap); + } + + + /** + * 将构建出来的segment关联到对应的类上 + * 基于工具类校验的话统一放到class vo/dto上 + * @param plantUmlContextBean + * @param validateSegmentMap + */ + private void relateValidateSegment(PlantUmlContextBean plantUmlContextBean, Map validateSegmentMap){ + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k,classBean)->{ + //对controller的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.CONTROLLER.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + }else { + paramType = param; + } + String [] validateKeyArr = validateSegmentMap.get(paramType); + if(validateKeyArr != null){ + List valdateKeyList = Lists.newArrayList(validateKeyArr); + ClassBean voBean = plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().get(paramType); + voBean.addImportClass("com.coderman.param.valid.ParamAnnotation"); + if(CollectionUtils.isNotEmpty(voBean.getFieldBeanList())){ + voBean.getFieldBeanList().forEach(fieldBean -> { + if(valdateKeyList.contains(fieldBean.getSimpleName())){ + fieldBean.addAnnotationTag("@ParamAnnotation(required = true)"); + } + }); + } + } + } + } + }); + } + }); + + + plantUmlContextBean.getDerivedPlantUmlContextBean().getInterfaceBeanMap().forEach((k,classBean)->{ + //对facade的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.FACADE.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + }else { + paramType = param; + } + String [] validateKeyArr = validateSegmentMap.get(paramType); + if(validateKeyArr != null){ + List valdateKeyList = Lists.newArrayList(validateKeyArr); + + ClassBean voBean = plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().get(paramType); + voBean.addImportClass("com.coderman.param.valid.ParamAnnotation"); + if(CollectionUtils.isNotEmpty(voBean.getFieldBeanList())){ + voBean.getFieldBeanList().forEach(fieldBean -> { + if(valdateKeyList.contains(fieldBean.getSimpleName())){ + fieldBean.addAnnotationTag("@ParamAnnotation(required = true)"); + } + }); + } + } + } + } + }); + } + }); + } + + private String buildMethodContent(String paramVar){ + StringBuilder builder = new StringBuilder("ResultDataDto resultDataDto = "+paramVar+".checkParam()\n"); + builder.append("\t\tif(!resultDataDto.isSuccess()){return resultDataDto;}"); + return builder.toString(); + } + + + private MethodBean buildCheckParamMethodBean(String methodContent){ + MethodBean methodBean = new MethodBean(); + methodBean.setMethodName("checkParam()"); + methodBean.setReturnClass("ResultDataDto"); + methodBean.setDesc("参数校验"); + methodBean.setVisibility("public "); + methodBean.setMethodContent(methodContent); + methodBean.setReturnBody(methodContent); + return methodBean; + } + + + private Map getSegmentMap(String [] modelKeyList, String [] validateKeyList){ + Map validateMap = new HashMap<>(); + if(modelKeyList != null && validateKeyList != null){ + for (String modelKey : modelKeyList){ + validateMap.put(modelKey, validateKeyList); + } + } + return validateMap; + } + + /** + * 构建验证的代码段内容 + * @param validateKeyList + * @return + */ + private SegmentBean getValidateSegment(String [] validateKeyList, ClassBean boClassBean){ + StringBuilder builder = new StringBuilder(); + Map fieldBeanMap = boClassBean.getFieldBeanList().stream().collect(Collectors.toMap(FieldBean::getSimpleName, o->o)); + + int i = 0; + for (String varName : validateKeyList){ + FieldBean fieldBean = fieldBeanMap.get(varName); + if(fieldBean == null){ + builder.append("\t\t//if(this."+varName+" == null ){ return ResultDataDto.fail(null);}\n"); + continue; + }else { + if(StringHandleUtils.isStrictBasicType(fieldBean.getFieldType())){ + builder.append("\t\t//if(this."+varName+" == 0 ){ return ResultDataDto.fail(null);}\n"); + continue; + } + if(fieldBean.getFieldType().toLowerCase().equals("string")){ + builder.append("\t\tif(this."+varName+" == null || this."+varName+" == \"\"" +"){ return ResultDataDto.fail(null);}\n"); + }else { + builder.append("\t\tif(this."+varName+" == null){ return ResultDataDto.fail(null);}\n"); + } + } + } + + builder.append("\t\treturn ResultDataDto.success();"); + + SegmentBean segmentBean = SegmentBean.getInstance(CodeSegmentEnum.VALIDATE.getTag(),builder.toString()); + segmentBean.importPackageName("com.coderman.utils.response.ResultDataDto"); + + return segmentBean; + } + +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateHibernateJSRImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateHibernateJSRImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..efec0734549304556b3c86c593dd0a86ef84cc7c --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateHibernateJSRImpl.java @@ -0,0 +1,155 @@ +package com.tianhua.codemaker.validate; + +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.enums.CodeSegmentEnum; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; +import com.google.common.collect.Lists; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Description:通过aop+自定义注解实现 + * + * 参考:https://blog.csdn.net/kermit_liu/article/details/90043295 + * + * https://www.jianshu.com/p/816c90b6ddc5 + * + * + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +@Component(value = "validateJSRHibernateService") +public class ValidateHibernateJSRImpl implements IValidateService { + @Override + public void dealValidate(PlantUmlContextBean plantUmlContextBean) { + Map validateSegmentMap = new HashMap<>(); + plantUmlContextBean.getClassBeanMap().forEach((s, classBean) -> { + if (classBean.getClassName().toLowerCase().endsWith(DomainElementEnum.BO.getElement()) && !classBean.getClassName().equals("PageBO")) { + ExtendFieldBean extendFieldBean = classBean.getExtendFieldBean(); + Map dtoValidateSegmentMap = getSegmentMap(extendFieldBean.getDtoKeyList(),extendFieldBean.getValidateKeyList()); + Map voValidateSegmentMap = getSegmentMap(extendFieldBean.getVoKeyList(), extendFieldBean.getValidateKeyList()); + validateSegmentMap.putAll(dtoValidateSegmentMap); + validateSegmentMap.putAll(voValidateSegmentMap); + } + }); + + + if(validateSegmentMap.isEmpty()){ + return; + } + relateValidateSegment(plantUmlContextBean, validateSegmentMap); + } + + + /** + * 将构建出来的segment关联到对应的类上 + * 基于工具类校验的话统一放到class vo/dto上 + * @param plantUmlContextBean + * @param validateSegmentMap + */ + private void relateValidateSegment(PlantUmlContextBean plantUmlContextBean, Map validateSegmentMap){ + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k,classBean)->{ + //对controller的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.CONTROLLER.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + }else { + paramType = param; + } + String [] validateKeyArr = validateSegmentMap.get(paramType); + if(validateKeyArr != null){ + List valdateKeyList = Lists.newArrayList(validateKeyArr); + ClassBean voBean = plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().get(paramType); + voBean.addImportClass("javax.validation.constraints.*"); + classBean.addImportClass("javax.validation.Valid"); + if(CollectionUtils.isNotEmpty(voBean.getFieldBeanList())){ + voBean.getFieldBeanList().forEach(fieldBean -> { + if(valdateKeyList.contains(fieldBean.getSimpleName())){ + if(fieldBean.getFieldType().toLowerCase().equals("string")){ + fieldBean.addAnnotationTag("@NotBlank(message = \" " + fieldBean.getSimpleName() +" 不能为空\")"); + }else if(fieldBean.getFieldType().toLowerCase().equals("long") || fieldBean.getFieldType().toLowerCase().equals("integer")){ + fieldBean.addAnnotationTag("@NotNull(message = \" " + fieldBean.getSimpleName() +" 不能为空\")"); + }else { + fieldBean.addAnnotationTag("@NotBlank(message = \" " + fieldBean.getSimpleName() +" 不能为空\")"); + } + } + }); + } + methodBean.addParamAnnotation("@Valid",0); + } + } + } + }); + } + }); + + + plantUmlContextBean.getDerivedPlantUmlContextBean().getInterfaceBeanMap().forEach((k,classBean)->{ + //对facade的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.FACADE.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + }else { + paramType = param; + } + String [] validateKeyArr = validateSegmentMap.get(paramType); + if(validateKeyArr != null){ + List valdateKeyList = Lists.newArrayList(validateKeyArr); + + ClassBean dtoBean = plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().get(paramType); + dtoBean.addImportClass("javax.validation.constraints.*"); + if(CollectionUtils.isNotEmpty(dtoBean.getFieldBeanList())){ + dtoBean.getFieldBeanList().forEach(fieldBean -> { + if(valdateKeyList.contains(fieldBean.getSimpleName())){ + if(fieldBean.getFieldType().toLowerCase().equals("string")){ + fieldBean.addAnnotationTag("@NotBlank(message = \" " + fieldBean.getSimpleName() +" 不能为空\")"); + }else if(fieldBean.getFieldType().toLowerCase().equals("long") || fieldBean.getFieldType().toLowerCase().equals("integer")){ + fieldBean.addAnnotationTag("@NotNull(message = \" " + fieldBean.getSimpleName() +" 不能为空\")"); + }else { + fieldBean.addAnnotationTag("@NotBlank(message = \" " + fieldBean.getSimpleName() +" 不能为空\")"); + } + } + }); + } + } + } + } + }); + } + }); + } + + + private Map getSegmentMap(String [] modelKeyList, String [] validateKeyList){ + Map validateMap = new HashMap<>(); + if(modelKeyList != null && validateKeyList != null){ + for (String modelKey : modelKeyList){ + validateMap.put(modelKey, validateKeyList); + } + } + return validateMap; + } + +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateParamImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateParamImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2679c5c9b0acad8e8db342d11d28b36348e15735 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateParamImpl.java @@ -0,0 +1,194 @@ +package com.tianhua.codemaker.validate; + +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.bean.segment.SegmentBean; +import com.tianhua.codemaker.enums.CodeSegmentEnum; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Description:通过参数对象内部的参数校验方法校验 + * + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "validateParamService") +public class ValidateParamImpl implements IValidateService { + + @Override + public void dealValidate(PlantUmlContextBean plantUmlContextBean) { + Map validateSegmentMap = new HashMap<>(); + plantUmlContextBean.getClassBeanMap().forEach((s, classBean) -> { + if (classBean.getClassName().toLowerCase().endsWith(DomainElementEnum.BO.getElement()) && !classBean.getClassName().equals("PageBO")) { + ExtendFieldBean extendFieldBean = classBean.getExtendFieldBean(); + Map dtoValidateSegmentMap = getSegmentMap(extendFieldBean.getDtoKeyList(),extendFieldBean.getValidateKeyList(),classBean); + Map voValidateSegmentMap = getSegmentMap(extendFieldBean.getVoKeyList(), extendFieldBean.getValidateKeyList(),classBean); + validateSegmentMap.putAll(dtoValidateSegmentMap); + validateSegmentMap.putAll(voValidateSegmentMap); + } + }); + + + if(validateSegmentMap.isEmpty()){ + return; + } + relateValidateSegment(plantUmlContextBean, validateSegmentMap); + } + + /** + * 将构建出来的segment关联到对应的类上 + * 基于工具类校验的话统一放到class vo/dto上 + * @param plantUmlContextBean + * @param validateSegmentMap + */ + private void relateValidateSegment(PlantUmlContextBean plantUmlContextBean, Map validateSegmentMap){ + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k,classBean)->{ + //对controller的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.CONTROLLER.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + String paramVar = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + paramVar = param.split(" ")[1]; + }else { + paramType = param; + paramVar = param.substring(0,1).toLowerCase()+param.substring(1); + } + + SegmentBean segmentBean = validateSegmentMap.get(paramType); + if(segmentBean != null){ + MethodBean checkParamMethodBean = buildCheckParamMethodBean(segmentBean.getCode()); + ClassBean voBean = plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().get(paramType); + if(CollectionUtils.isEmpty(voBean.getMethodBeanList())){ + voBean.setMethodBeanList(new ArrayList<>()); + } + voBean.getMethodBeanList().add(checkParamMethodBean); + voBean.addImportClassBatch(segmentBean.getPackageNameList()); + classBean.addImportClassBatch(segmentBean.getPackageNameList()); + methodBean.addInvokeRowContentSimple(buildMethodContent(paramVar)); + } + } + } + }); + } + }); + + + plantUmlContextBean.getDerivedPlantUmlContextBean().getInterfaceBeanMap().forEach((k,classBean)->{ + //对facade的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.FACADE.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + String paramVar = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + paramVar = param.split(" ")[1]; + }else { + paramType = param; + paramVar = param.substring(0,1).toLowerCase()+param.substring(1); + } + + SegmentBean segmentBean = validateSegmentMap.get(paramType); + if(segmentBean != null){ + MethodBean checkParamMethodBean = buildCheckParamMethodBean(segmentBean.getCode()); + ClassBean dtoBean = plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().get(paramType); + if(CollectionUtils.isEmpty(dtoBean.getMethodBeanList())){ + dtoBean.setMethodBeanList(new ArrayList<>()); + } + dtoBean.getMethodBeanList().add(checkParamMethodBean); + dtoBean.addImportClassBatch(segmentBean.getPackageNameList()); + classBean.addImportClassBatch(segmentBean.getPackageNameList()); + methodBean.addInvokeRowContentSimple(buildMethodContent(paramVar)); + } + } + } + }); + } + }); + } + + private String buildMethodContent(String paramVar){ + StringBuilder builder = new StringBuilder("ResultDataDto resultDataDto = "+paramVar+".checkParam()\n"); + builder.append("\t\tif(!resultDataDto.isSuccess()){return resultDataDto;}"); + return builder.toString(); + } + + + private MethodBean buildCheckParamMethodBean(String methodContent){ + MethodBean methodBean = new MethodBean(); + methodBean.setMethodName("checkParam()"); + methodBean.setReturnClass("ResultDataDto"); + methodBean.setDesc("参数校验"); + methodBean.setVisibility("public "); + methodBean.setMethodContent(methodContent); + methodBean.setReturnBody(methodContent); + return methodBean; + } + + + private Map getSegmentMap(String [] modelKeyList, String [] validateKeyList, ClassBean boClassBean){ + Map validateMap = new HashMap<>(); + if(modelKeyList != null && validateKeyList != null){ + for (String modelKey : modelKeyList){ + validateMap.put(modelKey, getValidateSegment(validateKeyList,boClassBean)); + } + } + return validateMap; + } + + /** + * 构建验证的代码段内容 + * @param validateKeyList + * @return + */ + private SegmentBean getValidateSegment(String [] validateKeyList, ClassBean boClassBean){ + StringBuilder builder = new StringBuilder(); + Map fieldBeanMap = boClassBean.getFieldBeanList().stream().collect(Collectors.toMap(FieldBean::getSimpleName,o->o)); + + int i = 0; + for (String varName : validateKeyList){ + FieldBean fieldBean = fieldBeanMap.get(varName); + if(fieldBean == null){ + builder.append("\t\t//if(this."+varName+" == null ){ return ResultDataDto.fail(null);}\n"); + continue; + }else { + if(StringHandleUtils.isStrictBasicType(fieldBean.getFieldType())){ + builder.append("\t\t//if(this."+varName+" == 0 ){ return ResultDataDto.fail(null);}\n"); + continue; + } + if(fieldBean.getFieldType().toLowerCase().equals("string")){ + builder.append("\t\tif(this."+varName+" == null || this."+varName+" == \"\"" +"){ return ResultDataDto.fail(null);}\n"); + }else { + builder.append("\t\tif(this."+varName+" == null){ return ResultDataDto.fail(null);}\n"); + } + } + } + + builder.append("\t\treturn ResultDataDto.success();"); + + SegmentBean segmentBean = SegmentBean.getInstance(CodeSegmentEnum.VALIDATE.getTag(),builder.toString()); + segmentBean.importPackageName("com.coderman.utils.response.ResultDataDto"); + + return segmentBean; + } + +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateServiceImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9b751ec466552bf23c85ee88d6ae3ca91cc56633 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateServiceImpl.java @@ -0,0 +1,143 @@ +package com.tianhua.codemaker.validate; + +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.bean.segment.SegmentBean; +import com.tianhua.codemaker.enums.CodeSegmentEnum; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +/** + * Description:独立构建一个validator包 + * + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +@Component(value = "validateServiceValidator") +public class ValidateServiceImpl implements IValidateService { + @Override + public void dealValidate(PlantUmlContextBean plantUmlContextBean) { + Map validateSegmentMap = new HashMap<>(); + plantUmlContextBean.getClassBeanMap().forEach((s, classBean) -> { + if (classBean.getClassName().toLowerCase().endsWith(DomainElementEnum.BO.getElement()) && !classBean.getClassName().equals("PageBO")) { + ExtendFieldBean extendFieldBean = classBean.getExtendFieldBean(); + Map dtoValidateSegmentMap = getSegmentMap(extendFieldBean.getDtoKeyList(),extendFieldBean.getValidateKeyList()); + Map voValidateSegmentMap = getSegmentMap(extendFieldBean.getVoKeyList(), extendFieldBean.getValidateKeyList()); + validateSegmentMap.putAll(dtoValidateSegmentMap); + validateSegmentMap.putAll(voValidateSegmentMap); + } + }); + + if(validateSegmentMap.isEmpty()){ + return; + } + relateValidateSegment(plantUmlContextBean, validateSegmentMap); + } + + + /** + * 将构建出来的segment关联到对应的类上 + * 基于工具类校验的话统一放到class vo/dto上 + * @param plantUmlContextBean + * @param validateSegmentMap + */ + private void relateValidateSegment(PlantUmlContextBean plantUmlContextBean, Map validateSegmentMap){ + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k,classBean)->{ + //对controller的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.CONTROLLER.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + String paramVar = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + paramVar = param.split(" ")[1]; + }else { + paramType = param; + paramVar = param.substring(0,1).toLowerCase() + param.substring(1); + } + + SegmentBean segmentBean = validateSegmentMap.get(paramType); + if(segmentBean != null){ + methodBean.addInvokeRowContentSimple(segmentBean.getCode().replace("${paramObject}",paramVar)); + classBean.addImportClassBatch(segmentBean.getPackageNameList()); + } + + } + } + }); + } + }); + plantUmlContextBean.getDerivedPlantUmlContextBean().getInterfaceBeanMap().forEach((k,classBean)->{ + //对facade的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.FACADE.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + String paramVar = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + paramVar = param.split(" ")[1]; + }else { + paramType = param; + paramVar = param.substring(0,1).toLowerCase() + param.substring(1); + } + + SegmentBean segmentBean = validateSegmentMap.get(paramType); + if(segmentBean != null){ + methodBean.addInvokeRowContentSimple(segmentBean.getCode().replace("${paramObject}",paramVar)); + classBean.addImportClassBatch(segmentBean.getPackageNameList()); + } + + } + } + }); + } + }); + + } + + /** + * 构建代码段 + * @param modelKeyList + * @param validateKeyList + * @return + */ + private Map getSegmentMap(String [] modelKeyList, String [] validateKeyList){ + Map validateMap = new HashMap<>(); + if(modelKeyList != null && validateKeyList != null){ + for (String modelKey : modelKeyList){ + //todo replace paramObject to constant + String validateCodeSegment = "ParamCheckUtils.check(${paramObject}, " + getValidateStr(validateKeyList) +")"; + SegmentBean segmentBean = SegmentBean.getInstance(CodeSegmentEnum.VALIDATE.getTag(),validateCodeSegment); + segmentBean.importPackageName("com.coderman.check.ParamCheckUtils"); + validateMap.put(modelKey,segmentBean); + } + } + return validateMap; + } + + private String getValidateStr(String [] validateKeyList){ + if(validateKeyList.length == 1){ + return "\"" + validateKeyList[0] + "\""; + } + String valideStr = StringUtils.join(validateKeyList,"\", \""); + return "\"" + valideStr + "\""; + } + +} diff --git a/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateUtilImpl.java b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateUtilImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..966617b64970c5207f1b6f8bbda2e9cf3b7b9667 --- /dev/null +++ b/codemaker-parent/codemaker-apiImpl/src/main/java/com/tianhua/codemaker/validate/ValidateUtilImpl.java @@ -0,0 +1,133 @@ +package com.tianhua.codemaker.validate; + +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.bean.plantuml.ExtendFieldBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.bean.segment.SegmentBean; +import com.tianhua.codemaker.enums.CodeSegmentEnum; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +/** + * Description:基于paramCheckUtil工具类实现校验逻辑 + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "validateUtilService") +public class ValidateUtilImpl implements IValidateService { + + @Override + public void dealValidate(PlantUmlContextBean plantUmlContextBean) { + Map validateSegmentMap = new HashMap<>(); + plantUmlContextBean.getClassBeanMap().forEach((s, classBean) -> { + if (classBean.getClassName().toLowerCase().endsWith(DomainElementEnum.BO.getElement()) && !classBean.getClassName().equals("PageBO")) { + ExtendFieldBean extendFieldBean = classBean.getExtendFieldBean(); + Map dtoValidateSegmentMap = getSegmentMap(extendFieldBean.getDtoKeyList(),extendFieldBean.getValidateKeyList()); + Map voValidateSegmentMap = getSegmentMap(extendFieldBean.getVoKeyList(), extendFieldBean.getValidateKeyList()); + validateSegmentMap.putAll(dtoValidateSegmentMap); + validateSegmentMap.putAll(voValidateSegmentMap); + } + }); + + if(validateSegmentMap.isEmpty()){ + return; + } + relateValidateSegment(plantUmlContextBean, validateSegmentMap); + } + + /** + * 将构建出来的segment关联到对应的类上 + * 基于工具类校验的话统一放到class vo/dto上 + * @param plantUmlContextBean + * @param validateSegmentMap + */ + private void relateValidateSegment(PlantUmlContextBean plantUmlContextBean, Map validateSegmentMap){ + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k,classBean)->{ + //对controller的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.CONTROLLER.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + String paramVar = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + paramVar = param.split(" ")[1]; + }else { + paramType = param; + paramVar = param.substring(0,1).toLowerCase() + param.substring(1); + } + + SegmentBean segmentBean = validateSegmentMap.get(paramType); + if(segmentBean != null){ + methodBean.addInvokeRowContentSimple(segmentBean.getCode().replace("${paramObject}",paramVar)); + classBean.addImportClassBatch(segmentBean.getPackageNameList()); + } + + } + } + }); + } + }); + plantUmlContextBean.getDerivedPlantUmlContextBean().getInterfaceBeanMap().forEach((k,classBean)->{ + //对facade的入参数进行参数校验方法植入 + if(classBean.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.FACADE.getElement()) ) { + classBean.getMethodBeanList().forEach(methodBean -> { + String [] paramArr = methodBean.getParamArr(); + if(paramArr != null){ + for (String param : paramArr){ + String paramType = ""; + String paramVar = ""; + if(param.contains(" ")){ + paramType = param.split(" ")[0]; + paramVar = param.split(" ")[1]; + }else { + paramType = param; + paramVar = param.substring(0,1).toLowerCase() + param.substring(1); + } + + SegmentBean segmentBean = validateSegmentMap.get(paramType); + if(segmentBean != null){ + methodBean.addInvokeRowContentSimple(segmentBean.getCode().replace("${paramObject}",paramVar)); + classBean.addImportClassBatch(segmentBean.getPackageNameList()); + } + + } + } + }); + } + }); + + } + + private Map getSegmentMap(String [] modelKeyList, String [] validateKeyList){ + Map validateMap = new HashMap<>(); + if(modelKeyList != null && validateKeyList != null){ + for (String modelKey : modelKeyList){ + //todo replace paramObject to constant + String validateCodeSegment = "ParamCheckUtils.check(${paramObject}, " + getValidateStr(validateKeyList) +")"; + SegmentBean segmentBean = SegmentBean.getInstance(CodeSegmentEnum.VALIDATE.getTag(),validateCodeSegment); + segmentBean.importPackageName("com.coderman.check.ParamCheckUtils"); + validateMap.put(modelKey,segmentBean); + } + } + return validateMap; + } + + private String getValidateStr(String [] validateKeyList){ + if(validateKeyList.length == 1){ + return "\"" + validateKeyList[0] + "\""; + } + String valideStr = StringUtils.join(validateKeyList,"\", \""); + return "\"" + valideStr + "\""; + } +} diff --git a/codemaker-parent/codemaker-core/pom.xml b/codemaker-parent/codemaker-core/pom.xml index da37363cd60e23b15b30a21c389e8ad33c063b78..ac7ce2d1dabe714630479464a2e10a2adaf4ceb4 100644 --- a/codemaker-parent/codemaker-core/pom.xml +++ b/codemaker-parent/codemaker-core/pom.xml @@ -6,11 +6,11 @@ com.coderman.codemaker codemaker-parent - 1.2.2-SNAPSHOT + 1.3.0-SNAPSHOT com.coderman.codemaker codemaker-core - 1.2.2-SNAPSHOT + 1.3.0-SNAPSHOT codemaker-core @@ -18,13 +18,13 @@ UTF-8 - 1.7 - 1.7 + 1.8 + 1.8 - fanchunshuai - fanchunshuai + shenshuai + shenshuai 2217011466@qq.com @@ -34,7 +34,7 @@ com.coderman.codemaker codemaker-apiImpl - 1.0-SNAPSHOT + 1.1-SNAPSHOT @@ -188,6 +188,24 @@ lombok + + com.coderman.codermaker.dberparse + codemaker-dberparse + 1.0.1-SNAPSHOT + + + + + + @@ -197,10 +215,30 @@ org.apache.maven.plugins maven-compiler-plugin - 9 - 9 + 8 + 8 + + + + src/main/resources + true + + **/*.* + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/CommonWriteService.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/CommonWriteService.java deleted file mode 100644 index cd469ba2f594778c09f90ef5462dfacfbd4b4750..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/CommonWriteService.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.coderman.codemaker.app; - -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.utils.Constant; -import org.apache.commons.io.FileUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.io.IOException; - -/** - * Description: - * date: 2021/7/8 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Service -public class CommonWriteService { - - @Autowired - private AppServiceConfig appServiceConfig; - - /** - * 写工具类文件 - * @param content - * @param modulePath - */ - public void writeSpringApplicationContext(String content,String modulePath) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/utils"; - String fileName = "SpringApplicationContext.java"; - filePath = modulePath + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写工具类文件 - * @param content - * @param modulePath - */ - public void writeAppEventPublisher(String content, String modulePath) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/utils"; - String fileName = "AppEventPublisher.java"; - filePath = modulePath + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写工具类文件 - * - * @param content - */ - public void writeBaseEvent(String content, String modulePath) { - String packageName = appServiceConfig.getPackage()+".domain.event"; - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath; - String fileName = "BaseEvent.java"; - filePath = modulePath + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写BaseController文件 - * - * @param content - */ - public void writeBaseController(String content, String modulePath) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/controller"; - String fileName = "BaseController.java"; - filePath = modulePath + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaAdapterWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaAdapterWriteServiceImpl.java deleted file mode 100644 index 65190846008894dadbc163598d7f95da3cf1d17e..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaAdapterWriteServiceImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.coderman.codemaker.app.cola; - -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.ProjectTemplateColaConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * Description: - * date: 2021/7/6 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "colaAdapterWriteService") -public class ColaAdapterWriteServiceImpl extends WriteService implements IWriteFileService { - @Autowired - private ProjectTemplateColaConfig projectTemplateColaConfig; - - @Autowired - private CommonWriteService commonWriteService; - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleAdapterPath()); - - //写vo - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VO.getTempFileName())){ - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().endsWith("VO") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"VO"); - classContentBean.setChildPackageName("vo"); - classContentBean.setClassSuffix("VO.java"); - writeClassFile(classContentBean); - } - - //写vo-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VO_DDD.getTempFileName())){ - classContentBean.setChildPackageName("adapter.vo"); - classContentBean.setClassSuffix("VO.java"); - writeRoute(classContentBean); - } - - //写controller - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONTROLLER.getTempFileName())){ - - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().endsWith("Controller") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"Controller"); - classContentBean.setChildPackageName("controller"); - classContentBean.setClassSuffix("Controller.java"); - writeClassFile(classContentBean); - } - - //写controller-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONTROLLER_DDD.getTempFileName())){ - classContentBean.setChildPackageName("adapter.controller"); - classContentBean.setClassSuffix("Controller.java"); - writeRoute(classContentBean); - } - - //写convert - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONVERT.getTempFileName())){ - writeClassFileV2(classContentBean); - } - - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BASE_CONTROLLER.getTempFileName())){ - commonWriteService.writeBaseController(writeContentBean.getContent(),projectTemplateColaConfig.getModuleAdapterPath()); - } - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - } - -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaAppWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaAppWriteServiceImpl.java deleted file mode 100644 index a91b1223ddae59bfd0aeb8a2bd29be508a41aff0..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaAppWriteServiceImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.coderman.codemaker.app.cola; - -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateColaConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * Description: - * date: 2021/7/6 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "colaAppWriteService") -public class ColaAppWriteServiceImpl extends WriteService implements IWriteFileService { - - @Autowired - private AppServiceConfig appServiceConfig; - @Autowired - private ProjectTemplateColaConfig projectTemplateColaConfig; - - @Autowired - private CommonWriteService commonWriteService; - - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleAppPath()); - - //写FacadeImpl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACADE_IMPL.getTempFileName())){ - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("facadeimpl") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"FacadeImpl"); - classContentBean.setChildPackageName("app.facadeimpl"); - writeRoute(classContentBean); - } - - //写app.cmd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CMD.getTempFileName())){ - classContentBean.setChildPackageName("app.command"); - writeRoute(classContentBean); - } - //写app.exe - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EXE.getTempFileName())){ - classContentBean.setChildPackageName("app.executor"); - writeRoute(classContentBean); - } - - //写convert - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONVERT.getTempFileName())){ - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".app.convert"); - writeClassFileV2(classContentBean); - } - - //写app.listener - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_LISTENER.getTempFileName())){ - classContentBean.setChildPackageName("app.listener"); - writeRoute(classContentBean); - } - - /* //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName())){ - commonWriteService.writeSpringApplicationContext(writeContentBean.getContent(),projectTemplateColaConfig.getModuleAppPath()); - } - - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName())){ - commonWriteService.writeAppEventPublisher(writeContentBean.getContent(),projectTemplateColaConfig.getModuleAppPath()); - }*/ - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaClientWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaClientWriteServiceImpl.java deleted file mode 100644 index dd4dcc447003f9306bb731ec0976b57117a9f8ea..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaClientWriteServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.coderman.codemaker.app.cola; - -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateColaConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.utils.Constant; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.IOException; - -/** - * Description: - * date: 2021/7/6 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "colaClientWriteService") -public class ColaClientWriteServiceImpl extends WriteService implements IWriteFileService { - - @Autowired - private ProjectTemplateColaConfig projectTemplateColaConfig; - - @Autowired - private AppServiceConfig appServiceConfig; - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleClientPath()); - - //写api.dto-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO_DDD.getTempFileName())){ - - classContentBean.setChildPackageName("api.dto"); - classContentBean.setClassSuffix("DTO.java"); - writeRoute(classContentBean); - } - //写api.dto - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO.getTempFileName())){ - classContentBean.setChildPackageName("dto"); - classContentBean.setClassSuffix("DTO.java"); - writeDTO(classContentBean); - } - - //写api.facade - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACADE.getTempFileName())){ - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("facade") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"Facade"); - classContentBean.setChildPackageName("api.facade"); - classContentBean.setClassSuffix("Facade.java"); - writeRoute(classContentBean); - } - - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("api.enums"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".api.enums"); - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - } - - /** - * 写dto文件 - * @param classContentBean - */ - public void writeDTO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/") + "/api"; - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateColaConfig.getModuleClientPath() + packagePath + "/" + fileName; - } - -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaDomainWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaDomainWriteServiceImpl.java deleted file mode 100644 index 273e2b3c1139a51e4dae6eb41cca9e32e43a9e20..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaDomainWriteServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.coderman.codemaker.app.cola; - -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.ProjectTemplateColaConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * Description: - * date: 2021/7/6 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "colaDomainWriteService") -public class ColaDomainWriteServiceImpl extends WriteService implements IWriteFileService { - - @Autowired - private ProjectTemplateColaConfig projectTemplateColaConfig; - - @Autowired - private CommonWriteService commonWriteService; - - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleDomainPath()); - - //写domain.bo-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName())){ - classContentBean.setChildPackageName("domain.bo"); - writeRoute(classContentBean); - } - - //写model.bo - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT.getTempFileName())){ - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("bo") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"BO"); - classContentBean.setChildPackageName("model.bo"); - classContentBean.setClassSuffix("BO.java"); - writeClassFile(classContentBean); - } - - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("domain.enums"); - writeRoute(classContentBean); - } - - //写domain.valueobject - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VALUE_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("domain.valueobject"); - writeRoute(classContentBean); - } - //写domain.msgbody - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MESSAGE_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.msgbody"); - writeRoute(classContentBean); - } - - //写domain.event - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EVENT_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.event"); - writeRoute(classContentBean); - } - - - //写domain.gataway - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY.getTempFileName())){ - classContentBean.setChildPackageName("domain.gataway"); - writeRoute(classContentBean); - } - //写domain.repository - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.repository"); - writeRoute(classContentBean); - } - //写domain.factory - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACTORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.factory"); - writeRoute(classContentBean); - } - - //写service - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE.getTempFileName())){ - classContentBean.setChildPackageName("service"); - classContentBean.setClassSuffix("Service.java"); - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("service") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"Service"); - writeClassFile(classContentBean); - } - - //写BaseEvent - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName())){ - commonWriteService.writeBaseEvent(writeContentBean.getContent(),projectTemplateColaConfig.getModuleDomainPath()); - } - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - - } - -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaFeignApiWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaFeignApiWriteServiceImpl.java deleted file mode 100644 index 9c6c09d37584c1c96bb9dfc4b248d15fc435fab0..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaFeignApiWriteServiceImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.coderman.codemaker.app.cola; - -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateColaConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.utils.Constant; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.IOException; - -/** - * Description: - * date: 2021/11/29 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ - -@Component(value = "colaFeignApiWriteService") -public class ColaFeignApiWriteServiceImpl extends WriteService implements IWriteFileService { - @Autowired - private ProjectTemplateColaConfig projectTemplateColaConfig; - - @Autowired - private AppServiceConfig appServiceConfig; - - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleFeignApiPath()); - //写api.dto-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO_DDD.getTempFileName())){ - classContentBean.setChildPackageName("api.dto"); - classContentBean.setClassSuffix("DTO.java"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - //写api.dto - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO.getTempFileName())){ - classContentBean.setChildPackageName("dto"); - classContentBean.setClassSuffix("DTO.java"); - writeDTO(classContentBean); - } - - - //写feign - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FEIGN.getTempFileName())){ - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("feign") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"Feign"); - classContentBean.setChildPackageName("api.feign"); - classContentBean.setClassSuffix("Feign.java"); - writeRoute(classContentBean); - } - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("domain.enums"); - writeRoute(classContentBean); - } - - } - - /** - * 写dto文件 - * @param classContentBean - */ - public void writeDTO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/") ; - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateColaConfig.getModuleFeignApiPath() + packagePath + "/" + fileName; - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaInfrastWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaInfrastWriteServiceImpl.java deleted file mode 100644 index fb5050201f1dc8f7e87d9533ffd88ad18a343b92..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaInfrastWriteServiceImpl.java +++ /dev/null @@ -1,263 +0,0 @@ -package com.coderman.codemaker.app.cola; - -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateColaConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.utils.Constant; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.IOException; - -/** - * Description: - * date: 2021/7/6 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "colaInfrastWriteService") -public class ColaInfrastWriteServiceImpl extends WriteService implements IWriteFileService { - @Autowired - private ProjectTemplateColaConfig projectTemplateColaConfig; - - @Autowired - private AppServiceConfig appServiceConfig; - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleInfrastPath()); - - //写do class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DATA_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("dataobject"); - classContentBean.setClassSuffix("DO.java"); - writeDO(classContentBean); - } - //写mapper class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER.getTempFileName())){ - classContentBean.setChildPackageName("mapper"); - classContentBean.setClassSuffix("Mapper.java"); - writeMapper(classContentBean); - } - - //写mapper.xml - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_XML.getTempFileName())){ - classContentBean.setChildPackageName("mapper"); - classContentBean.setClassSuffix("Mapper.xml"); - writeMapperXml(classContentBean); - } - - //写domain.gataway.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("gatawayimpl"); - classContentBean.setClassPackageName(writeContentBean.getClassPackageName()+".gatawayimpl"); - - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.gatawayimpl"); - writeClassFileV2(classContentBean); - } - } - - //写domain.repository.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("repositoryimpl"); - classContentBean.setClassPackageName(writeContentBean.getClassPackageName()+".repositoryimpl"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.repositoryimpl"); - writeClassFileV2(classContentBean); - } - } - - - //写infrast.acl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl"); - }else { - classContentBean.setChildPackageName("infrast.adapter"); - } - writeRoute(classContentBean); - } - //写infrast.acl.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_IMPL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl.impl"); - }else { - classContentBean.setChildPackageName("infrast.adapter.impl"); - } - writeRoute(classContentBean); - } - - //写acl.param - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_PARAM.getTempFileName())){ - writeClassFileV2(classContentBean); - } - //写acl.param.convert - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO2DTO_CONVERT.getTempFileName())){ - writeRoute(classContentBean); - } - - //写convert - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONVERT.getTempFileName())){ - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.dataconvert"); - writeClassFileV2(classContentBean); - } - - - //写serviceimpl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.service.impl"); - classContentBean.setClassSuffix("ServiceImpl.java"); - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("serviceimpl") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"ServiceImpl"); - writeClassFile(classContentBean); - } - - //写infras.mq.consumer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_CONSUMER.getTempFileName())){ - classContentBean.setChildPackageName("mq.consumer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.consumer"); - - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.handler - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_HANDLER.getTempFileName())){ - classContentBean.setChildPackageName("mq.handler"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.handler"); - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.producer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_PRODUCER.getTempFileName())){ - classContentBean.setChildPackageName("mq.producer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.producer"); - writeClassFileV2(classContentBean); - } - } - - - //写infrast.dao.mapper - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_DDD.getTempFileName())){ - classContentBean.setChildPackageName("infrast.dao.mapper"); - writeRoute(classContentBean); - } - //写mapper.xml - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_XML_DDD.getTempFileName())){ - classContentBean.setChildPackageName("mapper"); - classContentBean.setClassSuffix(".xml"); - writeMapperXml(classContentBean); - } - - //写infrast.cache - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CACHE.getTempFileName())){ - classContentBean.setChildPackageName("infrast.cache"); - writeRoute(classContentBean); - } - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - } - - /** - * 写DO文件 - * @param classContentBean - */ - public void writeDO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写Mapper文件 - * @param classContentBean - */ - public void writeMapper(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写Mapper.xml文件 - * @param classContentBean - */ - public void writeMapperXml(ClassContentBean classContentBean) { - String filePath = getMapperFilePath(classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/") + "/infrast/dao"; - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateColaConfig.getModuleInfrastPath() + packagePath + "/" + fileName; - } - - - /** - * - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getMapperFilePath(String humpClassName, String classSuffix) { - String fileName = humpClassName + classSuffix; - return projectTemplateColaConfig.getModuleInfrastPath() + Constant.MAPPER + "/" + fileName; - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboCoreWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboCoreWriteServiceImpl.java deleted file mode 100644 index 31a2f774f036436044255a7f02acc192b17dc498..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboCoreWriteServiceImpl.java +++ /dev/null @@ -1,328 +0,0 @@ -package com.coderman.codemaker.app.dubbo; - -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateDubboConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.utils.Constant; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.IOException; - -/** - * Description: - * date: 2021/6/21 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "dubboCoreWriteFileService") -public class DubboCoreWriteServiceImpl extends WriteService implements IWriteFileService { - - @Autowired - private ProjectTemplateDubboConfig projectTemplateDubboConfig; - - - @Autowired - private AppServiceConfig appServiceConfig; - - @Autowired - private CommonWriteService commonWriteService; - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateDubboConfig.getModuleCorePath()); - - //写FacadeImpl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACADE_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("facade.impl"); - classContentBean.setClassSuffix("FacadeImpl.java"); - writeRoute(classContentBean); - } - - //写model.bo - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("model.bo"); - classContentBean.setClassSuffix("BO.java"); - writeClassFile(classContentBean); - } - //写domain.bo-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName())){ - classContentBean.setChildPackageName("domain.bo"); - writeRoute(classContentBean); - } - - //写convert - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONVERT.getTempFileName())){ - writeClassFileV2(classContentBean); - } - - //写service - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE.getTempFileName())){ - classContentBean.setChildPackageName("service"); - classContentBean.setClassSuffix("Service.java"); - writeClassFile(classContentBean); - } - - - //写serviceimpl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("service.impl"); - classContentBean.setClassSuffix("ServiceImpl.java"); - writeClassFile(classContentBean); - } - - //写test - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.TEST.getTempFileName())){ - classContentBean.setChildPackageName("test"); - classContentBean.setClassSuffix("FacadeTest.java"); - writeClassTestFile(classContentBean); - } - - //写Application类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APPLICATION.getTempFileName())){ - classContentBean.setChildPackageName(""); - writeClassFile(classContentBean); - } - - //写Aop类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACADE_AOP.getTempFileName())){ - classContentBean.setChildPackageName("aop"); - writeClassFile(classContentBean); - } - - //写springapplication - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName())){ - classContentBean.setChildPackageName("utils"); - writeClassFile(classContentBean); - } - - - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName())){ - classContentBean.setChildPackageName("utils"); - writeClassFile(classContentBean); - } - - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("domain.enums"); - writeRoute(classContentBean); - } - - //写domain.valueobject - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VALUE_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("domain.valueobject"); - writeRoute(classContentBean); - } - //写domain.msgbody - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MESSAGE_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.msgbody"); - writeRoute(classContentBean); - } - - //写domain.event - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EVENT_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.event"); - writeRoute(classContentBean); - } - - //写domain.gataway - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY.getTempFileName())){ - classContentBean.setChildPackageName("domain.gataway"); - writeRoute(classContentBean); - } - //写domain.repository - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.repository"); - writeRoute(classContentBean); - } - - //写domain.gataway.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("gataway.impl"); - writeRoute(classContentBean); - } - - - //写domain.repository.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("repositoryimpl"); - classContentBean.setClassPackageName(writeContentBean.getClassPackageName()+".repositoryimpl"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.repositoryimpl"); - writeClassFileV2(classContentBean); - } - } - - - - //写infrast.acl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl"); - }else { - classContentBean.setChildPackageName("infrast.adapter"); - } - writeRoute(classContentBean); - } - //写infrast.acl.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_IMPL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl.impl"); - }else { - classContentBean.setChildPackageName("infrast.adapter.impl"); - } - writeRoute(classContentBean); - } - - //写acl.param - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_PARAM.getTempFileName())){ - writeClassFileV2(classContentBean); - } - - //写app.cmd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CMD.getTempFileName())){ - classContentBean.setChildPackageName("app.command"); - writeRoute(classContentBean); - } - //写app.exe - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EXE.getTempFileName())){ - classContentBean.setChildPackageName("app.executor"); - classContentBean.setModulePath(projectTemplateDubboConfig.getModuleCorePath()); - writeRoute(classContentBean); - } - - //写domain.factory - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACTORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.factory"); - writeRoute(classContentBean); - } - //写app.listener - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_LISTENER.getTempFileName())){ - classContentBean.setChildPackageName("app.listener"); - - } - - //写infrast.cache - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CACHE.getTempFileName())){ - classContentBean.setChildPackageName("infrast.cache"); - writeRoute(classContentBean); - } - - //写infras.mq.consumer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_CONSUMER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.consumer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.consumer"); - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.handler - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_HANDLER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.handler"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.handler"); - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.producer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_PRODUCER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.producer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.producer"); - writeClassFileV2(classContentBean); - } - } - - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - } - - /** - * 写class文件 - * @param classContentBean - */ - public void writeClassFile(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateDubboConfig.getModuleCorePath() + packagePath + "/" + fileName; - } - - /** - * 写测试文件 - * @param childPackageName - * @param humpClassName - * @param classSuffix - * @return - */ - public String getTestFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - packagePath = Constant.TEST_JAVA + "/" + packagePath + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateDubboConfig.getModuleCorePath() + packagePath + "/" + fileName; - } - - /** - * 写class文件 - * @param classContentBean - */ - public void writeClassTestFile(ClassContentBean classContentBean) { - String filePath = getTestFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springboot/SpringBootWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springboot/SpringBootWriteServiceImpl.java deleted file mode 100644 index 0f89daae0a59c92a366eaab94fd156697d438088..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springboot/SpringBootWriteServiceImpl.java +++ /dev/null @@ -1,769 +0,0 @@ -package com.coderman.codemaker.app.springboot; - -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.*; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateSpringbootConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.dberpicture.DBErPictureService; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.utils.Constant; -import com.coderman.codemaker.utils.FreemarkerUtils; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Description: - * date: 2021/6/22 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "springBootWriteService") -public class SpringBootWriteServiceImpl extends WriteService implements IWriteFileService { - - @Autowired - private ProjectTemplateSpringbootConfig projectTemplateConfig; - - - @Autowired - private AppServiceConfig appServiceConfig; - @Autowired - private DBErPictureService erPictureService; - - - @Autowired - private CommonWriteService commonWriteService; - - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateConfig.getOutPath()); - //写api.dto-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO_DDD.getTempFileName())){ - classContentBean.setChildPackageName("api.dto"); - classContentBean.setClassSuffix("DTO.java"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - //写api.dto - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO.getTempFileName())){ - classContentBean.setChildPackageName("dto"); - classContentBean.setClassSuffix("DTO.java"); - writeDTO(classContentBean); - } - - - //写entity class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENTITY.getTempFileName())){ - classContentBean.setChildPackageName("entity"); - classContentBean.setClassSuffix("Entity.java"); - writeClassFile(classContentBean); - } - - //写do class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DATA_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("infrast.dao.dataobject"); - classContentBean.setClassSuffix("DO.java"); - // writeDO(classContentBean); - writeClassFile(classContentBean); - } - //写mapper class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER.getTempFileName())){ - classContentBean.setChildPackageName("dao.mapper"); - classContentBean.setClassSuffix("Mapper.java"); - writeClassFile(classContentBean); - } - - //写mapper.xml - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_XML.getTempFileName())){ - writeMapperXml(writeContentBean.getContent(), writeContentBean.getHumpClassName()); - } - - //写vo - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VO.getTempFileName())){ - classContentBean.setChildPackageName("vo"); - classContentBean.setClassSuffix("VO.java"); - writeClassFile(classContentBean); - } - - //写vo-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VO_DDD.getTempFileName())){ - classContentBean.setChildPackageName("adapter.vo"); - classContentBean.setClassSuffix("VO.java"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - - //写service - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE.getTempFileName())){ - classContentBean.setChildPackageName("service"); - classContentBean.setClassSuffix("Service.java"); - writeClassFile(classContentBean); - } - - //写serviceImpl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("service.impl"); - classContentBean.setClassSuffix("ServiceImpl.java"); - writeClassFile(classContentBean); - } - - //写controller - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONTROLLER.getTempFileName())){ - classContentBean.setChildPackageName("controller"); - classContentBean.setClassSuffix("Controller.java"); - writeClassFile(classContentBean); - } - - //写controller-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONTROLLER_DDD.getTempFileName())){ - classContentBean.setChildPackageName("adapter.controller"); - classContentBean.setClassSuffix("Controller.java"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写test - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.TEST.getTempFileName())){ - writeTest(writeContentBean.getContent(), writeContentBean.getHumpClassName()); - } - - /* //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName())){ - commonWriteService.writeSpringApplicationContext(writeContentBean.getContent(),projectTemplateConfig.getOutPath()); - }*/ - - /* //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BASE_CONTROLLER.getTempFileName())){ - writeBaseController(writeContentBean.getContent()); - } - - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APPLICATION.getTempFileName())){ - writeApplication(writeContentBean.getContent()); - } - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName())){ - commonWriteService.writeAppEventPublisher(writeContentBean.getContent(),projectTemplateConfig.getOutPath()); - } - - //写BaseEvent - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName())){ - commonWriteService.writeBaseEvent(writeContentBean.getContent(),projectTemplateConfig.getOutPath()); - } -*/ - - //写model.bo - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("bo"); - classContentBean.setClassSuffix("BO.java"); - writeClassFile(classContentBean); - } - //写domain.bo-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName())){ - classContentBean.setChildPackageName("domain.bo"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写convert - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONVERT.getTempFileName())){ - writeClassFileV2(classContentBean); - } - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("domain.enums"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.valueobject - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VALUE_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("domain.valueobject"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.event - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EVENT_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.event"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - - } - - - //写domain.msgbody - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MESSAGE_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.msgbody"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - - } - - //写domain.gataway - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY.getTempFileName())){ - classContentBean.setChildPackageName("domain.gataway"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.repository - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.repository"); - writeRoute(classContentBean); - } - - //写domain.gataway.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("gataway.impl"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - - //写domain.repository.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("repositoryimpl"); - classContentBean.setClassPackageName(writeContentBean.getClassPackageName()+".repositoryimpl"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.repositoryimpl"); - writeClassFileV2(classContentBean); - } - } - - - //写infrast.acl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl"); - }else { - classContentBean.setChildPackageName("infrast.adapter"); - } - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - //写infrast.acl.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_IMPL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl.impl"); - }else { - classContentBean.setChildPackageName("infrast.adapter.impl"); - } - - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写acl.param - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_PARAM.getTempFileName())){ - writeClassFileV2(classContentBean); - } - - //写app.cmd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CMD.getTempFileName())){ - classContentBean.setChildPackageName("app.command"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - //写app.exe - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EXE.getTempFileName())){ - classContentBean.setChildPackageName("app.executor"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.factory - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACTORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.factory"); - - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - - //写app.listener - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_LISTENER.getTempFileName())){ - classContentBean.setChildPackageName("app.listener"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写infrast.cache - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CACHE.getTempFileName())){ - classContentBean.setChildPackageName("infrast.cache"); - writeRoute(classContentBean); - } - - - //写infras.mq.consumer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_CONSUMER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.consumer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.consumer"); - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.handler - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_HANDLER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.handler"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.handler"); - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.producer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_PRODUCER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.producer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.producer"); - writeClassFileV2(classContentBean); - } - } - - //写infrast.dao.mapper - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_DDD.getTempFileName())){ - classContentBean.setChildPackageName("infrast.dao.mapper"); - writeRoute(classContentBean); - } - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - } - - /** - * 写mapper xml文件 - * - * @param content - * @param humpClassName - */ - public void writeMapperXml(String content, String humpClassName) { - String fileName = humpClassName + "Mapper.xml"; - String filePath = projectTemplateConfig.getOutPath() + Constant.MAPPER + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写entity文件 - * - * @param content - * @param humpClassName - */ - public void writeEntity(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/entity"; - String fileName = humpClassName + "Entity.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写entity文件 - * - * @param content - * @param humpClassName - */ - public void writeVO(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/vo"; - String fileName = humpClassName + "VO.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写mapper class文件 - * - * @param content - * @param humpClassName - */ - public void writeMapper(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/mapper"; - String fileName = humpClassName + "Mapper.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写service文件 - * - * @param content - * @param humpClassName - */ - public void writeService(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/service"; - String fileName = humpClassName + "Service.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写serviceImpl文件 - * - * @param content - * @param humpClassName - */ - public void writeServiceImpl(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/service/impl"; - String fileName = humpClassName + "ServiceImpl.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写BaseController文件 - * - * @param content - */ - public void writeBaseController(String content) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/controller"; - String fileName = "BaseController.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写测试文件 - * - * @param content - */ - public void writeTest(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.TEST_JAVA + "/" + packagePath + "/service/test"; - String fileName = humpClassName + "ServiceTest.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写应用启动类 - * - * @param content - */ - public void writeApplication(String content) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + ""; - String fileName = "Application.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写controller文件 - * - * @param content - * @param humpClassName - */ - public void writeController(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/controller"; - String fileName = humpClassName + "Controller.java"; - filePath = projectTemplateConfig.getOutPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 一次性生成单表需要的所有模块代码 - * - * @param humpClassName - * @param varMap - */ - public void writeAll(String humpClassName, Map varMap, String fast) { - String entityContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.ENTITY.getTempFileName(), varMap); - this.writeEntity(entityContent, humpClassName); - - String serviceContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.SERVICE.getTempFileName(), varMap); - this.writeService(serviceContent, humpClassName); - - String serviceImplContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.SERVICE_IMPL.getTempFileName(), varMap); - this.writeServiceImpl(serviceImplContent, humpClassName); - - String mapperXmlContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.MAPPER_XML.getTempFileName(), varMap); - this.writeMapperXml(mapperXmlContent, humpClassName); - - String mapperContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.MAPPER.getTempFileName(), varMap); - this.writeMapper(mapperContent, humpClassName); - - String controllerContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.CONTROLLER.getTempFileName(), varMap); - this.writeController(controllerContent, humpClassName); - - String voContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.VO.getTempFileName(), varMap); - this.writeVO(voContent, humpClassName); - - String testContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.TEST.getTempFileName(), varMap); - this.writeTest(testContent, humpClassName); - - - } - - /** - * 写公共基础服务类 - * - * @param varMap - */ - public void writeCommon(Map varMap, String fast) { - String baseControllerContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), varMap); - this.writeBaseController(baseControllerContent); - - String SpringApplicationContextContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName(), varMap); - commonWriteService.writeSpringApplicationContext(SpringApplicationContextContent,projectTemplateConfig.getOutPath()); - - String application = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.APPLICATION.getTempFileName(), varMap); - this.writeApplication(application); - - } - - /** - * 整合e-r图生成工具 - * - * @param tableBeanMap - * @param columnBeanListMap - */ - public void writeERPicture(Map tableBeanMap, Map> columnBeanListMap) { - String filePath = projectTemplateConfig.getOutPath() + Constant.ER_PICTURE + "/" + projectTemplateConfig.getDbName() + ".puml"; - List tableBeanList = new ArrayList<>(); - tableBeanMap.forEach((k, v) -> { - com.coderman.codemaker.dbergenerate.bean.TableBean tableBean = new com.coderman.codemaker.dbergenerate.bean.TableBean(); - tableBean.setTableComment(v.getTableComment()); - tableBean.setTableName(v.getTableName()); - List columnBeanList = columnBeanListMap.get(k); - List columnBeanList1 = new ArrayList<>(); - columnBeanList.forEach(columnBean -> { - com.coderman.codemaker.dbergenerate.bean.ColumnBean columnBean1 = new com.coderman.codemaker.dbergenerate.bean.ColumnBean(); - columnBean1.setColumnComment(columnBean.getColumnComment()); - columnBean1.setColumnKey(columnBean.getColumnKey()); - columnBean1.setColumnName(columnBean.getColumnName()); - columnBean1.setTableName(columnBean.getTableName()); - columnBean1.setColumnType(columnBean.getColumnType()); - columnBean1.setDataType(columnBean.getDataType()); - columnBeanList1.add(columnBean1); - }); - tableBean.setColumnBeanList(columnBeanList1); - tableBeanList.add(tableBean); - }); - erPictureService.getErPicture(filePath, tableBeanList); - } - - - /** - * 写class文件 - * @param classContentBean - */ - public void writeClassFile(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/") ; - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateConfig.getOutPath() + packagePath + "/" + fileName; - } - - /** - * 写DO文件 - * @param classContentBean - */ - public void writeDO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写dto文件 - * @param classContentBean - */ - public void writeDTO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignApiDocWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignApiDocWriteServiceImpl.java deleted file mode 100644 index babb26fc5627b6f14612d30d89c746cf5d68a908..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignApiDocWriteServiceImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.coderman.codemaker.app.springcloud; - -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.WriteContentBean; -import org.springframework.stereotype.Component; - -/** - * Description: - * date: 2021/11/29 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "sCFeignApiDocWriteService") -public class SCFeignApiDocWriteServiceImpl extends WriteService implements IWriteFileService { - - @Override - public void writeContent(WriteContentBean writeContentBean) { - writeApiDoc(writeContentBean.getContent(),writeContentBean.getHumpClassName()); - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignApiWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignApiWriteServiceImpl.java deleted file mode 100644 index 277c1801b6fed5522df3b583ea8c97c272a9b3f1..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignApiWriteServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.coderman.codemaker.app.springcloud; - -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateSpringCloudConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.dberpicture.DBErPictureService; -import com.coderman.codemaker.utils.Constant; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.IOException; - -/** - * Description: - * date: 2021/11/29 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ - -@Component(value = "sCFeignApiWriteService") -public class SCFeignApiWriteServiceImpl extends WriteService implements IWriteFileService { - @Autowired - private ProjectTemplateSpringCloudConfig projectTemplateSpringCloudConfig; - - - @Autowired - private AppServiceConfig appServiceConfig; - - @Autowired - private DBErPictureService erPictureService; - - - @Autowired - private CommonWriteService commonWriteService; - - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateSpringCloudConfig.getModuleFeginApiPath()); - //写api.dto-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO_DDD.getTempFileName())){ - classContentBean.setChildPackageName("api.dto"); - classContentBean.setClassSuffix("DTO.java"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - //写api.dto - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO.getTempFileName())){ - classContentBean.setChildPackageName("dto"); - classContentBean.setClassSuffix("DTO.java"); - writeDTO(classContentBean); - } - - - //写feign - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FEIGN.getTempFileName())){ - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("feign") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"Feign"); - classContentBean.setChildPackageName("api.feign"); - classContentBean.setClassSuffix("Feign.java"); - writeRoute(classContentBean); - } - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("domain.enums"); - writeRoute(classContentBean); - } - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - - } - - /** - * 写dto文件 - * @param classContentBean - */ - public void writeDTO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/") ; - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateSpringCloudConfig.getModuleFeginApiPath() + packagePath + "/" + fileName; - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignProviderWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignProviderWriteServiceImpl.java deleted file mode 100644 index c813d265f4c21546d989b7d233ab9378bcce3b37..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springcloud/SCFeignProviderWriteServiceImpl.java +++ /dev/null @@ -1,751 +0,0 @@ -package com.coderman.codemaker.app.springcloud; - -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.*; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateSpringCloudConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.dberpicture.DBErPictureService; -import com.coderman.codemaker.utils.Constant; -import com.coderman.codemaker.utils.FreemarkerUtils; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Description: - * date: 2021/11/29 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Component(value = "sCFeignProviderWriteService") -public class SCFeignProviderWriteServiceImpl extends WriteService implements IWriteFileService { - @Autowired - private ProjectTemplateSpringCloudConfig projectTemplateSpringCloudConfig; - - - @Autowired - private AppServiceConfig appServiceConfig; - - @Autowired - private DBErPictureService erPictureService; - - - @Autowired - private CommonWriteService commonWriteService; - - - @Override - public void writeContent(WriteContentBean writeContentBean) { - - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateSpringCloudConfig.getModuleFeginProviderPath()); - - //写entity class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENTITY.getTempFileName())){ - classContentBean.setChildPackageName("entity"); - classContentBean.setClassSuffix("Entity.java"); - writeClassFile(classContentBean); - } - - //写do class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DATA_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("infrast.dao.dataobject"); - classContentBean.setClassSuffix("DO.java"); - // writeDO(classContentBean); - writeClassFile(classContentBean); - } - //写mapper class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER.getTempFileName())){ - classContentBean.setChildPackageName("dao.mapper"); - classContentBean.setClassSuffix("Mapper.java"); - writeClassFile(classContentBean); - } - - //写mapper.xml - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_XML.getTempFileName())){ - writeMapperXml(writeContentBean.getContent(), writeContentBean.getHumpClassName()); - } - - //写vo - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VO.getTempFileName())){ - classContentBean.setChildPackageName("vo"); - classContentBean.setClassSuffix("VO.java"); - writeClassFile(classContentBean); - } - - //写vo-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VO_DDD.getTempFileName())){ - classContentBean.setChildPackageName("adapter.vo"); - classContentBean.setClassSuffix("VO.java"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - - //写service - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE.getTempFileName())){ - classContentBean.setChildPackageName("service"); - classContentBean.setClassSuffix("Service.java"); - writeClassFile(classContentBean); - } - - //写serviceImpl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SERVICE_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("service.impl"); - classContentBean.setClassSuffix("ServiceImpl.java"); - writeClassFile(classContentBean); - } - - //写controller - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONTROLLER.getTempFileName())){ - classContentBean.setChildPackageName("controller"); - classContentBean.setClassSuffix("Controller.java"); - writeClassFile(classContentBean); - } - - //写controller-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONTROLLER_DDD.getTempFileName())){ - classContentBean.setChildPackageName("adapter.controller"); - classContentBean.setClassSuffix("Controller.java"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写test - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.TEST.getTempFileName())){ - writeTest(writeContentBean.getContent(), writeContentBean.getHumpClassName()); - } - - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName())){ - commonWriteService.writeSpringApplicationContext(writeContentBean.getContent(),projectTemplateSpringCloudConfig.getModuleFeginProviderPath()); - } - - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BASE_CONTROLLER.getTempFileName())){ - writeBaseController(writeContentBean.getContent()); - } - - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APPLICATION.getTempFileName())){ - writeApplication(writeContentBean.getContent()); - } - //指定服务类 or 工具类 - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName())){ - commonWriteService.writeAppEventPublisher(writeContentBean.getContent(),projectTemplateSpringCloudConfig.getModuleFeginProviderPath()); - } - - //写BaseEvent - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.APP_EVENT_PUBLISHER.getTempFileName())){ - commonWriteService.writeBaseEvent(writeContentBean.getContent(),projectTemplateSpringCloudConfig.getModuleFeginProviderPath()); - } - - - //写model.bo - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("bo"); - classContentBean.setClassSuffix("BO.java"); - writeClassFile(classContentBean); - } - //写domain.bo-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName())){ - classContentBean.setChildPackageName("domain.bo"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写convert - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CONVERT.getTempFileName())){ - writeClassFileV2(classContentBean); - } - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("domain.enums"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.valueobject - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.VALUE_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("domain.valueobject"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.event - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EVENT_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.event"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - - } - - - //写domain.msgbody - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MESSAGE_BODY.getTempFileName())){ - classContentBean.setChildPackageName("domain.msgbody"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - - } - - //写domain.gataway - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY.getTempFileName())){ - classContentBean.setChildPackageName("domain.gataway"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.repository - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.repository"); - writeRoute(classContentBean); - } - - //写domain.gataway.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.GATAWAY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("gataway.impl"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - - //写domain.repository.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.REPOSITORY_IMPL.getTempFileName())){ - classContentBean.setChildPackageName("repositoryimpl"); - classContentBean.setClassPackageName(writeContentBean.getClassPackageName()+".repositoryimpl"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.repositoryimpl"); - writeClassFileV2(classContentBean); - } - } - - - //写infrast.acl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl"); - }else { - classContentBean.setChildPackageName("infrast.adapter"); - } - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - //写infrast.acl.impl - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_IMPL.getTempFileName())){ - if(writeContentBean.getHumpClassName().toLowerCase().contains(TemplateFileEnum.ACL.getTempFileName())){ - classContentBean.setChildPackageName("infrast.acl.impl"); - }else { - classContentBean.setChildPackageName("infrast.adapter.impl"); - } - - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写acl.param - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ACL_PARAM.getTempFileName())){ - writeClassFileV2(classContentBean); - } - - //写app.cmd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CMD.getTempFileName())){ - classContentBean.setChildPackageName("app.command"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - //写app.exe - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.EXE.getTempFileName())){ - classContentBean.setChildPackageName("app.executor"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写domain.factory - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACTORY.getTempFileName())){ - classContentBean.setChildPackageName("domain.factory"); - - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - - //写app.listener - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_LISTENER.getTempFileName())){ - classContentBean.setChildPackageName("app.listener"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写infrast.cache - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.CACHE.getTempFileName())){ - classContentBean.setChildPackageName("infrast.cache"); - writeRoute(classContentBean); - } - - - //写infras.mq.consumer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_CONSUMER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.consumer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.consumer"); - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.handler - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_HANDLER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.handler"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.handler"); - //走文档里的package包生成方式 - writeClassFileV2(classContentBean); - } - } - - //写infras.mq.producer - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MQ_PRODUCER.getTempFileName())){ - classContentBean.setChildPackageName("infrast.mq.producer"); - //走默认的包生成方式 - if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ - writeClassFile(classContentBean); - }else { - //走文档里的package包生成方式 - classContentBean.setClassPackageName(appServiceConfig.getPackage()+".infrast.mq.producer"); - writeClassFileV2(classContentBean); - } - } - - //写infrast.dao.mapper - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_DDD.getTempFileName())){ - classContentBean.setChildPackageName("infrast.dao.mapper"); - writeRoute(classContentBean); - } - - //写自定义工具类 - if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ - writeRoute(classContentBean); - } - } - - /** - * 写mapper xml文件 - * - * @param content - * @param humpClassName - */ - public void writeMapperXml(String content, String humpClassName) { - String fileName = humpClassName + "Mapper.xml"; - String filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + Constant.MAPPER + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写entity文件 - * - * @param content - * @param humpClassName - */ - public void writeEntity(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/entity"; - String fileName = humpClassName + "Entity.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写entity文件 - * - * @param content - * @param humpClassName - */ - public void writeVO(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/vo"; - String fileName = humpClassName + "VO.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写mapper class文件 - * - * @param content - * @param humpClassName - */ - public void writeMapper(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/mapper"; - String fileName = humpClassName + "Mapper.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写service文件 - * - * @param content - * @param humpClassName - */ - public void writeService(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/service"; - String fileName = humpClassName + "Service.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写serviceImpl文件 - * - * @param content - * @param humpClassName - */ - public void writeServiceImpl(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/service/impl"; - String fileName = humpClassName + "ServiceImpl.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写BaseController文件 - * - * @param content - */ - public void writeBaseController(String content) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/controller"; - String fileName = "BaseController.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写测试文件 - * - * @param content - */ - public void writeTest(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.TEST_JAVA + "/" + packagePath + "/service/test"; - String fileName = humpClassName + "ServiceTest.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写应用启动类 - * - * @param content - */ - public void writeApplication(String content) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + ""; - String fileName = "Application.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - /** - * 写controller文件 - * - * @param content - * @param humpClassName - */ - public void writeController(String content, String humpClassName) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/"); - String filePath = Constant.JAVA + "/" + packagePath + "/controller"; - String fileName = humpClassName + "Controller.java"; - filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; - try { - FileUtils.write(new File(filePath), content, "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 一次性生成单表需要的所有模块代码 - * - * @param humpClassName - * @param varMap - */ - public void writeAll(String humpClassName, Map varMap, String fast) { - String entityContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.ENTITY.getTempFileName(), varMap); - this.writeEntity(entityContent, humpClassName); - - String serviceContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.SERVICE.getTempFileName(), varMap); - this.writeService(serviceContent, humpClassName); - - String serviceImplContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.SERVICE_IMPL.getTempFileName(), varMap); - this.writeServiceImpl(serviceImplContent, humpClassName); - - String mapperXmlContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.MAPPER_XML.getTempFileName(), varMap); - this.writeMapperXml(mapperXmlContent, humpClassName); - - String mapperContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.MAPPER.getTempFileName(), varMap); - this.writeMapper(mapperContent, humpClassName); - - String controllerContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.CONTROLLER.getTempFileName(), varMap); - this.writeController(controllerContent, humpClassName); - - String voContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.VO.getTempFileName(), varMap); - this.writeVO(voContent, humpClassName); - - String testContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.TEST.getTempFileName(), varMap); - this.writeTest(testContent, humpClassName); - - - } - - /** - * 写公共基础服务类 - * - * @param varMap - */ - public void writeCommon(Map varMap, String fast) { - String baseControllerContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), varMap); - this.writeBaseController(baseControllerContent); - - String SpringApplicationContextContent = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName(), varMap); - commonWriteService.writeSpringApplicationContext(SpringApplicationContextContent,projectTemplateSpringCloudConfig.getModuleFeginProviderPath()); - - String application = FreemarkerUtils.parseTpl(fast+ TemplateFileEnum.APPLICATION.getTempFileName(), varMap); - this.writeApplication(application); - - } - - /** - * 整合e-r图生成工具 - * - * @param tableBeanMap - * @param columnBeanListMap - */ - public void writeERPicture(Map tableBeanMap, Map> columnBeanListMap) { - String filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + Constant.ER_PICTURE + "/" + projectTemplateSpringCloudConfig.getDbName() + ".puml"; - List tableBeanList = new ArrayList<>(); - tableBeanMap.forEach((k, v) -> { - com.coderman.codemaker.dbergenerate.bean.TableBean tableBean = new com.coderman.codemaker.dbergenerate.bean.TableBean(); - tableBean.setTableComment(v.getTableComment()); - tableBean.setTableName(v.getTableName()); - List columnBeanList = columnBeanListMap.get(k); - List columnBeanList1 = new ArrayList<>(); - columnBeanList.forEach(columnBean -> { - com.coderman.codemaker.dbergenerate.bean.ColumnBean columnBean1 = new com.coderman.codemaker.dbergenerate.bean.ColumnBean(); - columnBean1.setColumnComment(columnBean.getColumnComment()); - columnBean1.setColumnKey(columnBean.getColumnKey()); - columnBean1.setColumnName(columnBean.getColumnName()); - columnBean1.setTableName(columnBean.getTableName()); - columnBean1.setColumnType(columnBean.getColumnType()); - columnBean1.setDataType(columnBean.getDataType()); - columnBeanList1.add(columnBean1); - }); - tableBean.setColumnBeanList(columnBeanList1); - tableBeanList.add(tableBean); - }); - erPictureService.getErPicture(filePath, tableBeanList); - } - - - /** - * 写class文件 - * @param classContentBean - */ - public void writeClassFile(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return - */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { - String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/") ; - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + packagePath + "/" + fileName; - } - - /** - * 写DO文件 - * @param classContentBean - */ - public void writeDO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * 写dto文件 - * @param classContentBean - */ - public void writeDTO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); - try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/package-info.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/package-info.java deleted file mode 100644 index a0d5ed7d6cc3d17640ad802f4f6f1f46543d6f84..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package com.coderman.codemaker; \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteDynamicCodeService.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteDynamicCodeService.java deleted file mode 100644 index 459cd5858925a853e6482de40e9022b47fac0940..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteDynamicCodeService.java +++ /dev/null @@ -1,711 +0,0 @@ -package com.coderman.codemaker.service; - -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.EnumBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.config.AppServiceConfig; - -import com.coderman.codemaker.enums.ModuleEnum; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.template.FreemarkerService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Description: - * 新版本的应用模块代码写服务,屏蔽底层写文件的细节,通过app和module隔离api和底层实现 - * 做到一套api支持多种应用框架风格的代码生成。 - * date: 2021/6/22 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ - -@Component -public class WriteDynamicCodeService { - - @Autowired - private AppServiceConfig appServiceConfig; - - @Autowired - private FreemarkerService freemarkerService; - - @Autowired - private WriteDynamicDDDService writeDynamicDDDModuleService; - - @Autowired - private WriteCodeService writeCodeService; - - - @Autowired - private WriteApiDocService writeApiDocService; - - - - /** - * 写BO文件 - * @param classBeanList - */ - public void writeBO(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.BUSINESS_OBJECT.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeBO(classBeanList,writeFileService,null); - } - - /** - * 写msgbody文件 - * @param classBeanList - */ - public void writeMsgBody(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MESSAGE_BODY.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeMsgBody(classBeanList,writeFileService,null); - } - - /** - * 写event文件 - * @param classBeanList - */ - public void writeDomainEvent(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.EVENT_BODY.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDomainEvent(classBeanList,writeFileService,null); - } - - /** - * 写domaingataway文件 - * @param classBeanList - */ - public void writeDomainGataway(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.GATAWAY.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeGataWay(classBeanList,writeFileService,null); - } - - /** - * 写domainrepository文件 - * @param classBeanList - */ - public void writeDomainRepository(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.GATAWAY.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeRepository(classBeanList,writeFileService,null); - } - - - /** - * 写dynamicMapper文件 - * @param classBeanList - */ - public void writeDynamicMapper(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MAPPER_DDD.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDynamicMapper(classBeanList,writeFileService,null); - } - - /** - * 写dynamicMapperxml文件 - * @param classBeanList - */ - public void writeDynamicMapperXml(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MAPPER_XML_DDD.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDynamicMapperXml(classBeanList,writeFileService,null); - } - - /** - * 写domaingatawayimpl文件 - * @param gatawayImplBeanList - */ - public void writeGatawayImpl(List gatawayImplBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.GATAWAY_IMPL.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeGatawayImpl(gatawayImplBeanList,writeFileService,null); - } - - /** - * 写domainrepositoryimpl文件 - * @param repositoryImplBeanList - */ - public void writeRepositoryImpl(List repositoryImplBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.REPOSITORY_IMPL.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeRepositoryImpl(repositoryImplBeanList,writeFileService,null); - } - - /** - * 写command文件 - * @param classBeanList - */ - public void writeCommand(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.CMD.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeAppCommand(classBeanList,writeFileService,null); - } - - /** - * 写factory文件 - * @param classBeanList - */ - public void writeFactory(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.FACTORY.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeFactory(classBeanList,writeFileService,null); - } - - - /** - * 写cache文件 - * @param classBeanList - */ - public void writeCache(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.CACHE.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeCache(classBeanList,writeFileService,null); - } - - /** - * 写applistener文件 - * @param classBeanList - */ - public void writeAppListener(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MQ_LISTENER.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeAppListner(classBeanList,writeFileService,null); - } - - /** - * 写mqproducer文件 - * @param classBeanList - */ - public void writeMqProducer(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MQ_PRODUCER.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeMqProducer(classBeanList,writeFileService,null); - } - - /** - * 写mqconsumer文件 - * @param classBeanList - */ - public void writeMqConsumer(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MQ_CONSUMER.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeMqConsumer(classBeanList,writeFileService,null); - } - - /** - * 写mqhandler文件 - * @param classBeanList - */ - public void writeMqHandler(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MQ_HANDLER.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeMqHandler(classBeanList,writeFileService,null); - } - - /** - * 写AppExeImpl文件 - * @param classBeanList - */ - public void writeAppExeImpl(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.CMD.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeAppExeImpl(classBeanList,writeFileService,null); - } - - /** - * 写AppExeInterface文件 - * @param interfaceBeanList - */ - public void writeAppExeInterface(List interfaceBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.EXE.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeAppExeInterface(interfaceBeanList,writeFileService,null); - } - - - /** - * 写dtoboconvert文件 - * @param dtoboConvertBeanList - */ - public void writeDTOBOConvert(List dtoboConvertBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.DTOBO_CONVERT.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDtoBOConvert(dtoboConvertBeanList,writeFileService); - } - - /** - * 写voboconvert文件 - * @param dtoboConvertBeanList - */ - public void writeVOBOConvert(List dtoboConvertBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.VOBO_CONVERT.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeVoBOConvert(dtoboConvertBeanList,writeFileService); - } - - /** - * 写doboconvert文件 - * @param doboConvertBeanList - */ - public void writeDOBOConvert(List doboConvertBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.DOBO_CONVERT.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDoBOConvert(doboConvertBeanList,writeFileService); - } - - /** - * 写dto2dtoconvert文件 - * @param doboConvertBeanList - */ - public void writeDTO2DTOConvert(List doboConvertBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.DOBO_CONVERT.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDTO2DTOConvert(doboConvertBeanList,writeFileService); - } - - - /** - * 写acl.param文件 - * @param classBeanList - */ - public void writeAclInterfaceParam(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.ACL_PARAM.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeACLParam(classBeanList,writeFileService,null); - } - - /** - * 写AppExeInterface文件 - * @param interfaceBeanList - */ - public void writeAclInterface(List interfaceBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.ACL.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeAclInterface(interfaceBeanList,writeFileService,null); - } - - - /** - * 写InfrastAclImpl文件 - * @param classBeanList - */ - public void writeAclInterfaceImpl(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.ACL_IMPL.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeAclInterfaceImpl(classBeanList,writeFileService,null); - } - - /** - * 写valueobject文件 - * @param classBeanList - */ - public void writeValueObject(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.VALUE_OBJECT.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeValueObject(classBeanList,writeFileService,null); - } - - /** - * 写enum文件 - * @param classBeanList - */ - public void writeEnum(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.ENUM.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeEnum(classBeanList,writeFileService,null); - } - - - /** - * 写apienum文件 - * @param classBeanList - */ - public void writeAPIEnum(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.API_ENUM.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeEnum(classBeanList,writeFileService,null); - } - - /** - * 写DTO文件 - * @param classBeanList - */ - public void writeDTO(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.DTO.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDTO(classBeanList,writeFileService); - } - - /** - * 写feignDTO文件 - * @param classBeanList - */ - public void writeFeignDTO(List classBeanList) { - - IWriteFileService writeFileService = appServiceConfig.getWriteServiceByModuleName(ModuleEnum.COLA_FEIGN_API.getModuleName()); - //只有springcloud cola需要写feign dto - if (writeFileService == null - || appServiceConfig.getApplicationType().equals(ModuleEnum.DUBBO_API.getAppName()) - || appServiceConfig.getApplicationType().equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { - return; - } - - - writeDynamicDDDModuleService.writeDTO(classBeanList,writeFileService); - } - - - /** - * 写VO文件 - * @param classBeanList - */ - public void writeVO(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.VO.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeVO(classBeanList,writeFileService); - } - - /** - * 写controller文件 - * @param classBeanList - */ - public void writeController(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.CONTROLLER.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeController(classBeanList,writeFileService); - } - - /** - * 写facade文件 - * @param classBeanList - */ - public void writeFacade(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.FACADE_DDD.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeFacade(classBeanList,writeFileService); - } - - /** - * 写feign文件 - * @param classBeanList - */ - public void writeFeign(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.FEIGN.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeFeign(classBeanList,writeFileService); - } - - /** - * 写facadeimpl文件 - * @param classBeanList - */ - public void writeFacadeImpl(List classBeanList) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.FACADE_IMPL_DDD.getTempFileName()); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeFacadeImpl(classBeanList,writeFileService); - } - - /** - * 写service文件 - * - * @param content - * @param humpClassName - */ - public void writeService(String content, String humpClassName) { - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.SERVICE.getTempFileName()); - if (writeFileService == null) { - return; - } - WriteContentBean writeContentBean = WriteContentBean.builder().content(content) - .templateName(TemplateFileEnum.SERVICE.getTempFileName()) - .humpClassName(humpClassName).build(); - writeFileService.writeContent(writeContentBean); - } - - /** - * 一次性生成所有表的模块代码,同时解析plantUML的类图结合起来 - * @param allMetaDataMap - */ - public void writeAllWithDDD(Map allMetaDataMap){ - List boClassBeanList = (List)allMetaDataMap.get("domainbo"); - this.writeBO(boClassBeanList); - - List valueObjectBeanList = (List)allMetaDataMap.get("domainvalueobject"); - List enumBeanList = (List)allMetaDataMap.get("valueobjectenum"); - this.writeValueObject(valueObjectBeanList); - this.writeEnum(enumBeanList); - - List apiEnumBeanList = (List)allMetaDataMap.get("apienum"); - this.writeAPIEnum(apiEnumBeanList); - - List msgClassBeanList = (List)allMetaDataMap.get("domainmsg"); - this.writeMsgBody(msgClassBeanList); - - List eventClassBeanList = (List)allMetaDataMap.get("domainevent"); - this.writeDomainEvent(eventClassBeanList); - - List gatawayBeanList = (List)allMetaDataMap.get("gataway"); - this.writeDomainGataway(gatawayBeanList); - - List repositoryBeanList = (List)allMetaDataMap.get("repository"); - this.writeDomainRepository(repositoryBeanList); - - List gatawayImplBeanList = (List)allMetaDataMap.get("gatawayimpl"); - this.writeGatawayImpl(gatawayImplBeanList); - - List repositoryImplBeanList = (List)allMetaDataMap.get("repositoryimpl"); - this.writeRepositoryImpl(repositoryImplBeanList); - - List aclBeanList = (List)allMetaDataMap.get("infrastacl"); - List aclParamBeanList = (List)allMetaDataMap.get("infrastaclparam"); - List aclImplBeanList = (List)allMetaDataMap.get("infrastaclimpl"); - - this.writeAclInterface(aclBeanList); - this.writeAclInterfaceParam(aclParamBeanList); - this.writeAclInterfaceImpl(aclImplBeanList); - - List commandBeanList = (List)allMetaDataMap.get("cmd"); - this.writeCommand(commandBeanList); - - List exeBeanList = (List)allMetaDataMap.get("exeClass"); - List exeInterfaceBeanList = (List)allMetaDataMap.get("exeInterface"); - this.writeAppExeImpl(exeBeanList); - this.writeAppExeInterface(exeInterfaceBeanList); - - List factoryBeanList = (List)allMetaDataMap.get("domainfactory"); - this.writeFactory(factoryBeanList); - - List appListenerBeanList = (List)allMetaDataMap.get("applistener"); - this.writeAppListener(appListenerBeanList); - - List mqProducerBeanList = (List)allMetaDataMap.get("mqproducer"); - this.writeMqProducer(mqProducerBeanList); - - List mqConsumerBeanList = (List)allMetaDataMap.get("mqconsumer"); - this.writeMqConsumer(mqConsumerBeanList); - - List mqHandlerBeanList = (List)allMetaDataMap.get("mqhandler"); - this.writeMqHandler(mqHandlerBeanList); - - List cacheBeanList = (List)allMetaDataMap.get("cache"); - this.writeCache(cacheBeanList); - - List voClassBeanList = (List)allMetaDataMap.get("adaptervo"); - this.writeVO(voClassBeanList); - - List controllerBeanList = (List)allMetaDataMap.get("controller"); - this.writeController(controllerBeanList); - - - List derivefeignInterfaceBeanList = (List)allMetaDataMap.get("derivefeign"); - this.writeFeign(derivefeignInterfaceBeanList); - - - List derivefacadeInterfaceBeanList = (List)allMetaDataMap.get("derivefacade"); - this.writeFacade(derivefacadeInterfaceBeanList); - - List derivefacadeimplclassBeanList = (List)allMetaDataMap.get("derivefacadeimpl"); - this.writeFacadeImpl(derivefacadeimplclassBeanList); - - List dtoClassBeanList = (List)allMetaDataMap.get("derivedto"); - this.writeDTO(dtoClassBeanList); - - List dtoboconvertBeanList = (List)allMetaDataMap.get("dtoboconvert"); - this.writeDTOBOConvert(dtoboconvertBeanList); - - List voboconvertBeanList = (List)allMetaDataMap.get("voboconvert"); - this.writeVOBOConvert(voboconvertBeanList); - - List doboconvertBeanList = (List)allMetaDataMap.get("doboconvert"); - this.writeDOBOConvert(doboconvertBeanList); - - List dynamicMapperBeanList = (List)allMetaDataMap.get("dynamicmapper"); - this.writeDynamicMapper(dynamicMapperBeanList); - - List dynamicMapperXmlBeanList = (List)allMetaDataMap.get("dynamicmapperxml"); - this.writeDynamicMapperXml(dynamicMapperXmlBeanList); - - Map tableBeanMap = (Map)allMetaDataMap.get("table"); - Map> columnBeanListMap = (Map>)allMetaDataMap.get("columns"); - Map varMap = new HashMap<>(); - - List dto2dtoConvertInterfaceList = (List)allMetaDataMap.get("convertdto2dto"); - - this.writeFeignDTO(dtoClassBeanList); - this.writeDTO2DTOConvert(dto2dtoConvertInterfaceList); - - - - tableBeanMap.forEach((k,v)->{ - varMap.put("table", v); - varMap.put("columns", columnBeanListMap.get(k)); - varMap.put("package", allMetaDataMap.get("package")); - varMap.put("author", allMetaDataMap.get("author")); - varMap.put("packageInfrast", allMetaDataMap.get("packageInfrast")); - varMap.put("packageDomain", allMetaDataMap.get("packageDomain")); - - String templateContent = freemarkerService.parseTpl(TemplateFileEnum.DATA_OBJECT.getTempFileName(),varMap); - writeCodeService.writeDO(templateContent,v.getHumpClassName()); - - templateContent = freemarkerService.parseTpl(TemplateFileEnum.TEST.getTempFileName(),varMap); - writeCodeService.writeTest(templateContent,v.getHumpClassName()); - }); - - //写公共服务类 - this.writeCommon(varMap,""); - //渲染e-r图 - writeCodeService.writeERPicture(tableBeanMap,columnBeanListMap); - - //进行文档生成 - if(appServiceConfig.getApiDocGenerator()){ - this.writeHttpApiDoc(controllerBeanList,voClassBeanList); - this.writeRpcApiDoc(derivefacadeInterfaceBeanList,dtoClassBeanList); - this.writeRpcApiDoc(derivefeignInterfaceBeanList,dtoClassBeanList); - - } - - } - - /** - * 写http接口文档 - * @param controllerBeanList - */ - private void writeHttpApiDoc(List controllerBeanList,List voBeanList){ - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.API_HTTP.getTempFileName()); - if (writeFileService == null) { - return; - } - writeApiDocService.writeHttpApiDoc(controllerBeanList,writeFileService,voBeanList); - } - - /** - * 写rpc接口文档 - * @param facadeBeanList - * @param dtoBeanList - */ - private void writeRpcApiDoc(List facadeBeanList,List dtoBeanList){ - IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.API_RPC.getTempFileName()); - if (writeFileService == null) { - return; - } - writeApiDocService.writeRpcApiDoc(facadeBeanList,writeFileService,dtoBeanList); - } - - /** - * 写公共基础服务类 - * - * @param varMap - */ - public void writeCommon(Map varMap, String fast) { - - Map> initClassMap = appServiceConfig.getInitClassMapList(); - if(initClassMap == null || initClassMap.isEmpty()){ - return; - } - - for (Map.Entry> entry : initClassMap.entrySet()){ - for (String classTemplate : entry.getValue()){ - String clazzContent = freemarkerService.parseTplCommon(classTemplate, varMap); - writeCodeService.writeInitClass(entry.getKey(),clazzContent,classTemplate); - } - } - String facadeAop = freemarkerService.parseTpl(fast + TemplateFileEnum.FACADE_AOP.getTempFileName(), varMap); - writeCodeService.writeFacadeAop(facadeAop); - } - - - /** - * 写dynamicddd模块代码生成 - * - * @param dynamicDDDMap - */ - public void writeDynamicDDD(Map dynamicDDDMap) { - IWriteFileService writeFileService = appServiceConfig.getDynamicDDDWriteService(); - if (writeFileService == null) { - return; - } - writeDynamicDDDModuleService.writeDynamicDDD(dynamicDDDMap, writeFileService); - } - - - -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteDynamicDDDService.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteDynamicDDDService.java deleted file mode 100644 index 42e9e001f9f7f13803b2a040c19cd490c8f1e892..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteDynamicDDDService.java +++ /dev/null @@ -1,710 +0,0 @@ -package com.coderman.codemaker.service; - -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.EnumBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.template.FreemarkerService; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -/** - * Description: - * date: 2021/6/30 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Service -public class WriteDynamicDDDService { - @Autowired - private FreemarkerService freemarkerService; - - /** - * 写dynamicddd模块代码生成 - * @param dynamicDDDMap - */ - public void writeDynamicDDD(Map dynamicDDDMap, IWriteFileService writeFileService){ - //写bo - List classBeanList = (List)dynamicDDDMap.get("domainbo"); - writeBO(classBeanList,writeFileService,"ddd"); - - //写valueobject - List valueObjectBeanList = (List)dynamicDDDMap.get("domainvalueobject"); - writeValueObject(valueObjectBeanList,writeFileService,"ddd"); - - //写接口 - List repositoryInterfaceBeanList = (List)dynamicDDDMap.get("repository"); - List gatawayInterfaceBeanList = (List)dynamicDDDMap.get("gataway"); - repositoryInterfaceBeanList.addAll(gatawayInterfaceBeanList); - writeInterfaceAndImpl(repositoryInterfaceBeanList,writeFileService,"ddd"); - - //写枚举 - List enumBeanList = (List)dynamicDDDMap.get("valueobjectenum"); - writeEnum(enumBeanList,writeFileService,"ddd"); - - //写msgbody - List domainMsgBeanList = (List)dynamicDDDMap.get("domainmsg"); - writeMsgBody(domainMsgBeanList,writeFileService,"ddd"); - - - //写domainevent - List domainEventBeanList = (List)dynamicDDDMap.get("domainevent"); - writeDomainEvent(domainEventBeanList,writeFileService,"ddd"); - - //写factory - List domainFactoryBeanList = (List)dynamicDDDMap.get("domainfactory"); - writeFactory(domainFactoryBeanList,writeFileService,"ddd"); - - //写防腐层接口 - List infrastAclInterfaceList = (List)dynamicDDDMap.get("infrastacl"); - writeAclInterface(infrastAclInterfaceList,writeFileService,"ddd"); - - //写防腐层接口 - List infrastAclInterfaceImplList = (List)dynamicDDDMap.get("infrastaclimpl"); - writeAclInterfaceImpl(infrastAclInterfaceImplList,writeFileService,"ddd"); - - //写防腐层接口需要的参数 - List infrastAclParamClassList = (List)dynamicDDDMap.get("infrastaclparam"); - writeACLParam(infrastAclParamClassList,writeFileService,"ddd"); - - //写app层的命令服务 - List appCommandClassList = (List)dynamicDDDMap.get("cmd"); - writeAppCommand(appCommandClassList,writeFileService,"ddd"); - - //写app.exe interface - List appExeInterfaceList = (List)dynamicDDDMap.get("exeInterface"); - writeAppExeInterface(appExeInterfaceList,writeFileService,"ddd"); - - //写app.exeImpl - List appExeClassImplList = (List)dynamicDDDMap.get("exeClass"); - writeAppExeImpl(appExeClassImplList,writeFileService,"ddd"); - } - - /** - * 写BO - * @param classBeanList - * @param writeFileService - */ - public void writeBO(List classBeanList, IWriteFileService writeFileService,String dddTag){ - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if (StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.BUSINESS_OBJECT_DDD); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写msgbody - * @param classBeanList - * @param writeFileService - */ - public void writeMsgBody(List classBeanList, IWriteFileService writeFileService,String dddTag){ - - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.MESSAGE_BODY.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.MESSAGE_BODY.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.MESSAGE_BODY); - writeFileService.writeContent(writeContentBean); - } - } - - - - /** - * 写domainEvent - * @param classBeanList - * @param writeFileService - */ - public void writeDomainEvent(List classBeanList, IWriteFileService writeFileService,String dddTag){ - - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.EVENT_BODY.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.EVENT_BODY.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.EVENT_BODY); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写DTO - * @param classBeanList - * @param writeFileService - */ - public void writeDTO(List classBeanList, IWriteFileService writeFileService){ - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent = freemarkerService.parseTpl(TemplateFileEnum.DTO_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.DTO_DDD); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写VO - * @param classBeanList - * @param writeFileService - */ - public void writeVO(List classBeanList, IWriteFileService writeFileService){ - - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent = freemarkerService.parseTpl(TemplateFileEnum.VO_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.VO_DDD); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写VO - * @param classBeanList - * @param writeFileService - */ - public void writeController(List classBeanList, IWriteFileService writeFileService){ - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent = freemarkerService.parseTpl(TemplateFileEnum.CONTROLLER_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.CONTROLLER_DDD); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写facadeimpl - * @param classBeanList - * @param writeFileService - */ - public void writeFacadeImpl(List classBeanList, IWriteFileService writeFileService){ - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent = freemarkerService.parseTpl(TemplateFileEnum.FACADE_IMPL_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.FACADE_IMPL); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写facade - * @param classBeanList - * @param writeFileService - */ - public void writeFacade(List classBeanList, IWriteFileService writeFileService){ - for (InterfaceBean interfaceBean : classBeanList){ - Map varMap = interfaceBean.buildVarMap(); - String boContent = freemarkerService.parseTpl(TemplateFileEnum.FACADE_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(boContent,TemplateFileEnum.FACADE); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写facade - * @param classBeanList - * @param writeFileService - */ - public void writeFeign(List classBeanList, IWriteFileService writeFileService){ - for (InterfaceBean interfaceBean : classBeanList){ - Map varMap = interfaceBean.buildVarMap(); - String boContent = freemarkerService.parseTpl(TemplateFileEnum.FEIGN_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(boContent,TemplateFileEnum.FEIGN); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写valueobject - * @param classBeanList - * @param writeFileService - */ - public void writeValueObject(List classBeanList, IWriteFileService writeFileService,String dddTag){ - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.VALUE_OBJECT.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.VALUE_OBJECT.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.VALUE_OBJECT); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写接口和实现 - * @param repositoryInterfaceBeanList - * @param writeFileService - */ - private void writeInterfaceAndImpl(List repositoryInterfaceBeanList, IWriteFileService writeFileService,String dddTag){ - for (InterfaceBean interfaceBean : repositoryInterfaceBeanList){ - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent; - if (StringUtils.isNotEmpty(dddTag)){ - interfaceContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); - }else { - interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.GATAWAY); - writeFileService.writeContent(writeContentBean); - - //写接口实现 - String interfaceImplContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.GATAWAY_IMPL.getTempFileName(), varMap); - WriteContentBean writeContentBean2 = interfaceBean.buildWriteContentBean(interfaceImplContent,TemplateFileEnum.GATAWAY_IMPL); - writeFileService.writeContent(writeContentBean2); - } - } - - /** - * 写gataway接口和repository接口 - * @param gataWayBeanList - * @param writeFileService - */ - public void writeGataWay(List gataWayBeanList, IWriteFileService writeFileService,String dddTag) { - for (InterfaceBean interfaceBean : gataWayBeanList) { - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.GATAWAY); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写gataway接口和repository接口 - * @param repositoryBeanList - * @param writeFileService - */ - public void writeRepository(List repositoryBeanList, IWriteFileService writeFileService,String dddTag) { - for (InterfaceBean interfaceBean : repositoryBeanList) { - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.REPOSITORY); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写dynamicmapper - * @param dynamicMapperBeanList - * @param writeFileService - */ - public void writeDynamicMapper(List dynamicMapperBeanList, IWriteFileService writeFileService,String dddTag) { - for (InterfaceBean interfaceBean : dynamicMapperBeanList) { - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.MAPPER_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.MAPPER_DDD); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写dynamicmapperxml - * @param dynamicMapperXmlBeanList - * @param writeFileService - */ - public void writeDynamicMapperXml(List dynamicMapperXmlBeanList, IWriteFileService writeFileService,String dddTag) { - for (ClassBean classBean : dynamicMapperXmlBeanList) { - Map varMap = classBean.buildVarMap(); - if(CollectionUtils.isNotEmpty(classBean.getImportClassList())){ - Optional doPackageName = classBean.getImportClassList().stream().filter(importClassName -> importClassName.toLowerCase().endsWith(TemplateFileEnum.DATA_OBJECT.getTempFileName())).findFirst(); - if(doPackageName.isPresent()){ - varMap.put("doPackageName",doPackageName.get()); - } - } - - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.MAPPER_XML_DDD.getTempFileName(), varMap); - WriteContentBean writeContentBean = classBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.MAPPER_XML_DDD); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写gataway实现 - * @param gatawayImplInterfaceBeanList - * @param writeFileService - */ - public void writeGatawayImpl(List gatawayImplInterfaceBeanList, IWriteFileService writeFileService,String dddTag){ - for (ClassBean classBean : gatawayImplInterfaceBeanList){ - Map varMap = classBean.buildVarMap(); - //写接口实现 - String interfaceImplContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY_IMPL.getTempFileName(), varMap); - WriteContentBean writeContentBean = classBean.buildWriteContentBean(interfaceImplContent,TemplateFileEnum.GATAWAY_IMPL); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写repository实现 - * @param repositoryImplInterfaceBeanList - * @param writeFileService - */ - public void writeRepositoryImpl(List repositoryImplInterfaceBeanList, IWriteFileService writeFileService,String dddTag){ - for (ClassBean classBean : repositoryImplInterfaceBeanList){ - Map varMap = classBean.buildVarMap(); - //写接口实现 - String interfaceImplContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY_IMPL.getTempFileName(), varMap); - WriteContentBean writeContentBean = classBean.buildWriteContentBean(interfaceImplContent,TemplateFileEnum.REPOSITORY_IMPL); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写枚举 - * @param enumBeanList - * @param writeFileService - */ - public void writeEnum(List enumBeanList, IWriteFileService writeFileService,String dddTag){ - //写枚举 - for (EnumBean enumBean : enumBeanList){ - Map varMap = enumBean.buildVarMap(); - String enumContent; - if(StringUtils.isNotEmpty(dddTag)){ - enumContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.ENUM.getTempFileName(), varMap); - }else { - enumContent = freemarkerService.parseTpl(TemplateFileEnum.ENUM.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = enumBean.buildWriteContentBean(enumContent,TemplateFileEnum.ENUM); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写factory - * @param domainFactoryBeanList - * @param writeFileService - */ - public void writeFactory(List domainFactoryBeanList, IWriteFileService writeFileService,String dddTag){ - //写factory - for (ClassBean classBean : domainFactoryBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.FACTORY.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.FACTORY.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.FACTORY); - writeFileService.writeContent(writeContentBean); - } - } - /** - * 写cache - * @param domainFactoryBeanList - * @param writeFileService - */ - public void writeCache(List domainFactoryBeanList, IWriteFileService writeFileService,String dddTag){ - //写factory - for (ClassBean classBean : domainFactoryBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.CACHE.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.CACHE.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.CACHE); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写app.listener - * @param appListenerBeanList - * @param writeFileService - */ - public void writeAppListner(List appListenerBeanList, IWriteFileService writeFileService,String dddTag){ - //写app.listener - for (ClassBean classBean : appListenerBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.MQ_LISTENER.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.MQ_LISTENER.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.MQ_LISTENER); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写infrast.mq.producer - * @param appListenerBeanList - * @param writeFileService - */ - public void writeMqProducer(List appListenerBeanList, IWriteFileService writeFileService,String dddTag){ - //写infrast.mq.producer - for (ClassBean classBean : appListenerBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.MQ_PRODUCER.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.MQ_PRODUCER.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.MQ_PRODUCER); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写infrast.mq.consumer - * @param appListenerBeanList - * @param writeFileService - */ - public void writeMqConsumer(List appListenerBeanList, IWriteFileService writeFileService,String dddTag){ - //写infrast.mq.consumer - for (ClassBean classBean : appListenerBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.MQ_CONSUMER.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.MQ_CONSUMER.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.MQ_CONSUMER); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写infrast.mq.handler - * @param appListenerBeanList - * @param writeFileService - */ - public void writeMqHandler(List appListenerBeanList, IWriteFileService writeFileService,String dddTag){ - //写infrast.mq.handler - for (ClassBean classBean : appListenerBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.MQ_HANDLER.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.MQ_HANDLER.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.MQ_HANDLER); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写infrastacl接口 - * @param aclInterfaceBeanList - * @param writeFileService - */ - public void writeAclInterface(List aclInterfaceBeanList, IWriteFileService writeFileService,String dddTag){ - for (InterfaceBean interfaceBean : aclInterfaceBeanList){ - Map varMap = interfaceBean.buildVarMap(); - - String interfaceContent; - if(StringUtils.isNotEmpty(dddTag)){ - interfaceContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.ACL.getTempFileName(), varMap); - }else { - interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.ACL.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.ACL); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写infrastaclImpl - * @param infrastAclImplBeanList - * @param writeFileService - */ - public void writeAclInterfaceImpl(List infrastAclImplBeanList, IWriteFileService writeFileService,String dddTag){ - for (ClassBean classBean : infrastAclImplBeanList){ - Map varMap = classBean.buildVarMap(); - String interfaceImplContent; - if(StringUtils.isNotEmpty(dddTag)){ - interfaceImplContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.ACL_IMPL.getTempFileName(), varMap); - }else { - interfaceImplContent = freemarkerService.parseTpl(TemplateFileEnum.ACL_IMPL.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(interfaceImplContent,TemplateFileEnum.ACL_IMPL); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写acl.param - * @param classBeanList - * @param writeFileService - */ - public void writeACLParam(List classBeanList, IWriteFileService writeFileService,String dddTag){ - - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - //使用BO的模板 - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.ACL_PARAM); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写app.cmd - * @param classBeanList - * @param writeFileService - */ - public void writeAppCommand(List classBeanList, IWriteFileService writeFileService,String dddTag){ - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - //使用BO的模板 - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), varMap); - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.BUSINESS_OBJECT_DDD.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.CMD); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写app.exe--->class 接口实现 - * @param classBeanList - * @param writeFileService - */ - public void writeAppExeImpl(List classBeanList, IWriteFileService writeFileService,String dddTag){ - for (ClassBean classBean : classBeanList){ - Map varMap = classBean.buildVarMap(); - String boContent; - if(StringUtils.isNotEmpty(dddTag)){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.EXE_IMPL.getTempFileName(), varMap); - if(StringUtils.isEmpty(classBean.getRelationClassStr())){ - boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.EXE_ABSTRACT.getTempFileName(), varMap); - } - }else { - boContent = freemarkerService.parseTpl(TemplateFileEnum.EXE_IMPL.getTempFileName(), varMap); - if(StringUtils.isEmpty(classBean.getRelationClassStr())){ - boContent = freemarkerService.parseTpl(TemplateFileEnum.EXE_ABSTRACT.getTempFileName(), varMap); - } - } - WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.EXE); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写app.exe--->interface 接口 - * @param interfaceBeanList - * @param writeFileService - */ - public void writeAppExeInterface(List interfaceBeanList, IWriteFileService writeFileService,String dddTag){ - for (InterfaceBean interfaceBean : interfaceBeanList){ - Map varMap = interfaceBean.buildVarMap(); - //借用gataway的模板 - String interfaceContent; - if(StringUtils.isNotEmpty(dddTag)){ - interfaceContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); - }else { - interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); - } - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.EXE); - writeFileService.writeContent(writeContentBean); - } - } - - - /** - * 写dtobo-convert 接口 - * @param interfaceBeanList - * @param writeFileService - */ - public void writeDtoBOConvert(List interfaceBeanList, IWriteFileService writeFileService){ - for (InterfaceBean interfaceBean : interfaceBeanList){ - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.CONVERT.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.CONVERT); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写vobo-convert 接口 - * @param interfaceBeanList - * @param writeFileService - */ - public void writeVoBOConvert(List interfaceBeanList, IWriteFileService writeFileService){ - for (InterfaceBean interfaceBean : interfaceBeanList){ - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.CONVERT.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.CONVERT); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写dobo-convert 接口 - * @param interfaceBeanList - * @param writeFileService - */ - public void writeDoBOConvert(List interfaceBeanList, IWriteFileService writeFileService){ - for (InterfaceBean interfaceBean : interfaceBeanList){ - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.CONVERT.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.CONVERT); - writeFileService.writeContent(writeContentBean); - } - } - - /** - * 写dto2dto-convert 接口 - * @param interfaceBeanList - * @param writeFileService - */ - public void writeDTO2DTOConvert(List interfaceBeanList, IWriteFileService writeFileService){ - for (InterfaceBean interfaceBean : interfaceBeanList){ - Map varMap = interfaceBean.buildVarMap(); - String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.CONVERT.getTempFileName(), varMap); - WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.DTO2DTO_CONVERT); - writeFileService.writeContent(writeContentBean); - } - } -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeElementRegistService.java b/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeElementRegistService.java deleted file mode 100644 index d9399a7a265dac624ff9369cbf955137b8a628dc..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeElementRegistService.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.coderman.codemaker.service.invoker; - -import com.coderman.codemaker.api.ICompRegistService; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.config.AppServiceConfig; -import org.assertj.core.util.Lists; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * Description:预先读取plantUML调用时序图文档,以及补充其他内置的工具类 - * 如BaseEvent,AppEventPublisher类等 - * date: 2021/10/25 - * - * @author fanchunshuai - * @version 1.0.0 - * @since JDK 1.8 - */ -@Service -public class InvokeElementRegistService { - - @Autowired - private AppServiceConfig appServiceConfig; - - @Autowired - private ICompRegistService iCompRegistService; - - /** - * 注册独立类和工具 - * @param plantUmlContextBean - */ - public void registDefaultClass(PlantUmlContextBean plantUmlContextBean){ - ComponentContextBean componentContextBean = iCompRegistService.registSingleClass(); - - - plantUmlContextBean.getCompContextBeanMap().put("singleClass",componentContextBean); - - - } - - /** - * 注册事件发布器 - * @param plantUmlContextBean - */ - /*private void registAppEventPublisher(PlantUmlContextBean plantUmlContextBean){ - ClassBean classBean = new ClassBean(); - classBean.setClassDesc("事件发布器"); - classBean.setClassName("AppEventPublisher"); - classBean.setDerived(false); - classBean.setPackageName(appServiceConfig.getPackage()+".utils"); - classBean.setPlantUMLPackage("utils"); - MethodBean methodBean = new MethodBean(); - methodBean.setReturnBody("void"); - methodBean.setMethodName("publish(T t)"); - methodBean.setStatic(false); - methodBean.setVisibility("public"); - methodBean.setDesc("发布事件入口"); - methodBean.setClassName("AppEventPublisher"); - classBean.setMethodBeanList(Lists.newArrayList(methodBean)); - plantUmlContextBean.addClassBean(classBean); - } -*/ - /** - * 注册bo类对象 - * @param plantUmlContextBean - */ - /*public void registPageBO(PlantUmlContextBean plantUmlContextBean){ - ClassBean classBean = new ClassBean(); - classBean.setClassDesc("分页bo对象"); - classBean.setClassName("PageBO"); - classBean.setDerived(false); - classBean.setPackageName("com.coderman.utils.commonbo"); - - plantUmlContextBean.addClassBean(classBean); - }*/ - - - -} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/Main.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..ed34a5341505b7281cc9264adbed219e32d257f2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/Main.java @@ -0,0 +1,37 @@ +package com.tianhua.codemaker; + +import com.coderman.codemaker.dberparse.ERPlantUMLParseService; +import com.coderman.codemaker.dberparse.ERPlantUMLParseServiceImpl; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; + +/** + * description: Main
+ * date: 2020/7/6 23:07
+ * author: coderman
+ * version: 1.0
+ */ +@SpringBootApplication +@MapperScan(value = "com.tianhua.codemaker.dao") +@EnableConfigurationProperties +@ComponentScan({"com.tianhua.*"}) +public class Main { + + /** + * 将plantuml e-r图解析服务注入到springbean中 + * @return + */ + @Bean + public ERPlantUMLParseService getErplantUMLParseService(){ + return new ERPlantUMLParseServiceImpl(); + } + + public static void main(String[] args) { + SpringApplication.run(Main.class, args); + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/AppService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/AppService.java similarity index 82% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/AppService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/AppService.java index 3e885bd2c0e93b366fc07902299fef9eeaf9f029..2ef0e3747847e585e6846b8399b6ee6904a92370 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/AppService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/AppService.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; /** * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/ColaAppService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/ColaAppService.java similarity index 70% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/ColaAppService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/ColaAppService.java index 29502a7b1903b1b2556f85850b5c0fc213b52ff7..d0d6dcfabc8e5709eb3b99e1eb2ca19a87f354e4 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/ColaAppService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/ColaAppService.java @@ -1,6 +1,7 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; -import com.coderman.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.enums.ModuleEnum; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -9,7 +10,7 @@ import javax.annotation.Resource; * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -47,23 +48,23 @@ public class ColaAppService implements AppService{ @Override public IWriteFileService getModelAppService(String moduleName) { - if(moduleName.equals(ModuleEnum.COLA_INFRAST.getModuleName())){ + if(ModuleEnum.COLA_INFRAST.getModuleName().endsWith(moduleName)){ return colaInfrastWriteService; - } else if (moduleName.equals(ModuleEnum.COLA_CLIENT.getModuleName())) { + } else if (ModuleEnum.COLA_CLIENT.getModuleName().endsWith(moduleName)) { return colaClientWriteService; } - else if(moduleName.equals(ModuleEnum.COLA_DOMAIN.getModuleName())){ + else if(ModuleEnum.COLA_DOMAIN.getModuleName().endsWith(moduleName)){ return colaDomainWriteService; - } else if (moduleName.equals(ModuleEnum.COLA_APP.getModuleName())) { + } else if (ModuleEnum.COLA_APP.getModuleName().endsWith(moduleName)) { return colaAppWriteService; } - else if (moduleName.equals(ModuleEnum.COLA_API_DOC.getModuleName())) { + else if (moduleName.equals(ModuleEnum.COLA_API_DOC.getModuleName()) || moduleName.equals(GlobalConstant.PARENT)) { return colaApiDocWriteService; } - else if (moduleName.equals(ModuleEnum.COLA_START.getModuleName())) { + else if (ModuleEnum.COLA_START.getModuleName().endsWith(moduleName)) { return colaStartWriteService; } - else if (moduleName.equals(ModuleEnum.COLA_FEIGN_API.getModuleName())) { + else if (ModuleEnum.COLA_FEIGN_API.getModuleName().endsWith(moduleName)) { return colaFeginApiWriteService; } return colaAdapterWriteService; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/CommonWriteService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/CommonWriteService.java new file mode 100644 index 0000000000000000000000000000000000000000..e8861a894d8972394d28f2a42dbcb52a94ebd3b8 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/CommonWriteService.java @@ -0,0 +1,155 @@ +package com.tianhua.codemaker.app; + +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.utils.Constant; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; + +/** + * Description: + * date: 2021/7/8 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +@Slf4j +public class CommonWriteService { + + @Autowired + private AppServiceConfig appServiceConfig; + /** + * 写pom文件 + * @param classContentBean + */ + public void writePom(ClassContentBean classContentBean){ + String modulePath = classContentBean.getModulePath(); + String filePath = modulePath + "/" + "pom.xml"; + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + + /** + * 写路由 + * @param classContentBean + */ + public void writeRoute(ClassContentBean classContentBean){ + //走默认的包生成方式 + if(StringUtils.isEmpty(classContentBean.getClassPackageName())){ + writeClassFile(classContentBean); + }else { + //走文档里的package包生成方式 + writeClassFileV2(classContentBean); + } + } + + /** + * 写class文件 + * @param classContentBean + */ + public void writeClassFile(ClassContentBean classContentBean) { + String filePath = getFilePath(classContentBean); + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + + /** + * + * @param classContentBean + * @return + */ + private String getFilePath(ClassContentBean classContentBean) { + String packageName = appServiceConfig.getPackage(); + String packagePath = packageName.replace(".", "/") ; + packagePath = Constant.JAVA + "/" + packagePath + "/" + classContentBean.getChildPackageName(); + String fileName = classContentBean.getHumpClassName() + ".java"; + return classContentBean.getModulePath() + packagePath + "/" + fileName; + } + + + /** + * 写class文件 + * @param classContentBean + */ + public void writeClassFileV2(ClassContentBean classContentBean) { + String filePath = getClassPackageFilePath(classContentBean); + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + log.error("error",e); + } + } + + /** + * + * @param classContentBean + * @return + */ + private String getClassPackageFilePath(ClassContentBean classContentBean) { + String packagePath = classContentBean.getClassPackageName().replace(".", "/") ; + packagePath = Constant.JAVA + "/" + packagePath; + String fileName = classContentBean.getHumpClassName() + ".java"; + return classContentBean.getModulePath() + packagePath + "/" + fileName; + } + + + /** + * 写Mapper.xml文件 + * @param classContentBean + */ + public void writeMapperXml(ClassContentBean classContentBean) { + String filePath = classContentBean.getModulePath() + Constant.MAPPER + "/" + classContentBean.getHumpClassName() + classContentBean.getClassSuffix(); + + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 写class文件 + * @param classContentBean + */ + public void writeClassTestFile(ClassContentBean classContentBean) { + + String filePath = getTestFilePath( classContentBean.getHumpClassName(), classContentBean.getClassSuffix(), classContentBean.getModulePath()); + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 写测试文件 + * @param humpClassName + * @param classSuffix + * @return + */ + public String getTestFilePath(String humpClassName, String classSuffix, String modulePath) { + String packageName = appServiceConfig.getPackage(); + String packagePath = packageName.replace(".", "/"); + packagePath = Constant.TEST_JAVA + "/" + packagePath + ".test"; + String fileName = humpClassName+"Test" + classSuffix; + return modulePath + packagePath + "/" + fileName; + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/DubboAppService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/DubboAppService.java similarity index 69% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/DubboAppService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/DubboAppService.java index ddf71282d3acd837286f44efed07084b845d9c8c..8afd7d87e40d381a45f0ae00f84839308ee71d43 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/DubboAppService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/DubboAppService.java @@ -1,6 +1,7 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; -import com.coderman.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.enums.ModuleEnum; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -9,7 +10,7 @@ import javax.annotation.Resource; * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -32,12 +33,12 @@ public class DubboAppService implements AppService{ @Override public IWriteFileService getModelAppService(String moduleName) { - if(moduleName.equals(ModuleEnum.DUBBO_API.getModuleName())){ + if(ModuleEnum.DUBBO_API.getModuleName().endsWith(moduleName)){ return dubboApiWriteFileService; - } else if (moduleName.equals(ModuleEnum.DUBBO_COMMON.getModuleName())) { + } else if (ModuleEnum.DUBBO_COMMON.getModuleName().endsWith(moduleName)) { return dubboCommonWriteFileService; } - else if (moduleName.equals(ModuleEnum.DUBBO_API_DOC.getModuleName())) { + else if (ModuleEnum.DUBBO_API_DOC.getModuleName().endsWith(moduleName) || moduleName.equals(GlobalConstant.PARENT)) { return dubboApiDocWriteFileService; } return dubboCoreWriteFileService; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/DynamicDDDAppService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/DynamicDDDAppService.java similarity index 89% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/DynamicDDDAppService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/DynamicDDDAppService.java index 71d6d0b7d85d7a803d41ab5e5aeedcbdaeafcfe8..c51d4b6f467fbc5eb6b2e94fec09adc58d5763bf 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/DynamicDDDAppService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/DynamicDDDAppService.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; import org.springframework.stereotype.Component; @@ -8,7 +8,7 @@ import javax.annotation.Resource; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/FunctionCodeAppWriteService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/FunctionCodeAppWriteService.java new file mode 100644 index 0000000000000000000000000000000000000000..e2ba09f3fe800c3493789eb74762898a8a6b757b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/FunctionCodeAppWriteService.java @@ -0,0 +1,82 @@ +package com.tianhua.codemaker.app; + +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Consumer; + +/** + * Description: + * date: 2022/1/26 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class FunctionCodeAppWriteService { + + @Autowired + private CommonWriteService writeService; + + /** + * 第一级key:模块标示 + * 第二级key:代码元素标示 + * 第二级value:代码生成的lamda函数 + */ + private static Map>> templateCodeWriteMap = new HashMap<>(); + + /** + * 初始化业务分派逻辑,代替了if-else部分 + * key: 代码元素类型 + * value: lambda表达式,写代码文件执行的方法 + */ + public void dispatcherInit(String appType){ + for (ModuleEnum moduleEnum : ModuleEnum.values()){ + if(moduleEnum.getAppName().equals(appType)){ + String simleModule = moduleEnum.getModuleName().replace(appType+"-",""); + Map> consumerMap = templateCodeWriteMap.get(simleModule); + if(consumerMap == null){ + consumerMap = new HashMap<>(); + } + Map> finalConsumerMap = consumerMap; + moduleEnum.getTemplateFileSet().forEach(templateCode-> { + if(templateCode.contains(TemplateFileEnum.POM.getTempFileName())){ + finalConsumerMap.put(templateCode, classContentBean -> writeService.writePom(classContentBean)); + } else if(templateCode.contains(TemplateFileEnum.MAPPER_XML.getTempFileName())){ + finalConsumerMap.put(templateCode, classContentBean -> writeService.writeMapperXml(classContentBean)); + }else if(templateCode.contains(TemplateFileEnum.TEST.getTempFileName())){ + finalConsumerMap.put(templateCode, classContentBean -> writeService.writeClassTestFile(classContentBean)); + } else { + finalConsumerMap.put(templateCode, classContentBean -> writeService.writeRoute(classContentBean)); + } + }); + templateCodeWriteMap.put(simleModule,consumerMap); + } + } + } + + /** + * 函数式代码元素文件写入方式 + * @param templateCode + * @param moduleCode + * @param classContentBean + */ + public void write(String templateCode, String moduleCode, ClassContentBean classContentBean){ + //外部appwriteservice根据模块标示moduleCode 代码元素标示templateCode、路由并执行写入函数 + Consumer result = templateCodeWriteMap.get(moduleCode).get(templateCode); + if(result != null){ + //classContentBean 执行这段表达式进行代码文件写入 + result.accept(classContentBean); + return; + } + System.out.println("找不到对应的代码元素处理函数--->moduleCode = "+moduleCode+",templateCode = "+templateCode); + } + + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/IWriteFileService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/IWriteFileService.java similarity index 70% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/IWriteFileService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/IWriteFileService.java index 7fb3fa0040c8b554ceef011241a26feeafe8ed78..02420d9be5dcab667e73fa4a6b23e755b7b5097a 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/IWriteFileService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/IWriteFileService.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; -import com.coderman.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.bean.WriteContentBean; /** * Description: * date: 2021/6/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/SpringBootAppService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/SpringBootAppService.java similarity index 66% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/SpringBootAppService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/SpringBootAppService.java index c1cb1138954cc28dc51e06f055a1c4e739d6eb25..37b78021dded9dfbb428146c46398d8f4179b753 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/SpringBootAppService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/SpringBootAppService.java @@ -1,6 +1,7 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; -import com.coderman.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.enums.ModuleEnum; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -9,7 +10,7 @@ import javax.annotation.Resource; * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -26,10 +27,10 @@ public class SpringBootAppService implements AppService{ @Override public IWriteFileService getModelAppService(String moduleName) { - if (moduleName.equals(ModuleEnum.SPRING_BOOT_WEB.getModuleName())) { + if (ModuleEnum.SPRING_BOOT_WEB.getModuleName().endsWith(moduleName)) { return springBootWriteService; } - else if (moduleName.equals(ModuleEnum.SPRINGBOOT_API_DOC.getModuleName())) { + else if (ModuleEnum.SPRINGBOOT_API_DOC.getModuleName().endsWith(moduleName) || moduleName.equals(GlobalConstant.PARENT)) { return springBootApiDocWriteService; } return null; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/SpringCloudAppService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/SpringCloudAppService.java similarity index 66% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/SpringCloudAppService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/SpringCloudAppService.java index 9afab14549739c70062f6773195415b497410171..65515ffadf7be10f29c65d251917b756a2db6172 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/SpringCloudAppService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/SpringCloudAppService.java @@ -1,6 +1,7 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; -import com.coderman.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.enums.ModuleEnum; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -9,7 +10,7 @@ import javax.annotation.Resource; * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -30,13 +31,13 @@ public class SpringCloudAppService implements AppService{ @Override public IWriteFileService getModelAppService(String moduleName) { - if (moduleName.equals(ModuleEnum.SC_FEIGN_API.getModuleName())) { + if (ModuleEnum.SC_FEIGN_API.getModuleName().endsWith(moduleName)) { return sCFeignApiWriteService; } - else if (moduleName.equals(ModuleEnum.SPRINGBOOT_API_DOC.getModuleName())) { + else if (ModuleEnum.SPRINGBOOT_API_DOC.getModuleName().endsWith(moduleName) || moduleName.equals(GlobalConstant.PARENT)) { return sCFeignApiDocWriteService; } - else if (moduleName.equals(ModuleEnum.SC_FEIGN_PROVIDER.getModuleName())) { + else if (ModuleEnum.SC_FEIGN_PROVIDER.getModuleName().endsWith(moduleName) ) { return sCFeignProviderWriteService; } return null; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/WriteService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/WriteService.java similarity index 64% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/WriteService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/WriteService.java index 9497470247f6e4167211f2caa5010d1969bd86f3..017d9b6e82e1252faaf036e19f34956fab228fe0 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/WriteService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/WriteService.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.app; +package com.tianhua.codemaker.app; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.utils.Constant; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.utils.Constant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; +import org.springframework.stereotype.Component; import java.io.File; import java.io.IOException; @@ -16,15 +16,22 @@ import java.io.IOException; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ -@Service +@Component(value = "abstractWriteService") @Slf4j public abstract class WriteService { @Autowired private AppServiceConfig appServiceConfig; + + + + + + + /** * 写class文件 * @param classContentBean @@ -108,4 +115,47 @@ public abstract class WriteService { e.printStackTrace(); } } + + /** + * 写pom文件 + * @param classContentBean + */ + public void writePom(ClassContentBean classContentBean){ + String modulePath = classContentBean.getModulePath(); + String filePath = modulePath + "/" + "pom.xml"; + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 写sql文件 + * @param classContentBean + */ + public void writeSql(ClassContentBean classContentBean){ + String modulePath = classContentBean.getModulePath(); + String filePath = modulePath + "/sql-doc/" + appServiceConfig.getDbName() + ".sql"; + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 写项目配置文件 + * @param classContentBean + */ + public void writeConfig(ClassContentBean classContentBean){ + String modulePath = classContentBean.getModulePath(); + String filePath = modulePath + "/src/main/resources/" + classContentBean.getHumpClassName(); + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } + } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaAdapterWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaAdapterWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..9d6ebd1ecdf67e100ab795ada8135d6806a2b4ca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaAdapterWriteServiceImpl.java @@ -0,0 +1,48 @@ +package com.tianhua.codemaker.app.cola; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/7/6 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "colaAdapterWriteService") +public class ColaAdapterWriteServiceImpl extends WriteService implements IWriteFileService { + @Autowired + private ProjectTemplateColaConfig projectTemplateColaConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "adapter"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateColaConfig.getModuleAdapterPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + + //写config文件 + if(writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)){ + writeConfig(classContentBean); + } + + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaApiDocWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaApiDocWriteServiceImpl.java similarity index 33% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaApiDocWriteServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaApiDocWriteServiceImpl.java index 802f8fbc332e035d90bf8e6707f42508b0819356..c9b58f5bb7065bcd2a38b5d98e2062927c97af2f 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaApiDocWriteServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaApiDocWriteServiceImpl.java @@ -1,9 +1,11 @@ -package com.coderman.codemaker.app.cola; +package com.tianhua.codemaker.app.cola; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -11,19 +13,32 @@ import org.springframework.stereotype.Component; * Description: * date: 2021/7/6 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Component(value = "colaApiDocWriteService") public class ColaApiDocWriteServiceImpl extends WriteService implements IWriteFileService { - @Autowired - private AppServiceConfig appServiceConfig; + private ProjectTemplateColaConfig projectTemplateColaConfig; + @Override public void writeContent(WriteContentBean writeContentBean) { + writeApiDoc(writeContentBean.getContent(),writeContentBean.getHumpClassName()); + + //写pom文件 + if(writeContentBean.getTemplateName().equals(TemplateFileEnum.PARENT_POM.getTempFileName())){ + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleParentPath()); + writePom(classContentBean); + } + + //写sql文件 + if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SQL.getTempFileName())){ + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleParentPath()); + writeSql(classContentBean); + } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaAppWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaAppWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..618e11de864fb705d121b4a38fc2c9eefb416802 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaAppWriteServiceImpl.java @@ -0,0 +1,49 @@ +package com.tianhua.codemaker.app.cola; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.app.IWriteFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/7/6 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "colaAppWriteService") +public class ColaAppWriteServiceImpl extends WriteService implements IWriteFileService { + + @Autowired + private ProjectTemplateColaConfig projectTemplateColaConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "app"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateColaConfig.getModuleAppPath()); + + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + + //写config文件 + if(writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)){ + writeConfig(classContentBean); + } + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaClientWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaClientWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..a8989c2458095785eec4bbb157131764869befb2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaClientWriteServiceImpl.java @@ -0,0 +1,44 @@ +package com.tianhua.codemaker.app.cola; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/7/6 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "colaClientWriteService") +public class ColaClientWriteServiceImpl extends WriteService implements IWriteFileService { + + @Autowired + private ProjectTemplateColaConfig projectTemplateColaConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "client"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateColaConfig.getModuleClientPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + } + + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaDomainWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaDomainWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..b90c3ec2fb6aab9e7ab4125c9e28c33f5ba2a224 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaDomainWriteServiceImpl.java @@ -0,0 +1,45 @@ +package com.tianhua.codemaker.app.cola; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.app.IWriteFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/7/6 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "colaDomainWriteService") +public class ColaDomainWriteServiceImpl extends WriteService implements IWriteFileService { + + @Autowired + private ProjectTemplateColaConfig projectTemplateColaConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "domain"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateColaConfig.getModuleDomainPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaFeignApiWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaFeignApiWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2d8fcfbfd73f6512eb66cbbee6e04a44f3decd98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaFeignApiWriteServiceImpl.java @@ -0,0 +1,43 @@ +package com.tianhua.codemaker.app.cola; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.utils.Constant; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/11/29 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ + +@Component(value = "colaFeignApiWriteService") +public class ColaFeignApiWriteServiceImpl extends WriteService implements IWriteFileService { + @Autowired + private ProjectTemplateColaConfig projectTemplateColaConfig; + + @Autowired + private AppServiceConfig appServiceConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "feignapi"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateColaConfig.getModuleFeignApiPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaInfrastWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaInfrastWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e092f634a8f85217174db1c3404a9cfc9e406ab1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaInfrastWriteServiceImpl.java @@ -0,0 +1,48 @@ +package com.tianhua.codemaker.app.cola; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/7/6 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "colaInfrastWriteService") +public class ColaInfrastWriteServiceImpl extends WriteService implements IWriteFileService { + @Autowired + private ProjectTemplateColaConfig projectTemplateColaConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "infrast"; + + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateColaConfig.getModuleInfrastPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + + //写config文件 + if(writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)){ + writeConfig(classContentBean); + } + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaStartWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaStartWriteServiceImpl.java similarity index 42% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaStartWriteServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaStartWriteServiceImpl.java index aa24e2d54553e87f6ca02b0174deffbbb6ed5ae5..121a127aaf22eb50de18ddf733e9e87d94511bcd 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/cola/ColaStartWriteServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/cola/ColaStartWriteServiceImpl.java @@ -1,25 +1,22 @@ -package com.coderman.codemaker.app.cola; +package com.tianhua.codemaker.app.cola; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateColaConfig; -import com.coderman.codemaker.utils.Constant; -import org.apache.commons.io.FileUtils; +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateColaConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.utils.Constant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.io.File; -import java.io.IOException; - /** * Description: * date: 2021/7/6 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -29,15 +26,23 @@ public class ColaStartWriteServiceImpl extends WriteService implements IWriteFil private ProjectTemplateColaConfig projectTemplateColaConfig; @Autowired - private AppServiceConfig appServiceConfig; + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "start"; @Override public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateColaConfig.getModuleStartPath()); + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateColaConfig.getModuleStartPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); //写自定义工具类 if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ writeRoute(classContentBean); } + + //写config文件 + if(writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)){ + writeConfig(classContentBean); + } } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboApiDocWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboApiDocWriteServiceImpl.java similarity index 33% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboApiDocWriteServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboApiDocWriteServiceImpl.java index 57b7f2c955464b77f23e8beff970b9b9b78bb6b3..3e85899f0bb9bf9c60b0977aca369396e61fdf9d 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboApiDocWriteServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboApiDocWriteServiceImpl.java @@ -1,10 +1,11 @@ -package com.coderman.codemaker.app.dubbo; +package com.tianhua.codemaker.app.dubbo; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateDubboConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateDubboConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -12,7 +13,7 @@ import org.springframework.stereotype.Component; * Description: * date: 2021/6/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * @@ -20,10 +21,22 @@ import org.springframework.stereotype.Component; */ @Component(value = "dubboApiDocWriteFileService") public class DubboApiDocWriteServiceImpl extends WriteService implements IWriteFileService { + @Autowired + private ProjectTemplateDubboConfig projectTemplateDubboConfig; @Override public void writeContent(WriteContentBean writeContentBean) { writeApiDoc(writeContentBean.getContent(),writeContentBean.getHumpClassName()); + //写pom文件 + if(writeContentBean.getTemplateName().equals(TemplateFileEnum.PARENT_POM.getTempFileName())){ + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateDubboConfig.getModuleParentPath()); + writePom(classContentBean); + } + //写sql文件 + if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SQL.getTempFileName())){ + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateDubboConfig.getModuleParentPath()); + writeSql(classContentBean); + } } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboApiWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboApiWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..5319684210e1e4357f63577725c5a680b9669117 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboApiWriteServiceImpl.java @@ -0,0 +1,44 @@ +package com.tianhua.codemaker.app.dubbo; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateDubboConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/6/18 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + * + * 写api模块服务 + */ +@Component(value = "dubboApiWriteFileService") +public class DubboApiWriteServiceImpl extends WriteService implements IWriteFileService { + + @Autowired + private ProjectTemplateDubboConfig projectTemplateDubboConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "api"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateDubboConfig.getModuleApiPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboCommonWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboCommonWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fb6fb872671ea9c5b485e28bbb33822dbbb1d144 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboCommonWriteServiceImpl.java @@ -0,0 +1,49 @@ +package com.tianhua.codemaker.app.dubbo; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateDubboConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/6/18 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + * 写持久层模块服务 + */ +@Component(value = "dubboCommonWriteFileService") +public class DubboCommonWriteServiceImpl extends WriteService implements IWriteFileService { + + @Autowired + private ProjectTemplateDubboConfig projectTemplateDubboConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "common"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateDubboConfig.getModuleCommonPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + + //写config文件 + if(writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)){ + writeConfig(classContentBean); + } + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboApiWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboCoreWriteServiceImpl.java similarity index 43% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboApiWriteServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboCoreWriteServiceImpl.java index 915f51e7846fba4ec2c5aa64168e8ea9b0596d04..53955504e9c15515d22ebd741892c63af91fb4d5 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboApiWriteServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dubbo/DubboCoreWriteServiceImpl.java @@ -1,14 +1,15 @@ -package com.coderman.codemaker.app.dubbo; +package com.tianhua.codemaker.app.dubbo; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateDubboConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.utils.Constant; +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.config.ProjectTemplateDubboConfig; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.utils.Constant; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -18,16 +19,14 @@ import java.io.IOException; /** * Description: - * date: 2021/6/18 + * date: 2021/6/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 - * - * 写api模块服务 */ -@Component(value = "dubboApiWriteFileService") -public class DubboApiWriteServiceImpl extends WriteService implements IWriteFileService { +@Component(value = "dubboCoreWriteFileService") +public class DubboCoreWriteServiceImpl extends WriteService implements IWriteFileService { @Autowired private ProjectTemplateDubboConfig projectTemplateDubboConfig; @@ -35,46 +34,31 @@ public class DubboApiWriteServiceImpl extends WriteService implements IWriteFile @Autowired private AppServiceConfig appServiceConfig; - @Override - public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateDubboConfig.getModuleApiPath()); + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO.getTempFileName())){ - classContentBean.setChildPackageName("api.dto"); - classContentBean.setClassSuffix("DTO.java"); - writeDTO(classContentBean); - } + private static final String moduleCode = "core"; - //写api.dto-ddd - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DTO_DDD.getTempFileName())){ - classContentBean.setChildPackageName("api.dto"); - classContentBean.setClassSuffix("DTO.java"); - writeRoute(classContentBean); - } - //写facade - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.FACADE.getTempFileName())){ - classContentBean.setHumpClassName(writeContentBean.getHumpClassName().toLowerCase().endsWith("facade") ? writeContentBean.getHumpClassName() : writeContentBean.getHumpClassName()+"Facade"); - classContentBean.setChildPackageName("api.facade"); - classContentBean.setClassSuffix("Facade.java"); - writeRoute(classContentBean); - } - //写domain.enum - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.ENUM.getTempFileName())){ - classContentBean.setChildPackageName("domain.enums"); - writeRoute(classContentBean); - } + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateDubboConfig.getModuleCorePath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); //写自定义工具类 if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ writeRoute(classContentBean); } + //写config文件 + if(writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)){ + writeConfig(classContentBean); + } } /** - * 写dto文件 + * 写class文件 * @param classContentBean */ - public void writeDTO(ClassContentBean classContentBean) { + public void writeClassFile(ClassContentBean classContentBean) { String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); try { FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); @@ -83,7 +67,6 @@ public class DubboApiWriteServiceImpl extends WriteService implements IWriteFile } } - /** * @param childPackageName 最后一级子包名称 * @param humpClassName 驼峰式类名 @@ -95,7 +78,22 @@ public class DubboApiWriteServiceImpl extends WriteService implements IWriteFile String packagePath = packageName.replace(".", "/"); packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; String fileName = humpClassName + classSuffix; - return projectTemplateDubboConfig.getModuleApiPath() + packagePath + "/" + fileName; + return projectTemplateDubboConfig.getModuleCorePath() + packagePath + "/" + fileName; + } + + /** + * 写测试文件 + * @param childPackageName + * @param humpClassName + * @param classSuffix + * @return + */ + public String getTestFilePath(String childPackageName, String humpClassName, String classSuffix) { + String packageName = appServiceConfig.getPackage(); + String packagePath = packageName.replace(".", "/"); + packagePath = Constant.TEST_JAVA + "/" + packagePath + childPackageName; + String fileName = humpClassName + classSuffix; + return projectTemplateDubboConfig.getModuleCorePath() + packagePath + "/" + fileName; } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/ClassBeanFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ClassBeanFactory.java similarity index 85% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/ClassBeanFactory.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ClassBeanFactory.java index 8618cca733f5450abe01e560e1cd93d3e10e440a..bc6d819b962855a20a3482819080bcdc3094b176 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/ClassBeanFactory.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ClassBeanFactory.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.app.dynamicddd; +package com.tianhua.codemaker.app.dynamicddd; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.FieldBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.FieldBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; import org.assertj.core.util.Lists; import org.springframework.stereotype.Service; @@ -13,7 +13,7 @@ import java.util.List; * Description: * date: 2021/11/1 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/ClassConvertFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ClassConvertFactory.java similarity index 94% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/ClassConvertFactory.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ClassConvertFactory.java index 3fe2ff04cf30625b7874d6b6809c3e1e7ca70612..67891524c3dadf18745be2a4101a60a6607281c5 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/ClassConvertFactory.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ClassConvertFactory.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.app.dynamicddd; - -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.enums.VisibilityEnum; -import com.coderman.codemaker.utils.StringHelperUtils; +package com.tianhua.codemaker.app.dynamicddd; + +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.VisibilityEnum; +import com.tianhua.codemaker.utils.StringHelperUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; @@ -14,13 +14,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** * Description:类转换构建工厂 * date: 2021/10/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -263,6 +264,9 @@ public class ClassConvertFactory { classBean.setMethodBeanList(methodBeanList); classBean.setFieldBeanList(fieldBeanList); classBean.setImportClassList(interfaceBean.getImportClassList()); + classBean.getImportClassList().addAll(interfaceBean.getChildClassImportPackageList()); + interfaceBean.getDynamicImportPackageList().forEach(str -> classBean.addImportClass(str)); + classBean.setRelationClassStr(" implements " + interfaceBean.getClassName()); facadeImplList.add(classBean); } @@ -318,6 +322,7 @@ public class ClassConvertFactory { facadeMethodList.addAll(newMethodList); } } + classBean.getDynamicImportPackageList().stream().forEach(str-> facadeInterfaceBean.addDynamicImportClass(str)); facadeInterfaceBean.setContext(classBean.getContext()); }); facadeMethodList.forEach(methodBean -> methodBean.buildParamArr()); @@ -409,6 +414,7 @@ public class ClassConvertFactory { controllerMethodList.addAll(newMethodList); } } + classBean.getDynamicImportPackageList().stream().forEach(str -> controllerBean.addImportClass(str)); }); controllerMethodList.forEach(methodBean -> methodBean.buildParamArr()); controllerBean.setMethodBeanList(controllerMethodList); @@ -567,7 +573,7 @@ public class ClassConvertFactory { Set importClassSet = new HashSet<>(); List classMethodList = new ArrayList<>(); - + AtomicInteger i = new AtomicInteger(); v.stream().forEach(classBean -> { List methodBeanList = new ArrayList<>(); @@ -579,7 +585,7 @@ public class ClassConvertFactory { .trim(); String[] arr = voClassNameStr.split(","); - int i = 0; + for (String voClassName : arr) { String varBOClassName = classBean.getClassName().substring(0, 1).toLowerCase().concat(classBean.getClassName().substring(1)); @@ -596,7 +602,7 @@ public class ClassConvertFactory { if (StringUtils.isEmpty(varVoName)) { varVoName = "vo"; } - String volist2bolist = methodBeanFactory.getvolist2boListMethod(i); + String volist2bolist = methodBeanFactory.getvolist2boListMethod(i.get()); dtoList2boList.setMethodName(volist2bolist + "(List<" + voClassName + "> " + varVoName + "List)"); dtoList2boList.setReturnClass("List<" + classBean.getClassName() + ">"); methodBeanList.add(dtoList2boList); @@ -609,12 +615,12 @@ public class ClassConvertFactory { methodBeanList.add(bo2to); MethodBean boList2dtoList = new MethodBean(); - String bolist2volist = methodBeanFactory.getbolist2voListMethod(i); + String bolist2volist = methodBeanFactory.getbolist2voListMethod(i.get()); boList2dtoList.setMethodName(bolist2volist + "(List<" + classBean.getClassName() + "> " + varBOClassName + "List)"); boList2dtoList.setReturnClass("List<" + voClassName + ">"); methodBeanList.add(boList2dtoList); - i++; + i.getAndIncrement(); } classMethodList.addAll(methodBeanList); } @@ -654,6 +660,35 @@ public class ClassConvertFactory { return methodBeanList; } + /** + * 处理派生类service->serviceimpl + * + * @param serviceInterfaceList + * @return + */ + public List geServiceImplList(List serviceInterfaceList) { + List serviceImplList = new ArrayList<>(); + + for (InterfaceBean interfaceBean : serviceInterfaceList) { + ClassBean classBean = new ClassBean(); + String className = interfaceBean.getClassName() + "Impl"; + classBean.setClassName(className); + classBean.setClassDesc(classBean.getClassDesc()); + classBean.setPlantUMLPackage("infrast.serviceImpl"); + classBean.setPackageName(appServiceConfig.getPackage() + "." + classBean.getPlantUMLPackage()); + if (CollectionUtils.isNotEmpty(interfaceBean.getMethodBeanList())) { + classBean.setMethodBeanList(getMethodBeanList(interfaceBean.getMethodBeanList())); + classBean.setFieldBeanList(interfaceBean.getFieldBeanList()); + } else { + classBean.setMethodBeanList(Lists.newArrayList()); + } + classBean.setImportClassList(interfaceBean.getImportClassList()); + classBean.setRelationClassStr(" implements " + interfaceBean.getClassName()); + serviceImplList.add(classBean); + } + return serviceImplList; + } + /** * 处理派生类gataway->gatawayimpl * @@ -860,4 +895,5 @@ public class ClassConvertFactory { return Lists.newArrayList(classBeanMap.values()); } + } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DerivedClassFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/DerivedClassFactory.java similarity index 93% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DerivedClassFactory.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/DerivedClassFactory.java index 7365b60c7680bb336549a67ea418f61cfeab3b51..13389758b53c3017b2fe06b14d395a0ce3a00643 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DerivedClassFactory.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/DerivedClassFactory.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.app.dynamicddd; +package com.tianhua.codemaker.app.dynamicddd; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.enums.TemplateFileEnum; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -13,7 +13,7 @@ import java.util.*; * 派生类工厂服务 * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -83,6 +83,9 @@ public class DerivedClassFactory { public void deriveDOBOConvert(List boElementBeanList, PlantUmlContextBean plantUmlContextBean) { Map convertMap = classConvertFactory.getDOBOConvertInterfaceList(boElementBeanList); List doboConvertInterfaceList = (List) convertMap.get("doboConvertList"); + if(CollectionUtils.isEmpty(doboConvertInterfaceList)){ + return; + } Map BoConvertRelationMap = (Map) convertMap.get("doboConvertRelationMap"); //将派生类放到派生类上下文里面 @@ -135,6 +138,7 @@ public class DerivedClassFactory { interfaceBean.setAuthor(v.getAuthor()); interfaceBean.setContext(v.getContext()); interfaceBean.setDerived(v.isDerived()); + v.getDynamicImportPackageList().forEach(str -> interfaceBean.addDynamicImportClass(str)); plantUmlContextBean.getDerivedPlantUmlContextBean().addInterfaceBean(interfaceBean); } } else { @@ -204,6 +208,7 @@ public class DerivedClassFactory { classBean.setImplInterfaceBean(v.getImplInterfaceBean()); classBean.setAuthor(v.getAuthor()); classBean.setDerived(v.isDerived()); + classBean.setAnnotationTagList(v.getAnnotationTagList()); plantUmlContextBean.getDerivedPlantUmlContextBean().addClassBean(classBean); } } else { @@ -300,6 +305,20 @@ public class DerivedClassFactory { } + /** + * 处理gataway到gatawayimpl的派生 + * + * @param serviceElementBeanList + * @param plantUmlContextBean + */ + public List deriveService2ServiceImpl(List serviceElementBeanList, PlantUmlContextBean plantUmlContextBean) { + List gatawayImplList = classConvertFactory.geServiceImplList(serviceElementBeanList); + if (CollectionUtils.isNotEmpty(gatawayImplList)) { + gatawayImplList.forEach(classBean -> plantUmlContextBean.getClassBeanMap().put(classBean.getClassName(), classBean)); + } + return gatawayImplList; + } + /** * 处理infrast acl到infrastaclimpl的派生 * diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DynamicDDDWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/DynamicDDDWriteServiceImpl.java similarity index 91% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DynamicDDDWriteServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/DynamicDDDWriteServiceImpl.java index 5372faa458c82d5205126070f69697cbf195dcf0..c569516a9484287ae8d06a6188d803350a963759 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/DynamicDDDWriteServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/DynamicDDDWriteServiceImpl.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd; - -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.ProjectTemplateDynamicDDDConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; +package com.tianhua.codemaker.app.dynamicddd; + +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateDynamicDDDConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.app.IWriteFileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -14,7 +14,7 @@ import org.springframework.stereotype.Component; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ElementHandlerContainer.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ElementHandlerContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..97f57fc120f0a9295e5645795f9f412932b2e18f --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ElementHandlerContainer.java @@ -0,0 +1,61 @@ +package com.tianhua.codemaker.app.dynamicddd; + +import com.tianhua.codemaker.annotations.ElementTag; +import com.tianhua.codemaker.api.DomainElementHandler; +import lombok.extern.slf4j.Slf4j; +import org.springframework.aop.support.AopUtils; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +/** + * Description: + * date: 2022/1/17 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +@Slf4j +public class ElementHandlerContainer implements ApplicationContextAware { + + private Map elementHandlerMap = new HashMap<>(); + + + /** + * 根据代码元素 + * @param codeElement + * @return + */ + public DomainElementHandler getElementHandler(String codeElement) { + return elementHandlerMap.get(codeElement); + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + Environment environment = applicationContext.getEnvironment(); + Map beansOfMQHandler = applicationContext.getBeansWithAnnotation(ElementTag.class); + for (Map.Entry entry : beansOfMQHandler.entrySet()) { + // 获取Handler中的代码元素标签 + ElementTag identifier = AopUtils.getTargetClass(entry.getValue()).getAnnotation(ElementTag.class); + String elementTag = environment.resolveRequiredPlaceholders(identifier.elementName()).intern(); + if(elementTag.contains(",")){ + String [] elementArr = elementTag.split(","); + //多个element共用一个代码元素处理器 + for (String element : elementArr){ + elementHandlerMap.put(element, (DomainElementHandler) entry.getValue()); + } + }else{ + elementHandlerMap.put(elementTag, (DomainElementHandler) entry.getValue()); + } + + } + log.info(">>>>>代码元素处理标签", elementHandlerMap); + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/MethodBeanFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/MethodBeanFactory.java similarity index 91% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/MethodBeanFactory.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/MethodBeanFactory.java index f3e1421d2dbf811a10dc26cdf820cc9a32676eb2..7da53770f674b59ae2fb416cc6e6bf21515288a2 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/MethodBeanFactory.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/MethodBeanFactory.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.app.dynamicddd; +package com.tianhua.codemaker.app.dynamicddd; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; import org.assertj.core.util.Lists; import org.springframework.stereotype.Service; @@ -13,16 +13,16 @@ import java.util.List; * Description:动态方法工厂 * date: 2021/11/1 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Service public class MethodBeanFactory { private List do2boList = Lists.newArrayList("do2bo", "DO2DO", "do2Bo", "Do2Bo"); - private List vos2bosList = Lists.newArrayList("VOs2BOs", "voList2boList", "volist2boList", "voList2BoList","vos2bos"); + private List vos2bosList = Lists.newArrayList("VOs2BOs", "voList2boList", "volist2boList", "voList2BoList","vos2bos","volist2bolist","vos2BOs"); - private List bos2vosList = Lists.newArrayList("BOs2VOs", "boList2voList", "bolist2voList", "boList2VoList","bos2vos"); + private List bos2vosList = Lists.newArrayList("BOs2VOs", "boList2voList", "bolist2voList", "boList2VoList","bos2vos","boList2VOList","bos2VOs"); @@ -66,7 +66,7 @@ public class MethodBeanFactory { if(index >= vos2bosList.size()){ return vos2bosList.get(vos2bosList.size()-1)+"V"+(index - vos2bosList.size()); } - return vos2bosList.get(Math.abs(random.nextInt(vos2bosList.size()))); + return vos2bosList.get(index); } public String getbolist2voListMethod(int index){ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ValidateFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ValidateFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..5e6f40d302ebf14b0f8ba2125f2d0feea8a3d0db --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/ValidateFactory.java @@ -0,0 +1,46 @@ +package com.tianhua.codemaker.app.dynamicddd; + +/** + * Description:参数校验模式实现工厂 + * date: 2022/1/24 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class ValidateFactory { + /** + * + * + * + * 1.在dto,vo中构建参数验证逻辑,-->代码片段模式 + * 2.独立构建一个validator包 + * 3.走aop+属性注解(相当于自定义实现) + * 4.走工具类+反射的方式 + * 5.spring validator注解 + */ + + /** + * 4.走工具类+反射的方式 + * @return + */ + public String buildByToolsAndReflection(){ + return null; + } + + /** + * 2.独立构建一个validator包 + * @return + */ + public String buildByValidator(){ + return null; + } + + /** + * 1.在dto,vo中构建参数验证逻辑 + * @return + */ + public String buildByInnerParam(){ + return null; + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedControllerElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedControllerElementHandler.java similarity index 73% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedControllerElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedControllerElementHandler.java index eb718f677cee337925feb5d903fe1041c30440e9..f51d6283aa0d3b508239ba3775a1f1015cf77f27 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedControllerElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedControllerElementHandler.java @@ -1,14 +1,14 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; - -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.ControllerElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.ControllerElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -21,7 +21,7 @@ import java.util.stream.Collectors; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理派生类bo->dto @@ -31,7 +31,7 @@ public class DerivedControllerElementHandler implements DomainElementHandler { + if(methodBean.getMethodName().contains(".")){ + methodBean.setMethodName(methodBean.getMethodName().split("\\.")[1]); + } methodBean.buildDoc(); buildParamAnnotation(methodBean); }); @@ -89,25 +92,21 @@ public class DerivedControllerElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public DoBoConvertElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedDTO2DTOConvertElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedDTO2DTOConvertElementHandler.java similarity index 72% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedDTO2DTOConvertElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedDTO2DTOConvertElementHandler.java index 958f9147f871a3af584dbd629e5b71d12f214065..b2e9baba55e00ac9a481365fd96a16e2646baad7 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedDTO2DTOConvertElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedDTO2DTOConvertElementHandler.java @@ -1,12 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; - -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.Dto2DtoConvertElementBean; -import com.coderman.codemaker.bean.dddelementderive.VoBoConvertElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; -import com.coderman.codemaker.service.ImportPackageService; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.Dto2DtoConvertElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,7 +16,7 @@ import java.util.List; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理派生类bo->dto @@ -26,7 +25,7 @@ import java.util.List; public class DerivedDTO2DTOConvertElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public Dto2DtoConvertElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedDTOBOConvertElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedDTOBOConvertElementHandler.java similarity index 69% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedDTOBOConvertElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedDTOBOConvertElementHandler.java index b5c613233ff6c9f76f008e6b9034158c9dbcea9b..9120239773c16c78c0acb6b0673a467e3fd2bc73 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedDTOBOConvertElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedDTOBOConvertElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.DtoBoConvertElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.DtoBoConvertElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,7 +16,7 @@ import java.util.List; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理派生类bo->dto @@ -25,7 +25,7 @@ import java.util.List; public class DerivedDTOBOConvertElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public DtoBoConvertElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { @@ -40,6 +40,9 @@ public class DerivedDTOBOConvertElementHandler implements DomainElementHandlerdto @@ -34,7 +34,7 @@ public class DerivedDTOElementHandler implements DomainElementHandlerrpc.client.enum @@ -25,7 +25,7 @@ import java.util.stream.Collectors; public class DerivedEnumElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public EnumElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeElementHandler.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeElementHandler.java index 436d45235c39263260c57e9db3da16391d42e1a3..6e2f0376545960ac47436f0090db487501d8b959 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeElementHandler.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.FacadeElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.FacadeElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -21,10 +21,10 @@ import java.util.stream.Collectors; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 - * 处理派生类bo->dto + * 处理派生类facade */ @Component(value = "derivedFacadeElementHandler") public class DerivedFacadeElementHandler implements DomainElementHandler { @@ -32,7 +32,7 @@ public class DerivedFacadeElementHandler implements DomainElementHandler methodBean.setMethodName(methodBean.getMethodName().split("\\.")[1])); v.setMethodBeanList(methodBeanFilterList); } - v.getMethodBeanList().forEach(methodBean -> methodBean.buildDoc()); + v.getMethodBeanList().forEach(methodBean -> { + if(methodBean.getMethodName().contains(".")){ + methodBean.setMethodName(methodBean.getMethodName().split("\\.")[1]); + } + methodBean.buildDoc(); + }); importPackageService.dealImportClass(v,plantUmlContextBean); facadeElementBeanList.add(v); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeImplElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeImplElementHandler.java similarity index 59% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeImplElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeImplElementHandler.java index 57c2173b1182435c8a1d842398b09ea7051c0b40..bceb39f5cd0e0734c2ecf28b50597df1e05c8d42 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeImplElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFacadeImplElementHandler.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.FacadeImplElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.FacadeImplElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,40 +17,41 @@ import java.util.List; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理派生类bo->dto */ @Component(value = "derivedFacadeImplElementHandler") public class DerivedFacadeImplElementHandler implements DomainElementHandler { - @Autowired - private DerivedClassFactory derivedClassFactory; @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public FacadeImplElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { if(plantUmlContextBean.getDerivedPlantUmlContextBean() == null){ return null; } - FacadeImplElementBean FacadeImplElementBean = new FacadeImplElementBean(); + FacadeImplElementBean facadeImplElementBean = new FacadeImplElementBean(); List facadeImplElementBeanList = new ArrayList<>(); plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k,v)->{ if(v.getClassName().toLowerCase().endsWith(DomainDerivedElementEnum.FACADE_IMPL.getElement())){ importPackageService.setPackageName(v,"app.facadeimpl"); String className = v.getClassName().substring(0,1).toUpperCase().concat(v.getClassName().substring(1)); v.setClassName(className); + if(CollectionUtils.isNotEmpty(v.getMethodBeanList())){ + v.getMethodBeanList().stream().forEach(methodBean -> methodBean.refreshReturnBodyByReturnType()); + } facadeImplElementBeanList.add(v); } }); facadeImplElementBeanList.stream().forEach(v-> importPackageService.dealImportClass(v,plantUmlContextBean)); - FacadeImplElementBean.setClassBeanList(facadeImplElementBeanList); + facadeImplElementBean.setClassBeanList(facadeImplElementBeanList); - return FacadeImplElementBean; + return facadeImplElementBean; } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFeignElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFeignElementHandler.java similarity index 66% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFeignElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFeignElementHandler.java index fb55e1c7209e17bb8f707f356298cee229cafcdd..5be6f7e50a12b6c5103c6e0e000b8a7cf1316291 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedFeignElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedFeignElementHandler.java @@ -1,28 +1,23 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; - -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.FacadeElementBean; -import com.coderman.codemaker.bean.dddelementderive.FeignElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; -import com.coderman.codemaker.service.ImportPackageService; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.FeignElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理派生类bo->dto @@ -33,7 +28,7 @@ public class DerivedFeignElementHandler implements DomainElementHandler methodBean.refreshReturnBodyByReturnType()); + } interfaceBeanList.add(v); } }); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedInfrastAclImplElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedInfrastAclImplElementHandler.java similarity index 70% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedInfrastAclImplElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedInfrastAclImplElementHandler.java index 5a79ff1dce1f2aad96f0724d11233a76f9a19a3a..74606a4476cb8b9d3a3926ba4d0234674109441a 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedInfrastAclImplElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedInfrastAclImplElementHandler.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.InfrastAclImplElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.InfrastAclImplElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -18,7 +18,7 @@ import java.util.List; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理infrastaclImpl @@ -29,7 +29,7 @@ public class DerivedInfrastAclImplElementHandler implements DomainElementHandler private DerivedClassFactory derivedClassFactory; @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public InfrastAclImplElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedRepositoryImplElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedRepositoryImplElementHandler.java similarity index 66% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedRepositoryImplElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedRepositoryImplElementHandler.java index d4a007954e8b24efd71bac15892c0b8575cb495f..51082ceecd0245b436cc77ed08c67be71c833f17 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedRepositoryImplElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedRepositoryImplElementHandler.java @@ -1,13 +1,14 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.RepositoryImplElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.RepositoryImplElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -18,7 +19,7 @@ import java.util.List; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理repositoryimpl @@ -29,7 +30,7 @@ public class DerivedRepositoryImplElementHandler implements DomainElementHandler private DerivedClassFactory derivedClassFactory; @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public RepositoryImplElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { @@ -43,6 +44,9 @@ public class DerivedRepositoryImplElementHandler implements DomainElementHandler importPackageService.setPackageName(v,"app.facadeimpl"); String className = v.getClassName().substring(0,1).toUpperCase().concat(v.getClassName().substring(1)); v.setClassName(className); + if(CollectionUtils.isNotEmpty(v.getMethodBeanList())){ + v.getMethodBeanList().stream().forEach(methodBean -> methodBean.refreshReturnBodyByReturnType()); + } repositoryElementBeanList.add(v); } }); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedServiceImplElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedServiceImplElementHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..d2e9aaa8a0b03a440748eb5ccd5f7db25156f7c2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedServiceImplElementHandler.java @@ -0,0 +1,68 @@ +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; + +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.bean.dddelementderive.FacadeImplElementBean; +import com.tianhua.codemaker.bean.dddelementderive.ServiceImplElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * Description: + * date: 2021/7/8 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + * 处理serviceimpl + */ +@Component(value = "derivedServiceImplElementHandler") +public class DerivedServiceImplElementHandler implements DomainElementHandler { + + @Autowired + private ImportPackageServiceImpl importPackageService; + @Autowired + private DerivedClassFactory derivedClassFactory; + + @Override + public ServiceImplElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { + if(plantUmlContextBean.getDerivedPlantUmlContextBean() == null){ + return null; + } + ServiceImplElementBean serviceImplElementBean = new ServiceImplElementBean(); + List serviceList = new ArrayList<>(); + plantUmlContextBean.getInterfaceBeanMap().forEach((k,v)->{ + if(v.getClassName().toLowerCase().endsWith(DomainElementEnum.SERVICE.getElement())){ + importPackageService.setPackageName(v,"infrast.serviceimpl"); + String className = v.getClassName().substring(0,1).toUpperCase().concat(v.getClassName().substring(1)); + v.setClassName(className); + if(CollectionUtils.isNotEmpty(v.getMethodBeanList())){ + v.getMethodBeanList().stream().forEach(methodBean -> methodBean.refreshReturnBodyByReturnType()); + } + serviceList.add(v); + } + }); + + serviceList.stream().forEach(v-> importPackageService.dealImportClass(v,plantUmlContextBean)); + + + List serviceImplElementBeanList = derivedClassFactory.deriveService2ServiceImpl(serviceList,plantUmlContextBean); + + serviceImplElementBeanList.stream().forEach(v-> importPackageService.dealImportClass(v,plantUmlContextBean)); + + serviceImplElementBean.setClassBeanList(serviceImplElementBeanList); + + return serviceImplElementBean; + + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedVOBOConvertElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedVOBOConvertElementHandler.java similarity index 80% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedVOBOConvertElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedVOBOConvertElementHandler.java index ba0cb30e4ee9dad3a3d4a8f832e4f5873731445d..cca15f3a4eed7e197d4099223a06dcf5feabb7bc 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedVOBOConvertElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedVOBOConvertElementHandler.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.VoBoConvertElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.VoBoConvertElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,7 +17,7 @@ import java.util.List; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理派生类bo->dto @@ -26,7 +26,7 @@ import java.util.List; public class DerivedVOBOConvertElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public VoBoConvertElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedVOElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedVOElementHandler.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedVOElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedVOElementHandler.java index b9636e332ee3638a3c73742ac91dba5da3b3867e..7aff7037944aaab18edba450fbfe2eff2f7ade81 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/derivedhandler/DerivedVOElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/derivedhandler/DerivedVOElementHandler.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.app.dynamicddd.derivedhandler; +package com.tianhua.codemaker.app.dynamicddd.derivedhandler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelementderive.VoElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.FieldBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelementderive.VoElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.FieldBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -19,7 +19,7 @@ import java.util.stream.Collectors; * Description: * date: 2021/7/8 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 处理派生类bo->dto @@ -30,7 +30,7 @@ public class DerivedVOElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public ExecutorElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/AppListenerElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/AppListenerElementHandler.java similarity index 72% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/AppListenerElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/AppListenerElementHandler.java index 96c070ead9efc4c2232783317e7b040111c41893..9222434aa2baf5430a8d8198d8d91c181f34e36a 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/AppListenerElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/AppListenerElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; +package com.tianhua.codemaker.app.dynamicddd.handler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.AppListenerElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.AppListenerElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,7 +16,7 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -24,7 +24,7 @@ import java.util.List; public class AppListenerElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public AppListenerElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/CacheElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/CacheElementHandler.java similarity index 77% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/CacheElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/CacheElementHandler.java index 6405d7a6632249d00ff962dc886ad21dfd1e3c4b..a9dc9e7243157b6ec54d7804111d59c7047b9554 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/CacheElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/CacheElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; - -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.CacheElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.service.ImportPackageService; +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.CacheElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,7 +17,7 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -25,7 +25,7 @@ import java.util.List; public class CacheElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public CacheElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainBoElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainBoElementHandler.java similarity index 88% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainBoElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainBoElementHandler.java index efdb56a1b046a2e6b9076570c33d9780ad8452df..c36473eb89bfb6516618614bea13913670fc59ae 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainBoElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainBoElementHandler.java @@ -1,13 +1,14 @@ -package com.coderman.codemaker.app.dynamicddd.handler; - -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.DomainBoElementBean; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.enums.DomainElementEnum; +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.annotations.ElementTag; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.DomainBoElementBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.apache.commons.collections4.CollectionUtils; import org.assertj.core.util.Lists; import org.springframework.beans.factory.annotation.Autowired; @@ -20,18 +21,19 @@ import java.util.stream.Collectors; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Component(value = "domainBoElementHandler") +@ElementTag(elementName = "bo") public class DomainBoElementHandler implements DomainElementHandler { @Autowired private DerivedClassFactory derivedClassFactory; @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public DomainBoElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { @@ -46,6 +48,7 @@ public class DomainBoElementHandler implements DomainElementHandler boWithQueryDTOKeyList = new ArrayList<>(); List boWithQueryVOKeyList = new ArrayList<>(); List boWithExportACLKeyList = new ArrayList<>(); + List boWithValidateKeyList = new ArrayList<>(); //过滤带有数据库表映射的bo @@ -118,6 +121,12 @@ public class DomainBoElementHandler implements DomainElementHandler optionalFieldBeanValidateKey = v.getFieldBeanList().stream().filter(f -> f.isValidateKey()).findFirst(); + if (optionalFieldBeanValidateKey.isPresent()) { + boWithValidateKeyList.add(v); + v.getExtendFieldBean().buildValidteKeyArr(optionalFieldBeanValidateKey.get().getFieldName()); + } } }); //bo 派生 do-bo convert @@ -168,8 +177,6 @@ public class DomainBoElementHandler implements DomainElementHandler { if (v.getClassName().toLowerCase().endsWith(DomainElementEnum.BO.getElement()) && !v.getClassName().equals("PageBO")) { //过滤扩展属性 @@ -181,7 +188,7 @@ public class DomainBoElementHandler implements DomainElementHandler {methodBean.refreshReturnBodyByReturnType();}); + methodBeanList.stream().forEach(methodBean -> methodBean.refreshReturnBodyByReturnType()); v.setMethodBeanList(methodBeanList); String className = v.getClassName().substring(0, 1).toUpperCase().concat(v.getClassName().substring(1)); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainFactoryElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainFactoryElementHandler.java similarity index 73% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainFactoryElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainFactoryElementHandler.java index 2b32fe2c667d22bce6bb1a7f2610127200d63cdc..70358294f8bed11ab8fe0d0c8e70d790da544982 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainFactoryElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainFactoryElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; +package com.tianhua.codemaker.app.dynamicddd.handler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.FactoryElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.FactoryElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,7 +16,7 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -24,7 +24,7 @@ import java.util.List; public class DomainFactoryElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public FactoryElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainGatawayElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainGatawayElementHandler.java similarity index 73% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainGatawayElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainGatawayElementHandler.java index 44813efeb6185b2aba5fd48bdc15eb7f006762cf..2bea0a30c2a88dc940085ce1e3a6f3f4c9cbea3f 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DomainGatawayElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainGatawayElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.GatawayElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.GatawayElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,14 +16,14 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Component(value = "domainGatawayElementHandler") public class DomainGatawayElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public GatawayElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainServiceElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainServiceElementHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..24fab3a921a8f0ea4b40e642eb11aecc2f3eeef7 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DomainServiceElementHandler.java @@ -0,0 +1,50 @@ +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.GatawayElementBean; +import com.tianhua.codemaker.bean.dddelement.ServiceElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * Description: + * date: 2021/6/29 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "domainServiceElementHandler") +public class DomainServiceElementHandler implements DomainElementHandler { + @Autowired + private ImportPackageServiceImpl importPackageService; + + @Override + public ServiceElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { + ServiceElementBean serviceElementBean = new ServiceElementBean(); + List gatawInterfaceBeanList = new ArrayList<>(); + plantUmlContextBean.getInterfaceBeanMap().forEach((k,v)->{ + if(v.getClassName().toLowerCase().endsWith(DomainElementEnum.SERVICE.getElement())){ + importPackageService.setPackageName(v,"domain.service"); + + String className = v.getClassName().substring(0,1).toUpperCase().concat(v.getClassName().substring(1)); + v.setClassName(className); + importPackageService.dealImportClass(v,plantUmlContextBean); + gatawInterfaceBeanList.add(v); + v.getMethodBeanList().forEach(methodBean -> methodBean.buildDoc()); + } + }); + + serviceElementBean.setInterfaceBeanList(gatawInterfaceBeanList); + return serviceElementBean; + } + + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DynamicMapperElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DynamicMapperElementHandler.java similarity index 53% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DynamicMapperElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DynamicMapperElementHandler.java index 9fc70ce7b13937597860e8f79438dbe8327afb09..156954bbf07fed52fd1eaea0676a547929ad8c2d 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DynamicMapperElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DynamicMapperElementHandler.java @@ -1,12 +1,16 @@ -package com.coderman.codemaker.app.dynamicddd.handler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.MapperMethodConstant; -import com.coderman.codemaker.bean.dddelement.DynamicMapperElementBean; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.MapperMethodConstant; +import com.tianhua.codemaker.bean.dddelement.DynamicMapperElementBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; +import org.assertj.core.util.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -20,14 +24,17 @@ import java.util.stream.Collectors; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Component(value = "dynamicMapperElementHandler") public class DynamicMapperElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; + + @Autowired + private AppServiceConfig appServiceConfig; @Override public DynamicMapperElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { @@ -50,7 +57,12 @@ public class DynamicMapperElementHandler implements DomainElementHandler fieldBeanList1 = convertDefaultSqlXmlFieldBeanList(mapperXmlBean); + fieldBeanList.addAll(fieldBeanList1); return fieldBeanList; } @@ -138,14 +152,40 @@ public class DynamicMapperElementHandler implements DomainElementHandler\n" + + private String buildUpdateSqlXml(String methodName, String tableName, String parameterTypeStr, List columnBeanList) { + StringBuilder sqlTemplate = new StringBuilder(); + sqlTemplate.append(" \n" + " update tableName\n" + - " set\n" + - " ${table.updateColumnNameList}\n" + - " where id = #{id}\n" + - " "; - return sqlTemplate.replace("methodName", methodName).replace("tableName", tableName).replace("parameterTypeStr", parameterTypeStr); + " \n"); + boolean containsDateUpdate = false; + int c = 0; + for (ColumnBean columnBean : columnBeanList){ + c++; + if(columnBean.getColumnName().equals("id")){ + continue; + } + if(columnBean.getColumnName().equals("date_update")){ + containsDateUpdate = true; + continue; + } + + String sqlIf = " columnName = #{columnField},\n"; + if(!containsDateUpdate && c == (columnBeanList.size()-1)){ + sqlIf = sqlIf.replace(",",""); + } + sqlIf = sqlIf.replace("columnField",columnBean.getColumnFieldName()).replace("columnName",columnBean.getColumnName()); + sqlTemplate.append(sqlIf); + } + + if(containsDateUpdate){ + sqlTemplate.append(" date_update = now()\n"); + } + + sqlTemplate.append( " \n"); + sqlTemplate.append(" where id = #{id}\n" + + " "); + + return sqlTemplate.toString().replace("methodName", methodName).replace("tableName", tableName).replace("parameterTypeStr", parameterTypeStr); } /** @@ -191,18 +231,106 @@ public class DynamicMapperElementHandler implements DomainElementHandler convertDefaultSqlXmlFieldBeanList(ClassBean mapperXmlBean) { + List fieldBeanList = new ArrayList<>(); + String tableName = mapperXmlBean.getTableBean().getTableName(); + FieldBean insertFieldBean = new FieldBean(); + Optional doTypePackage = mapperXmlBean.getImportClassList().stream().filter(str -> str.endsWith("DO")).findFirst(); + String parameterTypeStr = tableName; + if (doTypePackage.isPresent()) { + parameterTypeStr = doTypePackage.get(); + } + mapperXmlBean.getTableBean().getInsertColumnNames(); + insertFieldBean.setFieldName(buildDefaultInsertSqlXml("insert", mapperXmlBean.getTableBean(), parameterTypeStr)); + fieldBeanList.add(insertFieldBean); + + + FieldBean deleteFieldBean = new FieldBean(); + deleteFieldBean.setFieldName(buildDefaultDeleteSqlXml("deleteById",tableName)); + fieldBeanList.add(deleteFieldBean); + + + + FieldBean updateFieldBean = new FieldBean(); + updateFieldBean.setFieldName(buildUpdateSqlXml("update",tableName,parameterTypeStr, mapperXmlBean.getColumnBeanList())); + fieldBeanList.add(updateFieldBean); + + + + FieldBean getByIdFieldBean = new FieldBean(); + getByIdFieldBean.setFieldName(buildDefaultGetByIdSqlXml("getById",tableName)); + fieldBeanList.add(getByIdFieldBean); + + + FieldBean getAllFieldBean = new FieldBean(); + getAllFieldBean.setFieldName(buildSelectSqlXml("getAll",tableName)); + fieldBeanList.add(getAllFieldBean); + + + return fieldBeanList; + } + + + private String buildDefaultInsertSqlXml(String methodName, TableBean tableBean, String parameterTypeStr) { + String sqlTemplate = " \n" + + " insert into tableName(\n" + + " ${table.insertColumnNames}\n" + + " )\n" + + " values(\n" + + " ${table.insertColumnNameList}\n" + + " )\n" + + " "; + return sqlTemplate.replace("methodName", methodName) + .replace("tableName", tableBean.getTableName()) + .replace("${table.insertColumnNames}", tableBean.getInsertColumnNames()) + .replace("${table.insertColumnNameList}", tableBean.getInsertColumnNameList()) + .replace("parameterTypeStr",parameterTypeStr); + + } + + /** + * 构建删除sqlxml + * + * @param methodName + * @return + */ + private String buildDefaultDeleteSqlXml(String methodName, String tableName) { + String sqlTemplate = " \n" + + " delete from table.tableName where id = #{id}\n" + + " "; + return sqlTemplate.replace("methodName", methodName).replace("tableName", tableName); + } + + + /** + * 构建查询sqlxml + * + * @param methodName + * @return + */ + private String buildDefaultGetByIdSqlXml(String methodName, String tableName) { + String sqlTemplate = " "; + return sqlTemplate.replace("methodName", methodName).replace("tableName", tableName); + } + } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DynamicMapperXmlElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DynamicMapperXmlElementHandler.java similarity index 70% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DynamicMapperXmlElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DynamicMapperXmlElementHandler.java index 7ee7d1ee69562dad59e365a9a6cd09be41c04bd2..99507beea4fb7d502ee65c9802647d4695a75400 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/DynamicMapperXmlElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/DynamicMapperXmlElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; +package com.tianhua.codemaker.app.dynamicddd.handler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.DynamicMapperXmlElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.DynamicMapperXmlElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,14 +16,14 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Component(value = "dynamicMapperXmlElementHandler") public class DynamicMapperXmlElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public DynamicMapperXmlElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/EventElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/EventElementHandler.java similarity index 72% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/EventElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/EventElementHandler.java index 251514cfb37e481c766d18a85d97b5ac88300640..202f1df235f8b10fc12d563d0399ee4e42ebdc85 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/EventElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/EventElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; +package com.tianhua.codemaker.app.dynamicddd.handler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.DomainEventElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.DomainEventElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,7 +16,7 @@ import java.util.List; * Description: * date: 2021/6/30 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -24,7 +24,7 @@ import java.util.List; public class EventElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/InfrastAclElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/InfrastAclElementHandler.java similarity index 89% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/InfrastAclElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/InfrastAclElementHandler.java index b5ed0fec49c8aa44539938a57308a07f831aac9a..bcab273d27c0d9242acb258291c4c904f94beac6 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/InfrastAclElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/InfrastAclElementHandler.java @@ -1,14 +1,14 @@ -package com.coderman.codemaker.app.dynamicddd.handler; - -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.InfrastAclElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.InfrastAclElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import com.google.common.collect.Sets; import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; @@ -23,7 +23,7 @@ import java.util.Set; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -32,7 +32,7 @@ public class InfrastAclElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public MqConsumerElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MqHandlerElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MqHandlerElementHandler.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MqHandlerElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MqHandlerElementHandler.java index 00ba65122b0ef9b3425f2951e2734854d7a59dd3..bca95fc0079240a87678586a94616e83989a5660 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MqHandlerElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MqHandlerElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; +package com.tianhua.codemaker.app.dynamicddd.handler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.MqHandlerElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.MqHandlerElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,7 +17,7 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -25,7 +25,7 @@ import java.util.List; public class MqHandlerElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public MqHandlerElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MqProducerElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MqProducerElementHandler.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MqProducerElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MqProducerElementHandler.java index f28aff5e83a366c122d43e514af34044507b855b..8f40b8336050571538898adaad462cbc396e4e0b 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MqProducerElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MqProducerElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.MqProducerElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.MqProducerElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,7 +17,7 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -25,7 +25,7 @@ import java.util.List; public class MqProducerElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public MqProducerElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MsgBodyElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MsgBodyElementHandler.java similarity index 72% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MsgBodyElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MsgBodyElementHandler.java index c14b2014d5960cfe837c0563e82724f0a0d502a6..28e922183a2ee2ce4a45d27fd5b0227acebd1996 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/MsgBodyElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/MsgBodyElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; +package com.tianhua.codemaker.app.dynamicddd.handler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.DomainMsgBodyElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.DomainMsgBodyElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,7 +16,7 @@ import java.util.List; * Description: * date: 2021/6/30 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -24,7 +24,7 @@ import java.util.List; public class MsgBodyElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/RepositoryElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/RepositoryElementHandler.java similarity index 73% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/RepositoryElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/RepositoryElementHandler.java index 223a00dc879609c93fc1607abcb0c83aff7c9a11..9346317fd28d914fac96a4b2c73856ed22fd23e9 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/RepositoryElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/RepositoryElementHandler.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.app.dynamicddd.handler; +package com.tianhua.codemaker.app.dynamicddd.handler; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.RepositoryElementBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.RepositoryElementBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,7 +16,7 @@ import java.util.List; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -24,7 +24,7 @@ import java.util.List; public class RepositoryElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Override public RepositoryElementBean getElementBeanList(PlantUmlContextBean plantUmlContextBean) { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/ValueObjectElementHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/ValueObjectElementHandler.java similarity index 86% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/ValueObjectElementHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/ValueObjectElementHandler.java index 9d8c4ba90e1ded9cf67f9116be4e8aea1401d438..d13e2f152d45e13757ecc95eed485b17a93339cc 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dynamicddd/handler/ValueObjectElementHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/dynamicddd/handler/ValueObjectElementHandler.java @@ -1,15 +1,15 @@ -package com.coderman.codemaker.app.dynamicddd.handler; - -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.app.dynamicddd.DerivedClassFactory; -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.dddelement.ValueObjectElementBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.EnumBean; -import com.coderman.codemaker.bean.plantuml.FieldBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.enums.VisibilityEnum; +package com.tianhua.codemaker.app.dynamicddd.handler; + +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.app.dynamicddd.DerivedClassFactory; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.bean.dddelement.ValueObjectElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.EnumBean; +import com.tianhua.codemaker.bean.plantuml.FieldBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.enums.VisibilityEnum; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -24,7 +24,7 @@ import java.util.stream.Collectors; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -32,7 +32,7 @@ import java.util.stream.Collectors; public class ValueObjectElementHandler implements DomainElementHandler { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Autowired private DerivedClassFactory derivedClassFactory; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springboot/SpringBootApiDocWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springboot/SpringBootApiDocWriteServiceImpl.java similarity index 39% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springboot/SpringBootApiDocWriteServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springboot/SpringBootApiDocWriteServiceImpl.java index 7f463afdb982f1b03b201a4d30182aace8cf9a40..6b9f6380c5287f61ce6f7aadbb02fd78e13b47cc 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/springboot/SpringBootApiDocWriteServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springboot/SpringBootApiDocWriteServiceImpl.java @@ -1,12 +1,11 @@ -package com.coderman.codemaker.app.springboot; +package com.tianhua.codemaker.app.springboot; -import com.coderman.codemaker.app.CommonWriteService; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateSpringbootConfig; -import com.coderman.codemaker.service.dberpicture.DBErPictureService; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateSpringbootConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -14,16 +13,24 @@ import org.springframework.stereotype.Component; * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Component(value = "springBootApiDocWriteService") public class SpringBootApiDocWriteServiceImpl extends WriteService implements IWriteFileService { + @Autowired + private ProjectTemplateSpringbootConfig projectTemplateSpringbootConfig; + @Override public void writeContent(WriteContentBean writeContentBean) { writeApiDoc(writeContentBean.getContent(),writeContentBean.getHumpClassName()); + //写sql文件 + if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SQL.getTempFileName())){ + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateSpringbootConfig.getModulePath()); + writeSql(classContentBean); + } } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springboot/SpringBootWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springboot/SpringBootWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..abfde0c69584221880a7e56899c1a1633fc8408d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springboot/SpringBootWriteServiceImpl.java @@ -0,0 +1,49 @@ +package com.tianhua.codemaker.app.springboot; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.*; +import com.tianhua.codemaker.config.ProjectTemplateSpringbootConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.app.IWriteFileService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + + + +/** + * Description: + * date: 2021/6/22 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "springBootWriteService") +public class SpringBootWriteServiceImpl extends WriteService implements IWriteFileService { + + @Autowired + private ProjectTemplateSpringbootConfig projectTemplateConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "springboot"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean("", projectTemplateConfig.getModulePath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(), moduleCode, classContentBean); + //写config文件 + if (writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)) { + writeConfig(classContentBean); + } + + //写自定义工具类 + if (writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)) { + writeRoute(classContentBean); + } + + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignApiDocWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignApiDocWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..38e65d6cb21d21cd0a8ad8c1190d7a31ca913a14 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignApiDocWriteServiceImpl.java @@ -0,0 +1,40 @@ +package com.tianhua.codemaker.app.springcloud; + +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateSpringCloudConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Description: + * date: 2021/11/29 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "sCFeignApiDocWriteService") +public class SCFeignApiDocWriteServiceImpl extends WriteService implements IWriteFileService { + @Autowired + private ProjectTemplateSpringCloudConfig projectTemplateSpringCloudConfig; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + writeApiDoc(writeContentBean.getContent(),writeContentBean.getHumpClassName()); + //写pom文件 + if(writeContentBean.getTemplateName().equals(TemplateFileEnum.PARENT_POM.getTempFileName())){ + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateSpringCloudConfig.getModuleParentPath()); + writePom(classContentBean); + } + + //写sql文件 + if(writeContentBean.getTemplateName().equals(TemplateFileEnum.SQL.getTempFileName())){ + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateSpringCloudConfig.getModuleParentPath()); + writeSql(classContentBean); + } + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignApiWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignApiWriteServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..28a9333500d589ecf4abecd687259a9c7f72136a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignApiWriteServiceImpl.java @@ -0,0 +1,43 @@ +package com.tianhua.codemaker.app.springcloud; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.ProjectTemplateSpringCloudConfig; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + + +/** + * Description: + * date: 2021/11/29 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ + +@Component(value = "sCFeignApiWriteService") +public class SCFeignApiWriteServiceImpl extends WriteService implements IWriteFileService { + @Autowired + private ProjectTemplateSpringCloudConfig projectTemplateSpringCloudConfig; + + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "api"; + + @Override + public void writeContent(WriteContentBean writeContentBean) { + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateSpringCloudConfig.getModuleFeginApiPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); + //写自定义工具类 + if(writeContentBean.getTemplateName().equals(GlobalConstant.SINGLE_CLASS_COMMON)){ + writeRoute(classContentBean); + } + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboCommonWriteServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignProviderWriteServiceImpl.java similarity index 32% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboCommonWriteServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignProviderWriteServiceImpl.java index 91724cc40c78cde0bbb870f31f930c7d86d69e77..33ceaad55fa336c52c17b9e4821d39f3934d7e11 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/app/dubbo/DubboCommonWriteServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/app/springcloud/SCFeignProviderWriteServiceImpl.java @@ -1,14 +1,14 @@ -package com.coderman.codemaker.app.dubbo; - -import com.coderman.codemaker.app.WriteService; -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateDubboConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.utils.Constant; +package com.tianhua.codemaker.app.springcloud; + +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.app.WriteService; +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.config.ProjectTemplateSpringCloudConfig; +import com.tianhua.codemaker.utils.Constant; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -16,51 +16,38 @@ import org.springframework.stereotype.Component; import java.io.File; import java.io.IOException; + /** * Description: - * date: 2021/6/18 + * date: 2021/11/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 - * 写持久层模块服务 */ -@Component(value = "dubboCommonWriteFileService") -public class DubboCommonWriteServiceImpl extends WriteService implements IWriteFileService { - +@Component(value = "sCFeignProviderWriteService") +public class SCFeignProviderWriteServiceImpl extends WriteService implements IWriteFileService { @Autowired - private ProjectTemplateDubboConfig projectTemplateDubboConfig; + private ProjectTemplateSpringCloudConfig projectTemplateSpringCloudConfig; + @Autowired private AppServiceConfig appServiceConfig; + @Autowired + private FunctionCodeAppWriteService functionCodeAppWriteService; + + private static final String moduleCode = "provider"; + @Override public void writeContent(WriteContentBean writeContentBean) { - ClassContentBean classContentBean = writeContentBean.buildClassContentBean(projectTemplateDubboConfig.getModuleCommonPath()); - //写do class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.DATA_OBJECT.getTempFileName())){ - classContentBean.setChildPackageName("infrast.dao.dataobject"); - classContentBean.setClassSuffix("DO.java"); - writeDO(classContentBean); - } - //写mapper class - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER.getTempFileName())){ - classContentBean.setChildPackageName("mapper"); - classContentBean.setClassSuffix("Mapper.java"); - writeMapper(classContentBean); - } + ClassContentBean classContentBean = writeContentBean.buildClassContentBean(moduleCode, projectTemplateSpringCloudConfig.getModuleFeginProviderPath()); + functionCodeAppWriteService.write(writeContentBean.getTemplateName(),moduleCode,classContentBean); - //写mapper.xml - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_XML.getTempFileName())){ - classContentBean.setChildPackageName("mapper"); - classContentBean.setClassSuffix("Mapper.xml"); - writeMapperXml(classContentBean); - } - //写infrast.dao.mapper - if(writeContentBean.getTemplateName().equals(TemplateFileEnum.MAPPER_DDD.getTempFileName())){ - classContentBean.setChildPackageName("infrast.dao.mapper"); - writeRoute(classContentBean); + //写config文件 + if(writeContentBean.getTemplateName().equals(GlobalConstant.CONFIG)){ + writeConfig(classContentBean); } //写自定义工具类 @@ -70,39 +57,56 @@ public class DubboCommonWriteServiceImpl extends WriteService implements IWriteF } /** - * 写DO文件 - * @param classContentBean + * 写service文件 + * + * @param content + * @param humpClassName */ - public void writeDO(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); + public void writeService(String content, String humpClassName) { + String packageName = appServiceConfig.getPackage(); + String packagePath = packageName.replace(".", "/"); + String filePath = Constant.JAVA + "/" + packagePath + "/service"; + String fileName = humpClassName + "Service.java"; + filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } } /** - * 写Mapper文件 - * @param classContentBean + * 写serviceImpl文件 + * + * @param content + * @param humpClassName */ - public void writeMapper(ClassContentBean classContentBean) { - String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); + public void writeServiceImpl(String content, String humpClassName) { + String packageName = appServiceConfig.getPackage(); + String packagePath = packageName.replace(".", "/"); + String filePath = Constant.JAVA + "/" + packagePath + "/service/impl"; + String fileName = humpClassName + "ServiceImpl.java"; + filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } } /** - * 写Mapper.xml文件 - * @param classContentBean + * 写测试文件 + * + * @param content */ - public void writeMapperXml(ClassContentBean classContentBean) { - String filePath = getMapperFilePath(classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); + public void writeTest(String content, String humpClassName) { + String packageName = appServiceConfig.getPackage(); + String packagePath = packageName.replace(".", "/"); + String filePath = Constant.TEST_JAVA + "/" + packagePath + "/service/test"; + String fileName = humpClassName + "ServiceTest.java"; + filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; try { - FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } @@ -110,29 +114,49 @@ public class DubboCommonWriteServiceImpl extends WriteService implements IWriteF /** - * @param childPackageName 最后一级子包名称 - * @param humpClassName 驼峰式类名 - * @param classSuffix 文件后缀 egg:DTO.java - * @return + * 写controller文件 + * + * @param content + * @param humpClassName */ - private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { + public void writeController(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "/") ; - packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; - String fileName = humpClassName + classSuffix; - return projectTemplateDubboConfig.getModuleCommonPath() + packagePath + "/" + fileName; + String packagePath = packageName.replace(".", "/"); + String filePath = Constant.JAVA + "/" + packagePath + "/controller"; + String fileName = humpClassName + "Controller.java"; + filePath = projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + filePath + "/" + fileName; + try { + FileUtils.write(new File(filePath), content, "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } } + /** + * 写class文件 + * @param classContentBean + */ + public void writeClassFile(ClassContentBean classContentBean) { + String filePath = getFilePath(classContentBean.getChildPackageName(), classContentBean.getHumpClassName(), classContentBean.getClassSuffix()); + try { + FileUtils.write(new File(filePath), classContentBean.getClassContent(), "UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + } /** - * + * @param childPackageName 最后一级子包名称 * @param humpClassName 驼峰式类名 * @param classSuffix 文件后缀 egg:DTO.java * @return */ - private String getMapperFilePath(String humpClassName, String classSuffix) { + private String getFilePath(String childPackageName, String humpClassName, String classSuffix) { + String packageName = appServiceConfig.getPackage(); + String packagePath = packageName.replace(".", "/") ; + packagePath = Constant.JAVA + "/" + packagePath + "/" + childPackageName; String fileName = humpClassName + classSuffix; - return projectTemplateDubboConfig.getModuleCommonPath() + Constant.MAPPER + "/" + fileName; + return projectTemplateSpringCloudConfig.getModuleFeginProviderPath() + packagePath + "/" + fileName; } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/AppServiceConfig.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/AppServiceConfig.java similarity index 74% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/AppServiceConfig.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/AppServiceConfig.java index 6f58621184825d849c8e6a4c7f30a3f1d196f530..ca0aa5fd695d443c3243402c2302aedd6ecaf3a1 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/AppServiceConfig.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/AppServiceConfig.java @@ -1,14 +1,18 @@ -package com.coderman.codemaker.config; +package com.tianhua.codemaker.config; -import com.coderman.codemaker.api.ICompDecorateService; -import com.coderman.codemaker.api.ICompScanService; -import com.coderman.codemaker.app.AppService; -import com.coderman.codemaker.enums.ModuleEnum; -import com.coderman.codemaker.exceptions.ConfigException; -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.utils.SpringContextHolder; +import com.tianhua.codemaker.api.ICompDecorateService; +import com.tianhua.codemaker.api.ICompScanService; +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.app.AppService; +import com.tianhua.codemaker.bean.config.ConfigFileBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.exceptions.ConfigException; +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.utils.SpringContextHolder; import com.google.common.collect.Sets; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -21,12 +25,13 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.*; +import java.util.stream.Collectors; /** * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -40,12 +45,18 @@ public class AppServiceConfig { */ @Value("${application.type}") private String applicationType; + @Value(value = "${application.global.package}") private String packageName; @Value(value = "${application.global.author}") private String author; + /** + * 是否链接具体数据库,根据数据库来构建数据模型 + */ + @Value(value = "${application.global.linkdb}") + private Boolean linkDB; @Value(value = "${application.maven.repo.path}") private String mavenRepoPath; @@ -63,6 +74,9 @@ public class AppServiceConfig { @Value(value = "${application.component.decorate.bean}") private String defaultComponentDecorateBean; + @Value(value = "${application.javsscript.enable}") + private boolean enableJavsScript; + @Resource(name = "colaAppService") private AppService colaAppService; @@ -78,7 +92,6 @@ public class AppServiceConfig { @Resource(name = "springCloudAppService") private AppService springCloudAppService; - @Autowired private ProjectTemplateSpringbootConfig projectTemplateSpringbootConfig; @@ -298,7 +311,7 @@ public class AppServiceConfig { */ public String getErPictureOutPath(){ if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { - return projectTemplateSpringbootConfig.getOutPath(); + return projectTemplateSpringbootConfig.getModulePath(); } else if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { return projectTemplateDubboConfig.getModuleCommonPath(); } else if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { @@ -327,6 +340,39 @@ public class AppServiceConfig { return null; } + /** + * 获取不同项目的文档输出路径 + * @return + */ + public String getJavsProjectOutPath(){ + if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + return projectTemplateSpringbootConfig.getModulePath()+"-javs"; + } else if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { + return projectTemplateDubboConfig.getModuleParentPath()+"-javs"; + } else if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { + return projectTemplateColaConfig.getModuleParentPath()+"-javs"; + } else if (applicationType.equals(ModuleEnum.SC_FEIGN_API.getAppName())) { + return projectTemplateSpringCloudConfig.getModuleParentPath()+"-javs"; + } + return null; + } + + /** + * 获取不同项目的文档输出路径 + * @return + */ + public String getUMLDocOutPath(){ + if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + return projectTemplateSpringbootConfig.getUMLDocPath(); + } else if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { + return projectTemplateDubboConfig.getUMLDocPath(); + } else if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { + return projectTemplateColaConfig.getUMLDocPath(); + } else if (applicationType.equals(ModuleEnum.SC_FEIGN_API.getAppName())) { + return projectTemplateSpringCloudConfig.getUMLDocPath(); + } + return null; + } /** * 获取配置中的文档生成开关 @@ -345,6 +391,22 @@ public class AppServiceConfig { return false; } + /** + * 获取配置中的文档生成开关 + * @return + */ + public Boolean getPlantUMLSync() { + if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + return projectTemplateSpringbootConfig.getPlantUMlDocSync(); + } else if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { + return projectTemplateDubboConfig.getPlantUMlDocSync(); + } else if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { + return projectTemplateColaConfig.getPlantUMlDocSync(); + } else if (applicationType.equals(ModuleEnum.SC_FEIGN_API.getAppName())) { + return projectTemplateSpringCloudConfig.getPlantUMlDocSync(); + } + return false; + } @@ -438,15 +500,6 @@ public class AppServiceConfig { - - /** - * 获取定制化的packageAdapter适配器 - * @return - */ - /*public IClazzAdapter getPackageAdapterBean(){ - return SpringContextHolder.getBean(this.packageAdapterBean,IClazzAdapter.class); - }*/ - /** * 获取项目自定义的需要注入的组件列表 * @return @@ -495,6 +548,9 @@ public class AppServiceConfig { String [] kvArr = clazz.trim().split(":"); String className = kvArr[0]; String moduleName = applicationType + "-" + kvArr[1]; + if(applicationType.equals(kvArr[1])){ + moduleName = applicationType; + } List classList = initClassMap.get(moduleName); if (CollectionUtils.isEmpty(classList)){ classList = new ArrayList<>(); @@ -584,4 +640,118 @@ public class AppServiceConfig { public ICompDecorateService getDefaultCompDecorateService(){ return SpringContextHolder.getBean(this.defaultComponentDecorateBean,ICompDecorateService.class); } + + /** + * 获取自定义的代码元素注册内容 + * @return + */ + public List getCustomCodeFtlList(){ + List ftlBeanList = new ArrayList<>(); + if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { + ftlBeanList = projectTemplateColaConfig.getFtlBeanList(); + } + + if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { + ftlBeanList = projectTemplateDubboConfig.getFtlBeanList(); + } + if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + ftlBeanList = projectTemplateSpringbootConfig.getFtlBeanList(); + } + if (applicationType.equals(ModuleEnum.SC_FEIGN_API.getAppName())) { + ftlBeanList = projectTemplateSpringCloudConfig.getFtlBeanList(); + } + ftlBeanList.forEach(ftlBean -> ModuleEnum.addCustomTemplateFile(this.applicationType, ftlBean.getModuleName(),ftlBean.getCodeTempFileName())); + return ftlBeanList; + } + + /** + * 获取统一的pom项目配置 + * @return + */ + public Map getPomConfigMap(){ + if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { + return projectTemplateColaConfig.getPomBeanV2(); + } + if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { + return projectTemplateDubboConfig.getPomBeanV2(); + } + if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + return projectTemplateSpringbootConfig.getPomBeanV2(); + } + if (applicationType.equals(ModuleEnum.SC_FEIGN_API.getAppName())) { + return projectTemplateSpringCloudConfig.getPomBeanV2(); + } + return null; + } + + /** + * 获取项目的配置信息 + * @return + */ + public List getConfigFileBeanList(){ + if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { + return projectTemplateColaConfig.getConfigFileBean(); + } + if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { + return projectTemplateDubboConfig.getConfigFileBean(); + } + if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + return projectTemplateSpringbootConfig.getConfigFileBean(); + } + if (applicationType.equals(ModuleEnum.SC_FEIGN_API.getAppName())) { + return projectTemplateSpringCloudConfig.getConfigFileBean(); + } + return null; + } + + public Boolean getLinkDB() { + return linkDB; + } + + /** + * 获取参数校验bean列表 + * @return + */ + public List getValidateServiceBeanList(){ + List validateBeanList = new ArrayList<>(); + if (applicationType.equals(ModuleEnum.COLA_ADAPTER.getAppName())) { + validateBeanList = projectTemplateColaConfig.getValidateBeanList(); + } + if (applicationType.equals(ModuleEnum.DUBBO_API.getAppName())) { + validateBeanList = projectTemplateDubboConfig.getValidateBeanList(); + } + if (applicationType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + validateBeanList = projectTemplateSpringbootConfig.getValidateBeanList(); + } + if (applicationType.equals(ModuleEnum.SC_FEIGN_API.getAppName())) { + validateBeanList = projectTemplateSpringCloudConfig.getValidateBeanList(); + } + return validateBeanList.stream().map(beanName -> (IValidateService)SpringContextHolder.getBean(beanName)).collect(Collectors.toList()); + } + + + /** + * 判断是否配置了mybatis-plus组件的装饰bean + * + * @return + */ + public boolean containsMybatisPlus(){ + List compDecorateServiceList = getCustomICompDecorateServiceList(); + for (ICompDecorateService iCompDecorateService : compDecorateServiceList){ + if(iCompDecorateService.getClass().getName().toLowerCase().contains("mybatisplus")){ + return true; + } + } + + return false; + } + + + /** + * 判断是否启用javsscritp脚本引擎并构建脚本文件 + * @return + */ + public boolean enableJavsScript(){ + return this.enableJavsScript; + } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ConfigFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ConfigFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..e1904ed0c1e400915d2ab68edf9477d7b82d0f0b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ConfigFactory.java @@ -0,0 +1,52 @@ +package com.tianhua.codemaker.config; + +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.config.ProjectBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +/** + * Description: + * date: 2022/3/28 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class ConfigFactory { + + @Autowired + private AppServiceConfig appServiceConfig; + /** + * 构建项目配置信息 + * @param plantUmlContextBean + * @return + */ + public ProjectBean getProjectBean(PlantUmlContextBean plantUmlContextBean){ + + ProjectBean projectBean = new ProjectBean(); + projectBean.setPackageName(appServiceConfig.getPackage()); + projectBean.setApplicationName(appServiceConfig.getApplicationName()); + projectBean.setDataBaseName(appServiceConfig.getDbName()); + Map contextBeanMap = plantUmlContextBean.getCompContextBeanMap(); + Map listMap = new HashMap<>(); + if(contextBeanMap != null && !contextBeanMap.isEmpty()){ + contextBeanMap.forEach((k,v)->{ + ComponentConfigBean componentConfigBean = v.getComponentConfigBean(); + if(componentConfigBean != null && CollectionUtils.isNotEmpty(componentConfigBean.getConfigList())){ + + listMap.put(componentConfigBean.getConfigName(),componentConfigBean); + } + }); + } + projectBean.setConfigFileMap(listMap); + return projectBean; + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ConfigParseService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ConfigParseService.java new file mode 100644 index 0000000000000000000000000000000000000000..0bf5bee4777157a888190a023399b662fb08426b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ConfigParseService.java @@ -0,0 +1,235 @@ +package com.tianhua.codemaker.config; + +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.config.ConfigFileBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.GAVBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.google.common.collect.Lists; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Description:解析公共配置 + * date: 2022/2/8 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class ConfigParseService { + /** + * 获取项目配置文件配置 + * @return + */ + public List getConfigFileBean(String configFile){ + List list = new ArrayList<>(); + if(StringUtils.isEmpty(configFile)){ + return list; + } + String [] configFileArr = configFile.split(","); + for (String configStr : configFileArr){ + String [] moduleConfigArr = configStr.split(":"); + String moduleName = moduleConfigArr[1]; + String [] configArr = moduleConfigArr[0].split("_"); + ConfigFileBean configFileBean = ConfigFileBean.getInstance(configArr[0],configArr[1], moduleName); + configFileBean.setTemplateName(moduleConfigArr[0]); + list.add(configFileBean); + } + return list; + } + + /** + * 获取统一的pom配置 + * 默认是父级pom.xml的实例 + * @return + */ + public Map getPomBeanV2(String initPom, String applicationName, String appAliasName,String groupId, String artifactId, String version){ + Map pomBeanMap = getPomBeanMap(applicationName, appAliasName, groupId, artifactId, version); + if(StringUtils.isNotEmpty(initPom)){ + String [] arr = initPom.split(","); + for (String pom : arr){ + String [] pomArr = pom.split(":"); + PomBean modulePom = pomBeanMap.get(pomArr[1]); + if(modulePom == null){ + modulePom = new PomBean(); + modulePom.setModuleName(pomArr[1]); + modulePom.setModuleCode(pomArr[1]); + modulePom.setModulePrefix(appAliasName); + modulePom.setGroupId(groupId); + List gavBeanList = new ArrayList<>(); + gavBeanList.add(new GAVBean(pomArr[0])); + modulePom.setDependencyList(gavBeanList); + }else { + modulePom.getDependencyList().add(new GAVBean(pomArr[0])); + } + pomBeanMap.put(pomArr[1], modulePom); + } + } + return pomBeanMap; + } + /** + * 获取pom配置 + * @return + */ + private Map getPomBeanMap(String applicationName, String appAliasName,String groupId, String artifactId, String version){ + Map pomBeanMap = new HashMap<>(); + PomBean parentPom = new PomBean(); + parentPom.setUrl(null); + parentPom.buildGAV(groupId,artifactId,version); + parentPom.setTemplateCode(TemplateFileEnum.PARENT_POM.getTempFileName()); + parentPom.setAppName(applicationName); + parentPom.buildModule(appAliasName, GlobalConstant.PARENT); + parentPom.setDependencyList(new ArrayList<>()); + + + PomBean clientPom = new PomBean(); + clientPom.buildGAV(groupId,artifactId,version); + clientPom.setDependencyList(new ArrayList<>()); + clientPom.setTemplateCode(TemplateFileEnum.CLIENT_POM.getTempFileName()); + clientPom.buildModule(appAliasName, GlobalConstant.CLIENT); + + + PomBean apiPom = new PomBean(); + apiPom.buildGAV(groupId,artifactId,version); + apiPom.setDependencyList(new ArrayList<>()); + apiPom.setTemplateCode(TemplateFileEnum.API_POM.getTempFileName()); + apiPom.buildModule(appAliasName, GlobalConstant.API); + + PomBean corePom = new PomBean(); + corePom.buildGAV(groupId,artifactId,version); + corePom.setDependencyList(new ArrayList<>()); + corePom.setTemplateCode(TemplateFileEnum.CORE_POM.getTempFileName()); + corePom.buildModule(appAliasName, GlobalConstant.CORE); + + PomBean commonPom = new PomBean(); + commonPom.buildGAV(groupId,artifactId,version); + commonPom.setDependencyList(new ArrayList<>()); + commonPom.setTemplateCode(TemplateFileEnum.COMMON_POM.getTempFileName()); + commonPom.buildModule(appAliasName, GlobalConstant.COMMON); + + + PomBean appPom = new PomBean(); + appPom.buildGAV(groupId,artifactId,version); + appPom.setDependencyList(new ArrayList<>()); + appPom.setTemplateCode(TemplateFileEnum.APP_POM.getTempFileName()); + appPom.buildModule(appAliasName, GlobalConstant.APP); + + PomBean domainPom = new PomBean(); + domainPom.buildGAV(groupId,artifactId,version); + domainPom.setDependencyList(new ArrayList<>()); + domainPom.setTemplateCode(TemplateFileEnum.DOMAIN_POM.getTempFileName()); + domainPom.buildModule(appAliasName, GlobalConstant.DOMAIN); + + + PomBean infrastPom = new PomBean(); + infrastPom.buildGAV(groupId,artifactId,version); + infrastPom.setDependencyList(new ArrayList<>()); + infrastPom.setTemplateCode(TemplateFileEnum.INFRAST_POM.getTempFileName()); + infrastPom.buildModule(appAliasName, GlobalConstant.INFRAST); + + PomBean startPom = new PomBean(); + startPom.buildGAV(groupId,artifactId,version); + startPom.setDependencyList(new ArrayList<>()); + startPom.setTemplateCode(TemplateFileEnum.START_POM.getTempFileName()); + startPom.buildModule(appAliasName, GlobalConstant.START); + + PomBean adapterPom = new PomBean(); + adapterPom.buildGAV(groupId,artifactId,version); + adapterPom.setDependencyList(new ArrayList<>()); + adapterPom.setTemplateCode(TemplateFileEnum.ADAPTER_POM.getTempFileName()); + adapterPom.buildModule(appAliasName, GlobalConstant.ADAPTER); + + + PomBean providerPom = new PomBean(); + providerPom.buildGAV(groupId,artifactId,version); + providerPom.setDependencyList(new ArrayList<>()); + providerPom.setTemplateCode(TemplateFileEnum.PROVIDER_POM.getTempFileName()); + providerPom.buildModule(appAliasName, GlobalConstant.PROVIDER); + + + PomBean feignApiPom = new PomBean(); + feignApiPom.buildGAV(groupId,artifactId,version); + feignApiPom.setDependencyList(new ArrayList<>()); + feignApiPom.setTemplateCode(TemplateFileEnum.FEIGN_API_POM.getTempFileName()); + feignApiPom.buildModule(appAliasName, GlobalConstant.FEIGN_API); + + + + + PomBean springBootPom = new PomBean(); + springBootPom.buildGAV(groupId,artifactId,version); + springBootPom.setDependencyList(new ArrayList<>()); + springBootPom.setTemplateCode(TemplateFileEnum.PARENT_POM.getTempFileName()); + springBootPom.buildModule(appAliasName, GlobalConstant.SPRING_BOOT); + + pomBeanMap.put(GlobalConstant.PARENT,parentPom); + pomBeanMap.put(GlobalConstant.ADAPTER.replace("-",""),adapterPom); + pomBeanMap.put(GlobalConstant.START.replace("-",""),startPom); + pomBeanMap.put(GlobalConstant.CLIENT.replace("-",""),clientPom); + pomBeanMap.put(GlobalConstant.APP.replace("-",""),appPom); + pomBeanMap.put(GlobalConstant.DOMAIN.replace("-",""),domainPom); + pomBeanMap.put(GlobalConstant.INFRAST.replace("-",""),infrastPom); + pomBeanMap.put(GlobalConstant.FEIGN_API.replace("-",""),feignApiPom); + pomBeanMap.put(GlobalConstant.API.replace("-",""),apiPom); + pomBeanMap.put(GlobalConstant.CORE.replace("-",""),corePom); + pomBeanMap.put(GlobalConstant.COMMON.replace("-",""),commonPom); + pomBeanMap.put(GlobalConstant.PROVIDER.replace("-",""),providerPom); + pomBeanMap.put(GlobalConstant.SPRING_BOOT.replace("-",""),springBootPom); + + return pomBeanMap; + } + + + /** + * 返回配置的参数验证服务bean + * @return + */ + public List getValidateBeanList(String validateBeans){ + if(StringUtils.isEmpty(validateBeans)){ + return Lists.newArrayList(); + } + if(!validateBeans.contains(",")){ + return Lists.newArrayList(validateBeans); + }else { + return Lists.newArrayList(validateBeans.split(",")); + } + } + + /** + * 获取自定义配置的代码元素 + * @return + */ + public List getFtlBeanList(String customFtl,String initPom, String applicationName, String appAliasName,String groupId, String artifactId, String version){ + List ftlBeans = new ArrayList<>(); + Map pomBeanMap = getPomBeanV2(initPom, applicationName, appAliasName, groupId, artifactId, version); + for (Map.Entry pomBeanEntry : pomBeanMap.entrySet()){ + PomBean pomBean = pomBeanEntry.getValue(); + String ftlStr = pomBean.getTemplateCode()+":pom:"+pomBean.getModuleCode(); + ftlBeans.add(FtlBean.getInstance(ftlStr)); + } + + if(StringUtils.isEmpty(customFtl)){ + return ftlBeans; + } + if(customFtl.contains(",")){ + String [] ftlStrArr = customFtl.split(","); + for (String flt : ftlStrArr){ + ftlBeans.add(FtlBean.getInstance(flt)); + } + }else { + ftlBeans.add(FtlBean.getInstance(customFtl)); + } + + + return ftlBeans; + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/DefaultPackageConfig.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/DefaultPackageConfig.java similarity index 79% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/DefaultPackageConfig.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/DefaultPackageConfig.java index 6e37197c9a81b70abf3852a449b68a391ebc17a3..aace55622962a3e5bc8834305bd4941e09970048 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/DefaultPackageConfig.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/DefaultPackageConfig.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.config; +package com.tianhua.codemaker.config; -import com.coderman.codemaker.service.adapter.PackgeConstants; -import com.coderman.codemaker.service.packageimport.PackageImportService; +import com.tianhua.codemaker.service.adapter.PackgeConstants; +import com.tianhua.codemaker.service.packageimport.PackageImportService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -12,7 +12,7 @@ import java.util.Map; * Description: * date: 2021/6/30 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -50,4 +50,9 @@ public class DefaultPackageConfig { } return ""; } + + public void addPackage(String className,String packageName){ + defaultPackageMap.put(className, packageName); + } + } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateColaConfig.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateColaConfig.java similarity index 31% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateColaConfig.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateColaConfig.java index 5c672d9dd351d82263171272943bcbec3cbfca18..2590acfd168745fe41e6d0e7a72220e1fd7c7b05 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateColaConfig.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateColaConfig.java @@ -1,17 +1,29 @@ -package com.coderman.codemaker.config; - -import com.coderman.codemaker.bean.GlobalConstant; +package com.tianhua.codemaker.config; + +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.config.ConfigFileBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.GAVBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.google.common.collect.Lists; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * Description: * 生成dubbo项目的配置文件 * date: 2021/6/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -33,46 +45,17 @@ public class ProjectTemplateColaConfig { private String applicationName; /** - * dubbo-common模块地址 - */ - @Value(value = "${cola.code.outpath.cola-adapter}") - private String moduleAdapterPath; - - /** - * dubbo-api模块地址 - */ - @Value(value = "${cola.code.outpath.cola-app}") - private String moduleAppPath; - - /** - * dubbo-api模块地址 - */ - @Value(value = "${cola.code.outpath.cola-client}") - private String moduleClientPath; - /** - * dubbo-api模块地址 - */ - @Value(value = "${cola.code.outpath.cola-infrast}") - private String moduleInfrastPath; - - /** - * dubbo-core模块地址 - */ - @Value(value = "${cola.code.outpath.cola-domain}") - private String moduleDomainPath; - - /** - * cola-start模块地址 + * 代码生成项目主目录 */ - @Value(value = "${cola.code.outpath.cola-start}") - private String moduleStartPath; + @Value(value = "${cola.code.app.project.path}") + private String projectPath; /** - * cola-feign-api模块地址 + * 应用工程别名 */ - @Value(value = "${cola.code.outpath.cola-feign-api}") - private String moduleFeignApiPath; + @Value(value = "${cola.global.applicationNameAlias}") + private String appAliasName; @@ -88,6 +71,12 @@ public class ProjectTemplateColaConfig { @Value("${cola.api.generator}") private Boolean apiGenerate; + /** + * 是否同步plantuml文档到工程中 + */ + @Value("${cola.plantumldoc.sync}") + private Boolean plantUMlDocSync; + @Value(value = "${cola.component.scan.config}") private String componentList; @@ -115,13 +104,41 @@ public class ProjectTemplateColaConfig { @Value(value = "${cola.component.init.clazz}") private String initClazz; + @Value(value = "${cola.pom.parent.groupId}") + private String groupId; + + @Value(value = "${cola.pom.parent.artifactId}") + private String artifactId; + + @Value(value = "${cola.pom.parent.version}") + private String version; + + + @Value(value = "${cola.code.template.custom.ftl}") + private String customFtl; - public String getModuleStartPath() { - return moduleStartPath; - } - public void setModuleStartPath(String moduleStartPath) { - this.moduleStartPath = moduleStartPath; + /** + * 初始化的pom依赖 + */ + @Value(value = "${cola.component.init.pom}") + private String initPom; + + /** + * 项目需要依赖的配置文件 + */ + @Value(value = "${cola.component.init.config}") + private String configFile; + + /** + * 参数校验逻辑 植入bean配置 + */ + @Value(value = "${cola.component.validate.beans}") + private String validateBeans; + + + public String getModuleStartPath() { + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.START; } public Boolean getRequest() { @@ -197,43 +214,36 @@ public class ProjectTemplateColaConfig { } public String getModuleAdapterPath() { - return moduleAdapterPath; - } - - public void setModuleAdapterPath(String moduleAdapterPath) { - this.moduleAdapterPath = moduleAdapterPath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.ADAPTER; } public String getModuleAppPath() { - return moduleAppPath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.APP; } - public void setModuleAppPath(String moduleAppPath) { - this.moduleAppPath = moduleAppPath; + public String getModuleParentPath() { + return projectPath + "/" + applicationName; } public String getModuleClientPath() { - return moduleClientPath; - } - - public void setModuleClientPath(String moduleClientPath) { - this.moduleClientPath = moduleClientPath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.CLIENT; } public String getModuleInfrastPath() { - return moduleInfrastPath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.INFRAST; } - public void setModuleInfrastPath(String moduleInfrastPath) { - this.moduleInfrastPath = moduleInfrastPath; + public String getModuleDomainPath() { + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.DOMAIN; + } - public String getModuleDomainPath() { - return moduleDomainPath; + public Boolean getPlantUMlDocSync() { + return plantUMlDocSync; } - public void setModuleDomainPath(String moduleDomainPath) { - this.moduleDomainPath = moduleDomainPath; + public void setPlantUMlDocSync(Boolean plantUMlDocSync) { + this.plantUMlDocSync = plantUMlDocSync; } /** @@ -245,36 +255,198 @@ public class ProjectTemplateColaConfig { return this.getModuleDomainPath().substring(0,index)+"/"+ GlobalConstant.API_DOC; } + + /** + * 获取UML doc文件存储路径 + * @return + */ + public String getUMLDocPath(){ + int index = this.getModuleDomainPath().lastIndexOf("/"); + return this.getModuleDomainPath().substring(0,index)+"/"+ GlobalConstant.PLANT_UML_DOC; + } + public String getComponentScanBeans() { return componentScanBeans; } - public void setComponentScanBeans(String componentScanBeans) { - this.componentScanBeans = componentScanBeans; - } public String getComponentDecorateBeans() { return componentDecorateBeans; } - public void setComponentDecorateBeans(String componentDecorateBeans) { - this.componentDecorateBeans = componentDecorateBeans; + public String getInitClazz() { + return initClazz; } + public String getModuleFeignApiPath() { + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.FEIGN_API; + } - public String getInitClazz() { - return initClazz; + /** + * 获取自定义配置的代码元素 + * @return + */ + public List getFtlBeanList(){ + List ftlBeans = new ArrayList<>(); + Map pomBeanMap = getPomBeanV2(); + for (Map.Entry pomBeanEntry : pomBeanMap.entrySet()){ + PomBean pomBean = pomBeanEntry.getValue(); + String ftlStr = pomBean.getTemplateCode()+":pom:"+pomBean.getModuleCode(); + ftlBeans.add(FtlBean.getInstance(ftlStr)); + } + + if(StringUtils.isEmpty(this.customFtl)){ + return ftlBeans; + } + if(this.customFtl.contains(",")){ + String [] ftlStrArr = this.customFtl.split(","); + for (String flt : ftlStrArr){ + ftlBeans.add(FtlBean.getInstance(flt)); + } + }else { + ftlBeans.add(FtlBean.getInstance(customFtl)); + } + + + return ftlBeans; } - public void setInitClazz(String initClazz) { - this.initClazz = initClazz; + /** + * 获取cola的统一的pom配置 + * 默认是父级pom.xml的实例 + * @return + */ + public Map getPomBeanV2(){ + Map pomBeanMap = getPomBeanMap(); + if(StringUtils.isNotEmpty(initPom)){ + String [] arr = initPom.split(","); + for (String pom : arr){ + String [] pomArr = pom.split(":"); + PomBean modulePom = pomBeanMap.get(pomArr[1]); + if(modulePom == null){ + modulePom = new PomBean(); + modulePom.setModuleName(pomArr[1]); + modulePom.setModulePrefix(appAliasName); + modulePom.setGroupId(groupId); + List gavBeanList = new ArrayList<>(); + gavBeanList.add(new GAVBean(pomArr[0])); + modulePom.setDependencyList(gavBeanList); + }else { + modulePom.getDependencyList().add(new GAVBean(pomArr[0])); + } + pomBeanMap.put(pomArr[1], modulePom); + } + } + return pomBeanMap; } - public String getModuleFeignApiPath() { - return moduleFeignApiPath; + /** + * 获取pom配置 + * @return + */ + private Map getPomBeanMap(){ + Map pomBeanMap = new HashMap<>(); + PomBean parentPom = new PomBean(); + parentPom.setUrl(null); + parentPom.buildGAV(groupId,artifactId,version); + parentPom.setTemplateCode(TemplateFileEnum.PARENT_POM.getTempFileName()); + parentPom.setAppName(applicationName); + parentPom.buildModule(appAliasName, GlobalConstant.PARENT); + parentPom.setDependencyList(new ArrayList<>()); + + + PomBean clientPom = new PomBean(); + clientPom.buildGAV(groupId,artifactId,version); + clientPom.setDependencyList(new ArrayList<>()); + clientPom.setTemplateCode(TemplateFileEnum.CLIENT_POM.getTempFileName()); + clientPom.buildModule(appAliasName, GlobalConstant.CLIENT); + + + PomBean appPom = new PomBean(); + appPom.buildGAV(groupId,artifactId,version); + appPom.setDependencyList(new ArrayList<>()); + appPom.setTemplateCode(TemplateFileEnum.APP_POM.getTempFileName()); + appPom.buildModule(appAliasName, GlobalConstant.APP); + + PomBean domainPom = new PomBean(); + domainPom.buildGAV(groupId,artifactId,version); + domainPom.setDependencyList(new ArrayList<>()); + domainPom.setTemplateCode(TemplateFileEnum.DOMAIN_POM.getTempFileName()); + domainPom.buildModule(appAliasName, GlobalConstant.DOMAIN); + + + PomBean infrastPom = new PomBean(); + infrastPom.buildGAV(groupId,artifactId,version); + infrastPom.setDependencyList(new ArrayList<>()); + infrastPom.setTemplateCode(TemplateFileEnum.INFRAST_POM.getTempFileName()); + infrastPom.buildModule(appAliasName, GlobalConstant.INFRAST); + + PomBean startPom = new PomBean(); + startPom.buildGAV(groupId,artifactId,version); + startPom.setDependencyList(new ArrayList<>()); + startPom.setTemplateCode(TemplateFileEnum.START_POM.getTempFileName()); + startPom.buildModule(appAliasName, GlobalConstant.START); + + PomBean adapterPom = new PomBean(); + adapterPom.buildGAV(groupId,artifactId,version); + adapterPom.setDependencyList(new ArrayList<>()); + adapterPom.setTemplateCode(TemplateFileEnum.ADAPTER_POM.getTempFileName()); + adapterPom.buildModule(appAliasName, GlobalConstant.ADAPTER); + + PomBean feignApiPom = new PomBean(); + feignApiPom.buildGAV(groupId,artifactId,version); + feignApiPom.setDependencyList(new ArrayList<>()); + feignApiPom.setTemplateCode(TemplateFileEnum.FEIGN_API_POM.getTempFileName()); + feignApiPom.buildModule(appAliasName, GlobalConstant.FEIGN_API); + + pomBeanMap.put(GlobalConstant.PARENT,parentPom); + pomBeanMap.put(GlobalConstant.ADAPTER.replace("-",""),adapterPom); + pomBeanMap.put(GlobalConstant.START.replace("-",""),startPom); + pomBeanMap.put(GlobalConstant.CLIENT.replace("-",""),clientPom); + pomBeanMap.put(GlobalConstant.APP.replace("-",""),appPom); + pomBeanMap.put(GlobalConstant.DOMAIN.replace("-",""),domainPom); + pomBeanMap.put(GlobalConstant.INFRAST.replace("-",""),infrastPom); + pomBeanMap.put(GlobalConstant.FEIGN_API.replace("-",""),feignApiPom); + + return pomBeanMap; } - public void setModuleFeignApiPath(String moduleFeignApiPath) { - this.moduleFeignApiPath = moduleFeignApiPath; + + /** + * 获取项目配置文件配置 + * @return + */ + public List getConfigFileBean(){ + List list = new ArrayList<>(); + if(StringUtils.isEmpty(configFile)){ + return list; + } + String [] configFileArr = configFile.split(","); + for (String configStr : configFileArr){ + String [] moduleConfigArr = configStr.split(":"); + String moduleName = moduleConfigArr[1]; + String [] configArr = moduleConfigArr[0].split("_"); + ConfigFileBean configFileBean = ConfigFileBean.getInstance(configArr[0],configArr[1], moduleName); + configFileBean.setTemplateName(moduleConfigArr[0]); + list.add(configFileBean); + } + return list; } + + /** + * 返回配置的参数验证服务bean + * @return + */ + public List getValidateBeanList(){ + if(StringUtils.isEmpty(this.validateBeans)){ + return Lists.newArrayList(); + } + if(!this.validateBeans.contains(",")){ + return Lists.newArrayList(this.validateBeans); + }else { + return Lists.newArrayList(this.validateBeans.split(",")); + } + } + + } \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateDubboConfig.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateDubboConfig.java similarity index 54% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateDubboConfig.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateDubboConfig.java index 4bb16c095af16bd23a5f27b7562d006dc8bc5079..7abe9945f02746cb1a3967c9af74a70990f68333 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateDubboConfig.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateDubboConfig.java @@ -1,21 +1,24 @@ -package com.coderman.codemaker.config; +package com.tianhua.codemaker.config; -import com.coderman.codemaker.bean.GlobalConstant; -import org.apache.commons.lang3.StringUtils; -import org.assertj.core.util.Lists; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.config.ConfigFileBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; import java.util.List; +import java.util.Map; /** * Description: * 生成dubbo项目的配置文件 * date: 2021/6/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -24,6 +27,8 @@ import java.util.List; @PropertySource("classpath:projecttemplate-dubbo.properties") public class ProjectTemplateDubboConfig { + @Autowired + private ConfigParseService configParseService; /** * 项目数据库名称 */ @@ -36,24 +41,28 @@ public class ProjectTemplateDubboConfig { @Value(value = "${dubbo.global.applicationName}") private String applicationName; - /** - * dubbo-common模块地址 + * 代码生成项目主目录 */ - @Value(value = "${dubbo.code.outpath.dubbo-common}") - private String moduleCommonPath; + @Value(value = "${dubbo.code.app.project.path}") + private String projectPath; /** - * dubbo-api模块地址 + * 应用工程别名 */ - @Value(value = "${dubbo.code.outpath.dubbo-api}") - private String moduleApiPath; + @Value(value = "${dubbo.global.applicationNameAlias}") + private String appAliasName; + + + @Value(value = "${dubbo.pom.parent.groupId}") + private String groupId; + + @Value(value = "${dubbo.pom.parent.artifactId}") + private String artifactId; + + @Value(value = "${dubbo.pom.parent.version}") + private String version; - /** - * dubbo-core模块地址 - */ - @Value(value = "${dubbo.code.outpath.dubbo-core}") - private String moduleCorePath; /** * 应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 @@ -67,6 +76,12 @@ public class ProjectTemplateDubboConfig { @Value(("${dubbo.api.generator}")) private Boolean apiGenerate; + /** + * 是否同步plantuml文档到工程中 + */ + @Value("${dubbo.plantumldoc.sync}") + private Boolean plantUMlDocSync; + @Value(value = "${dubbo.component.scan.config}") private String componentList; @@ -95,30 +110,41 @@ public class ProjectTemplateDubboConfig { @Value(value = "${dubbo.component.init.clazz}") private String initClazz; + + @Value(value = "${dubbo.code.template.custom.ftl}") + private String customFtl; + + + /** + * 初始化的pom依赖 + */ + @Value(value = "${dubbo.component.init.pom}") + private String initPom; + + /** + * 项目需要依赖的配置文件 + */ + @Value(value = "${dubbo.component.init.config}") + private String configFile; + + /** + * 参数校验逻辑 植入bean配置 + */ + @Value(value = "${dubbo.component.validate.beans}") + private String validateBeans; + public String getInitClazz() { return initClazz; } - public void setInitClazz(String initClazz) { - this.initClazz = initClazz; - } - public String getComponentScanBeans() { return componentScanBeans; } - public void setComponentScanBeans(String componentScanBeans) { - this.componentScanBeans = componentScanBeans; - } - public String getComponentDecorateBeans() { return componentDecorateBeans; } - public void setComponentDecorateBeans(String componentDecorateBeans) { - this.componentDecorateBeans = componentDecorateBeans; - } - public Boolean getRequest() { return request; } @@ -139,42 +165,27 @@ public class ProjectTemplateDubboConfig { return readSenceSet; } - public void setReadSenceSet(String readSenceSet) { - this.readSenceSet = readSenceSet; - } - public String getWriteSenceSet() { return writeSenceSet; } - public void setWriteSenceSet(String writeSenceSet) { - this.writeSenceSet = writeSenceSet; - } public String getComponentList() { return componentList; } - public void setComponentList(String componentList) { - this.componentList = componentList; + public Boolean getPlantUMlDocSync() { + return plantUMlDocSync; } public Boolean getApiGenerate() { return apiGenerate; } - public void setApiGenerate(Boolean apiGenerate) { - this.apiGenerate = apiGenerate; - } - public String getPlantumlName() { return plantumlName; } - public void setPlantumlName(String plantumlName) { - this.plantumlName = plantumlName; - } - public String getDbName() { return dbName; } @@ -192,27 +203,21 @@ public class ProjectTemplateDubboConfig { } public String getModuleCommonPath() { - return moduleCommonPath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.COMMON; } - public void setModuleCommonPath(String moduleCommonPath) { - this.moduleCommonPath = moduleCommonPath; - } public String getModuleApiPath() { - return moduleApiPath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.API; } - public void setModuleApiPath(String moduleApiPath) { - this.moduleApiPath = moduleApiPath; - } public String getModuleCorePath() { - return moduleCorePath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.CORE; } - public void setModuleCorePath(String moduleCorePath) { - this.moduleCorePath = moduleCorePath; + public String getModuleParentPath() { + return projectPath + "/" + applicationName; } /** @@ -223,32 +228,44 @@ public class ProjectTemplateDubboConfig { int index = this.getModuleApiPath().lastIndexOf("/"); return this.getModuleApiPath().substring(0,index)+"/"+ GlobalConstant.API_DOC; } - /** - * 获取配置的组件扫描bean + * 获取UML doc文件存储路径 * @return */ - public List getComponentScanBeanList(){ - String scanBeansStr = this.getComponentScanBeans(); - - if(StringUtils.isEmpty(scanBeansStr)){ - return null; - } - return Lists.newArrayList(scanBeansStr.split(",")); + public String getUMLDocPath(){ + int index = this.getModuleCorePath().lastIndexOf("/"); + return this.getModuleCorePath().substring(0,index)+"/"+ GlobalConstant.PLANT_UML_DOC; } - /** - * 获取配置的组件装饰bean + * 获取项目配置文件配置 * @return */ - public List getComponentDecorateBeanList(){ - String decorateBeansStr = this.getComponentDecorateBeans(); + public List getConfigFileBean(){ + return configParseService.getConfigFileBean(this.configFile); + } - if(StringUtils.isEmpty(decorateBeansStr)){ - return null; - } - return Lists.newArrayList(decorateBeansStr.split(",")); + /** + * 获取统一的pom配置 + * 默认是父级pom.xml的实例 + * @return + */ + public Map getPomBeanV2(){ + return configParseService.getPomBeanV2(initPom, applicationName, appAliasName,groupId,artifactId,version); } + /** + * 返回配置的参数验证服务bean + * @return + */ + public List getValidateBeanList(){ + return configParseService.getValidateBeanList(validateBeans); + } + /** + * 获取自定义配置的代码元素 + * @return + */ + public List getFtlBeanList(){ + return configParseService.getFtlBeanList(this.customFtl,initPom, applicationName, appAliasName,groupId,artifactId,version); + } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateDynamicDDDConfig.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateDynamicDDDConfig.java similarity index 94% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateDynamicDDDConfig.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateDynamicDDDConfig.java index f6561e374ab50fff772cefba432c8dffe6519852..9df57377c79d230350017dc89b7a8f6615321492 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateDynamicDDDConfig.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateDynamicDDDConfig.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.config; +package com.tianhua.codemaker.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -10,7 +10,7 @@ import org.springframework.stereotype.Component; * 生成dubbo项目的配置文件 * date: 2021/6/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateSpringCloudConfig.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateSpringCloudConfig.java similarity index 58% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateSpringCloudConfig.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateSpringCloudConfig.java index 8338d0844f93e65bf752e59b5ba3abd803928c7a..b0016d5353085aa3acc31c5a6ba21b046d4bf546 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateSpringCloudConfig.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateSpringCloudConfig.java @@ -1,11 +1,18 @@ -package com.coderman.codemaker.config; +package com.tianhua.codemaker.config; -import com.coderman.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.config.ConfigFileBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; + /** * description: ProjectTemplateConfig
* date: 2020/7/7 22:14
@@ -17,12 +24,27 @@ import org.springframework.stereotype.Component; @PropertySource("classpath:projecttemplate-springcloud.properties") public class ProjectTemplateSpringCloudConfig { + @Autowired + private ConfigParseService configParseService; + @Value(value = "${springcloud.global.dbName}") private String dbName; @Value(value = "${springcloud.global.applicationName}") private String applicationName; + /** + * 代码生成项目主目录 + */ + @Value(value = "${springcloud.code.app.project.path}") + private String projectPath; + + /** + * 应用工程别名 + */ + @Value(value = "${springcloud.global.applicationNameAlias}") + private String appAliasName; + @Value(value = "${springcloud.pom.groupId}") private String groupId; @@ -32,13 +54,6 @@ public class ProjectTemplateSpringCloudConfig { @Value(value = "${springcloud.pom.version}") private String version; - @Value(value = "${springcloud.code.feign-api}") - private String moduleFeginApiPath; - - @Value(value = "${springcloud.code.feign-provider}") - private String moduleFeginProviderPath; - - /** * 应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 */ @@ -51,6 +66,12 @@ public class ProjectTemplateSpringCloudConfig { @Value("${springcloud.api.generator}") private Boolean apiGenerate; + /** + * 是否同步plantuml文档到工程中 + */ + @Value("${springcloud.plantumldoc.sync}") + private Boolean plantUMlDocSync; + @Value(value = "${springcloud.component.scan.config}") private String componentList; @@ -79,30 +100,41 @@ public class ProjectTemplateSpringCloudConfig { private String initClazz; + @Value(value = "${springcloud.code.template.custom.ftl}") + private String customFtl; + + + /** + * 初始化的pom依赖 + */ + @Value(value = "${springcloud.component.init.pom}") + private String initPom; + + /** + * 项目需要依赖的配置文件 + */ + @Value(value = "${springcloud.component.init.config}") + private String configFile; + + /** + * 参数校验逻辑 植入bean配置 + */ + @Value(value = "${springcloud.component.validate.beans}") + private String validateBeans; + public String getInitClazz() { return initClazz; } - public void setInitClazz(String initClazz) { - this.initClazz = initClazz; - } public String getComponentScanBeans() { return componentScanBeans; } - public void setComponentScanBeans(String componentScanBeans) { - this.componentScanBeans = componentScanBeans; - } - public String getComponentDecorateBeans() { return componentDecorateBeans; } - public void setComponentDecorateBeans(String componentDecorateBeans) { - this.componentDecorateBeans = componentDecorateBeans; - } - public Boolean getRequest() { return request; } @@ -123,42 +155,22 @@ public class ProjectTemplateSpringCloudConfig { return readSenceSet; } - public void setReadSenceSet(String readSenceSet) { - this.readSenceSet = readSenceSet; - } - public String getWriteSenceSet() { return writeSenceSet; } - public void setWriteSenceSet(String writeSenceSet) { - this.writeSenceSet = writeSenceSet; - } - public String getComponentList() { return componentList; } - public void setComponentList(String componentList) { - this.componentList = componentList; - } - public Boolean getApiGenerate() { return apiGenerate; } - public void setApiGenerate(Boolean apiGenerate) { - this.apiGenerate = apiGenerate; - } - public String getPlantumlName() { return plantumlName; } - public void setPlantumlName(String plantumlName) { - this.plantumlName = plantumlName; - } - public String getDbName() { return dbName; @@ -200,20 +212,23 @@ public class ProjectTemplateSpringCloudConfig { this.version = version; } - public String getModuleFeginApiPath() { - return moduleFeginApiPath; + + public Boolean getPlantUMlDocSync() { + return plantUMlDocSync; } - public void setModuleFeginApiPath(String moduleFeginApiPath) { - this.moduleFeginApiPath = moduleFeginApiPath; + public String getModuleFeginApiPath() { + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.API; } + public String getModuleFeginProviderPath() { - return moduleFeginProviderPath; + return projectPath + "/" + applicationName + "/" +appAliasName+GlobalConstant.PROVIDER; } - public void setModuleFeginProviderPath(String moduleFeginProviderPath) { - this.moduleFeginProviderPath = moduleFeginProviderPath; + + public String getModuleParentPath() { + return projectPath + "/" + applicationName; } /** @@ -224,4 +239,46 @@ public class ProjectTemplateSpringCloudConfig { int index = this.getModuleFeginApiPath().lastIndexOf("/"); return this.getModuleFeginApiPath().substring(0,index)+"/"+ GlobalConstant.API_DOC; } + + /** + * 获取UML doc文件存储路径 + * @return + */ + public String getUMLDocPath(){ + int index = this.getModuleFeginProviderPath().lastIndexOf("/"); + return this.getModuleFeginProviderPath().substring(0,index)+"/"+ GlobalConstant.PLANT_UML_DOC; + } + + /** + * 获取项目配置文件配置 + * @return + */ + public List getConfigFileBean(){ + return configParseService.getConfigFileBean(this.configFile); + } + + /** + * 获取统一的pom配置 + * 默认是父级pom.xml的实例 + * @return + */ + public Map getPomBeanV2(){ + return configParseService.getPomBeanV2(initPom, applicationName, appAliasName,groupId,artifactId,version); + } + + /** + * 返回配置的参数验证服务bean + * @return + */ + public List getValidateBeanList(){ + return configParseService.getValidateBeanList(validateBeans); + } + + /** + * 获取自定义配置的代码元素 + * @return + */ + public List getFtlBeanList(){ + return configParseService.getFtlBeanList(this.customFtl,initPom, applicationName, appAliasName,groupId,artifactId,version); + } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateSpringbootConfig.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateSpringbootConfig.java similarity index 58% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateSpringbootConfig.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateSpringbootConfig.java index 3847d36276363894a8a81e0312922b7ce368fcef..d15537ccd1f229da3f4ab90173fb6730fcad4fad 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/config/ProjectTemplateSpringbootConfig.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/config/ProjectTemplateSpringbootConfig.java @@ -1,11 +1,18 @@ -package com.coderman.codemaker.config; +package com.tianhua.codemaker.config; -import com.coderman.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.config.ConfigFileBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; + /** * description: ProjectTemplateConfig
* date: 2020/7/7 22:14
@@ -17,28 +24,42 @@ import org.springframework.stereotype.Component; @PropertySource("classpath:projecttemplate-springboot.properties") public class ProjectTemplateSpringbootConfig { + @Autowired + private ConfigParseService configParseService; + + @Value(value = "${springboot.global.dbName}") private String dbName; @Value(value = "${springboot.global.applicationName}") private String applicationName; - @Value(value = "${codemaker.pom.groupId}") + @Value(value = "${springboot.pom.groupId}") private String groupId; - @Value(value = "${codemaker.pom.artifactId}") + @Value(value = "${springboot.pom.artifactId}") private String artifactId; - @Value(value = "${codemaker.pom.version}") + @Value(value = "${springboot.pom.version}") private String version; - @Value(value = "${codemaker.code.outpath}") - private String outPath; + + /** + * 代码生成项目主目录 + */ + @Value(value = "${springboot.code.app.project.path}") + private String projectPath; + + /** + * 应用工程别名 + */ + @Value(value = "${springboot.global.applicationNameAlias}") + private String appAliasName; /** * 应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 */ - @Value("${codemaker.domain.plantuml}") + @Value("${springboot.domain.plantuml}") private String plantumlName; /** @@ -47,6 +68,14 @@ public class ProjectTemplateSpringbootConfig { @Value("${springboot.api.generator}") private Boolean apiGenerate; + + /** + * 是否同步plantuml文档到工程中 + */ + @Value("${springboot.plantumldoc.sync}") + private Boolean plantUMlDocSync; + + @Value(value = "${springboot.component.scan.config}") private String componentList; @@ -75,30 +104,43 @@ public class ProjectTemplateSpringbootConfig { private String initClazz; + @Value(value = "${springboot.code.template.custom.ftl}") + private String customFtl; + + + /** + * 初始化的pom依赖 + */ + @Value(value = "${springboot.component.init.pom}") + private String initPom; + + /** + * 项目需要依赖的配置文件 + */ + @Value(value = "${springboot.component.init.config}") + private String configFile; + + /** + * 参数校验逻辑 植入bean配置 + */ + @Value(value = "${springboot.component.validate.beans}") + private String validateBeans; + + public String getInitClazz() { return initClazz; } - public void setInitClazz(String initClazz) { - this.initClazz = initClazz; - } public String getComponentScanBeans() { return componentScanBeans; } - public void setComponentScanBeans(String componentScanBeans) { - this.componentScanBeans = componentScanBeans; - } public String getComponentDecorateBeans() { return componentDecorateBeans; } - public void setComponentDecorateBeans(String componentDecorateBeans) { - this.componentDecorateBeans = componentDecorateBeans; - } - public Boolean getRequest() { return request; } @@ -127,41 +169,21 @@ public class ProjectTemplateSpringbootConfig { return writeSenceSet; } - public void setWriteSenceSet(String writeSenceSet) { - this.writeSenceSet = writeSenceSet; - } public String getComponentList() { return componentList; } - public void setComponentList(String componentList) { - this.componentList = componentList; - } public Boolean getApiGenerate() { return apiGenerate; } - public void setApiGenerate(Boolean apiGenerate) { - this.apiGenerate = apiGenerate; - } public String getPlantumlName() { return plantumlName; } - public void setPlantumlName(String plantumlName) { - this.plantumlName = plantumlName; - } - - public String getOutPath() { - return outPath; - } - - public void setOutPath(String outPath) { - this.outPath = outPath; - } public String getDbName() { return dbName; @@ -203,6 +225,15 @@ public class ProjectTemplateSpringbootConfig { this.version = version; } + + public Boolean getPlantUMlDocSync() { + return plantUMlDocSync; + } + + public void setPlantUMlDocSync(Boolean plantUMlDocSync) { + this.plantUMlDocSync = plantUMlDocSync; + } + @Override public String toString() { return "ProjectTemplateSpringbootConfig{" + @@ -211,7 +242,6 @@ public class ProjectTemplateSpringbootConfig { ", groupId='" + groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", version='" + version + '\'' + - ", outPath='" + outPath + '\'' + ", plantumlName='" + plantumlName + '\'' + '}'; } @@ -221,6 +251,50 @@ public class ProjectTemplateSpringbootConfig { * @return */ public String getApiDocPath(){ - return this.getOutPath() + "/" + GlobalConstant.API_DOC; + return getModulePath() + "/" + GlobalConstant.API_DOC; + } + + /** + * 获取UML doc文件存储路径 + * @return + */ + public String getUMLDocPath(){ + return getModulePath() + "/" + GlobalConstant.PLANT_UML_DOC; + } + + public String getModulePath() { + return projectPath + "/" + applicationName; + } + /** + * 获取项目配置文件配置 + * @return + */ + public List getConfigFileBean(){ + return configParseService.getConfigFileBean(this.configFile); + } + + /** + * 获取统一的pom配置 + * 默认是父级pom.xml的实例 + * @return + */ + public Map getPomBeanV2(){ + return configParseService.getPomBeanV2(initPom, applicationName, appAliasName,groupId,artifactId,version); + } + + /** + * 返回配置的参数验证服务bean + * @return + */ + public List getValidateBeanList(){ + return configParseService.getValidateBeanList(validateBeans); + } + + /** + * 获取自定义配置的代码元素 + * @return + */ + public List getFtlBeanList(){ + return configParseService.getFtlBeanList(this.customFtl,initPom, applicationName, appAliasName,groupId,artifactId,version); } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/CodeMakerController.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/CodeMakerController.java similarity index 85% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/CodeMakerController.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/CodeMakerController.java index 93cc4b1ef93210cf7b5a2c98bb0d09b9d7c8c1b5..84676c95c704ab667f0476907ca223f4af2535a4 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/CodeMakerController.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/CodeMakerController.java @@ -1,13 +1,14 @@ -package com.coderman.codemaker.controller; - -import com.alibaba.fastjson.JSON; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.WriteCodeService; -import com.coderman.codemaker.service.WriteDynamicCodeService; -import com.coderman.codemaker.service.write.WriteSpringbootService; -import com.coderman.codemaker.service.registry.element.DynamicDDDVarRegistry; -import com.coderman.codemaker.service.registry.element.MapperXmlVarRegistry; +package com.tianhua.codemaker.controller; + +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.WriteCodeService; +import com.tianhua.codemaker.service.WriteDynamicCodeService; +import com.tianhua.codemaker.service.write.WriteSpringbootService; +import com.tianhua.codemaker.service.registry.element.DynamicDDDVarRegistry; +import com.tianhua.codemaker.service.registry.element.MapperXmlVarRegistry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -26,6 +27,9 @@ import java.util.*; */ @RestController public class CodeMakerController { + + private Logger logger = LoggerFactory.getLogger(CodeMakerController.class); + @Resource(name = "mapperXmlVarRegistry") private MapperXmlVarRegistry mapperXmlVarRegistry; @@ -52,6 +56,7 @@ public class CodeMakerController { if(map.containsKey("dynamicddd")){ writeDynamicCodeService.writeAllWithDDD(map); }else { + logger.info("纯数据库模式生成---->"); Map tableBeanMap = (Map)map.get("table"); Map> columnBeanListMap = (Map>)map.get("columns"); Map varMap = new HashMap<>(); @@ -67,7 +72,9 @@ public class CodeMakerController { writeCodeService.writeAll(v.getHumpClassName(),varMap,""); }); //写公共服务类 - writeCodeService.writeCommon(varMap,""); + writeCodeService.writeCommon(varMap); + //写纯DB模式下的配置信息和pom文件 + writeDynamicCodeService.writeConfigForDBModel(varMap); //渲染e-r图 writeCodeService.writeERPicture(tableBeanMap,columnBeanListMap); } @@ -84,7 +91,6 @@ public class CodeMakerController { Map map = mapperXmlVarRegistry.getTemplateVar(); Map tableBeanMap = (Map)map.get("table"); - System.out.println("tableBeanMap====="+ JSON.toJSONString(tableBeanMap)); Map> columnBeanListMap = (Map>)map.get("columns"); Map varMap = new HashMap<>(); //循环写每个表对应的类 @@ -98,10 +104,13 @@ public class CodeMakerController { writeFileService.writeAll(v.getHumpClassName(),varMap,"/fast/"); }); + //写公共服务类 - writeFileService.writeCommon(varMap,"/fast/"); + writeCodeService.writeCommon(varMap); + //写纯DB模式下的配置信息和pom文件 + writeDynamicCodeService.writeConfigForDBModel(varMap); //渲染e-r图 - writeFileService.writeERPicture(tableBeanMap,columnBeanListMap); + writeCodeService.writeERPicture(tableBeanMap,columnBeanListMap); return "success"; } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/GeneratorController.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/GeneratorController.java similarity index 85% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/GeneratorController.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/GeneratorController.java index 5d9ba0bbc3c2cd47417ea221915473d78328ccd1..59b5e183cf27e8c52db2fb5ef925e8855d9e8acc 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/GeneratorController.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/GeneratorController.java @@ -1,16 +1,16 @@ -package com.coderman.codemaker.controller; - -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.EnumBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.WriteCodeService; -import com.coderman.codemaker.service.registry.element.*; -import com.coderman.codemaker.service.template.FreemarkerService; -import com.coderman.codemaker.service.WriteDynamicCodeService; +package com.tianhua.codemaker.controller; + +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.EnumBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.WriteCodeService; +import com.tianhua.codemaker.service.registry.element.*; +import com.tianhua.codemaker.service.template.FreemarkerService; +import com.tianhua.codemaker.service.WriteDynamicCodeService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -116,7 +116,7 @@ public class GeneratorController { Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ List classBeanList = (List)map.get("adaptervo"); - writeDynamicCodeService.writeVO(classBeanList); + writeDynamicCodeService.writeClassEle(classBeanList,TemplateFileEnum.VO_DDD,TemplateFileEnum.VO_DDD,null); }else { Map tableBeanMap = (Map)map.get("table"); Map> columnBeanListMap = (Map>)map.get("columns"); @@ -215,7 +215,7 @@ public class GeneratorController { Map map = serviceImplVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ List classBeanList = (List)map.get("controller"); - writeDynamicCodeService.writeController(classBeanList); + writeDynamicCodeService.writeClassEle(classBeanList,TemplateFileEnum.CONTROLLER_DDD,TemplateFileEnum.CONTROLLER_DDD,null); }else { Map tableBeanMap = (Map)map.get("table"); Map> columnBeanListMap = (Map>)map.get("columns"); @@ -268,11 +268,8 @@ public class GeneratorController { public String getFacadeTemplate(){ Map map = serviceVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ - List interfaceBeanList = (List)map.get("derivefacade"); - writeDynamicCodeService.writeFacade(interfaceBeanList); - - List classBeanList = (List)map.get("derivefacadeimpl"); - writeDynamicCodeService.writeFacadeImpl(classBeanList); + writeDynamicCodeService.writeInterfaceEle((List)map.get("derivefacade"),TemplateFileEnum.FACADE_DDD,TemplateFileEnum.FACADE,null); + writeDynamicCodeService.writeClassEle((List)map.get("derivefacadeimpl"),TemplateFileEnum.FACADE_IMPL_DDD, TemplateFileEnum.FACADE_IMPL,null); }else { Map tableBeanMap = (Map)map.get("table"); Map> columnBeanListMap = (Map>)map.get("columns"); @@ -303,7 +300,7 @@ public class GeneratorController { Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ List classBeanList = (List)map.get("derivedto"); - writeDynamicCodeService.writeDTO(classBeanList); + writeDynamicCodeService.writeClassEle(classBeanList,TemplateFileEnum.DTO_DDD, TemplateFileEnum.DTO_DDD,null); }else { Map tableBeanMap = (Map)map.get("table"); Map> columnBeanListMap = (Map>)map.get("columns"); @@ -330,7 +327,7 @@ public class GeneratorController { Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ List classBeanList = (List)map.get("domainbo"); - writeDynamicCodeService.writeBO(classBeanList); + writeDynamicCodeService.writeClassEle(classBeanList,TemplateFileEnum.BUSINESS_OBJECT_DDD, TemplateFileEnum.BUSINESS_OBJECT_DDD,null); }else { Map tableBeanMap = (Map)map.get("table"); Map> columnBeanListMap = (Map>)map.get("columns"); @@ -363,8 +360,8 @@ public class GeneratorController { if(map.containsKey("dynamicddd")){ List valueObjectBeanList = (List)map.get("domainvalueobject"); List enumBeanList = (List)map.get("valueobjectenum"); - writeDynamicCodeService.writeValueObject(valueObjectBeanList); - writeDynamicCodeService.writeEnum(enumBeanList); + writeDynamicCodeService.writeClassEle(valueObjectBeanList,TemplateFileEnum.VALUE_OBJECT,TemplateFileEnum.VALUE_OBJECT,null); + writeDynamicCodeService.writeEnumEle(enumBeanList,null); }else { log.warn("valueobject class generation depends on plantuml..........!!!!!!!"); } @@ -381,7 +378,7 @@ public class GeneratorController { Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ List classBeanList = (List)map.get("domainmsg"); - writeDynamicCodeService.writeMsgBody(classBeanList); + writeDynamicCodeService.writeClassEle(classBeanList,TemplateFileEnum.MESSAGE_BODY,TemplateFileEnum.BUSINESS_OBJECT_DDD,null); }else { log.warn("msgbody class generation depends on plantuml..........!!!!!!!"); } @@ -399,13 +396,9 @@ public class GeneratorController { List gatawayBeanList = (List)map.get("gataway"); List repositoryBeanList = (List)map.get("repository"); gatawayBeanList.addAll(repositoryBeanList); - writeDynamicCodeService.writeDomainGataway(gatawayBeanList); - - List gatawayImplBeanList = (List)map.get("gatawayimpl"); - writeDynamicCodeService.writeGatawayImpl(gatawayImplBeanList); - - List repositoryImplBeanList = (List)map.get("repositoryimpl"); - writeDynamicCodeService.writeRepositoryImpl(repositoryImplBeanList); + writeDynamicCodeService.writeInterfaceEle(gatawayBeanList,TemplateFileEnum.GATAWAY,TemplateFileEnum.GATAWAY,null); + writeDynamicCodeService.writeClassEle((List)map.get("gatawayimpl"), TemplateFileEnum.GATAWAY_IMPL,TemplateFileEnum.GATAWAY_IMPL,null); + writeDynamicCodeService.writeClassEle((List)map.get("repositoryimpl"), TemplateFileEnum.GATAWAY_IMPL,TemplateFileEnum.GATAWAY_IMPL,null); }else { //gataway需要依赖plantUML类图标示,否则基于数据库表生成会显得不伦不类 log.warn("gataway class generation depends on plantuml..........!!!!!!!"); @@ -422,13 +415,9 @@ public class GeneratorController { public String getAclAdapter(){ Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ - List aclBeanList = (List)map.get("infrastacl"); - List aclImplBeanList = (List)map.get("infrastaclimpl"); - - List aclParamBeanList = (List)map.get("infrastaclparam"); - writeDynamicCodeService.writeAclInterface(aclBeanList); - writeDynamicCodeService.writeAclInterfaceImpl(aclImplBeanList); - writeDynamicCodeService.writeAclInterfaceParam(aclParamBeanList); + writeDynamicCodeService.writeInterfaceEle((List)map.get("infrastacl"),TemplateFileEnum.ACL,TemplateFileEnum.ACL,null); + writeDynamicCodeService.writeClassEle((List)map.get("infrastaclparam"),TemplateFileEnum.BUSINESS_OBJECT_DDD,TemplateFileEnum.ACL_PARAM,null); + writeDynamicCodeService.writeClassEle((List)map.get("infrastaclimpl"),TemplateFileEnum.ACL_IMPL,TemplateFileEnum.ACL_IMPL,null); }else { //gataway需要依赖plantUML类图标示,否则基于数据库表生成会显得不伦不类 log.warn("gataway class generation depends on plantuml..........!!!!!!!"); @@ -445,7 +434,7 @@ public class GeneratorController { Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ List commandBeanList = (List)map.get("cmd"); - writeDynamicCodeService.writeCommand(commandBeanList); + writeDynamicCodeService.writeClassEle(commandBeanList,TemplateFileEnum.BUSINESS_OBJECT_DDD, TemplateFileEnum.CMD,null); }else { //gataway需要依赖plantUML类图标示,否则基于数据库表生成会显得不伦不类 log.warn("gataway class generation depends on plantuml..........!!!!!!!"); @@ -482,7 +471,7 @@ public class GeneratorController { Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ List factoryBeanList = (List)map.get("domainfactory"); - writeDynamicCodeService.writeFactory(factoryBeanList); + writeDynamicCodeService.writeClassEle(factoryBeanList,TemplateFileEnum.FACTORY, TemplateFileEnum.FACTORY,null); }else { //factory需要依赖plantUML类图标示,否则基于数据库表生成会显得不伦不类 log.warn("factory class generation depends on plantuml..........!!!!!!!"); @@ -499,8 +488,7 @@ public class GeneratorController { public String getDTOBOConvert(){ Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ - List dtoboconvertBeanList = (List)map.get("dtoboconvert"); - writeDynamicCodeService.writeDTOBOConvert(dtoboconvertBeanList); + writeDynamicCodeService.writeInterfaceEle((List)map.get("dtoboconvert"),TemplateFileEnum.DTOBO_CONVERT,TemplateFileEnum.CONVERT,null); }else { //dtoboconvert需要依赖plantUML类图标示,否则基于数据库表生成会显得不伦不类 log.warn("dtoboconvert class generation depends on plantuml..........!!!!!!!"); @@ -516,8 +504,7 @@ public class GeneratorController { public String getVOBOConvert(){ Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ - List voboconvertBeanList = (List)map.get("voboconvert"); - writeDynamicCodeService.writeVOBOConvert(voboconvertBeanList); + writeDynamicCodeService.writeInterfaceEle((List)map.get("voboconvert"),TemplateFileEnum.VOBO_CONVERT,TemplateFileEnum.CONVERT,null); }else { //voboconvert需要依赖plantUML类图标示,否则基于数据库表生成会显得不伦不类 log.warn("voboconvert class generation depends on plantuml..........!!!!!!!"); @@ -532,8 +519,7 @@ public class GeneratorController { public String getDOBOConvert(){ Map map = entityVarRegistry.getTemplateVar(); if(map.containsKey("dynamicddd")){ - List doboconvertBeanList = (List)map.get("doboconvert"); - writeDynamicCodeService.writeDOBOConvert(doboconvertBeanList); + writeDynamicCodeService.writeInterfaceEle((List)map.get("doboconvert"),TemplateFileEnum.DOBO_CONVERT,TemplateFileEnum.CONVERT,null); }else { log.warn("doboconvert class generation depends on plantuml..........!!!!!!!"); } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/GeneratorFastController.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/GeneratorFastController.java similarity index 96% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/GeneratorFastController.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/GeneratorFastController.java index 2d9eacec8989f886d19c0fab5e9e82200e281fc7..0ae38867f99c161a2a2319a33ec2700e8ec8f8e7 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/controller/GeneratorFastController.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/controller/GeneratorFastController.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.controller; - -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.write.WriteSpringbootService; -import com.coderman.codemaker.service.registry.element.*; -import com.coderman.codemaker.utils.FreemarkerUtils; +package com.tianhua.codemaker.controller; + +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.write.WriteSpringbootService; +import com.tianhua.codemaker.service.registry.element.*; +import com.tianhua.codemaker.utils.FreemarkerUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/dao/SqlMapper.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/dao/SqlMapper.java similarity index 69% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/dao/SqlMapper.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/dao/SqlMapper.java index 40f80e3300a436a098fcb21f6eba7596f1e8054a..179b687a839633defd474142fdbb16b178e2c078 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/dao/SqlMapper.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/dao/SqlMapper.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.dao; +package com.tianhua.codemaker.dao; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; import org.springframework.stereotype.Repository; import java.util.List; /** - * @Author fanchunshuai + * @Author shenshuai * @Date 2019/11/22 17 * @Description:mysql 元数据查询接口 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/exceptions/ConfigException.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/exceptions/ConfigException.java similarity index 82% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/exceptions/ConfigException.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/exceptions/ConfigException.java index bdf00e171a7887fd34ccdc3363e56709e29f6596..f83d0dc3908b3048649f815a5c226a3f7d624539 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/exceptions/ConfigException.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/exceptions/ConfigException.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.exceptions; +package com.tianhua.codemaker.exceptions; /** * Description: * date: 2021/6/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/listener/RefrashConfigListener.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/listener/RefrashConfigListener.java similarity index 73% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/listener/RefrashConfigListener.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/listener/RefrashConfigListener.java index 47fa3bfebb88a2d8c76821b6a83128a9c330c28f..dbc88cfb94e2dea7d694665bcd8bac448658f4a0 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/listener/RefrashConfigListener.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/listener/RefrashConfigListener.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.listener; +package com.tianhua.codemaker.listener; -import com.coderman.codemaker.api.ICompScanService; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.DefaultPackageConfig; -import com.coderman.codemaker.service.dsl.DSLService; +import com.tianhua.codemaker.app.FunctionCodeAppWriteService; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.config.DefaultPackageConfig; +import com.tianhua.codemaker.service.dsl.DSLService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -12,14 +12,12 @@ import org.springframework.context.ApplicationListener; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import javax.annotation.Resource; - /** * Description:项目启动监听器,做数据初始化使用 * date: 2020/9/29 10:21 上午 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -31,15 +29,16 @@ public class RefrashConfigListener implements ApplicationListener classBeanList, TemplateFileEnum templateFileEnum, TemplateFileEnum eleEnum, IWriteFileService writeFileService) { + boolean dynamicDDD = false; + if(writeFileService == null){ + writeFileService = appServiceConfig.getModuleWriteService(templateFileEnum.getTempFileName()); + }else { + dynamicDDD = true; + } + if (writeFileService == null) { + return; + } + for (ClassBean classBean : classBeanList){ + Map varMap = classBean.buildVarMap(); + String boContent; + if(dynamicDDD){ + boContent = freemarkerService.parseTplDynamicDDD(templateFileEnum.getTempFileName(), varMap); + }else { + boContent = freemarkerService.parseTpl(templateFileEnum.getTempFileName(), varMap); + } + WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,eleEnum); + writeFileService.writeContent(writeContentBean); + } + } + + + /** + * 所有interface类型的element统一写入口 + * @param interfaceBeanList + * @param templateFileEnum + * @param eleEnum + */ + public void writeInterfaceEle(List interfaceBeanList, TemplateFileEnum templateFileEnum, TemplateFileEnum eleEnum, IWriteFileService writeFileService){ + boolean dynamicDDD = false; + if(writeFileService == null){ + writeFileService = appServiceConfig.getModuleWriteService(templateFileEnum.getTempFileName()); + }else { + dynamicDDD = true; + } + if (writeFileService == null) { + return; + } + for (InterfaceBean interfaceBean : interfaceBeanList){ + Map varMap = interfaceBean.buildVarMap(); + String interfaceContent; + if(dynamicDDD){ + interfaceContent = freemarkerService.parseTplDynamicDDD(templateFileEnum.getTempFileName(), varMap); + }else { + interfaceContent = freemarkerService.parseTpl(templateFileEnum.getTempFileName(), varMap); + } + WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,eleEnum); + writeFileService.writeContent(writeContentBean); + } + } + + + public void writeEnumEle(List enumBeanList, IWriteFileService writeFileService){ + if(writeFileService == null){ + writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.ENUM.getTempFileName()); + } + if (writeFileService == null) { + return; + } + writeFileService = getRoute(enumBeanList.get(0).getPackageName(),writeFileService); + //写枚举 + for (EnumBean enumBean : enumBeanList){ + Map varMap = enumBean.buildVarMap(); + String enumContent; + enumContent = freemarkerService.parseTpl(TemplateFileEnum.ENUM.getTempFileName(), varMap); + WriteContentBean writeContentBean = enumBean.buildWriteContentBean(enumContent,TemplateFileEnum.ENUM); + writeFileService.writeContent(writeContentBean); + } + } + + + + + private IWriteFileService getRoute(String packageName,IWriteFileService writeFileService){ + String appType = appServiceConfig.getApplicationType(); + if (appType.equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + return writeFileService; + } else if (appType.equals(ModuleEnum.DUBBO_API.getAppName()) && packageName.contains("api")) { + return appServiceConfig.getWriteServiceByModuleName(ModuleEnum.DUBBO_API.getModuleName()); + } else if (appType.equals(ModuleEnum.COLA_ADAPTER.getAppName()) && packageName.contains("api")) { + return appServiceConfig.getWriteServiceByModuleName(ModuleEnum.COLA_CLIENT.getModuleName()); + } else if (appType.equals(ModuleEnum.SC_FEIGN_API.getAppName()) && packageName.contains("api")) { + return appServiceConfig.getWriteServiceByModuleName(ModuleEnum.SC_FEIGN_API.getModuleName()); + } + return writeFileService; + } + + + + + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/AnnotationParseService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/AnnotationParseService.java new file mode 100644 index 0000000000000000000000000000000000000000..c18b1f8fc772760a1b9628cae37f7a827e9cd7e7 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/AnnotationParseService.java @@ -0,0 +1,183 @@ +package com.tianhua.codemaker.service; + +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.config.AnnotationTagBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.stereotype.Service; + +import java.io.*; +import java.util.*; + +/** + * Description:类和方法上的注解标签解析 + * date: 2022/1/24 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class AnnotationParseService { + + @Autowired + private ResourceLoader resourceLoader; + + @Autowired + private AppServiceConfig appServiceConfig; + /** + * 统一处理注解标签内容 + * @param plantUmlContextBean + */ + public void dealPlantUmlContextAnnotation(PlantUmlContextBean plantUmlContextBean){ + Map annotationTagBeanMap = buildAnnotationTagBeanMap(); + plantUmlContextBean.getClassBeanMap().forEach((k,classBean)->{ + //处理类上的注解信息 + if(CollectionUtils.isNotEmpty(classBean.getAnnotationTagList())){ + List annotationContentList = new ArrayList<>(); + + for (String annotationTag : classBean.getAnnotationTagList()){ + AnnotationTagBean annotationTagBean = annotationTagBeanMap.get(annotationTag); + if(annotationTagBean != null){ + String newPackage = annotationTagBean.getPackageName().replace("${package}",appServiceConfig.getPackage()); + classBean.addImportClass(newPackage + "."+annotationTagBean.getClassName()); + classBean.addDynamicImportClass(newPackage + "."+annotationTagBean.getClassName()); + annotationContentList.add(annotationTagBean.getAnnotation()); + } + } + classBean.setAnnotationTagList(annotationContentList); + } + + //处理方法上的注解信息 + if(CollectionUtils.isNotEmpty(classBean.getMethodBeanList())){ + for (MethodBean methodBean : classBean.getMethodBeanList()){ + List annotationContentList = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(methodBean.getAnnotationTagList())){ + for (String annotationTag : methodBean.getAnnotationTagList()){ + AnnotationTagBean annotationTagBean = annotationTagBeanMap.get(annotationTag); + if(annotationTagBean != null){ + String newPackage = annotationTagBean.getPackageName().replace("${package}",appServiceConfig.getPackage()); + classBean.addImportClass(newPackage+"."+annotationTagBean.getClassName()); + classBean.addDynamicImportClass(newPackage + "."+annotationTagBean.getClassName()); + + annotationContentList.add(annotationTagBean.getAnnotation()); + } + } + methodBean.setAnnotationTagList(annotationContentList); + } + } + } + }); + + plantUmlContextBean.getInterfaceBeanMap().forEach((k,interfaceBean)->{ + //处理类上的注解信息 + if(CollectionUtils.isNotEmpty(interfaceBean.getAnnotationTagList())){ + List annotationContentList = new ArrayList<>(); + for (String annotationTag : interfaceBean.getAnnotationTagList()){ + AnnotationTagBean annotationTagBean = annotationTagBeanMap.get(annotationTag); + if(annotationTagBean != null){ + String newPackage = annotationTagBean.getPackageName().replace("${package}",appServiceConfig.getPackage()); + if(annotationTagBean.modifyOnThis()){ + interfaceBean.addImportClass(newPackage+"."+annotationTagBean.getClassName()); + }else { + interfaceBean.addChildImportClass(newPackage+"."+annotationTagBean.getClassName()); + } + annotationContentList.add(annotationTagBean.getAnnotation()); + } + } + interfaceBean.setAnnotationTagList(annotationContentList); + } + + //处理方法上的注解信息 + if(CollectionUtils.isNotEmpty(interfaceBean.getMethodBeanList())){ + for (MethodBean methodBean : interfaceBean.getMethodBeanList()){ + List annotationContentList = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(methodBean.getAnnotationTagList())){ + for (String annotationTag : methodBean.getAnnotationTagList()){ + AnnotationTagBean annotationTagBean = annotationTagBeanMap.get(annotationTag); + if(annotationTagBean != null){ + String newPackage = annotationTagBean.getPackageName().replace("${package}",appServiceConfig.getPackage()); + if(annotationTagBean.modifyOnThis()){ + interfaceBean.addImportClass(newPackage+"."+annotationTagBean.getClassName()); + }else { + interfaceBean.addChildImportClass(newPackage+"."+annotationTagBean.getClassName()); + } + annotationContentList.add(annotationTagBean.getAnnotation()); + } + } + methodBean.setAnnotationTagList(annotationContentList); + } + } + } + }); + + } + + /** + * 构建注解标示对象配置 + * @return + */ + public Map buildAnnotationTagBeanMap(){ + Map annotationTagBeanMap = new HashMap<>(); + try { + String path = GlobalConstant.COMP_COMPONENT_ANNOTATION_TAG_PATH; + Resource resource = resourceLoader.getResource("classpath:"+path); + File file = resource.getFile(); + for (File annoTagFile : file.listFiles()){ + Properties properties = readPropertiesFile(annoTagFile.getAbsolutePath()); + AnnotationTagBean annotationTagBean = new AnnotationTagBean(); + for (Map.Entry entry : properties.entrySet()) { + if (entry.getKey().equals(GlobalConstant.COMP_PACKAGE)) { + annotationTagBean.setPackageName(entry.getValue().toString()); + } + if (entry.getKey().equals(GlobalConstant.COMP_ANNOTATION_ALIAS)) { + annotationTagBean.setClassAlias(entry.getValue().toString()); + } + if (entry.getKey().equals(GlobalConstant.COMP_ANNOTATION_PRE)) { + annotationTagBean.setAnnotation(entry.getValue().toString()); + } + if (entry.getKey().equals(GlobalConstant.COMP_MODIFY_ON)) { + annotationTagBean.setModifyOn(entry.getValue().toString()); + } + } + annotationTagBean.setClassName(annoTagFile.getName().replace(".properties","")); + annotationTagBeanMap.put(annotationTagBean.getClassAlias(),annotationTagBean); + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return annotationTagBeanMap; + } + + + /** + * 读取组件配置文件 + * @param filePath + * @return + * @throws IOException + */ + public Properties readPropertiesFile(String filePath) throws IOException { + InputStream inputStream = null; + try { + + Properties props = new Properties(); + // 使用InPutStream流读取properties文件 + BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath)); + props.load(bufferedReader); + return props; + } catch (Exception e) { + return null; + } finally { + if (inputStream != null) { + inputStream.close(); + } + } + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteApiDocService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteApiDocService.java similarity index 76% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteApiDocService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteApiDocService.java index 5183bc53516426182a352fc702f9cb407af88913..06fde4430f51ac0b9e1f49529ebdd09e2c99a444 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteApiDocService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteApiDocService.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.service; - -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.bean.apidoc.ApiDocBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.template.FreemarkerService; +package com.tianhua.codemaker.service; + +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.bean.apidoc.ApiDocBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.template.FreemarkerService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -21,7 +21,7 @@ import java.util.stream.Collectors; * Description: * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -49,9 +49,7 @@ public class WriteApiDocService { List apiDocBeanList = new ArrayList<>(); - classBean.getMethodBeanList().forEach(methodBean -> { - apiDocBeanList.add(methodBean.buildApiDocBean(classVOBeanMap)); - }); + classBean.getMethodBeanList().forEach(methodBean -> apiDocBeanList.add(methodBean.buildApiDocBean(classVOBeanMap))); varMap.put("apiList", apiDocBeanList); String content = freemarkerService.parseTplApi(TemplateFileEnum.API_HTTP.getTempFileName(), varMap); @@ -94,7 +92,14 @@ public class WriteApiDocService { .templateName(TemplateFileEnum.API_HTTP.getTempFileName()).build(); writeFileService.writeContent(writeContentBean); } + } + public void writeSqlDoc(List sqlContentList, IWriteFileService writeFileService){ + StringBuilder stringBuilder = new StringBuilder(""); + sqlContentList.forEach(sql->stringBuilder.append(sql)); + WriteContentBean writeContentBean = WriteContentBean.builder().content(stringBuilder.toString()) + .templateName(TemplateFileEnum.SQL.getTempFileName()).build(); + writeFileService.writeContent(writeContentBean); } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteCodeService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteCodeService.java similarity index 83% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteCodeService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteCodeService.java index 115924451df5625e103afc8c40060f41fb8023b2..ae14dfdd9359e2370c7e672e5747263230d214de 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/WriteCodeService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteCodeService.java @@ -1,15 +1,15 @@ -package com.coderman.codemaker.service; - -import com.coderman.codemaker.app.IWriteFileService; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.bean.WriteContentBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.dberpicture.DBErPictureService; -import com.coderman.codemaker.service.template.FreemarkerService; -import com.coderman.codemaker.utils.Constant; +package com.tianhua.codemaker.service; + +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.dberpicture.DBErPictureService; +import com.tianhua.codemaker.service.template.FreemarkerService; +import com.tianhua.codemaker.utils.Constant; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -26,7 +26,7 @@ import java.util.Map; * date: 2021/6/22 * * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -92,8 +92,11 @@ public class WriteCodeService { if (writeFileService == null) { return; } + String classPackageName = content.split("\n")[0].replace("package","").replace(" ","").replace(";",""); + WriteContentBean writeContentBean = WriteContentBean.builder().content(content) .templateName(TemplateFileEnum.DATA_OBJECT.getTempFileName()) + .classPackageName(classPackageName) .humpClassName(humpClassName).build(); writeFileService.writeContent(writeContentBean); @@ -359,73 +362,72 @@ public class WriteCodeService { * @param humpClassName * @param varMap */ - public void writeAll(String humpClassName, Map varMap, String fast) { + public void writeAll(final String humpClassName, Map varMap, String fast) { if (StringUtils.isEmpty(fast)) { fast = "/" + appServiceConfig.getApplicationType() + "/"; } String entityContent = freemarkerService.parseTpl(fast + TemplateFileEnum.ENTITY.getTempFileName(), varMap); - this.writeEntity(entityContent, humpClassName); + this.writeEntity(entityContent, humpClassName + "Entity"); String serviceContent = freemarkerService.parseTpl(fast + TemplateFileEnum.SERVICE.getTempFileName(), varMap); - this.writeService(serviceContent, humpClassName); + this.writeService(serviceContent, humpClassName + "Service"); String serviceImplContent = freemarkerService.parseTpl(fast + TemplateFileEnum.SERVICE_IMPL.getTempFileName(), varMap); - this.writeServiceImpl(serviceImplContent, humpClassName); + this.writeServiceImpl(serviceImplContent, humpClassName + "ServiceImpl"); String mapperXmlContent = freemarkerService.parseTpl(fast + TemplateFileEnum.MAPPER_XML.getTempFileName(), varMap); - this.writeMapperXml(mapperXmlContent, humpClassName); + this.writeMapperXml(mapperXmlContent, humpClassName + "Mapper"); String mapperContent = freemarkerService.parseTpl(fast + TemplateFileEnum.MAPPER.getTempFileName(), varMap); - this.writeMapper(mapperContent, humpClassName); + this.writeMapper(mapperContent, humpClassName+ "Mapper"); String controllerContent = freemarkerService.parseTpl(fast + TemplateFileEnum.CONTROLLER.getTempFileName(), varMap); - this.writeController(controllerContent, humpClassName); + this.writeController(controllerContent, humpClassName+ "Controller"); String voContent = freemarkerService.parseTpl(fast + TemplateFileEnum.VO.getTempFileName(), varMap); - this.writeVO(voContent, humpClassName); + this.writeVO(voContent, humpClassName + "VO"); String testContent = freemarkerService.parseTpl(fast + TemplateFileEnum.TEST.getTempFileName(), varMap); - this.writeTest(testContent, humpClassName); + if(appServiceConfig.getApplicationType().equals("springboot")){ + this.writeTest(testContent, humpClassName +"Service"); + }else { + this.writeTest(testContent, humpClassName + "Facade"); + } String boContent = freemarkerService.parseTpl(fast + TemplateFileEnum.BUSINESS_OBJECT.getTempFileName(), varMap); - this.writeBO(boContent, humpClassName); + this.writeBO(boContent, humpClassName + "BO"); String dtoContent = freemarkerService.parseTpl(fast + TemplateFileEnum.DTO.getTempFileName(), varMap); - this.writeDTO(dtoContent, humpClassName); + this.writeDTO(dtoContent, humpClassName + "DTO"); String facadeContent = freemarkerService.parseTpl(fast + TemplateFileEnum.FACADE.getTempFileName(), varMap); - this.writeFacade(facadeContent, humpClassName); + this.writeFacade(facadeContent, humpClassName + "Facade"); String facadeImplContent = freemarkerService.parseTpl(fast + TemplateFileEnum.FACADE_IMPL.getTempFileName(), varMap); - this.writeFacadeImpl(facadeImplContent, humpClassName); + this.writeFacadeImpl(facadeImplContent, humpClassName + "FacadeImpl"); String doContent = freemarkerService.parseTpl(fast + TemplateFileEnum.DATA_OBJECT.getTempFileName(), varMap); - this.writeDO(doContent, humpClassName); + this.writeDO(doContent, humpClassName + "DO"); } /** * 写公共基础服务类 - * * @param varMap */ - public void writeCommon(Map varMap, String fast) { - - - String baseControllerContent = freemarkerService.parseTpl(fast + TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), varMap); - this.writeBaseController(baseControllerContent); - - String SpringApplicationContextContent = freemarkerService.parseTpl(fast + TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName(), varMap); - this.writeSpringApplicationContext(SpringApplicationContextContent); - - String application = freemarkerService.parseTpl(fast + TemplateFileEnum.APPLICATION.getTempFileName(), varMap); - this.writeApplication(application); - - String facadeAop = freemarkerService.parseTpl(fast + TemplateFileEnum.FACADE_AOP.getTempFileName(), varMap); - this.writeFacadeAop(facadeAop); - + public void writeCommon(Map varMap) { + Map> initClassMap = appServiceConfig.getInitClassMapList(); + if(initClassMap == null || initClassMap.isEmpty()){ + return; + } + for (Map.Entry> entry : initClassMap.entrySet()){ + for (String classTemplate : entry.getValue()){ + String clazzContent = freemarkerService.parseTplCommon(classTemplate, varMap); + this.writeInitClass(entry.getKey(),clazzContent,classTemplate); + } + } } /** @@ -435,6 +437,11 @@ public class WriteCodeService { * @param columnBeanListMap */ public void writeERPicture(Map tableBeanMap, Map> columnBeanListMap) { + //这里走了e-r图构建了,所以不需要再次渲染e-r图了 + if(!appServiceConfig.getLinkDB()){ + return; + } + String filePath = appServiceConfig.getErPictureOutPath() + Constant.ER_PICTURE + "/" + appServiceConfig.getDbName() + ".puml"; List tableBeanList = new ArrayList<>(); tableBeanMap.forEach((k, v) -> { @@ -482,5 +489,25 @@ public class WriteCodeService { writeFileService.writeContent(writeContentBean); } + /** + * 写配置文件的统一方法 + * @param moduleName + * @param content + */ + public void writeConfig(String moduleName, String content,String configFileName){ + if(StringUtils.isEmpty(content)){ + return; + } + IWriteFileService writeFileService = appServiceConfig.getWriteServiceByModuleName(moduleName); + if (writeFileService == null) { + return; + } + + WriteContentBean writeContentBean = WriteContentBean.builder().content(content) + .templateName(GlobalConstant.CONFIG) + .humpClassName(configFileName).build(); + writeFileService.writeContent(writeContentBean); + } + } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteDynamicCodeService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteDynamicCodeService.java new file mode 100644 index 0000000000000000000000000000000000000000..eb1453c4e619af93dfe206740a782e2724b313ec --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteDynamicCodeService.java @@ -0,0 +1,460 @@ +package com.tianhua.codemaker.service; + +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.config.ConfigFileBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.bean.config.ProjectBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.EnumBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.AppServiceConfig; + +import com.tianhua.codemaker.config.ConfigFactory; +import com.tianhua.codemaker.enums.ClassEnum; +import com.tianhua.codemaker.enums.ModuleEnum; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.component.ComponentDecorateService; +import com.tianhua.codemaker.service.plantuml.WriteDomainPlantDocService; +import com.tianhua.codemaker.service.registry.factory.ElementFactory; +import com.tianhua.codemaker.service.template.FreemarkerService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Description: + * 新版本的应用模块代码写服务,屏蔽底层写文件的细节,通过app和module隔离api和底层实现 + * 做到一套api支持多种应用框架风格的代码生成。 + * date: 2021/6/22 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ + +@Component +public class WriteDynamicCodeService extends AbstractEleWriteService{ + + @Autowired + private AppServiceConfig appServiceConfig; + + @Autowired + private FreemarkerService freemarkerService; + + @Autowired + private WriteDynamicDDDService writeDynamicDDDModuleService; + + @Autowired + private WriteCodeService writeCodeService; + + + @Autowired + private WriteApiDocService writeApiDocService; + + @Autowired + private WriteDomainPlantDocService writeDomainPlantDocService; + + @Autowired + private ComponentDecorateService componentDecorateService; + + @Autowired + private ConfigFactory configFactory; + + @Autowired + private ElementFactory elementFactory; + + + /** + * 写dynamicMapperxml文件 + * @param classBeanList + */ + public void writeDynamicMapperXml(List classBeanList) { + IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.MAPPER_XML_DDD.getTempFileName()); + if (writeFileService == null) { + return; + } + writeDynamicDDDModuleService.writeDynamicMapperXml(classBeanList,writeFileService,null); + } + + /** + * 写AppExeImpl文件 + * @param classBeanList + */ + public void writeAppExeImpl(List classBeanList) { + IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.CMD.getTempFileName()); + if (writeFileService == null) { + return; + } + writeDynamicDDDModuleService.writeAppExeImpl(classBeanList,writeFileService,null); + } + + /** + * 写AppExeInterface文件 + * @param interfaceBeanList + */ + public void writeAppExeInterface(List interfaceBeanList) { + IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.EXE.getTempFileName()); + if (writeFileService == null) { + return; + } + writeDynamicDDDModuleService.writeAppExeInterface(interfaceBeanList,writeFileService,null); + } + + + /** + * 写feignDTO文件 + * @param classBeanList + */ + public void writeFeignDTO(List classBeanList) { + + IWriteFileService writeFileService = appServiceConfig.getWriteServiceByModuleName(ModuleEnum.COLA_FEIGN_API.getModuleName()); + //只有springcloud cola需要写feign dto + if (writeFileService == null + || appServiceConfig.getApplicationType().equals(ModuleEnum.DUBBO_API.getAppName()) + || appServiceConfig.getApplicationType().equals(ModuleEnum.SPRING_BOOT_WEB.getAppName())) { + return; + } + writeDynamicDDDModuleService.writeClassEle(classBeanList,TemplateFileEnum.DTO_DDD,TemplateFileEnum.DTO_DDD,null); + } + + /** + * 一次性生成所有表的模块代码,同时解析plantUML的类图结合起来 + * @param allMetaDataMap + */ + public void writeAllWithDDD(Map allMetaDataMap){ + writeClassEle((List)allMetaDataMap.get("domainbo"),TemplateFileEnum.BUSINESS_OBJECT_DDD,TemplateFileEnum.BUSINESS_OBJECT_DDD,null); + writeClassEle((List)allMetaDataMap.get("domainvalueobject"),TemplateFileEnum.VALUE_OBJECT,TemplateFileEnum.VALUE_OBJECT,null); + writeEnumEle((List)allMetaDataMap.get("valueobjectenum"),null); + writeEnumEle((List)allMetaDataMap.get("apienum"),null); + writeClassEle((List)allMetaDataMap.get("domainmsg"),TemplateFileEnum.MESSAGE_BODY,TemplateFileEnum.BUSINESS_OBJECT_DDD,null); + writeClassEle((List)allMetaDataMap.get("domainevent"),TemplateFileEnum.EVENT_BODY,TemplateFileEnum.BUSINESS_OBJECT_DDD,null); + writeInterfaceEle((List)allMetaDataMap.get("gataway"),TemplateFileEnum.GATAWAY,TemplateFileEnum.GATAWAY,null); + writeInterfaceEle((List)allMetaDataMap.get("domainservice"),TemplateFileEnum.SERVICE_DDD,TemplateFileEnum.SERVICE_DDD,null); + writeInterfaceEle((List)allMetaDataMap.get("repository"),TemplateFileEnum.GATAWAY,TemplateFileEnum.REPOSITORY,null); + writeClassEle((List)allMetaDataMap.get("gatawayimpl"),TemplateFileEnum.GATAWAY_IMPL,TemplateFileEnum.GATAWAY_IMPL,null); + writeClassEle((List)allMetaDataMap.get("serviceimpl"),TemplateFileEnum.GATAWAY_IMPL,TemplateFileEnum.SERVICE_IMPL,null); + + writeClassEle((List)allMetaDataMap.get("repositoryimpl"),TemplateFileEnum.GATAWAY_IMPL,TemplateFileEnum.GATAWAY_IMPL,null); + + writeInterfaceEle((List)allMetaDataMap.get("infrastacl"),TemplateFileEnum.ACL,TemplateFileEnum.ACL,null); + writeClassEle((List)allMetaDataMap.get("infrastaclparam"),TemplateFileEnum.BUSINESS_OBJECT_DDD,TemplateFileEnum.ACL_PARAM,null); + writeClassEle((List)allMetaDataMap.get("infrastaclimpl"),TemplateFileEnum.ACL_IMPL,TemplateFileEnum.ACL_IMPL,null); + writeClassEle((List)allMetaDataMap.get("cmd"),TemplateFileEnum.BUSINESS_OBJECT_DDD, TemplateFileEnum.CMD,null); + + this.writeAppExeImpl((List)allMetaDataMap.get("exeClass")); + + writeInterfaceEle((List)allMetaDataMap.get("exeInterface"),TemplateFileEnum.GATAWAY,TemplateFileEnum.EXE,null); + writeClassEle((List)allMetaDataMap.get("domainfactory"),TemplateFileEnum.FACTORY, TemplateFileEnum.FACTORY,null); + writeClassEle((List)allMetaDataMap.get("applistener"),TemplateFileEnum.MQ_LISTENER, TemplateFileEnum.MQ_LISTENER,null); + writeClassEle((List)allMetaDataMap.get("mqproducer"),TemplateFileEnum.MQ_PRODUCER, TemplateFileEnum.MQ_PRODUCER,null); + writeClassEle((List)allMetaDataMap.get("mqconsumer"),TemplateFileEnum.MQ_CONSUMER, TemplateFileEnum.MQ_CONSUMER,null); + writeClassEle((List)allMetaDataMap.get("mqhandler"),TemplateFileEnum.MQ_HANDLER, TemplateFileEnum.MQ_HANDLER,null); + writeClassEle((List)allMetaDataMap.get("cache"),TemplateFileEnum.CACHE, TemplateFileEnum.CACHE,null); + writeClassEle((List)allMetaDataMap.get("adaptervo"),TemplateFileEnum.VO_DDD, TemplateFileEnum.VO_DDD,null); + writeClassEle((List)allMetaDataMap.get("controller"),TemplateFileEnum.CONTROLLER_DDD, TemplateFileEnum.CONTROLLER_DDD,null); + writeInterfaceEle((List)allMetaDataMap.get("derivefeign"),TemplateFileEnum.FEIGN_DDD,TemplateFileEnum.FEIGN,null); + writeInterfaceEle((List)allMetaDataMap.get("derivefacade"),TemplateFileEnum.FACADE_DDD,TemplateFileEnum.FACADE,null); + writeClassEle((List)allMetaDataMap.get("derivefacadeimpl"),TemplateFileEnum.FACADE_IMPL_DDD, TemplateFileEnum.FACADE_IMPL,null); + writeClassEle((List)allMetaDataMap.get("derivedto"),TemplateFileEnum.DTO_DDD, TemplateFileEnum.DTO_DDD,null); + + writeInterfaceEle((List)allMetaDataMap.get("dtoboconvert"),TemplateFileEnum.DTOBO_CONVERT,TemplateFileEnum.CONVERT,null); + writeInterfaceEle((List)allMetaDataMap.get("voboconvert"),TemplateFileEnum.VOBO_CONVERT,TemplateFileEnum.CONVERT,null); + writeInterfaceEle((List)allMetaDataMap.get("doboconvert"),TemplateFileEnum.DOBO_CONVERT,TemplateFileEnum.CONVERT,null); + writeInterfaceEle((List)allMetaDataMap.get("dynamicmapper"),TemplateFileEnum.MAPPER_DDD,TemplateFileEnum.MAPPER_DDD,null); + + List dynamicMapperXmlBeanList = (List)allMetaDataMap.get("dynamicmapperxml"); + this.writeDynamicMapperXml(dynamicMapperXmlBeanList); + + Map tableBeanMap = (Map)allMetaDataMap.get("table"); + Map> columnBeanListMap = (Map>)allMetaDataMap.get("columns"); + Map varMap = new HashMap<>(); + + this.writeFeignDTO((List)allMetaDataMap.get("derivedto")); + writeInterfaceEle((List)allMetaDataMap.get("convertdto2dto"),TemplateFileEnum.DOBO_CONVERT,TemplateFileEnum.CONVERT,null); + + varMap.put("projectBean",allMetaDataMap.get("projectBean")); + tableBeanMap.forEach((k,v)->{ + varMap.put("table", v); + varMap.put("columns", columnBeanListMap.get(k)); + varMap.put("package", allMetaDataMap.get("package")); + varMap.put("author", allMetaDataMap.get("author")); + varMap.put("packageInfrast", allMetaDataMap.get("packageInfrast")); + varMap.put("packageDomain", allMetaDataMap.get("packageDomain")); + + String templateContent = freemarkerService.parseTpl(TemplateFileEnum.DATA_OBJECT.getTempFileName(),varMap); + writeCodeService.writeDO(templateContent,v.getHumpClassName()+"DO"); + }); + + + List facadeInterfaceBeanList = (List)allMetaDataMap.get("derivefacade"); + if(CollectionUtils.isNotEmpty(facadeInterfaceBeanList)){ + for (InterfaceBean interfaceBean : facadeInterfaceBeanList){ + varMap.put("package", allMetaDataMap.get("package")); + varMap.put("author", allMetaDataMap.get("author")); + varMap.put("packageInfrast", allMetaDataMap.get("packageInfrast")); + varMap.put("packageDomain", allMetaDataMap.get("packageDomain")); + varMap.putAll(interfaceBean.buildVarMap()); + String templateContent = freemarkerService.parseTpl(TemplateFileEnum.TEST_DDD.getTempFileName(),varMap); + writeCodeService.writeTest(templateContent,interfaceBean.getClassName()); + } + } + + //处理自定义的代码模板 + for (Map.Entry entry : allMetaDataMap.entrySet()){ + String key = entry.getKey(); + if(!key.contains(":")){ + continue; + } + FtlBean ftlBean = FtlBean.getInstance(key); + if(ClassEnum.isClass(ftlBean.getClassType())){ + List classBeanList = (List)entry.getValue(); + writeClassBean(classBeanList,ftlBean); + } + if(ClassEnum.isInterface(ftlBean.getClassType())){ + List interfaceBeanList = (List)entry.getValue(); + writeInterfaceBean(interfaceBeanList,ftlBean); + } + if(ClassEnum.isEnum(ftlBean.getClassType())){ + List enumBeanList = (List)entry.getValue(); + } + + if(ClassEnum.isPom(ftlBean.getClassType())){ + List pomBeanList = (List)entry.getValue(); + writePom(pomBeanList,ftlBean); + } + } + + //写公共服务类 + this.writeCommon(varMap,""); + //写项目配置文件 + this.writeConfig(varMap); + //渲染e-r图 + writeCodeService.writeERPicture(tableBeanMap,columnBeanListMap); + + //进行文档生成 + if(appServiceConfig.getApiDocGenerator()){ + this.writeHttpApiDoc((List)allMetaDataMap.get("controller"),(List)allMetaDataMap.get("adaptervo")); + this.writeRpcApiDoc((List)allMetaDataMap.get("derivefacade"),(List)allMetaDataMap.get("derivedto")); + this.writeRpcApiDoc((List)allMetaDataMap.get("derivefeign"),(List)allMetaDataMap.get("derivedto")); + } + + //进行plantuml文档同步 + if(appServiceConfig.getPlantUMLSync()){ + writeDomainPlantDocService.writePlantUMLDomainDoc(); + List dynamicInvokeFileList = (List)allMetaDataMap.get("dynamicInvokeFileList"); + writeDomainPlantDocService.writePlantUMLSequenceDoc(dynamicInvokeFileList); + } + + this.writeSqlDoc((List)allMetaDataMap.get("sql")); + } + + + + /** + * 写http接口文档 + * @param controllerBeanList + */ + private void writeHttpApiDoc(List controllerBeanList,List voBeanList){ + IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.API_HTTP.getTempFileName()); + if (writeFileService == null) { + return; + } + writeApiDocService.writeHttpApiDoc(controllerBeanList,writeFileService,voBeanList); + } + + /** + * 写rpc接口文档 + * @param facadeBeanList + * @param dtoBeanList + */ + private void writeRpcApiDoc(List facadeBeanList,List dtoBeanList){ + IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.API_RPC.getTempFileName()); + if (writeFileService == null) { + return; + } + writeApiDocService.writeRpcApiDoc(facadeBeanList,writeFileService,dtoBeanList); + } + + + /** + * 写sql文档 + * @param sqlContentList + */ + private void writeSqlDoc(List sqlContentList){ + IWriteFileService writeFileService = appServiceConfig.getModuleWriteService(TemplateFileEnum.API_RPC.getTempFileName()); + if (writeFileService == null) { + return; + } + writeApiDocService.writeSqlDoc(sqlContentList,writeFileService); + } + + /** + * 写公共基础服务类 + * + * @param varMap + */ + public void writeCommon(Map varMap, String fast) { + + Map> initClassMap = appServiceConfig.getInitClassMapList(); + if(initClassMap == null || initClassMap.isEmpty()){ + return; + } + + for (Map.Entry> entry : initClassMap.entrySet()){ + for (String classTemplate : entry.getValue()){ + String clazzContent = freemarkerService.parseTplCommon(classTemplate, varMap); + writeCodeService.writeInitClass(entry.getKey(),clazzContent,classTemplate); + } + } + } + + /** + * 写配置文件 + * + * @param varMap + */ + public void writeConfig(Map varMap) { + + List configFileBeanList = appServiceConfig.getConfigFileBeanList(); + if(CollectionUtils.isEmpty(configFileBeanList)){ + return; + } + ProjectBean projectBean = (ProjectBean)varMap.get("projectBean"); + for (ConfigFileBean configFileBean : configFileBeanList){ + ComponentConfigBean componentConfigBean = projectBean.getConfigFileMap().get(configFileBean.getConfigFileName()); + //非组件配置 + if(componentConfigBean == null){ + String configContent = freemarkerService.parseTplConfig(configFileBean.getTemplateName(), varMap); + writeCodeService.writeConfig(configFileBean.getModuleName(),configContent,configFileBean.getConfigFileName()+"."+configFileBean.getConfigFileSuffix()); + continue; + } + else if(componentConfigBean != null && CollectionUtils.isNotEmpty(componentConfigBean.getConfigList()) && configFileBean.getConfigFileName().equals("application")){ + varMap.put("configFileList", componentConfigBean.getConfigList()); + String configContent = freemarkerService.parseTplConfig(configFileBean.getTemplateName(), varMap); + writeCodeService.writeConfig(configFileBean.getModuleName(),configContent,configFileBean.getConfigFileName()+"."+configFileBean.getConfigFileSuffix()); + }else { + String configContent = StringUtils.join(componentConfigBean.getConfigList(),"\n"); + writeCodeService.writeConfig(configFileBean.getModuleName(),configContent,configFileBean.getConfigFileName()+"."+configFileBean.getConfigFileSuffix()); + } + } + + + } + + /** + * 写dynamicddd模块代码生成 + * + * @param dynamicDDDMap + */ + public void writeDynamicDDD(Map dynamicDDDMap) { + IWriteFileService writeFileService = appServiceConfig.getDynamicDDDWriteService(); + if (writeFileService == null) { + return; + } + writeDynamicDDDModuleService.writeDynamicDDD(dynamicDDDMap, writeFileService); + } + + + /** + * 写classBean + * @param classBeanList + * @param ftlBean + */ + public void writeClassBean(List classBeanList, FtlBean ftlBean){ + IWriteFileService writeFileService = appServiceConfig.getWriteServiceByModuleName(ftlBean.getModuleName()); + if (writeFileService == null) { + return; + } + writeDynamicDDDModuleService.writeClassBean(classBeanList,writeFileService,null,ftlBean.getCodeTempFileName()); + } + + /** + * 写interfaceBean + * @param interfaceBeanList + * @param ftlBean + */ + public void writeInterfaceBean(List interfaceBeanList, FtlBean ftlBean){ + IWriteFileService writeFileService = appServiceConfig.getWriteServiceByModuleName(ftlBean.getModuleName()); + if (writeFileService == null) { + return; + } + writeDynamicDDDModuleService.writeInterfaceBean(interfaceBeanList,writeFileService,ftlBean.getCodeTempFileName()); + } + + + /** + * 写pomBean + * @param pomBeanList + * @param ftlBean + */ + public void writePom(List pomBeanList, FtlBean ftlBean){ + if(CollectionUtils.isEmpty(pomBeanList)){ + return; + } + IWriteFileService writeFileService = appServiceConfig.getWriteServiceByModuleName(ftlBean.getModuleName()); + if (writeFileService == null) { + return; + } + writeDynamicDDDModuleService.writePomBean(pomBeanList,writeFileService,ftlBean.getCodeTempFileName()); + } + + + /** + * 纯数据库模式下写一些配置类文件 + */ + public void writeConfigForDBModel(Map varMap){ + PlantUmlContextBean plantUmlContextBean = new PlantUmlContextBean(); + plantUmlContextBean.setDerivedPlantUmlContextBean(new PlantUmlContextBean()); + plantUmlContextBean.setAppName(appServiceConfig.getApplicationName()); + plantUmlContextBean.setApplicationType(appServiceConfig.getApplicationType()); + Map pomBeanMap = appServiceConfig.getPomConfigMap(); + + pomBeanMap.forEach((k,v)-> plantUmlContextBean.addPomBean(v)); + componentDecorateService.decorateComponent(plantUmlContextBean); + elementFactory.dealPomDependency(plantUmlContextBean); + + Map customElementMap = elementFactory.getElementMap(plantUmlContextBean); + + Map> pomBeanListMap = new HashMap<>(); + if(!customElementMap.isEmpty()){ + List ftlBeanList = appServiceConfig.getCustomCodeFtlList(); + Map ftlBeanMap = ftlBeanList.stream().collect(Collectors.toMap(FtlBean::getFtlStr, o->o)); + for (Map.Entry entry : customElementMap.entrySet()){ + FtlBean ftlBean = ftlBeanMap.get(entry.getKey()); + if(ClassEnum.isPom(ftlBean.getClassType())){ + pomBeanListMap.put(ftlBean.getFtlStr(),entry.getValue().getPomBeanList()); + } + } + } + + + for (Map.Entry> entry : pomBeanListMap.entrySet()){ + FtlBean ftlBean = FtlBean.getInstance(entry.getKey()); + if(ClassEnum.isPom(ftlBean.getClassType())){ + List pomBeanList = entry.getValue(); + writePom(pomBeanList,ftlBean); + } + } + + + //进行框架中间件和组件的包装和注册 + componentDecorateService.decorateComponent(plantUmlContextBean); + ProjectBean projectBean = configFactory.getProjectBean(plantUmlContextBean); + varMap.put("projectBean",projectBean); + this.writeConfig(varMap); + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteDynamicDDDService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteDynamicDDDService.java new file mode 100644 index 0000000000000000000000000000000000000000..257bbaeb10bc096b347d0f3335c89b6be938dafa --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/WriteDynamicDDDService.java @@ -0,0 +1,210 @@ +package com.tianhua.codemaker.service; + +import com.tianhua.codemaker.app.IWriteFileService; +import com.tianhua.codemaker.bean.WriteContentBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.EnumBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.template.FreemarkerService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * Description: + * date: 2021/6/30 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class WriteDynamicDDDService extends AbstractEleWriteService{ + @Autowired + private FreemarkerService freemarkerService; + + /** + * 写dynamicddd模块代码生成 + * @param dynamicDDDMap + */ + public void writeDynamicDDD(Map dynamicDDDMap, IWriteFileService writeFileService){ + writeClassEle((List)dynamicDDDMap.get("domainbo"), TemplateFileEnum.BUSINESS_OBJECT_DDD, TemplateFileEnum.BUSINESS_OBJECT_DDD, writeFileService); + writeClassEle((List)dynamicDDDMap.get("domainvalueobject"), TemplateFileEnum.VALUE_OBJECT, TemplateFileEnum.VALUE_OBJECT, writeFileService); + + //写接口 + List repositoryInterfaceBeanList = (List)dynamicDDDMap.get("repository"); + List gatawayInterfaceBeanList = (List)dynamicDDDMap.get("gataway"); + repositoryInterfaceBeanList.addAll(gatawayInterfaceBeanList); + writeInterfaceAndImpl(repositoryInterfaceBeanList,writeFileService,"ddd"); + + writeEnumEle((List)dynamicDDDMap.get("valueobjectenum"), writeFileService); + writeClassEle((List)dynamicDDDMap.get("domainmsg"), TemplateFileEnum.MESSAGE_BODY, TemplateFileEnum.MESSAGE_BODY, writeFileService); + writeClassEle((List)dynamicDDDMap.get("domainevent"), TemplateFileEnum.EVENT_BODY, TemplateFileEnum.EVENT_BODY, writeFileService); + writeClassEle( (List)dynamicDDDMap.get("domainfactory"), TemplateFileEnum.FACTORY, TemplateFileEnum.FACTORY, writeFileService); + writeInterfaceEle((List)dynamicDDDMap.get("infrastacl"), TemplateFileEnum.ACL, TemplateFileEnum.ACL, writeFileService); + + writeClassEle((List)dynamicDDDMap.get("infrastaclimpl"), TemplateFileEnum.ACL_IMPL, TemplateFileEnum.ACL_IMPL, writeFileService); + + writeClassEle((List)dynamicDDDMap.get("infrastaclparam"), TemplateFileEnum.BUSINESS_OBJECT_DDD, TemplateFileEnum.ACL_PARAM, writeFileService); + writeClassEle((List)dynamicDDDMap.get("cmd"), TemplateFileEnum.BUSINESS_OBJECT_DDD, TemplateFileEnum.CMD, writeFileService); + writeInterfaceEle((List)dynamicDDDMap.get("exeInterface"), TemplateFileEnum.GATAWAY, TemplateFileEnum.EXE, writeFileService); + writeAppExeImpl((List)dynamicDDDMap.get("exeClass"),writeFileService,"ddd"); + } + + /** + * 写接口和实现 + * @param repositoryInterfaceBeanList + * @param writeFileService + */ + private void writeInterfaceAndImpl(List repositoryInterfaceBeanList, IWriteFileService writeFileService,String dddTag){ + for (InterfaceBean interfaceBean : repositoryInterfaceBeanList){ + Map varMap = interfaceBean.buildVarMap(); + String interfaceContent; + if (StringUtils.isNotEmpty(dddTag)){ + interfaceContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); + }else { + interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); + } + WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.GATAWAY); + writeFileService.writeContent(writeContentBean); + + //写接口实现 + String interfaceImplContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.GATAWAY_IMPL.getTempFileName(), varMap); + WriteContentBean writeContentBean2 = interfaceBean.buildWriteContentBean(interfaceImplContent,TemplateFileEnum.GATAWAY_IMPL); + writeFileService.writeContent(writeContentBean2); + } + } + + + + + /** + * 写dynamicmapperxml + * @param dynamicMapperXmlBeanList + * @param writeFileService + */ + public void writeDynamicMapperXml(List dynamicMapperXmlBeanList, IWriteFileService writeFileService,String dddTag) { + for (ClassBean classBean : dynamicMapperXmlBeanList) { + Map varMap = classBean.buildVarMap(); + if(CollectionUtils.isNotEmpty(classBean.getImportClassList())){ + Optional doPackageName = classBean.getImportClassList().stream().filter(importClassName -> importClassName.toLowerCase().endsWith(TemplateFileEnum.DATA_OBJECT.getTempFileName())).findFirst(); + if(doPackageName.isPresent()){ + varMap.put("doPackageName",doPackageName.get()); + } + } + + String interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.MAPPER_XML_DDD.getTempFileName(), varMap); + WriteContentBean writeContentBean = classBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.MAPPER_XML_DDD); + writeFileService.writeContent(writeContentBean); + } + } + /** + * 写app.exe--->class 接口实现 + * @param classBeanList + * @param writeFileService + */ + public void writeAppExeImpl(List classBeanList, IWriteFileService writeFileService,String dddTag){ + for (ClassBean classBean : classBeanList){ + Map varMap = classBean.buildVarMap(); + String boContent; + if(StringUtils.isNotEmpty(dddTag)){ + boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.EXE_IMPL.getTempFileName(), varMap); + if(StringUtils.isEmpty(classBean.getRelationClassStr())){ + boContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.EXE_ABSTRACT.getTempFileName(), varMap); + } + }else { + boContent = freemarkerService.parseTpl(TemplateFileEnum.EXE_IMPL.getTempFileName(), varMap); + if(StringUtils.isEmpty(classBean.getRelationClassStr())){ + boContent = freemarkerService.parseTpl(TemplateFileEnum.EXE_ABSTRACT.getTempFileName(), varMap); + } + } + WriteContentBean writeContentBean = classBean.buildWriteContentBean(boContent,TemplateFileEnum.EXE); + writeFileService.writeContent(writeContentBean); + } + } + + /** + * 写app.exe--->interface 接口 + * @param interfaceBeanList + * @param writeFileService + */ + public void writeAppExeInterface(List interfaceBeanList, IWriteFileService writeFileService,String dddTag){ + for (InterfaceBean interfaceBean : interfaceBeanList){ + Map varMap = interfaceBean.buildVarMap(); + //借用gataway的模板 + String interfaceContent; + if(StringUtils.isNotEmpty(dddTag)){ + interfaceContent = freemarkerService.parseTplDynamicDDD(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); + }else { + interfaceContent = freemarkerService.parseTpl(TemplateFileEnum.GATAWAY.getTempFileName(), varMap); + } + WriteContentBean writeContentBean = interfaceBean.buildWriteContentBean(interfaceContent,TemplateFileEnum.EXE); + writeFileService.writeContent(writeContentBean); + } + } + + /** + * 写interface + * @param interfaceBeanList + * @param writeFileService + */ + public void writeInterfaceBean(List interfaceBeanList, IWriteFileService writeFileService,String templateFileCode){ + for (InterfaceBean interfaceBean : interfaceBeanList){ + Map varMap = interfaceBean.buildVarMap(); + String interfaceContent = freemarkerService.parseTpl(templateFileCode, varMap); + WriteContentBean writeContentBean = interfaceBean.buildWriteContentBeanV2(interfaceContent,templateFileCode,true); + writeFileService.writeContent(writeContentBean); + } + } + + + /** + * 写interface + * @param pomBeanList + * @param writeFileService + */ + public void writePomBean(List pomBeanList, IWriteFileService writeFileService, String templateFileCode){ + if(CollectionUtils.isEmpty(pomBeanList)){ + return; + } + for (PomBean pomBean : pomBeanList){ + if(pomBean == null){ + continue; + } + Map varMap = pomBean.buildVarMap(); + String interfaceContent = freemarkerService.parseTpl(templateFileCode, varMap); + WriteContentBean writeContentBean = pomBean.buildWriteContentBean(interfaceContent,templateFileCode); + writeFileService.writeContent(writeContentBean); + } + } + + /** + * 写classBean + * @param classBeanList + * @param writeFileService + */ + public void writeClassBean(List classBeanList, IWriteFileService writeFileService,String dddTag, String templateFileCode){ + if(CollectionUtils.isEmpty(classBeanList)){ + return; + } + for (ClassBean classBean : classBeanList){ + Map varMap = classBean.buildVarMap(); + String boContent; + if(StringUtils.isNotEmpty(dddTag)){ + boContent = freemarkerService.parseTplDynamicDDD(templateFileCode, varMap); + }else { + boContent = freemarkerService.parseTpl(templateFileCode, varMap); + } + WriteContentBean writeContentBean = classBean.buildWriteContentBeanV2(boContent,templateFileCode,true); + writeFileService.writeContent(writeContentBean); + } + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/DefaultClazzWrapperImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/DefaultClazzWrapperImpl.java similarity index 93% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/DefaultClazzWrapperImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/DefaultClazzWrapperImpl.java index 45488907a3bc07bbad41812b60781cf891ff43ff..3a11b3c007bfafa0d2bdcc57c8b6c807622f356e 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/DefaultClazzWrapperImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/DefaultClazzWrapperImpl.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.service.adapter; +package com.tianhua.codemaker.service.adapter; import org.springframework.stereotype.Service; @@ -9,7 +9,7 @@ import java.util.Map; * Description:codeMaker的默认实现 * date: 2021/10/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * 该组件已过期,整体逻辑已通过组件化升级完成 diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/IClazzAdapter.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/IClazzAdapter.java similarity index 85% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/IClazzAdapter.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/IClazzAdapter.java index 39056372dea0cd6570ca5af6cc1c6ae90d506615..ed1ccddcb60f18721e8968c2d2d49fd347745b69 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/IClazzAdapter.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/IClazzAdapter.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.service.adapter; +package com.tianhua.codemaker.service.adapter; import java.util.Map; @@ -7,7 +7,7 @@ import java.util.Map; * 解除对coderman-utils工具包的强依赖关系 * date: 2021/10/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/JavsAdapterBeanFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/JavsAdapterBeanFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..b0b68cc667e7d0850a90b2027995da9bb4924266 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/JavsAdapterBeanFactory.java @@ -0,0 +1,26 @@ +package com.tianhua.codemaker.service.adapter; + +import com.tianhua.codemaker.api.IJavsAdapterSerivce; +import com.tianhua.codemaker.utils.SpringContextHolder; +import org.springframework.stereotype.Service; + +/** + * Description: + * date: 2022/4/1 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class JavsAdapterBeanFactory { + /** + * 获取javs适配实现 + * @return + */ + public IJavsAdapterSerivce getJavsAdapterService(){ + return (IJavsAdapterSerivce)SpringContextHolder.getBean("javsAdapterService"); + } + + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/PackgeConstants.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/PackgeConstants.java similarity index 92% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/PackgeConstants.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/PackgeConstants.java index 6d4efeadbc0d732afc3b827a7178b6e9da2552d6..058de9c6929f44159bf4acf0d989056365b1adbe 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/adapter/PackgeConstants.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/adapter/PackgeConstants.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.service.adapter; +package com.tianhua.codemaker.service.adapter; import java.util.HashMap; @@ -8,7 +8,7 @@ import java.util.Map; * Description: * date: 2021/10/26 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/component/ComponentDecorateService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/component/ComponentDecorateService.java similarity index 79% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/component/ComponentDecorateService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/component/ComponentDecorateService.java index c91f1dbd419041c0999318b730623a055f93784e..adb43f60112361caf28f30b6cfd475719a4a2cab 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/component/ComponentDecorateService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/component/ComponentDecorateService.java @@ -1,11 +1,10 @@ -package com.coderman.codemaker.service.component; +package com.tianhua.codemaker.service.component; -import com.alibaba.fastjson.JSON; -import com.coderman.codemaker.api.ICompScanService; -import com.coderman.codemaker.api.ICompDecorateService; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.api.ICompScanService; +import com.tianhua.codemaker.api.ICompDecorateService; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.AppServiceConfig; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -18,7 +17,7 @@ import java.util.Map; * Description: * date: 2021/11/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -62,7 +61,7 @@ public class ComponentDecorateService { } //这里只注册应用级组件,框架级组件等有需求再注册 - plantUmlContextBean.setCompContextBeanMap(customCompContextBeanMap); - log.info("===========comp.size = "+customCompContextBeanMap.size()); + plantUmlContextBean.addCompContextBeanBatch(customCompContextBeanMap); + } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dberpicture/DBErPictureService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dberpicture/DBErPictureService.java similarity index 89% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dberpicture/DBErPictureService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dberpicture/DBErPictureService.java index ed7ea44d4c035f5714784a17bfafebe0be677a39..de50fecf568af39cbc61eb3f908207dc6f7be45b 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dberpicture/DBErPictureService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dberpicture/DBErPictureService.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.service.dberpicture; +package com.tianhua.codemaker.service.dberpicture; import com.coderman.codemaker.dbergenerate.bean.TableBean; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dberpicture/DBErPictureServiceImpl.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dberpicture/DBErPictureServiceImpl.java similarity index 93% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dberpicture/DBErPictureServiceImpl.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dberpicture/DBErPictureServiceImpl.java index 6ab3f48bd02cc1e561a15b061e4600c0556361bc..c6ea21f2ddc67e2dd0e52c7e0d376c99ccc25c18 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dberpicture/DBErPictureServiceImpl.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dberpicture/DBErPictureServiceImpl.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.service.dberpicture; +package com.tianhua.codemaker.service.dberpicture; import com.coderman.codemaker.dbergenerate.bean.TableBean; import com.coderman.codemaker.dbergenerate.service.ErPictureService; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dsl/DSLService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dsl/DSLService.java similarity index 76% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dsl/DSLService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dsl/DSLService.java index 5ea9e5178e6c8f4cf9bae48bf7daa92b35939d77..243209ab61fdcaf9898f055a307e14701aeb0007 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/dsl/DSLService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/dsl/DSLService.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.service.dsl; +package com.tianhua.codemaker.service.dsl; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,7 +10,7 @@ import org.springframework.stereotype.Service; * 归类读写场景 * date: 2021/11/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ConvertInvokeService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ConvertInvokeService.java similarity index 97% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ConvertInvokeService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ConvertInvokeService.java index afadf4cad6935713375ebf63bcebcdd21f27c46e..cd93782d7babc48b370448d09b5ddcf210688583 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ConvertInvokeService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ConvertInvokeService.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.service.invoker; - -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.utils.StringHandleUtils; +package com.tianhua.codemaker.service.invoker; + +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -18,7 +18,7 @@ import java.util.concurrent.atomic.AtomicReference; * Description:bo,vo,dto之间的转换调用处理器 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeElementRegistService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeElementRegistService.java new file mode 100644 index 0000000000000000000000000000000000000000..dbc207a446e2dba114ca65b71096b15e4d15d990 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeElementRegistService.java @@ -0,0 +1,56 @@ +package com.tianhua.codemaker.service.invoker; + +import com.tianhua.codemaker.api.ICompRegistService; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.config.DefaultPackageConfig; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * Description:预先读取plantUML调用时序图文档,以及补充其他内置的工具类 + * 如BaseEvent,AppEventPublisher类等 + * date: 2021/10/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class InvokeElementRegistService { + + @Autowired + private DefaultPackageConfig defaultPackageConfig; + + @Autowired + private AppServiceConfig appServiceConfig; + + @Autowired + private ICompRegistService iCompRegistService; + + /** + * 注册独立类和工具 + * @param plantUmlContextBean + */ + public void registDefaultClass(PlantUmlContextBean plantUmlContextBean){ + ComponentContextBean componentContextBean = iCompRegistService.registSingleClass(); + + if(CollectionUtils.isNotEmpty(componentContextBean.getClassBeanList())){ + componentContextBean.getClassBeanList().forEach(classBean -> { + String packageName = classBean.getPackageName().replace("${package}",appServiceConfig.getPackage())+"."+classBean.getClassName(); + defaultPackageConfig.addPackage(classBean.getClassName(),packageName); + }); + } + + if(CollectionUtils.isNotEmpty(componentContextBean.getInterfaceBeanList())){ + componentContextBean.getInterfaceBeanList().forEach(interfaceBean -> { + String packageName = interfaceBean.getPackageName().replace("${package}",appServiceConfig.getPackage())+"."+interfaceBean.getClassName(); + defaultPackageConfig.addPackage(interfaceBean.getClassName(),packageName); + }); + } + plantUmlContextBean.addCompContextBean("singleClass",componentContextBean); + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeHandler.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeHandler.java index 33825f32f9e983ad56fa8ba2ca9062ff9b37ca72..a381224b37c70fc80fa2f0733cfd8777c2f77fbd 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeHandler.java @@ -1,13 +1,13 @@ -package com.coderman.codemaker.service.invoker; +package com.tianhua.codemaker.service.invoker; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; /** * Description: 动态方法调用绘制处理器入口 * 主要处理convert和上下文等之间的代码生成关系分析等 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeSequenceService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeSequenceService.java similarity index 79% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeSequenceService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeSequenceService.java index d9c673ca6d28460f5552e57cd5b8ecd37fd96b3c..6a67e50c810fbf8ab229c877e1ce870cdd69bae2 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/InvokeSequenceService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/InvokeSequenceService.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.service.invoker; +package com.tianhua.codemaker.service.invoker; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.service.plantuml.ReadInvokeSequencePlantDocService; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.service.plantuml.ReadInvokeSequencePlantDocService; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,7 +10,7 @@ import org.springframework.stereotype.Service; * Description: * date: 2021/10/19 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/MethodFactoryService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/MethodFactoryService.java similarity index 96% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/MethodFactoryService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/MethodFactoryService.java index a54a378e9b9398a3f6239661c7f450130cfaa47a..395c6a6aeac02b56ac9d09f4acdb813e34201a24 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/MethodFactoryService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/MethodFactoryService.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.invoker; +package com.tianhua.codemaker.service.invoker; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; -import com.coderman.codemaker.utils.StringHandleUtils; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; @@ -16,7 +16,7 @@ import java.util.Optional; * Description: 针对动态调用时序中出现而领域文档没有出现的方法进行智能识别和构建 * date: 2021/10/30 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -33,7 +33,6 @@ public class MethodFactoryService { public MethodBean buildDynamicMethod(PlantUmlContextBean plantUmlContextBean, AbstractClassBean abstractClassBean, String methodStr) { Optional methodBeanOptional = abstractClassBean.getMatchMethodBean(methodStr); if (methodBeanOptional.isPresent()) { - methodBeanOptional.get().initInvokeRowContentList(); return methodBeanOptional.get(); } //如果是引用的组件则不进行智能推导 @@ -56,7 +55,6 @@ public class MethodFactoryService { methodBean.setReturnClass("void"); methodBean.setVisibility("public"); - methodBean.initInvokeRowContentList(); String returnClassTypeName = "void"; String wrType = ReadWriteTypeEnum.getCodeByMethod(methodStr.trim()); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/MethodInvokeService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/MethodInvokeService.java similarity index 94% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/MethodInvokeService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/MethodInvokeService.java index d051a9dd8790fbea167e52a489523e97eecfc294..a836cda297cf839acc3723beeecec762aee3cc8a 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/MethodInvokeService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/MethodInvokeService.java @@ -1,15 +1,15 @@ -package com.coderman.codemaker.service.invoker; - -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.enums.VisibilityEnum; -import com.coderman.codemaker.enums.dynamic.InvokeLayerTypeEnum; -import com.coderman.codemaker.enums.dynamic.InvokeSceneTypeEnum; -import com.coderman.codemaker.service.ImportPackageService; -import com.coderman.codemaker.utils.StringHandleUtils; +package com.tianhua.codemaker.service.invoker; + +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.enums.VisibilityEnum; +import com.tianhua.codemaker.enums.dynamic.InvokeLayerTypeEnum; +import com.tianhua.codemaker.enums.dynamic.InvokeSceneTypeEnum; +import com.tianhua.codemaker.service.packageimport.ImportPackageServiceImpl; +import com.tianhua.codemaker.utils.StringHandleUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; @@ -25,7 +25,7 @@ import java.util.Optional; * Description: * date: 2021/10/16 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -50,7 +50,7 @@ public class MethodInvokeService { @Autowired - private ImportPackageService importPackageService; + private ImportPackageServiceImpl importPackageService; @Autowired private ConvertInvokeService convertInvokeService; @@ -307,10 +307,6 @@ public class MethodInvokeService { return; } - if(CollectionUtils.isEmpty(invokerClassBean.getDynamicImportPackageList())){ - invokerClassBean.setDynamicImportPackageList(Lists.newArrayList()); - } - importClassName = importClassName.trim(); if(importClassName.contains("<")){ String [] arr = importClassName.split("<"); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ProviderInvokeHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ProviderInvokeHandler.java similarity index 71% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ProviderInvokeHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ProviderInvokeHandler.java index 90f80cd406b21e7d56d7a5f36f7313ee2db99084..41c2c15f3812de1a9d3bd48a3aa18589662f5a72 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ProviderInvokeHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ProviderInvokeHandler.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.service.invoker; +package com.tianhua.codemaker.service.invoker; import org.springframework.stereotype.Service; @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; * Description: * date: 2021/10/16 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ReturnBodyFactoryService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ReturnBodyFactoryService.java similarity index 90% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ReturnBodyFactoryService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ReturnBodyFactoryService.java index d6c4abfab40877a9ed69a3a7e2e4ac36f2db8b21..ef4e1d877a484d79d6358e6a4b5d498cb9d6394e 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/ReturnBodyFactoryService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/ReturnBodyFactoryService.java @@ -1,8 +1,8 @@ -package com.coderman.codemaker.service.invoker; +package com.tianhua.codemaker.service.invoker; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -12,7 +12,7 @@ import java.util.List; * Description:根据方法调用内容动态智能构建方法返回值 * date: 2021/11/1 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/AppHttpInvokeHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/AppHttpInvokeHandler.java similarity index 84% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/AppHttpInvokeHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/AppHttpInvokeHandler.java index 0e57132b165477e3bee5730ab4cdeae23284a394..12c50fa0cdd550f13629ded0a1e77f1de51f8855 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/AppHttpInvokeHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/AppHttpInvokeHandler.java @@ -1,25 +1,23 @@ -package com.coderman.codemaker.service.invoker.handler; +package com.tianhua.codemaker.service.invoker.handler; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; -import com.coderman.codemaker.service.invoker.ConvertInvokeService; -import com.coderman.codemaker.service.invoker.InvokeHandler; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.service.invoker.ConvertInvokeService; +import com.tianhua.codemaker.service.invoker.InvokeHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; -import java.util.ArrayList; import java.util.Optional; /** * Description: 应用层app_http调用方 方法绘制处理器 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -58,10 +56,6 @@ public class AppHttpInvokeHandler implements InvokeHandler { String currentInvokeRowContent = invokeBean.getCurrentInvokeRowBean().refreshInvokeContent(convertInvokeRowBean, invokeBean.getPlantUmlContextBean()); invokeBean.getInvokerMethodBean().addInvokeRowContent(currentInvokeRowContent,invokeBean.getCurrentInvokeRowBean()); - //需要引用convert接口的时候注册引用包 - if(CollectionUtils.isEmpty(invokeBean.getInvokerClassBean().getDynamicImportPackageList())){ - invokeBean.getInvokerClassBean().setDynamicImportPackageList(new ArrayList<>()); - } ClassBean returnClassBean = invokeBean.getPlantUmlContextBean().getClassBeanMap().get(convertMethod.getReturnClass()); if(returnClassBean == null){ returnClassBean = invokeBean.getPlantUmlContextBean().getDerivedPlantUmlContextBean().getClassBeanMap().get(convertMethod.getReturnClass()); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/AppRpcInvokeHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/AppRpcInvokeHandler.java similarity index 90% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/AppRpcInvokeHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/AppRpcInvokeHandler.java index 6a54cbacb646c0dcd1abd03e7f0fc8c3ac2ac6ec..19e1f461e81fd6fdf9bd91890e1718960761b754 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/AppRpcInvokeHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/AppRpcInvokeHandler.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.service.invoker.handler; +package com.tianhua.codemaker.service.invoker.handler; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; -import com.coderman.codemaker.service.invoker.ConvertInvokeService; -import com.coderman.codemaker.service.invoker.InvokeHandler; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.service.invoker.ConvertInvokeService; +import com.tianhua.codemaker.service.invoker.InvokeHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,7 +16,7 @@ import java.util.Optional; * Description:应用层app_rpc调用方 方法绘制处理器 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/DomainInvokeHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/DomainInvokeHandler.java similarity index 90% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/DomainInvokeHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/DomainInvokeHandler.java index 123d28c981a14d2f6e97011cb6cd5c31f8af5561..af63db77098c55fc114743a2d24b7f3ac6b04f40 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/DomainInvokeHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/DomainInvokeHandler.java @@ -1,14 +1,14 @@ -package com.coderman.codemaker.service.invoker.handler; - -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.enums.dynamic.InvokeSceneTypeEnum; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; -import com.coderman.codemaker.service.invoker.ConvertInvokeService; -import com.coderman.codemaker.service.invoker.InvokeHandler; +package com.tianhua.codemaker.service.invoker.handler; + +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.enums.dynamic.InvokeSceneTypeEnum; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.service.invoker.ConvertInvokeService; +import com.tianhua.codemaker.service.invoker.InvokeHandler; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -19,7 +19,7 @@ import java.util.Optional; * Description:领域层调用方 方法绘制处理器 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/DynamicConvertHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/DynamicConvertHandler.java similarity index 86% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/DynamicConvertHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/DynamicConvertHandler.java index 47e872598b48610699c0a8e8665c012a97dc7ebd..4b5abfdbb95557786af1131ae0ef9bb082de9be4 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/DynamicConvertHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/DynamicConvertHandler.java @@ -1,16 +1,16 @@ -package com.coderman.codemaker.service.invoker.handler; +package com.tianhua.codemaker.service.invoker.handler; import com.alibaba.fastjson.JSON; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.enums.dynamic.ReadWriteTypeEnum; -import com.coderman.codemaker.service.invoker.ConvertInvokeService; -import com.coderman.codemaker.service.invoker.InvokeHandler; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.enums.dynamic.ReadWriteTypeEnum; +import com.tianhua.codemaker.service.invoker.ConvertInvokeService; +import com.tianhua.codemaker.service.invoker.InvokeHandler; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -28,7 +28,7 @@ import java.util.Map; * * date: 2021/11/5 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/InfrastInvokeHandler.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/InfrastInvokeHandler.java similarity index 91% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/InfrastInvokeHandler.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/InfrastInvokeHandler.java index 49d8ab2aaee1c0be943977ace07f5c9e5964ce1c..7a010ad9c312bd60a69c227573afc148623759b9 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/invoker/handler/InfrastInvokeHandler.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/invoker/handler/InfrastInvokeHandler.java @@ -1,28 +1,25 @@ -package com.coderman.codemaker.service.invoker.handler; - -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.invoke.InvokeRowBean; -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.MethodBean; -import com.coderman.codemaker.enums.dynamic.InvokeSceneTypeEnum; -import com.coderman.codemaker.service.invoker.ConvertInvokeService; -import com.coderman.codemaker.service.invoker.InvokeHandler; -import com.coderman.codemaker.service.invoker.MethodInvokeService; +package com.tianhua.codemaker.service.invoker.handler; + +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeRowBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.enums.dynamic.InvokeSceneTypeEnum; +import com.tianhua.codemaker.service.invoker.ConvertInvokeService; +import com.tianhua.codemaker.service.invoker.InvokeHandler; +import com.tianhua.codemaker.service.invoker.MethodInvokeService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.support.AbstractApplicationContext; import org.springframework.stereotype.Service; -import java.lang.reflect.Method; import java.util.ArrayList; /** * Description:基础设施层infrast调用方 方法绘制处理器 * date: 2021/10/21 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/ImportPackageService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/packageimport/ImportPackageServiceImpl.java similarity index 96% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/ImportPackageService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/packageimport/ImportPackageServiceImpl.java index 3d306fb7e2549984f4f49085d7af284479c4fb29..6fbea1cc8204a4001060143f386936a9b8abd101 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/ImportPackageService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/packageimport/ImportPackageServiceImpl.java @@ -1,13 +1,14 @@ -package com.coderman.codemaker.service; - -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.plantuml.AbstractClassBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.DefaultPackageConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; +package com.tianhua.codemaker.service.packageimport; + +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.config.DefaultPackageConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.ImportPackageService; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -21,12 +22,13 @@ import java.util.Set; * Description: * date: 2021/6/30 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @Service -public class ImportPackageService { +public class ImportPackageServiceImpl implements ImportPackageService { + @Autowired private DefaultPackageConfig defaultPackageConfig; @@ -96,7 +98,7 @@ public class ImportPackageService { }); plantUmlContextBean.getEnumBeanMap().forEach((k,v)->{ - if(k.toLowerCase().equals(returnClassName.toLowerCase())){ + if(k.equals(returnClassName.toLowerCase())){ importClassSet.add(v.getPackageName()+"."+v.getClassName()); } if(methodBean.getMethodName().toLowerCase().contains(k.toLowerCase())){ diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/packageimport/PackageImportService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/packageimport/PackageImportService.java similarity index 81% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/packageimport/PackageImportService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/packageimport/PackageImportService.java index 9393aa35b9a845e054aa8a7bf68b515fb072d65e..259cf0ee2f2525d802b9597134327d6bcf0c0dfb 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/packageimport/PackageImportService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/packageimport/PackageImportService.java @@ -1,10 +1,10 @@ -package com.coderman.codemaker.service.packageimport; +package com.tianhua.codemaker.service.packageimport; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.component.CompPropReadService; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.component.CompPropReadService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; +import org.springframework.stereotype.Component; import java.io.IOException; import java.util.HashMap; @@ -15,11 +15,11 @@ import java.util.Properties; * Description: * date: 2021/11/24 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ -@Service +@Component("componentPackageImportService") @Slf4j public class PackageImportService { diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadDomainPlantDocService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadDomainPlantDocService.java similarity index 89% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadDomainPlantDocService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadDomainPlantDocService.java index 6038dd969ca5a8ed2b86923dc38c6a1d97c7856d..6f0546ee2f51222303d6efed95c62c9683c148ee 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadDomainPlantDocService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadDomainPlantDocService.java @@ -1,12 +1,12 @@ -package com.coderman.codemaker.service.plantuml; - -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.enums.ClassEnum; -import com.coderman.codemaker.enums.ClassRelationEnum; -import com.coderman.codemaker.enums.VisibilityEnum; -import com.coderman.codemaker.utils.StringHandleUtils; +package com.tianhua.codemaker.service.plantuml; + +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.enums.ClassEnum; +import com.tianhua.codemaker.enums.ClassRelationEnum; +import com.tianhua.codemaker.enums.VisibilityEnum; +import com.tianhua.codemaker.utils.StringHandleUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -20,7 +20,7 @@ import java.util.*; * 读取plantUML类图 * date: 2021/6/28 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 * @@ -197,6 +197,19 @@ public class ReadDomainPlantDocService { classBean.setClassDesc(classBean.getClassName()); classBean.setClassName(className); } + + if(classBean.getClassName().contains("@")){ + List annoTagList = new ArrayList<>(); + String [] annoArr = classBean.getClassName().split("\\."); + for (String annoTag : annoArr){ + if(annoTag.contains("@")){ + annoTagList.add(annoTag); + } + } + classBean.setClassName(annoArr[0]); + classBean.setAnnotationTagList(annoTagList); + } + methodBeanList.forEach(methodBean -> methodBean.setClassName(classBean.getClassName())); classBean.setMethodBeanList(methodBeanList); @@ -338,6 +351,28 @@ public class ReadDomainPlantDocService { if(!methodBean.getReturnClass().contains("void")){ methodBean.setReturnBody("return null;"); } + String methodAnnoTag = methodBean.getMethodName(); + if(methodAnnoTag.contains("@")){ + + List methodSegList = new ArrayList<>(); + String [] annoArr = methodAnnoTag.split("\\."); + List annoTagList = new ArrayList<>(); + for (String annoTag : annoArr){ + if(annoTag.contains("@")){ + annoTagList.add(annoTag); + }else { + methodSegList.add(annoTag); + } + } + if(methodSegList.size() == 1){ + methodBean.setMethodName(methodSegList.get(0)); + }else if(methodSegList.size() > 1){ + methodBean.setMethodName(StringUtils.join(methodSegList,".")); + } + methodBean.setAnnotationTagList(annoTagList); + } + + methodBean.buildParamArr(); methodBeanList.add(methodBean); } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadInvokeSequencePlantDocService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadInvokeSequencePlantDocService.java similarity index 93% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadInvokeSequencePlantDocService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadInvokeSequencePlantDocService.java index 40b5de7f74c93e9aa98a595b1795c67f7f57de84..dd5f3de33207348558a5b9442e36ab33ac8ba624 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadInvokeSequencePlantDocService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadInvokeSequencePlantDocService.java @@ -1,20 +1,18 @@ -package com.coderman.codemaker.service.plantuml; - -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.bean.component.ComponentContextBean; -import com.coderman.codemaker.bean.invoke.InvokeContextBean; -import com.coderman.codemaker.bean.plantuml.*; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.service.invoker.MethodFactoryService; -import com.coderman.codemaker.service.invoker.MethodInvokeService; +package com.tianhua.codemaker.service.plantuml; + +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.invoke.InvokeContextBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.service.invoker.MethodFactoryService; +import com.tianhua.codemaker.service.invoker.MethodInvokeService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; -import org.assertj.core.util.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; -import java.util.ConcurrentModificationException; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; @@ -24,7 +22,7 @@ import java.util.concurrent.atomic.AtomicReference; * Description: * date: 2021/10/15 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -79,10 +77,6 @@ public class ReadInvokeSequencePlantDocService { return; } - if(org.apache.commons.collections4.CollectionUtils.isEmpty(invokerClassBean.getDynamicImportPackageList())){ - invokerClassBean.setDynamicImportPackageList(Lists.newArrayList()); - } - String invokerMethodStr = invokeArr[0].split(invokerClassBean.getClassName() + ".")[1].trim(); String providerMethodStr = invokeArr[1].split(providerClassBean.getClassName() + ".")[1].trim(); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadPlantUMLDocService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadPlantUMLDocService.java similarity index 74% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadPlantUMLDocService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadPlantUMLDocService.java index 04d422e2d9f9bd63d5e8170ce2e3035a8bc69b75..4c8acdfec30190c028650af99696987dac34f653 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/plantuml/ReadPlantUMLDocService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/ReadPlantUMLDocService.java @@ -1,13 +1,14 @@ -package com.coderman.codemaker.service.plantuml; +package com.tianhua.codemaker.service.plantuml; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.config.AppServiceConfig; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; import org.springframework.stereotype.Service; -import org.springframework.util.ResourceUtils; import java.io.File; import java.io.IOException; @@ -17,7 +18,7 @@ import java.util.List; * Description: 读取plantUML类图统一处理类 * date: 2021/10/25 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -27,6 +28,9 @@ public class ReadPlantUMLDocService { @Autowired private AppServiceConfig appServiceConfig; + @Autowired + private ResourceLoader resourceLoader; + /** * 读取领域模型plantUML类图文档 * @param plantUMLFileName @@ -59,7 +63,9 @@ public class ReadPlantUMLDocService { return null; } try { - File file = ResourceUtils.getFile("classpath:"+plantUMLFileDir+"/"+applicationName+"/"+plantUMLFileName); + Resource resource = resourceLoader.getResource("classpath:"+plantUMLFileDir+"/"+applicationName+"/"+plantUMLFileName); + File file = resource.getFile(); + //File file = ResourceUtils.getFile("classpath:"+plantUMLFileDir+"/"+applicationName+"/"+plantUMLFileName); return FileUtils.readLines(file,"UTF-8"); } catch (IOException e) { e.printStackTrace(); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/WriteDomainPlantDocService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/WriteDomainPlantDocService.java new file mode 100644 index 0000000000000000000000000000000000000000..9120177984c69a24a62207ac5f81af58ac75ec50 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/plantuml/WriteDomainPlantDocService.java @@ -0,0 +1,71 @@ +package com.tianhua.codemaker.service.plantuml; + +import com.tianhua.codemaker.config.AppServiceConfig; + +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.FileUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.*; + +/** + * Description: 将plantuml 文档同步写到项目文件中 + * date: 2021/6/28 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + * + */ +@Service +@Slf4j +public class WriteDomainPlantDocService { + + @Autowired + private AppServiceConfig appServiceConfig; + @Autowired + private ReadPlantUMLDocService readPlantUMLDocService; + + /** + * 将领域模型文档写入到项目工程中 + */ + public void writePlantUMLDomainDoc(){ + String outPath = appServiceConfig.getUMLDocOutPath(); + List contentList = readPlantUMLDocService.readDomainPlantDoc(appServiceConfig.getPlantUMLFileName()); + if(CollectionUtils.isEmpty(contentList)){ + return; + } + String filePath = outPath + "/" + appServiceConfig.getPlantUMLFileName(); + try { + FileUtils.writeLines(new File(filePath),contentList); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + /** + * 将调用时序文档写入到项目工程中 + */ + public void writePlantUMLSequenceDoc(List invokeSequenceFileList){ + String outPath = appServiceConfig.getUMLDocOutPath(); + + for (String fileName : invokeSequenceFileList){ + List contentList = readPlantUMLDocService.readInvokeSequencePlantDoc(fileName); + if(CollectionUtils.isEmpty(contentList)){ + return; + } + String filePath = outPath + "/" + fileName; + try { + FileUtils.writeLines(new File(filePath),contentList); + } catch (IOException e) { + e.printStackTrace(); + } + } + + } +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/AbstractVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/AbstractVarRegistry.java similarity index 69% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/AbstractVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/AbstractVarRegistry.java index a1c1759f1a53d2452e3c07d86b8428135f9990c8..c3bec78d3d957efa222ae442c26d7e2a6cbde242 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/AbstractVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/AbstractVarRegistry.java @@ -1,27 +1,46 @@ -package com.coderman.codemaker.service.registry; - -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.service.component.ComponentDecorateService; -import com.coderman.codemaker.service.invoker.InvokeElementRegistService; -import com.coderman.codemaker.service.invoker.InvokeSequenceService; -import com.coderman.codemaker.app.dynamicddd.derivedhandler.*; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.bean.dddelement.*; -import com.coderman.codemaker.bean.dddelementderive.*; -import com.coderman.codemaker.bean.plantuml.ClassBean; -import com.coderman.codemaker.bean.plantuml.InterfaceBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.enums.DomainDerivedElementEnum; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.service.plantuml.ReadDomainPlantDocService; +package com.tianhua.codemaker.service.registry; + +import com.alibaba.fastjson.JSON; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.api.IJavsAdapterSerivce; +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.app.dynamicddd.ElementHandlerContainer; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.component.ComponentConfigBean; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.bean.config.ProjectBean; +import com.tianhua.codemaker.config.ConfigFactory; +import com.tianhua.codemaker.enums.ClassEnum; +import com.tianhua.codemaker.enums.CodeElementEnum; +import com.tianhua.codemaker.service.AnnotationParseService; +import com.tianhua.codemaker.service.adapter.JavsAdapterBeanFactory; +import com.tianhua.codemaker.service.component.ComponentDecorateService; +import com.tianhua.codemaker.service.invoker.InvokeElementRegistService; +import com.tianhua.codemaker.service.invoker.InvokeSequenceService; +import com.tianhua.codemaker.app.dynamicddd.derivedhandler.*; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.bean.dddelement.*; +import com.tianhua.codemaker.bean.dddelementderive.*; +import com.tianhua.codemaker.bean.plantuml.ClassBean; +import com.tianhua.codemaker.bean.plantuml.InterfaceBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.enums.DomainDerivedElementEnum; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.plantuml.ReadDomainPlantDocService; +import com.tianhua.codemaker.service.registry.factory.ElementFactory; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * description: AbstractVarRegistry
@@ -29,6 +48,7 @@ import java.util.Map; * author: coderman
* version: 1.0
*/ +@Slf4j public abstract class AbstractVarRegistry { @Autowired private ReadDomainPlantDocService readFileService; @@ -54,6 +74,10 @@ public abstract class AbstractVarRegistry { @Resource(name = "domainFactoryElementHandler") private DomainElementHandler domainFactoryElementHandler; + + @Resource(name = "domainServiceElementHandler") + private DomainElementHandler domainServiceElementHandler; + @Resource(name = "infrastAclElementHandler") private DomainElementHandler infrastAclElementHandler; @@ -85,6 +109,10 @@ public abstract class AbstractVarRegistry { @Resource(name = "cacheElementHandler") private DomainElementHandler cacheElementHandler; + + + + //------------------以下为领域元素派生类对象处理器 @Resource(name = "derivedDTOElementHandler") @@ -120,6 +148,9 @@ public abstract class AbstractVarRegistry { @Resource(name = "derivedGatawayImplElementHandler") private DerivedGatawayImplElementHandler derivedGatawayImplElementHandler; + @Resource(name = "derivedServiceImplElementHandler") + private DerivedServiceImplElementHandler derivedServiceImplElementHandler; + @Resource(name = "derivedInfrastAclImplElementHandler") private DerivedInfrastAclImplElementHandler derivedInfrastAclImplElementHandler; @@ -144,6 +175,22 @@ public abstract class AbstractVarRegistry { private ComponentDecorateService componentDecorateService; + @Autowired + protected ElementHandlerContainer elementHandlerContainer; + + + @Autowired + private AnnotationParseService annotationParseService; + + @Autowired + private JavsAdapterBeanFactory javsAdapterBeanFactory; + + + @Autowired + private ConfigFactory configFactory; + + @Autowired + private ElementFactory elementFactory; /** * 合并全局配置 @@ -163,10 +210,15 @@ public abstract class AbstractVarRegistry { } PlantUmlContextBean plantUmlContextBean = readFileService.getPlantUmlContextBean(plantUMLName); + if(plantUmlContextBean == null){ return varMap; } + //注解解析装饰到plantuml上下文中 + annotationParseService.dealPlantUmlContextAnnotation(plantUmlContextBean); + + Map tableBeanMap = (Map)varMap.get("table"); @@ -174,11 +226,12 @@ public abstract class AbstractVarRegistry { plantUmlContextBean.setAppName(appServiceConfig.getApplicationName()); plantUmlContextBean.setApplicationType(appServiceConfig.getApplicationType()); - + appServiceConfig.getPomConfigMap().forEach((k,v)-> plantUmlContextBean.addPomBean(v)); tableBeanMap.forEach((k,v)->{ ClassBean classBean = v.convertToClassBean(appServiceConfig.getPackage()+".infrast.dao.dataobject",columnBeanListMap.get(k)); - InterfaceBean mapperInterface = v.convertToMapperInterface(appServiceConfig.getPackage()+".infrast.dao.mapper",columnBeanListMap.get(k)); + + InterfaceBean mapperInterface = v.convertToMapperInterface(appServiceConfig.getPackage()+".infrast.dao.mapper",columnBeanListMap.get(k), appServiceConfig.containsMybatisPlus()); plantUmlContextBean.getClassBeanMap().put(classBean.getClassName(),classBean); plantUmlContextBean.getInterfaceBeanMap().put(mapperInterface.getClassName(),mapperInterface); @@ -187,9 +240,14 @@ public abstract class AbstractVarRegistry { //这里统一注册派生类对象上下文,后续各种handler内部逻辑则不需要再判断是否为空了 plantUmlContextBean.setDerivedPlantUmlContextBean(new PlantUmlContextBean()); - //打标 varMap.put("dynamicddd","dynamicddd"); + varMap.put("dynamicInvokeFileList",plantUmlContextBean.getDynamicInvokeFileList()); + + + //注册独立类和工具 + invokeElementRegistService.registDefaultClass(plantUmlContextBean); + DomainBoElementBean domainBoElementBean = (DomainBoElementBean)domainElementHandler.getElementBeanList(plantUmlContextBean); ValueObjectElementBean valueObjectElementBean = (ValueObjectElementBean)valueObjectElementHandler.getElementBeanList(plantUmlContextBean); @@ -197,6 +255,8 @@ public abstract class AbstractVarRegistry { GatawayElementBean gatawayElementBean = (GatawayElementBean)domainGatawayElementHandler.getElementBeanList(plantUmlContextBean); DomainMsgBodyElementBean domainMsgBodyElementBean = (DomainMsgBodyElementBean)msgBodyElementHandler.getElementBeanList(plantUmlContextBean); FactoryElementBean factoryElementBean = (FactoryElementBean)domainFactoryElementHandler.getElementBeanList(plantUmlContextBean); + ServiceElementBean serviceElementBean = (ServiceElementBean)domainServiceElementHandler.getElementBeanList(plantUmlContextBean); + InfrastAclElementBean infrastAclElementBean = (InfrastAclElementBean)infrastAclElementHandler.getElementBeanList(plantUmlContextBean); CommandElementBean commandElementBean = (CommandElementBean)appCmdElementHandler.getElementBeanList(plantUmlContextBean); ExecutorElementBean executorElementBean = (ExecutorElementBean)appExeElementHandler.getElementBeanList(plantUmlContextBean); @@ -219,21 +279,27 @@ public abstract class AbstractVarRegistry { VoBoConvertElementBean voBoConvertElementBean = derivedVOBOConvertElementHandler.getElementBeanList(plantUmlContextBean); EnumElementBean enumElementBean = derivedEnumElementHandler.getElementBeanList(plantUmlContextBean); GatawayImplElementBean gatawayImplElementBean = derivedGatawayImplElementHandler.getElementBeanList(plantUmlContextBean); + ServiceImplElementBean serviceImplElementBean = derivedServiceImplElementHandler.getElementBeanList(plantUmlContextBean); + RepositoryImplElementBean repositoryImplElementBean = derivedRepositoryImplElementHandler.getElementBeanList(plantUmlContextBean); InfrastAclImplElementBean infrastAclImplElementBean = derivedInfrastAclImplElementHandler.getElementBeanList(plantUmlContextBean); FeignElementBean feignElementBean = derivedFeignElementHandler.getElementBeanList(plantUmlContextBean); + List validateServiceList = appServiceConfig.getValidateServiceBeanList(); + if(CollectionUtils.isNotEmpty(validateServiceList)){ + validateServiceList.stream().forEach(validateService -> validateService.dealValidate(plantUmlContextBean)); + } //进行框架中间件和组件的包装和注册 componentDecorateService.decorateComponent(plantUmlContextBean); - //注册独立类和工具 - invokeElementRegistService.registDefaultClass(plantUmlContextBean); //最后进行动态调用绘制 invokeSequenceService.exeDynamicInvoke(plantUmlContextBean); + elementFactory.dealPomDependency(plantUmlContextBean); + //这里增加动态mapper的代码生成,补足调用时序图中缺失的方法 DynamicMapperElementBean dynamicMapperElementBean = (DynamicMapperElementBean)dynamicMapperElementHandler.getElementBeanList(plantUmlContextBean); //在动态调用绘制之后进行处理,比较特殊 @@ -241,6 +307,37 @@ public abstract class AbstractVarRegistry { + //启用javs脚本引擎 + if(appServiceConfig.enableJavsScript()){ + log.info("准备构建javs项目.............."); + IJavsAdapterSerivce javsAdapterSerivce = javsAdapterBeanFactory.getJavsAdapterService(); + javsAdapterSerivce.translateJavsScript(plantUmlContextBean,appServiceConfig.getJavsProjectOutPath()); + javsAdapterSerivce.generateJavsScriptProject(plantUmlContextBean,appServiceConfig.getJavsProjectOutPath()); + log.info("构建javs项目结束.............."); + } + + Map customElementMap = elementFactory.getElementMap(plantUmlContextBean); + if(!customElementMap.isEmpty()){ + List ftlBeanList = appServiceConfig.getCustomCodeFtlList(); + Map ftlBeanMap = ftlBeanList.stream().collect(Collectors.toMap(FtlBean::getFtlStr,o->o)); + for (Map.Entry entry : customElementMap.entrySet()){ + FtlBean ftlBean = ftlBeanMap.get(entry.getKey()); + if(ClassEnum.isClass(ftlBean.getClassType())){ + varMap.put(ftlBean.getFtlStr(),entry.getValue().refreshClass(plantUmlContextBean, ftlBean.getCodeTempFileName()).getClassBeanList()); + } + if(ClassEnum.isInterface(ftlBean.getClassType())){ + varMap.put(ftlBean.getFtlStr(),entry.getValue().refreshInterface(plantUmlContextBean, ftlBean.getCodeTempFileName()).getInterfaceBeanList()); + } + if(ClassEnum.isEnum(ftlBean.getClassType())){ + varMap.put(ftlBean.getFtlStr(),entry.getValue().getClassBeanList()); + } + if(ClassEnum.isPom(ftlBean.getClassType())){ + varMap.put(ftlBean.getFtlStr(),entry.getValue().getPomBeanList()); + } + } + } + + varMap.put("domainevent",domainEventElementBean.getClassBeanList()); varMap.put("domainbo",domainBoElementBean.getClassBeanList()); varMap.put("domainvalueobject",valueObjectElementBean.getClassBeanList()); @@ -248,6 +345,8 @@ public abstract class AbstractVarRegistry { varMap.put("repository",repositoryElementBean.refreshInterface(plantUmlContextBean,DomainElementEnum.REPOSITORY.getElement()).getInterfaceBeanList()); varMap.put("gataway",gatawayElementBean.refreshInterface(plantUmlContextBean,DomainElementEnum.GATAWAY.getElement()).getInterfaceBeanList()); varMap.put("domainmsg",domainMsgBodyElementBean.getClassBeanList()); + varMap.put("domainservice",serviceElementBean.refreshClass(plantUmlContextBean,DomainElementEnum.SERVICE.getElement()).getInterfaceBeanList()); + varMap.put("domainfactory",factoryElementBean.refreshClass(plantUmlContextBean,DomainElementEnum.FACTORY.getElement()).getClassBeanList()); varMap.put("infrastacl",infrastAclElementBean.getInterfaceBeanList()); varMap.put("infrastaclparam",infrastAclElementBean.getClassBeanList()); @@ -261,26 +360,31 @@ public abstract class AbstractVarRegistry { varMap.put("cache",cacheElementBean.getClassBeanList()); //处理派生类 - varMap.put("derivedto",dtoElementBean.getClassBeanList()); + varMap.put("derivedto",dtoElementBean.refreshClass(plantUmlContextBean, DomainDerivedElementEnum.DTO.getElement()).getClassBeanList()); varMap.put("derivefacade",facadeElementBean.refreshInterface(plantUmlContextBean,DomainDerivedElementEnum.FACADE.getElement()).getInterfaceBeanList()); varMap.put("derivefeign",feignElementBean.refreshInterface(plantUmlContextBean,DomainDerivedElementEnum.FEIGN.getElement()).getInterfaceBeanList()); varMap.put("derivefacadeimpl",facadeImplElementBean.refreshClass(plantUmlContextBean, DomainDerivedElementEnum.FACADE_IMPL.getElement()).getClassBeanList()); varMap.put("dtoboconvert",dtoBoConvertElementBean.getInterfaceBeanList()); varMap.put("doboconvert",doBoConvertElementBean.getInterfaceBeanList()); - varMap.put("adaptervo",voElementBean.getClassBeanList()); - varMap.put("controller",controllerElementBean.refreshClass(plantUmlContextBean,DomainDerivedElementEnum.CONTROLLER.getElement()).getClassBeanList()); + varMap.put("adaptervo",voElementBean.refreshClass(plantUmlContextBean, DomainDerivedElementEnum.VO.getElement()).getClassBeanList()); + varMap.put(CodeElementEnum.CONTROLLER.getCode(),controllerElementBean.refreshClass(plantUmlContextBean,DomainDerivedElementEnum.CONTROLLER.getElement()).getClassBeanList()); varMap.put("voboconvert",voBoConvertElementBean.getInterfaceBeanList()); varMap.put("apienum",enumElementBean.getEnumBeanList()); varMap.put("gatawayimpl",gatawayImplElementBean.refreshClass(plantUmlContextBean, DomainElementEnum.GATAWAY_IMPL.getElement()).getClassBeanList()); + varMap.put("serviceimpl",gatawayImplElementBean.refreshClass(plantUmlContextBean, DomainElementEnum.SERVICE_IMPL.getElement()).getClassBeanList()); + varMap.put("repositoryimpl",repositoryImplElementBean.refreshClass(plantUmlContextBean, DomainElementEnum.REPOSITORY_IMPL.getElement()).getClassBeanList()); varMap.put("infrastaclimpl",infrastAclImplElementBean.refreshClass(plantUmlContextBean, DomainElementEnum.ADAPTER_ACL_IMPL.getElement()).getClassBeanList()); varMap.put("dynamicmapper",dynamicMapperElementBean.getInterfaceBeanList()); varMap.put("dynamicmapperxml",dynamicMapperElementBean.getClassBeanList()); varMap.put("convertdto2dto",dto2DtoConvertElementBean.getInterfaceBeanList()); + varMap.put("projectBean",configFactory.getProjectBean(plantUmlContextBean)); return varMap; } public abstract Map getRegistVarMap(); + + } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ApplicationPropertiesVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ApplicationPropertiesVarRegistry.java similarity index 72% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ApplicationPropertiesVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ApplicationPropertiesVarRegistry.java index 6943366f1e1a842d456b111ed1a5ade0236bdcf5..72900dafdc243810ef8409e806872f64e947ff97 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ApplicationPropertiesVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ApplicationPropertiesVarRegistry.java @@ -1,7 +1,7 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; import java.util.Map; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/BaseControllerVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/BaseControllerVarRegistry.java similarity index 72% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/BaseControllerVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/BaseControllerVarRegistry.java index fafcedcfe725521f5e1199c2eaf7212f6676b17b..0b23a44202f388abe81c3b67dc313367b8bfedff 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/BaseControllerVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/BaseControllerVarRegistry.java @@ -1,6 +1,6 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; import java.util.Map; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ControllerVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ControllerVarRegistry.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ControllerVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ControllerVarRegistry.java index 97d90417dabf689608345273301f72d386947239..35c44ad41f3fcc87cb5086ff8070602967213521 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ControllerVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ControllerVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/DynamicDDDVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/DynamicDDDVarRegistry.java similarity index 88% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/DynamicDDDVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/DynamicDDDVarRegistry.java index 30eefaf353de380e4b1a5da9985685958cfa97a9..d1f957e772265c1653fa6d14c86f96584b63ac7d 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/DynamicDDDVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/DynamicDDDVarRegistry.java @@ -1,14 +1,14 @@ -package com.coderman.codemaker.service.registry.element; - -import com.coderman.codemaker.app.dynamicddd.DomainElementHandler; -import com.coderman.codemaker.app.dynamicddd.derivedhandler.DerivedInfrastAclImplElementHandler; -import com.coderman.codemaker.bean.dddelement.*; -import com.coderman.codemaker.bean.dddelementderive.InfrastAclImplElementBean; -import com.coderman.codemaker.bean.plantuml.PlantUmlContextBean; -import com.coderman.codemaker.config.ProjectTemplateDynamicDDDConfig; -import com.coderman.codemaker.enums.DomainElementEnum; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.plantuml.ReadDomainPlantDocService; +package com.tianhua.codemaker.service.registry.element; + +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.app.dynamicddd.derivedhandler.DerivedInfrastAclImplElementHandler; +import com.tianhua.codemaker.bean.dddelement.*; +import com.tianhua.codemaker.bean.dddelementderive.InfrastAclImplElementBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.ProjectTemplateDynamicDDDConfig; +import com.tianhua.codemaker.enums.DomainElementEnum; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.plantuml.ReadDomainPlantDocService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -20,7 +20,7 @@ import java.util.Map; * Description: * date: 2021/6/29 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -87,6 +87,8 @@ public class DynamicDDDVarRegistry extends AbstractVarRegistry { @Override public Map getRegistVarMap() { PlantUmlContextBean plantUmlContextBean = readFileService.getPlantUmlContextBean(projectTemplateDynamicDDDConfig.getPlantumlFileName()); + plantUmlContextBean.setDerivedPlantUmlContextBean(new PlantUmlContextBean()); + DomainBoElementBean domainBoElementBean = (DomainBoElementBean)domainElementHandler.getElementBeanList(plantUmlContextBean); ValueObjectElementBean valueObjectElementBean = (ValueObjectElementBean)valueObjectElementHandler.getElementBeanList(plantUmlContextBean); RepositoryElementBean repositoryElementBean = (RepositoryElementBean)repositoryElementHandler.getElementBeanList(plantUmlContextBean); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/EntityVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/EntityVarRegistry.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/EntityVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/EntityVarRegistry.java index 1e0f8d067ea1e128e3c71cc7547f76912f095264..74f9a5a2539617f3eda89951334fe7a0fcc34e4d 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/EntityVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/EntityVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/MapperVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/MapperVarRegistry.java similarity index 69% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/MapperVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/MapperVarRegistry.java index 25f5bc1cfdd06b4a51e13bb8d0b35d23789cb8f1..7b12dcd8ba9fd76332d889ef49a4f8e70ac48b2b 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/MapperVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/MapperVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -27,8 +27,10 @@ public class MapperVarRegistry extends AbstractVarRegistry { Map tableBeanMap = temlateVarService.getTableBeanMap(); Map> columnBeanListMap = temlateVarService.getColumnBeanMap(); Map map = new HashMap<>(); + List sqlContentList = temlateVarService.getSqlContent(); map.put("table",tableBeanMap); map.put("columns",columnBeanListMap); + map.put("sql",sqlContentList); return map; } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/MapperXmlVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/MapperXmlVarRegistry.java similarity index 66% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/MapperXmlVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/MapperXmlVarRegistry.java index f4b9bfc04b125cf1ccbe9cc1a7ca67410648d800..20d2583e9b9fe6893c872ca0c372332a065417c4 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/MapperXmlVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/MapperXmlVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -33,16 +33,20 @@ public class MapperXmlVarRegistry extends AbstractVarRegistry { for (Map.Entry entry : tableBeanMap.entrySet()){ List columnNameList = columnBeanListMap.get(entry.getKey()).stream().map(ColumnBean::getColumnName).collect(Collectors.toList()); + List columnFieldList = columnBeanListMap.get(entry.getKey()).stream().map(ColumnBean::getColumnFieldName).collect(Collectors.toList()); + entry.getValue().setColumnNameList(StringUtils.join(columnNameList,",")); - entry.getValue().setInsertColumnNameList(getInsertColumnNameList(columnNameList).replace("#{id},","")); - entry.getValue().setUpdateColumnNameList(getUpdateColumnNameList(columnNameList).replace("id=#{id},","")); + entry.getValue().setInsertColumnNameList(getInsertColumnNameList(columnFieldList).replace("#{id},","")); + entry.getValue().setUpdateColumnNameList(getUpdateColumnNameList(columnNameList,columnFieldList).replace("id=#{id},","")); entry.getValue().setInsertColumnNames(getInsertColumnNamesStr(columnNameList)); + } + List sqlContentList = temlateVarService.getSqlContent(); + Map map = new HashMap<>(); map.put("table",tableBeanMap); map.put("columns",columnBeanListMap); - - + map.put("sql",sqlContentList); return map; } @@ -61,10 +65,10 @@ public class MapperXmlVarRegistry extends AbstractVarRegistry { * @param columnNameList * @return */ - private String getUpdateColumnNameList(List columnNameList){ + private String getUpdateColumnNameList(List columnNameList,List columnFieldList){ List list = new ArrayList<>(); - for (String columnName : columnNameList){ - String columnStr = columnName+"=#{"+columnName+"}"; + for (int i = 0;i < columnNameList.size();i ++){ + String columnStr = columnNameList.get(i)+"=#{"+columnFieldList.get(i)+"}"; list.add(columnStr); } return StringUtils.join(list,","); @@ -81,4 +85,15 @@ public class MapperXmlVarRegistry extends AbstractVarRegistry { return StringUtils.join(tmpList,","); } + private String getInsertFieldStr(List columnFieldList){ + List tmpList = new ArrayList<>(); + for (String columnField : columnFieldList){ + if(columnField.equals("id")){ + continue; + } + tmpList.add(columnField); + } + return StringUtils.join(tmpList,","); + } + } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/PomVarRegsitry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/PomVarRegsitry.java similarity index 70% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/PomVarRegsitry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/PomVarRegsitry.java index 3b01f70154ee5a3285158366f2dec529c808ce46..7adcebc6beedc2a1196c7620dd3fe353564a5dfc 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/PomVarRegsitry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/PomVarRegsitry.java @@ -1,6 +1,6 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; import java.util.Map; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ServiceImplVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ServiceImplVarRegistry.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ServiceImplVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ServiceImplVarRegistry.java index 351bec5f913d5796bacb8f64e26d3b15a152588e..a7ab623b9a5940d5b737cd3ae1b290640a8d425d 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ServiceImplVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ServiceImplVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ServiceVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ServiceVarRegistry.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ServiceVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ServiceVarRegistry.java index ebbd382adf0bd6280714e40b7e92500dd2c6b772..1cf117081464e49f657ae29a72ae933a8d8c0c1c 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/ServiceVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/ServiceVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/SpringApplicationContextVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/SpringApplicationContextVarRegistry.java similarity index 73% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/SpringApplicationContextVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/SpringApplicationContextVarRegistry.java index 5040596450e4c56db6388a9bb78b4b8c10bada2b..efd24280215e9f18e08cec3a4b93a3c383c4117b 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/SpringApplicationContextVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/SpringApplicationContextVarRegistry.java @@ -1,6 +1,6 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; import java.util.Map; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/TestVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/TestVarRegistry.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/TestVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/TestVarRegistry.java index 569d2a3e38ea67cfa4076b314efe181992c6651c..a4117362f416ef08cf9e3e2fbf5bd7de45b42238 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/TestVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/TestVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/VoVarRegistry.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/VoVarRegistry.java similarity index 75% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/VoVarRegistry.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/VoVarRegistry.java index be9d294f9d56f832bf62d88f0c40de40696e4115..84d21be935e45819adf85da264c1849ad629a091 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/registry/element/VoVarRegistry.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/element/VoVarRegistry.java @@ -1,9 +1,9 @@ -package com.coderman.codemaker.service.registry.element; +package com.tianhua.codemaker.service.registry.element; -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.service.registry.AbstractVarRegistry; -import com.coderman.codemaker.service.template.TemlateVarService; +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.service.registry.AbstractVarRegistry; +import com.tianhua.codemaker.service.template.TemlateVarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/factory/ElementFactory.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/factory/ElementFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..72cbd063a659a9e1893f5de4f6961111f756e490 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/registry/factory/ElementFactory.java @@ -0,0 +1,116 @@ +package com.tianhua.codemaker.service.registry.factory; + +import com.alibaba.fastjson.JSON; +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.app.dynamicddd.ElementHandlerContainer; +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.config.FtlBean; +import com.tianhua.codemaker.bean.config.PomBean; +import com.tianhua.codemaker.bean.dddelement.ElementBean; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Description: + * date: 2022/3/28 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Slf4j +@Service +public class ElementFactory { + @Autowired + private AppServiceConfig appServiceConfig; + @Autowired + protected ElementHandlerContainer elementHandlerContainer; + + + /** + * 构建自定义代码元素集合 + * @param plantUmlContextBean + * @return + */ + public Map getElementMap(PlantUmlContextBean plantUmlContextBean){ + List ftlBeanList = appServiceConfig.getCustomCodeFtlList(); + Map customElementMap = new HashMap<>(); + if(CollectionUtils.isNotEmpty(ftlBeanList)){ + for (FtlBean ftlBean : ftlBeanList){ + DomainElementHandler domainElementHandler = elementHandlerContainer.getElementHandler(ftlBean.getCodeTempFileName()); + if(domainElementHandler == null){ + log.error("找不到对应代码元素处理器,ftlBean = "+ JSON.toJSONString(ftlBean)); + continue; + } + plantUmlContextBean.setFtlBean(ftlBean); + ElementBean elementBean = (ElementBean)domainElementHandler.getElementBeanList(plantUmlContextBean); + customElementMap.put(ftlBean.getFtlStr(),elementBean); + } + } + + return customElementMap; + } + + + /** + * 处理pom依赖 + * @param plantUmlContextBean + */ + public void dealPomDependency(PlantUmlContextBean plantUmlContextBean){ + Map contextBeanMap = plantUmlContextBean.getCompContextBeanMap(); + Map pomBeanMap = plantUmlContextBean.getPomBeanMap(); + for (Map.Entry pomBeanEntry : pomBeanMap.entrySet()){ + PomBean pomBean = pomBeanEntry.getValue(); + if(CollectionUtils.isEmpty(pomBean.getDependencyList())){ + continue; + } + pomBean.getDependencyList().forEach(gavBean -> { + ComponentContextBean componentContextBean = contextBeanMap.get(gavBean.getComponentName()); + if(componentContextBean != null && componentContextBean.getComponentConfigBean() != null){ + gavBean.setArtifactId(componentContextBean.getComponentConfigBean().getArtifactId()); + gavBean.setGroupId(componentContextBean.getComponentConfigBean().getGroupId()); + gavBean.setVersion(componentContextBean.getComponentConfigBean().getVersion()); + gavBean.setScope(componentContextBean.getComponentConfigBean().getScope()); + gavBean.setType(componentContextBean.getComponentConfigBean().getType()); + gavBean.setExclusionGAContent(buildExclusionGAContent(componentContextBean.getComponentConfigBean().getExclusionGAList())); + } + }); + } + } + + + private String buildExclusionGAContent(String exclusionGAList){ + if(StringUtils.isEmpty(exclusionGAList)){ + return null; + } + StringBuilder builder = new StringBuilder(" \n"); + if(exclusionGAList.contains(",")){ + String [] exclusionArr = exclusionGAList.split(","); + for (String exclusionGA : exclusionArr){ + String [] gaArr = exclusionGA.split(":"); + builder.append(" \n"); + builder.append(" " + gaArr[0] + "\n"); + builder.append(" " + gaArr[1] + "\n"); + builder.append(" \n"); + } + }else{ + String [] gaArr = exclusionGAList.split(":"); + builder.append(" \n"); + builder.append(" " + gaArr[0] + "\n"); + builder.append(" " + gaArr[1] + "\n"); + builder.append(" \n"); + } + builder.append(" \n"); + return builder.toString(); + } + +} diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/template/FreemarkerService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/template/FreemarkerService.java similarity index 81% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/template/FreemarkerService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/template/FreemarkerService.java index d301fc87a5ddbe8380e958fbd9596a8d80a69e0c..ecd0aa17e140362fb6b23485e3a913d3b353692d 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/template/FreemarkerService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/template/FreemarkerService.java @@ -1,8 +1,8 @@ -package com.coderman.codemaker.service.template; +package com.tianhua.codemaker.service.template; -import com.coderman.codemaker.bean.GlobalConstant; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.utils.FreemarkerUtils; +import com.tianhua.codemaker.bean.GlobalConstant; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.utils.FreemarkerUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -13,7 +13,7 @@ import java.util.Map; * Description:freemarker代码模板服务 * date: 2021/6/23 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -87,4 +87,15 @@ public class FreemarkerService { public String parseTplCommon(String viewName, Map params) { return FreemarkerUtils.parseTpl(GlobalConstant.SINGLE_CLASS_COMMON+"/"+viewName, params); } + + /** + * + * 生成初始化的独立工具类如aop,baseevent,applicaton等 + * @param viewName + * @param params + * @return + */ + public String parseTplConfig(String viewName, Map params) { + return FreemarkerUtils.parseTpl(GlobalConstant.CONFIG+"/"+viewName, params); + } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/template/TemlateVarService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/template/TemlateVarService.java similarity index 54% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/template/TemlateVarService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/template/TemlateVarService.java index 5bbb069f7fb22d105d47c5a0fcf4baa1a45fe215..5aa12f0e03b46b2aa3d6677e7cd490f33ee23010 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/template/TemlateVarService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/template/TemlateVarService.java @@ -1,17 +1,25 @@ -package com.coderman.codemaker.service.template; - -import com.coderman.codemaker.bean.ColumnBean; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.dao.SqlMapper; -import com.coderman.codemaker.utils.StringHelperUtils; +package com.tianhua.codemaker.service.template; + +import com.tianhua.codemaker.bean.ColumnBean; +import com.tianhua.codemaker.bean.TableBean; +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.dao.SqlMapper; +import com.coderman.codemaker.dberparse.ERPlantUMLParseService; +import com.coderman.codemaker.dberparse.bean.EntityBean; +import com.tianhua.codemaker.utils.StringHelperUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ResourceLoader; import org.springframework.stereotype.Service; + import javax.annotation.Resource; +import java.io.File; +import java.io.IOException; import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -36,14 +44,37 @@ public class TemlateVarService { private Map tableBeanMap; private Map> columnBeanMap; + private Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); + /** + * plantuml e-r图解析内容 + */ + private List erContentList; + + /** + * plantuml e-r图解析对象列表 + */ + private List entityBeanList; + + + @Autowired + private ERPlantUMLParseService erPlantUMLParseService; + + @Autowired + private ResourceLoader resourceLoader; + /** * 获取加工后的tableBean元数据 * @return */ public Map exeGetTableBeanMap(){ + String dbName = appServiceConfig.getDbName(); + //不链接db + if(!appServiceConfig.getLinkDB()){ + return buildTableBeanMap(); + } List tableBeanList = sqlMapper.getDBTableBeanList(dbName); Map tableBeanMap = new HashMap<>(); tableBeanList.stream().forEach(e->{ @@ -75,6 +106,11 @@ public class TemlateVarService { */ private Map> exeGetColumnBeanMap(){ String dbName = appServiceConfig.getDbName(); + //不链接db + if(!appServiceConfig.getLinkDB()){ + return buildColumnBeanMap(); + } + List columnBeanList = sqlMapper.getColumnBeanList(dbName); columnBeanList.stream().forEach(e->{ String columnFieldName = getHumpTableName(e.getColumnName()); @@ -164,10 +200,6 @@ public class TemlateVarService { - - - - /** * 获取字段类型对应的javaentity的java类型 * @param columnType @@ -203,6 +235,8 @@ public class TemlateVarService { } else if(columnType.toUpperCase().contains("DECIMAL")){ return "BigDecimal"; + }else if(columnType.contains("json")){ + return "String"; } return null; } @@ -224,4 +258,116 @@ public class TemlateVarService { return columnBeanMap; } + + /** + * 读取plantUMl文件 + * @return + */ + private List readPlantUMLContent(){ + try { + org.springframework.core.io.Resource resource = resourceLoader.getResource("classpath:er-plantuml/"+appServiceConfig.getApplicationName() + "/" + appServiceConfig.getDbName() + ".puml"); + File file = resource.getFile(); + //File file = ResourceUtils.getFile("classpath:er-plantuml/"+appServiceConfig.getApplicationName() + "/" + appServiceConfig.getDbName() + ".puml"); + return FileUtils.readLines(file,"UTF-8"); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 从plantuml文档中构建实体模型 + * @return + */ + public List getEntityBeanList(){ + if(CollectionUtils.isEmpty(this.entityBeanList)){ + this.erContentList = readPlantUMLContent(); + this.entityBeanList = erPlantUMLParseService.getPlantUmlContextBean(erContentList); + } + return this.entityBeanList; + } + + + /** + * 从e-r图文档中构建tableBean模型 + * @return + */ + private Map buildTableBeanMap(){ + List entityBeanList = getEntityBeanList(); + Map tableBeanMap = new HashMap<>(); + for (EntityBean entityBean : entityBeanList){ + String humpTableName = getHumpTableName(entityBean.getTableName()); + TableBean tableBean = new TableBean(); + + tableBean.setTableComment(entityBean.getTableDesc()); + tableBean.setHumpTableName(humpTableName); + + String humpClassName = StringHelperUtils.getHumpClassName(humpTableName); + tableBean.setHumpClassName(humpClassName); + + String tableName ; + if(entityBean.getTableName().contains("_")){ + String[] tableArr = entityBean.getTableName().split("_"); + if(isNum(tableArr[tableArr.length - 1])){ + String[] newArr = Arrays.copyOfRange(tableArr, 0, tableArr.length - 1); + tableName = StringUtils.join(newArr,"_"); + }else { + tableName = entityBean.getTableName(); + } + }else { + tableName = entityBean.getTableName(); + } + tableBean.setTableName(tableName); + tableBeanMap.put(tableName,tableBean); + } + return tableBeanMap; + } + + /** + * 从e-r图文档中构建columnBean模型 + * @return + */ + private Map> buildColumnBeanMap() { + List entityBeanList = getEntityBeanList(); + Map> columnBeanMap = new HashMap<>(); + for (EntityBean entityBean : entityBeanList) { + List columnBeans = new ArrayList<>(); + entityBean.getColumnBeanList().forEach(entityFieldBean -> { + ColumnBean columnBean = new ColumnBean(); + String columnFieldName = getHumpTableName(entityFieldBean.getColumnName()); + columnBean.setColumnFieldName(columnFieldName); + + String columnTypeName = getColumnTypeName(entityFieldBean.getColumnType()); + columnBean.setColumnTypeName(columnTypeName); + String columnUperName = columnFieldName.substring(0,1).toUpperCase().concat(columnFieldName.substring(1)); + columnBean.setColumnUperName(columnUperName); + columnBean.setColumnName(entityFieldBean.getColumnName()); + columnBean.setColumnComment(entityFieldBean.getColumnDesc()); + String tableName; + if(entityBean.getTableName().contains("_")){ + String[] tableArr = entityBean.getTableName().split("_"); + if(isNum(tableArr[tableArr.length - 1])){ + String[] newArr = Arrays.copyOfRange(tableArr, 0, tableArr.length - 1); + tableName = StringUtils.join(newArr,"_"); + }else { + tableName = entityBean.getTableName(); + } + }else { + tableName = entityBean.getTableName(); + } + columnBean.setTableName(tableName); + columnBeans.add(columnBean); + }); + columnBeanMap.put(entityBean.getTableName(),columnBeans); + } + return columnBeanMap; + } + + /** + * 获取解析的sql内容 + * @return + */ + public List getSqlContent(){ + return erPlantUMLParseService.parseERPlantUML(this.erContentList); + } } diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/write/WriteSpringbootService.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/write/WriteSpringbootService.java similarity index 74% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/write/WriteSpringbootService.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/write/WriteSpringbootService.java index 0c98bb4ef5e0c80c852ace61b88a542f50cbd077..7079e9a71c9e14aa1c72204fb56acd67e04d939e 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/service/write/WriteSpringbootService.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/service/write/WriteSpringbootService.java @@ -1,11 +1,11 @@ -package com.coderman.codemaker.service.write; - -import com.coderman.codemaker.config.AppServiceConfig; -import com.coderman.codemaker.config.ProjectTemplateSpringbootConfig; -import com.coderman.codemaker.enums.TemplateFileEnum; -import com.coderman.codemaker.service.dberpicture.DBErPictureService; -import com.coderman.codemaker.utils.Constant; -import com.coderman.codemaker.utils.FreemarkerUtils; +package com.tianhua.codemaker.service.write; + +import com.tianhua.codemaker.config.AppServiceConfig; +import com.tianhua.codemaker.config.ProjectTemplateSpringbootConfig; +import com.tianhua.codemaker.enums.TemplateFileEnum; +import com.tianhua.codemaker.service.dberpicture.DBErPictureService; +import com.tianhua.codemaker.utils.Constant; +import com.tianhua.codemaker.utils.FreemarkerUtils; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,7 +44,7 @@ public class WriteSpringbootService { */ public void writeMapperXml(String content, String humpClassName) { String fileName = humpClassName + "Mapper.xml"; - String filePath = projectTemplateConfig.getOutPath() + Constant.MAPPER + "/" + fileName; + String filePath = projectTemplateConfig.getModulePath() + Constant.MAPPER + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -60,10 +60,10 @@ public class WriteSpringbootService { */ public void writeEntity(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/entity"; String fileName = humpClassName + "Entity.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -80,10 +80,10 @@ public class WriteSpringbootService { */ public void writeVO(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/vo"; String fileName = humpClassName + "VO.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -100,10 +100,10 @@ public class WriteSpringbootService { */ public void writeMapper(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/mapper"; String fileName = humpClassName + "Mapper.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -119,10 +119,10 @@ public class WriteSpringbootService { */ public void writeService(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/service"; String fileName = humpClassName + "Service.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -138,10 +138,10 @@ public class WriteSpringbootService { */ public void writeServiceImpl(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/service/impl"; String fileName = humpClassName + "ServiceImpl.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -157,10 +157,10 @@ public class WriteSpringbootService { */ public void writeBaseController(String content) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/controller"; String fileName = "BaseController.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -175,10 +175,10 @@ public class WriteSpringbootService { */ public void writeSpringApplicationContext(String content) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/utils"; String fileName = "SpringApplicationContext.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -194,10 +194,10 @@ public class WriteSpringbootService { */ public void writeTest(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.TEST_JAVA + "/" + packagePath + "/service/test"; String fileName = humpClassName + "ServiceTest.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -212,10 +212,10 @@ public class WriteSpringbootService { */ public void writeApplication(String content) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + ""; String fileName = "Application.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -232,10 +232,10 @@ public class WriteSpringbootService { */ public void writeController(String content, String humpClassName) { String packageName = appServiceConfig.getPackage(); - String packagePath = packageName.replace(".", "\\"); + String packagePath = packageName.replace(".", "/"); String filePath = Constant.JAVA + "/" + packagePath + "/controller"; String fileName = humpClassName + "Controller.java"; - filePath = projectTemplateConfig.getOutPath() + "\\" + filePath + "\\" + fileName; + filePath = projectTemplateConfig.getModulePath() + "/" + filePath + "/" + fileName; try { FileUtils.write(new File(filePath), content, "UTF-8"); } catch (IOException e) { @@ -276,40 +276,20 @@ public class WriteSpringbootService { } - - - /** - * 写公共基础服务类 - * - * @param varMap - */ - public void writeCommon(Map varMap, String fast) { - String baseControllerContent = FreemarkerUtils.parseTpl(fast+TemplateFileEnum.BASE_CONTROLLER.getTempFileName(), varMap); - this.writeBaseController(baseControllerContent); - - String SpringApplicationContextContent = FreemarkerUtils.parseTpl(fast+TemplateFileEnum.SPRING_APPLICATION_CONTEXT.getTempFileName(), varMap); - this.writeSpringApplicationContext(SpringApplicationContextContent); - - String application = FreemarkerUtils.parseTpl(fast+TemplateFileEnum.APPLICATION.getTempFileName(), varMap); - this.writeApplication(application); - - } - - /** * 整合e-r图生成工具 * * @param tableBeanMap * @param columnBeanListMap */ - public void writeERPicture(Map tableBeanMap, Map> columnBeanListMap) { - String filePath = projectTemplateConfig.getOutPath() + Constant.ER_PICTURE + "/" + projectTemplateConfig.getDbName() + ".puml"; + public void writeERPicture(Map tableBeanMap, Map> columnBeanListMap) { + String filePath = projectTemplateConfig.getModulePath() + Constant.ER_PICTURE + "/" + projectTemplateConfig.getDbName() + ".puml"; List tableBeanList = new ArrayList<>(); tableBeanMap.forEach((k, v) -> { com.coderman.codemaker.dbergenerate.bean.TableBean tableBean = new com.coderman.codemaker.dbergenerate.bean.TableBean(); tableBean.setTableComment(v.getTableComment()); tableBean.setTableName(v.getTableName()); - List columnBeanList = columnBeanListMap.get(k); + List columnBeanList = columnBeanListMap.get(k); List columnBeanList1 = new ArrayList<>(); columnBeanList.forEach(columnBean -> { com.coderman.codemaker.dbergenerate.bean.ColumnBean columnBean1 = new com.coderman.codemaker.dbergenerate.bean.ColumnBean(); diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/Constant.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/Constant.java similarity index 94% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/Constant.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/Constant.java index 55308f447cf8b032eaea2011eae96974b360c0d5..7f51149b186cc3b7fa85cf630e4e1bbbdacf643f 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/Constant.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/Constant.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.utils; +package com.tianhua.codemaker.utils; /** * description: Constant
diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/FreeMarkerUtil.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/FreeMarkerUtil.java similarity index 98% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/FreeMarkerUtil.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/FreeMarkerUtil.java index f48ce4dccf6f577d25b7ca50f6b18e3a36d4f575..ef49309a0921fb7d2edf2647451ea89768e976c4 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/FreeMarkerUtil.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/FreeMarkerUtil.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.utils; +package com.tianhua.codemaker.utils; import com.google.common.collect.Maps; import freemarker.template.Configuration; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/FreemarkerUtils.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/FreemarkerUtils.java similarity index 95% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/FreemarkerUtils.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/FreemarkerUtils.java index 2641c19eb1e5f3a417438e6917fa5727c85e31cf..addfe4b1079220c17d4af69f2ca95aec4472bebc 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/FreemarkerUtils.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/FreemarkerUtils.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.utils; +package com.tianhua.codemaker.utils; import freemarker.template.Configuration; import freemarker.template.Template; diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/ResultDto.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/ResultDto.java similarity index 93% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/ResultDto.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/ResultDto.java index 8eace43f977187f2439e0c01616cd9060b3d24fc..84c07bd3d3571496ab6c0d5148476bc74767bd59 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/ResultDto.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/ResultDto.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.utils; +package com.tianhua.codemaker.utils; /** * description: ResultDto
diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/SpringContextHolder.java b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/SpringContextHolder.java similarity index 97% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/SpringContextHolder.java rename to codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/SpringContextHolder.java index 0b99ca05a26c00df0626a8cd564139eebbcd5b7a..259c85607e1cd023ed7b984ab3f12e02f34b2c2d 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/utils/SpringContextHolder.java +++ b/codemaker-parent/codemaker-core/src/main/java/com/tianhua/codemaker/utils/SpringContextHolder.java @@ -1,4 +1,4 @@ -package com.coderman.codemaker.utils; +package com.tianhua.codemaker.utils; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; diff --git a/codemaker-parent/codemaker-core/src/main/resources/application.properties b/codemaker-parent/codemaker-core/src/main/resources/application.properties index b68ab2288df4a45c06bf6503f1a8460ac264e23b..6e49966752f4c48d1b6c2fbaf9730bf336c760b1 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/application.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/application.properties @@ -22,9 +22,9 @@ server.port=8099 #数据库配置 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3306/infosys_auth?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC -spring.datasource.username= -spring.datasource.password= +spring.datasource.url=jdbc:mysql://localhost:3306/infosys_express?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=root #配置.xml文件路径 mybatis.config-locations=classpath:mybatis-config.xml @@ -33,16 +33,21 @@ mybatis.mapper-locations=classpath:mapper/*.xml mybatis.type-aliases-package=com.coderman.codemaker.bean spring.application.name=codemaker #生成的应用类型,支持springboot,dubbo,cola,springcloud -application.type=cola +application.type=dubbo #目标应用根包名称 -application.global.package=com.coderman.infosys.auth +application.global.package=com.coderman.infosys.express #作者 application.global.author=shenshuai +#是否链接目标数据库,默认是,不链接则需要在resources/er-plantuml文件夹下创建对应项目应用的plantuml e-r图文档, +#内部融合了codemaker-dberparse模块的功能可以解析并实现不链接具体应用的数据库而实现代码生成 +#application.global.linkdb=true +application.global.linkdb=true + #组件化需要的maven repository本地路径,用来扫描依赖的组件jar包 -application.maven.repo.path=jar:file:///Users/shenshuia/.m2/repository +application.maven.repo.path=jar:file:///Users/shenshuai/programfile/maven/repo #代码生成需要的全局组件,框架中间件可以放到全局组件依赖配置里,类似于脚手架,或者自己封装的业务组件框架 application.component.scan.config=dubbo,spring-web,openfeign @@ -52,3 +57,7 @@ application.component.scan.bean=defaultCompScanService #自定义的组件装饰bean,defaultCompDecorateService默认实现支持全局组件的装饰,开发者可以参考进行自定义扫描组件实现替代掉默认的 application.component.decorate.bean=defaultCompDecorateService + +#是否启用javs脚本来辅助代码生成,默认为false +application.javsscript.enable=false + diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/IdemPotent.properties b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/IdemPotent.properties new file mode 100644 index 0000000000000000000000000000000000000000..b414326173c49f866c13c59a4fc63c859976000b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/IdemPotent.properties @@ -0,0 +1,5 @@ +packageName=${package}.domain.support.annotations +classAlias=@I +annotation=@IdemPotent(key = "requestNo") +#value is this,child +modifyOn=child \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/LockA.properties b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/LockA.properties new file mode 100644 index 0000000000000000000000000000000000000000..15a0edb9eb9761a671d78ed1a78b8f1ff26e5d7e --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/LockA.properties @@ -0,0 +1,5 @@ +packageName=${package}.domain.support.annotations +classAlias=@L +annotation=@Lock(key = "requestNo") +#value is this,child +modifyOn=child \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/MqHandler.properties b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/MqHandler.properties new file mode 100644 index 0000000000000000000000000000000000000000..3b2f7cb2892fe86e1b626cc225fbefd7151e65ab --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/MqHandler.properties @@ -0,0 +1,5 @@ +packageName=${package}.domain.support.annotations +classAlias=@M +annotation=@MqHandler(key = "xxx") +#value is this,child +modifyOn=child \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/Transactional.properties b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/Transactional.properties new file mode 100644 index 0000000000000000000000000000000000000000..dd7d1f7605b47f6f68fe9a6e94beff629ac4bf41 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/Transactional.properties @@ -0,0 +1,5 @@ +packageName=org.springframework.transaction.annotation +classAlias=@T +annotation=@Transactional(rollbackFor = Exception.class) +#value is this,child +modifyOn=child \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/TransactionalEventListener.properties b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/TransactionalEventListener.properties new file mode 100644 index 0000000000000000000000000000000000000000..1ff552f0da84d3b4bc4c1c35a4be50a71e9e5c79 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/annotationClass/TransactionalEventListener.properties @@ -0,0 +1,5 @@ +packageName=org.springframework.transaction.event.TransactionalEventListener +classAlias=@TE +annotation=@TransactionalEventListener(fallbackExecution = true) +#value is this,child +modifyOn=child \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/apiresult/apiresult.properties b/codemaker-parent/codemaker-core/src/main/resources/component/apiresult/apiresult.properties index 67182949726e9cfdfbb09c8cd0870b707a141bbe..e54dc6709db4153af21e932ac468c666bbe11075 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/component/apiresult/apiresult.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/component/apiresult/apiresult.properties @@ -1,6 +1,6 @@ #Generated by Maven #Fri Sep 20 00:50:48 CST 2019 -version=1.0.4 +version=1.0.5-SNAPSHOT groupId=com.coderman.utils artifactId=coderman-utils class1=com.coderman.utils.response.ResultDataDto diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/liteflow/config.properties b/codemaker-parent/codemaker-core/src/main/resources/component/liteflow/config.properties new file mode 100644 index 0000000000000000000000000000000000000000..ba6bbe6b0c026b9b7385f84f741a273a12139c7d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/liteflow/config.properties @@ -0,0 +1 @@ +liteflow.ruleSource=liteflow/flow.xml diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/liteflow/liteflow.properties b/codemaker-parent/codemaker-core/src/main/resources/component/liteflow/liteflow.properties new file mode 100644 index 0000000000000000000000000000000000000000..e9f01fdc91ae147124d619d5e1121e76f1e9b330 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/liteflow/liteflow.properties @@ -0,0 +1,15 @@ +version=2.6.10 +groupId=com.yomahub +artifactId=liteflow-core +#application??config.yml?????????application.properties???? +#configName=application +#liteflow?????liteflow?????????application.properties???????????? +#???template/config?????liteflow_properties.ftl??liteflow_yml.ftl +configName=liteflow + +class1=com.yomahub.liteflow.entity.data.AbsSlot +class2=com.yomahub.liteflow.core.NodeComponent +NodeComponent.method1=public abstract void process() throws Exception +NodeComponent.method2=public boolean isAccess() +NodeComponent.field1=private MonitorBus monitorBus +NodeComponent.field2=private NodeComponent self diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/mybatis-plus/mybatis-plus.properties b/codemaker-parent/codemaker-core/src/main/resources/component/mybatis-plus/mybatis-plus.properties new file mode 100644 index 0000000000000000000000000000000000000000..2917187c4864966f338905337c7d1328c8df721c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/mybatis-plus/mybatis-plus.properties @@ -0,0 +1,4 @@ +version=3.5.1 +groupId=com.baomidou +artifactId=mybatis-plus-core +interface1=com.baomidou.mybatisplus.core.mapper.BaseMapper diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/rocketmq/config.properties b/codemaker-parent/codemaker-core/src/main/resources/component/rocketmq/config.properties new file mode 100644 index 0000000000000000000000000000000000000000..f21835686c9b2a9cfca6e42a603c730fd691ef37 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/rocketmq/config.properties @@ -0,0 +1,25 @@ +# ???????? +rocketmq.producer.isOnOff=on +# ?????????????group?????????????rocketmq???ip@pid?pid??jvm????????? +rocketmq.producer.groupName=${spring.application.name} +# mq?nameserver?? +rocketmq.producer.namesrvAddr=127.0.0.1:9876 +# ?????? ?? 1024 * 4 (4M) +rocketmq.producer.maxMessageSize = 4096 +# ??????????? 3000 +rocketmq.producer.sendMsgTimeOut=3000 +# ?????????????2 +rocketmq.producer.retryTimesWhenSendFailed=2 +# ???????? +rocketmq.consumer.isOnOff=on +# ?????????????group?????????????rocketmq???ip@pid?pid??jvm????????? +rocketmq.consumer.groupName=${spring.application.name} +# mq?nameserver?? +rocketmq.consumer.namesrvAddr=127.0.0.1:9876 +# ????????topic?tags?*???????????tags????: topic~tag1||tag2||tags3; +rocketmq.consumer.topics=TestTopic~TestTag;TestTopic~HelloTag;HelloTopic~HelloTag;MyTopic~* +# ???????? +rocketmq.consumer.consumeThreadMin=5 +rocketmq.consumer.consumeThreadMax=32 +# ??????????????1 +rocketmq.consumer.consumeMessageBatchMaxSize=1 \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/rocketmq/rocketmq.properties b/codemaker-parent/codemaker-core/src/main/resources/component/rocketmq/rocketmq.properties new file mode 100644 index 0000000000000000000000000000000000000000..d1d4942c52a1e9b5d4e6be7d441942222034fcec --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/rocketmq/rocketmq.properties @@ -0,0 +1,4 @@ +version=4.7.0 +groupId=org.apache.rocketmq +artifactId=rocketmq-client +configName=application \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/singleClass/BaseEvent.properties b/codemaker-parent/codemaker-core/src/main/resources/component/singleClass/BaseEvent.properties new file mode 100644 index 0000000000000000000000000000000000000000..ace596e5a954854cd34a63afcaf3f72f0ce6f2c2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/singleClass/BaseEvent.properties @@ -0,0 +1,2 @@ +packageName=${package}.domain.event +classType=class \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/singleClass/PageBO.properties b/codemaker-parent/codemaker-core/src/main/resources/component/singleClass/PageBO.properties new file mode 100644 index 0000000000000000000000000000000000000000..d54698b422ae80393f88b39dd866b7e408f1f1df --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/singleClass/PageBO.properties @@ -0,0 +1,2 @@ +packageName=${package}.domain.bo +classType=class \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/snakeyaml/snakeyaml.properties b/codemaker-parent/codemaker-core/src/main/resources/component/snakeyaml/snakeyaml.properties new file mode 100644 index 0000000000000000000000000000000000000000..f2a9e8edbef204335016e619d2f0a5f2a86ccaf6 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/snakeyaml/snakeyaml.properties @@ -0,0 +1,2 @@ +groupId=org.yaml +artifactId=snakeyaml diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springboot-redis/config.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springboot-redis/config.properties new file mode 100644 index 0000000000000000000000000000000000000000..2c9a9a95434da2c04fd06cbde503bd844e5d3cc9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springboot-redis/config.properties @@ -0,0 +1,18 @@ +# Redis?????????0? +spring.redis.database=0 +# Redis????? +spring.redis.host=127.0.0.1 +# Redis??????? +spring.redis.port=6379 +# Redis????????????? +spring.redis.password= +# ???????????????????? +spring.redis.jedis.pool.max-active=20 +# ??????????????????????? +spring.redis.jedis.pool.max-wait=-1 +# ??????????? +spring.redis.jedis.pool.max-idle=10 +# ??????????? +spring.redis.jedis.pool.min-idle=0 +# ?????????? +spring.redis.timeout=1000 diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springboot-redis/springboot-redis.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springboot-redis/springboot-redis.properties new file mode 100644 index 0000000000000000000000000000000000000000..53cbcff68f5d5147df4c0084670fa011ff183d98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springboot-redis/springboot-redis.properties @@ -0,0 +1,3 @@ +groupId=org.springframework.boot +artifactId=spring-boot-starter-data-redis +configName=application \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springboot-test/springboot-test.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springboot-test/springboot-test.properties new file mode 100644 index 0000000000000000000000000000000000000000..ca6b8dd3aef9beeb24eaa2bca5d7082ca6af2da8 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springboot-test/springboot-test.properties @@ -0,0 +1,3 @@ +groupId=org.springframework.boot +artifactId=spring-boot-starter-test +scope=test \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springboot/springboot.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springboot/springboot.properties index 7efe2bc036fa4d0d1f9159a3e64252c4cf6fcaff..f9fec0f60fffa3e9bd2d288cc40f309b9d712830 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/component/springboot/springboot.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springboot/springboot.properties @@ -1,11 +1,5 @@ -#Generated by Maven -#Fri Sep 20 00:50:48 CST 2019 -version=1.2.61 -groupId=com.alibaba -artifactId=fastjson -packageName=com.alibaba.fastjson -class1=JSON -class2=com.alibaba.fastjson.spi.Module - - - +version=2.1.9.RELEASE +groupId=org.springframework.boot +artifactId=spring-boot-dependencies +type=pom +scope=import diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-eureka/config.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-eureka/config.properties new file mode 100644 index 0000000000000000000000000000000000000000..dc3fa8a55058aab0c3f43bf557690eb562996ab0 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-eureka/config.properties @@ -0,0 +1,9 @@ +# ????????????????true +# ?Eureka???????????????????????????????????????? +eureka.server.enable-self-preservation=false + +# Peer???????????? +eureka.server.peer-eureka-nodes-update-interval-ms= + +# Eureka????????????????????????60000??60? +eureka.server.eviction-interval-timer-in-ms=60000 \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-eureka/springcloud-eureka.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-eureka/springcloud-eureka.properties new file mode 100644 index 0000000000000000000000000000000000000000..7fee4dabd7de45e6c22204fbebb1250f0b806746 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-eureka/springcloud-eureka.properties @@ -0,0 +1,3 @@ +groupId=org.springframework.cloud +artifactId=spring-cloud-starter-eureka-server +configName=application \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-gataway/config.yml b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-gataway/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..c8018b472de7d442d720c2d52e1fae1da8ab560d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-gataway/config.yml @@ -0,0 +1,12 @@ +spring: + gateway: + discovery: + locator: + enabled: false # ???????????????false ???? + lowerCaseServiceId: false # ????????????????????false????? + httpclient: #http???? + pool: + max-connections: 5000 #????? + # max-life-time: 45000 #?????? + acquire-timeout: 15000 #???? + max-idle-time: 10000 #?????? \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-gataway/springcloud-gataway.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-gataway/springcloud-gataway.properties new file mode 100644 index 0000000000000000000000000000000000000000..d5e96328b516e93f36c6ee7a8795b4adb2acdcda --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-gataway/springcloud-gataway.properties @@ -0,0 +1,3 @@ +groupId=org.springframework.cloud +artifactId=spring-cloud-starter-gateway +configName=application \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-ribbon/springcloud-ribbon.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-ribbon/springcloud-ribbon.properties new file mode 100644 index 0000000000000000000000000000000000000000..3a1e637beead22d45646a1cdb972d0d442b296f5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloud-ribbon/springcloud-ribbon.properties @@ -0,0 +1,3 @@ +groupId=org.springframework.cloud +artifactId=spring-cloud-starter-netflix-ribbon +configName= \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosconfig/config.yml b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosconfig/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..6dc1ce53f6dc9330a5528b21eea23280afced16f --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosconfig/config.yml @@ -0,0 +1,12 @@ +spring: + cloud: + nacos: + # ?????nacos.core.auth.enabled=true ????? + username: ${nacos.username} + password: ${nacos.password} + config: + server-addr: ${nacos.server-addr} + namespace: ${nacos.namespace} + prefix: nacos-config-base + file-extension: yaml + group: SPRING_CLOUD_EXAMPLE_GROUP \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosconfig/springcloudalibaba-nacosconfig.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosconfig/springcloudalibaba-nacosconfig.properties new file mode 100644 index 0000000000000000000000000000000000000000..3b269cad48e66d9197db0dc89ea05571e75ba97f --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosconfig/springcloudalibaba-nacosconfig.properties @@ -0,0 +1,3 @@ +groupId=com.alibaba.cloud +artifactId=spring-cloud-starter-alibaba-nacos-config +configName=bootstrap \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosdiscovery/springcloudalibaba-nacosdiscovery.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosdiscovery/springcloudalibaba-nacosdiscovery.properties new file mode 100644 index 0000000000000000000000000000000000000000..bc38ed21eb2fdfdfc7f11049f278feeafad88dae --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-nacosdiscovery/springcloudalibaba-nacosdiscovery.properties @@ -0,0 +1,2 @@ +groupId=com.alibaba.cloud +artifactId=spring-cloud-starter-alibaba-nacos-discovery \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-rocketmq/config.yml b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-rocketmq/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..46f7a61fa78a30ccca5a1bf442dd1cae601b5526 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-rocketmq/config.yml @@ -0,0 +1,19 @@ +spring: + cloud: + stream: + rocketmq: + binder: + name-server: 127.0.0.1:9876 + bindings: + input: + consumer: + enabled: true # 是否开启消费,默认为 true + broadcasting: true # 是否使用广播消费,默认为 false(使用集群消费) + bindings: + output: + destination: test-topic + content-type: application/json + input: + destination: test-topic + content-type: application/json + group: test-group \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-rocketmq/springcloudalibaba-rocketmq.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-rocketmq/springcloudalibaba-rocketmq.properties new file mode 100644 index 0000000000000000000000000000000000000000..5cbec3b3565ff714d82e60ec49f320b3fcc75468 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-rocketmq/springcloudalibaba-rocketmq.properties @@ -0,0 +1,4 @@ +groupId=com.alibaba.cloud +artifactId=spring-cloud-starter-stream-rocketmq +configName=rocketmq +exclusionGAList=ch.qos.logback:logback-classic,ch.qos.logback:logback-core diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-seata/config.yml b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-seata/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..0949abbf347a68a781a257d12e0194d2ef15b047 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-seata/config.yml @@ -0,0 +1,65 @@ +seata: + enabled: true + application-id: #自己服务ID + tx-service-group: test_tx_group + enable-auto-data-source-proxy: true + use-jdk-proxy: false + excludes-for-auto-proxying: firstClassNameForExclude,secondClassNameForExclude + client: + rm: + async-commit-buffer-limit: 1000 + report-retry-count: 5 + table-meta-check-enable: false + report-success-enable: false + saga-branch-register-enable: false + lock: + retry-interval: 10 + retry-times: 30 + retry-policy-branch-rollback-on-conflict: true + tm: + commit-retry-count: 5 + rollback-retry-count: 5 + undo: + data-validation: true + log-serialization: jackson + log-table: undo_log + log: + exceptionRate: 100 + service: + vgroup-mapping: + renren_tx_group: default + enable-degrade: false + disable-global-transaction: false + transport: + shutdown: + wait: 3 + thread-factory: + boss-thread-prefix: NettyBoss + worker-thread-prefix: NettyServerNIOWorker + server-executor-thread-prefix: NettyServerBizHandler + share-boss-worker: false + client-selector-thread-prefix: NettyClientSelector + client-selector-thread-size: 1 + client-worker-thread-prefix: NettyClientWorkerThread + worker-thread-size: default + boss-thread-size: 1 + type: TCP + server: NIO + heartbeat: true + serialization: seata + compressor: none + enable-client-batch-send-request: true + config: + type: file + registry: + type: nacos + nacos: + application: seata-server + #修改对应端口 + server-addr: localhost:8849 + #修改对应namespace + namespace: d3cca02c-6317-474d-bced-6715cf3fa658 + userName: "" + password: "" + #和服务端保持一致 + group: seata_group \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-seata/springcloudalibaba-seata.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-seata/springcloudalibaba-seata.properties new file mode 100644 index 0000000000000000000000000000000000000000..a4ec28cc41fc8f9dc02c1a712e9bad3b28c3d896 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-seata/springcloudalibaba-seata.properties @@ -0,0 +1,3 @@ +groupId=org.springframework.cloud +artifactId=spring-cloud-starter-alibaba-seata +configName= \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-sentinel/config.yml b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-sentinel/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..d66285b0e35db76766dcbc1ca1a99eac818bc437 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-sentinel/config.yml @@ -0,0 +1,13 @@ +spring: + cloud: + sentinel: + transport: + dashboard: localhost:8080 + datasource: + ds: + nacos: + server-addr: http://***** + groupId: DEFAULT_GROUP + dataId: provider-sentinel + namespace: 725d62dc-11f8-451d-ac7e-04427536de08 + rule-type: flow \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-sentinel/springcloudalibaba-sentinel.properties b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-sentinel/springcloudalibaba-sentinel.properties new file mode 100644 index 0000000000000000000000000000000000000000..a4ec28cc41fc8f9dc02c1a712e9bad3b28c3d896 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/component/springcloudalibaba-sentinel/springcloudalibaba-sentinel.properties @@ -0,0 +1,3 @@ +groupId=org.springframework.cloud +artifactId=spring-cloud-starter-alibaba-seata +configName= \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV3.puml b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV3.puml index 0e043a5111d614a099107c3f3df4fa58d8f10a33..c56b653984ed87867fcd2e9a867bbb110bd6b7ac 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV3.puml +++ b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV3.puml @@ -448,7 +448,7 @@ package app.command { package app.exe { interface "命令执行接口-CmdExeService" as CmdExeService{ - 命令执行入口:String exe(AbstractCmd abstractCmd) + 命令执行入口:String exe(AbstractCmd abstractCmd).@T.@L } class "用户组cmd处理类-UserGroupCmdExe" as UserGroupCmdExe{ @@ -479,30 +479,29 @@ package app.exe { package "应用层事件监听器包支持域内消息和域外消息,在应用层处理消息-app.listener" as app.listener{ class "权限变更监听器-AuthorityChangeListener" as AuthorityChangeListener{ - +事务提交后权限变更监听:void authorityCreate(String authCode) - +用户状态信息变更监听消费:void userStatusChange(Long userId) + +事务提交后权限变更监听:void authorityCreate(String authCode).@TE + +用户状态信息变更监听消费:void userStatusChange(Long userId).@TE } class "系统菜单按钮变更监听器-SystemChangeListener" as SystemChangeListener{ - +事务提交后权限变更监听:void systemChange(MenuChangeEvent event) + +事务提交后权限变更监听:void systemChange(MenuChangeEvent event).@TE } } - package "基础设施层消息生产者-mq.producer" as mq.producer { class "权限上下文消息生产者-AuthorityMqProducer" as AuthorityMqProducer{ - +权限创建:void authorityCreate(String authCode) - +权限更新:void authorityUpdate(String authCode) + +权限创建:void authorityCreate(String authCode).@TE + +权限更新:void authorityUpdate(String authCode).@TE } class "系统上下文消息生产者-SystemMqProducer" as SystemMqProducer{ - +事务提交后权限变更监听:void systemChange(MenuChangeEvent event) + +事务提交后权限变更监听:void systemChange(MenuChangeEvent event).@TE } } package "基础设施层消息消费者-mq.consumer" as mq.consumer { - class "用户上下文消息消费者或者监听-UserMqConsumer" as UserMqConsumer{ + class "用户上下文消息消费者或者监听-UserMqConsumer.@M" as UserMqConsumer{ +监听用户状态变更:void consumeUserStatusChange(String mqBody) } class "组织上下文消息消费者或者监听-DepartmentMqConsumer" as DepartmentMqConsumer{ diff --git a/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV5.puml b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV5.puml index d586594a5ba588f9655bcc61685390002741c87f..ac8ec573e872b97fcc00eb592867dc807d83bb4e 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV5.puml +++ b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-auth/auth-domainV5.puml @@ -59,17 +59,17 @@ package domain.bo { 分页获取用户组信息: PageDTO UserGroupQueryFacade.getPageList() - 创建用户组: UserGroupDTO UserGroupFacade.createUserGroup(CreateUserGroupRequestDTO createUserGroupRequestDTO) - 修改用户组信息: Boolean UserGroupFacade.updateUserGroup(UpdateUserGroupRequestDTO updateUserGroupRequestDTO) - 设置用户组状态: Boolean UserGroupFacade.updateUserGroupStatus(String groupCode,Integer status) + 创建用户组: UserGroupDTO UserGroupFacade.createUserGroup(CreateUserGroupRequestDTO createUserGroupRequestDTO).@I + 修改用户组信息: Boolean UserGroupFacade.updateUserGroup(UpdateUserGroupRequestDTO updateUserGroupRequestDTO).@I + 设置用户组状态: Boolean UserGroupFacade.updateUserGroupStatus(String groupCode,Integer status).@I 根据code获取用户组详情: UserGroupDTO UserGroupQueryFacade.getByGroupCode(String groupCode) 根据code或者名称搜索用户组信息: List UserGroupQueryFacade.search(String search) 分页获取用户组信息/usergroup/pagelist: PageVO userGroupQueryController.getPageList(PageVO pageVO ) - 创建用户组/usergroup/create: UserGroupVO UserGroupController.createUserGroup(CreateUserGroupRequestVO createUserGroupRequestVO) - 修改用户组信息/usergroup/upate: Boolean UserGroupController.updateUserGroup(UpdateUserGroupRequestVO updateUserGroupRequestVO) - 设置用户组状态/usergroup/changestatus: Boolean UserGroupController.updateUserGroupStatus(String groupCode,Integer status) + 创建用户组/usergroup/create: UserGroupVO UserGroupController.createUserGroup(CreateUserGroupRequestVO createUserGroupRequestVO).@I + 修改用户组信息/usergroup/upate: Boolean UserGroupController.updateUserGroup(UpdateUserGroupRequestVO updateUserGroupRequestVO).@I + 设置用户组状态/usergroup/changestatus: Boolean UserGroupController.updateUserGroupStatus(String groupCode,Integer status).@I 根据code获取用户组详情/usergroup/detail: UserGroupDTO UserGroupQueryController.getByGroupCode(String groupCode) 根据code或者名称搜索用户组信息/usergroup/search: List UserGroupQueryController.search(String search) @@ -105,19 +105,22 @@ package domain.bo { queryVoKey:RoleQueryVO String roleCode,String roleCode,Integer status contextKey:String role - + validateKey:String roleName,roleCode !invokeFileKey:String rolecontextseq.puml - 创建角色/role/create: RoleVO RoleController.createRole(CreateRoleRequestVO createRoleRequestVO) + + + + 创建角色/role/create: RoleVO RoleController.createRole(CreateRoleRequestVO createRoleRequestVO).@I.@T 根据编码获取角色详情/role/getbyrolecode: RoleVO RoleQueryController.getByRoleCode(String roleCode) - 禁用角色/role/disable: Boolean RoleController.disable(String roleCode) - 启用角色/role/enable: Boolean RoleController.enable(String roleCode) + 禁用角色/role/disable: Boolean RoleController.disable(String roleCode).@I.@T + 启用角色/role/enable: Boolean RoleController.enable(String roleCode).@I.@T 分页获取角色信息/role/pagelist: PageVO RoleQueryController.getPageList(PageVO pageVO) - 角色关联用户/role/relatetouser: Boolean RoleController.relateToUser(String userIds) + 角色关联用户/role/relatetouser: Boolean RoleController.relateToUser(String userIds).@I.@T 分页获取角色信息: PageDTO RoleQueryFacade.getPageList(PageDTO pageDTO) - 创建角色: RoleDTO RoleFacade.createRole(CreateRoleRequestDTO createRoleRequestDTO) - 修改角色信息: Boolean RoleFacade.updateRole(UpdateRoleRequestDTO updateRoleRequestDTO) + 创建角色: RoleDTO RoleFacade.createRole(CreateRoleRequestDTO createRoleRequestDTO).@I.@T + 修改角色信息: Boolean RoleFacade.updateRole(UpdateRoleRequestDTO updateRoleRequestDTO).@I.@T 设置角色状态: Boolean RoleFacade.updateRoleStatus(String groupCode,Integer status) 根据code获取角色详情: RoleDTO RoleQueryFacade.getByRoleCode(String groupCode) 根据code或者名称搜索角色信息: List RoleQueryFacade.search(String search) @@ -125,8 +128,8 @@ package domain.bo { } class "角色组-RoleGroupBO" as RoleGroupBO{ - 角色组名称:String roleName - 角色组编码:String roleCode + 角色组名称:String roleGroupName + 角色组编码:String roleGroupCode 组内角色列表:List roleList 角色状态:Integer status .. extend info .. @@ -145,6 +148,7 @@ package domain.bo { contextKey:String role + validateKey:String roleGroupName,roleGroupCode 创建角色组/rolegroup/create: RoleVO RoleGroupController.createRole(CreateRoleGroupRequestVO createRoleRequestVO) @@ -194,7 +198,7 @@ package domain.bo { 根据用户和系统获取系统权限信息: AuthorityDTO AuthorityQueryFacade.getUserSystemAuth(Long userId,String systemCode) 根据权限code获取权限信息: AuthorityDTO AuthorityQueryFacade.getByCode(String authCode) 分页获取权限信息: PageDTO AuthorityQueryFacade.getPageList(String authCode) - 给角色授权: AuthorityDTO AuthorityFacade.saveAuthority(CreateAuthorityRequestDTO createAuthorityRequestDTO) + 给角色授权: AuthorityDTO AuthorityFacade.saveAuthority(CreateAuthorityRequestDTO createAuthorityRequestDTO).@I.@T 修改授权信息: Boolean AuthorityFacade.updateAuthority(UpdateAuthorityRequestDTO updateAuthorityRequestDTO) @@ -260,7 +264,7 @@ package domain.bo { 获取系统菜单权限信息: SystemAuthorityDTO SystemAuthorityQueryFacade.getByCode(String authCode) - 给角色授权系统菜单权限: DataAuthorityDTO SystemAuthorityFacade.saveSystemAuthority(CreateSystemAuthorityRequestDTO createAuthorityRequestDTO) + 给角色授权系统菜单权限: DataAuthorityDTO SystemAuthorityFacade.saveSystemAuthority(CreateSystemAuthorityRequestDTO createAuthorityRequestDTO).@I.@T 修改角色授权系统菜单权限: Boolean SystemAuthorityFacade.saveSystemAuthority(UpdateSystemAuthorityRequestDTO createAuthorityRequestDTO) 获取系统菜单权限信息/systemauthority/getbycode: SystemAuthorityDTO SystemAuthorityQueryController.getByCode(String authCode) @@ -322,13 +326,13 @@ package domain.bo { controllerKey:String SystemController,SystemQueryController dtoKeyList:String UpdateSystemRequestDTO,SystemDTO,CreateSystemRequestDTO - voKeyList:String UpdateSystemRequestVO,SystemVO,CreateSystemRequestVO + voKeyList:String UpdateSystemRequestVO,SystemVO, queryDtoKey:SystemQueryDTO String systemName,String systemCode,Long tecAdminUserId,Long departmentId queryVoKey:SystemQueryVO String systemName,String systemCode,Long tecAdminUserId,Long departmentId contextKey:String system - + validateKey:String systemName,systemCode,departmentId invokeFileKey:String systemcontextseq.puml 注册系统: SystemDTO SystemFacade.registSystem(SystemDTO systemDTO) @@ -623,7 +627,25 @@ package "缓存包-infrast.cache" as infrast.cache { } +package app.validator{ + class "RoleValidator-角色相关校验处理服务" as RoleValidator{ + + +创建逻辑校验:void validate(UpdateRoleRequestDTO updateRoleRequestDTO) + +修改逻辑校验:void validate(CreateRoleRequestDTO createRoleRequestDTO) + + } + + class "AuthorityValidator-权限相关校验处理服务" as AuthorityValidator{ + + } + + class "SystemValidator-系统相关校验处理服务" as SystemValidator{ + +创建逻辑校验:void validate(CreateSystemRequestDTO createSystemRequestDTO) + +修改逻辑校验:void validate(UpdateSystemRequestDTO updateSystemRequestDTO) + } + +} package app.command { @@ -683,7 +705,7 @@ package app.command { package app.exe { interface "命令执行接口-CmdExeService" as CmdExeService{ - 命令执行入口:String exe(AbstractCmd abstractCmd) + 命令执行入口:String exe(AbstractCmd abstractCmd).@T } class "用户组cmd处理类-UserGroupCmdExe" as UserGroupCmdExe{ @@ -714,12 +736,12 @@ package app.exe { package "应用层事件监听器包支持域内消息和域外消息,在应用层处理消息-app.listener" as app.listener{ class "权限变更监听器-AuthorityChangeListener" as AuthorityChangeListener{ - +事务提交后权限变更监听:void authorityCreate(String authCode) - +用户状态信息变更监听消费:void userStatusChange(Long userId) + +事务提交后权限变更监听:void authorityCreate(String authCode).@TE + +用户状态信息变更监听消费:void userStatusChange(Long userId).@TE } class "系统菜单按钮变更监听器-SystemChangeListener" as SystemChangeListener{ - +事务提交后权限变更监听:void systemChange(MenuChangedEvent event) + +事务提交后权限变更监听:void systemChange(MenuChangedEvent event).@TE } } @@ -727,8 +749,8 @@ package "应用层事件监听器包支持域内消息和域外消息,在应 package "基础设施层消息生产者-mq.producer" as mq.producer { class "权限上下文消息生产者-AuthorityMqProducer" as AuthorityMqProducer{ - +权限创建:void authorityCreate(String authCode) - +权限更新:void authorityUpdate(String authCode) + +权限创建:void authorityCreate(String authCode).@TE + +权限更新:void authorityUpdate(String authCode).@TE } class "系统上下文消息生产者-SystemMqProducer" as SystemMqProducer{ @@ -737,17 +759,17 @@ package "基础设施层消息生产者-mq.producer" as mq.producer { } package "基础设施层消息消费者-mq.consumer" as mq.consumer { - class "用户上下文消息消费者或者监听-UserMqConsumer" as UserMqConsumer{ + class "用户上下文消息消费者或者监听-UserMqConsumer.@M" as UserMqConsumer{ +监听用户状态变更:void consumeUserStatusChange(String mqBody) } - class "组织上下文消息消费者或者监听-DepartmentMqConsumer" as DepartmentMqConsumer{ + class "组织上下文消息消费者或者监听-DepartmentMqConsumer.@M" as DepartmentMqConsumer{ +监听组织状态变更:void consumeDepartmentStatusChange(String mqBody) } } package "基础设施层消息消费处理器或者直接在基础设施层处理消息代码方案一-mq.handler" as mq.handler { - class "用户上下文消息处理器-UserMqHandler" as UserMqHandler{ + class "用户上下文消息处理器-UserMqHandler.@M" as UserMqHandler{ +处理用户状态变更的权限信息:void handleUserStatusChange(String mqBody) } } diff --git a/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-express/express-domain-V2.puml b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-express/express-domain-V2.puml new file mode 100644 index 0000000000000000000000000000000000000000..51ca375271cf4312812878bfa4f0321b62ed1ac3 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-express/express-domain-V2.puml @@ -0,0 +1,33 @@ +@startuml + +package domain.bo { + + class "快递订单-ExpressOrderBO" as ExpressOrderBO{ + 发件人信息:AddresserBO addresserBO + 收件人信息:RecipientBO recipientBO + 订单状态:Integer orderStatus + 订单创建时间:Date dateCreate + 发件人地址:AddressBO addressSendBO + 收件人地址:AddressBO addressReceiveBO + 订单金额:Long price + 快递单号:String orderCode + 订单来源:String orderSource + 订单业务类型:String expressOrderBusType + 物品信息:ExpressItemsBO expressItemsBO + +支付订单: void payOrder() + +关闭订单: void closeOrder() + +初始化订单对象:static ExpressOrderBO getInstance(String orderCode) + .. extend info .. + tableKey:String express_order + contextKey:String order + } +} + + + + + + + + +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-express/express-domain.puml b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-express/express-domain.puml new file mode 100644 index 0000000000000000000000000000000000000000..11dc9ad255ecdb3524eb8930afe4bed16c737a6f --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/ddd-plantuml/infosys-express/express-domain.puml @@ -0,0 +1,317 @@ +@startuml + +package domain.enum{ + enum "物品类型-ItemTypeEnum" as ExpressageTypeEnum{ + FOOD(1,"食品"), + CLOTHES(2,"衣服"), + ELECTRONICS(3,"电子产品"), + DRUG(4,"药品"), + OTHER(4,"其他"); + 快递类型:Integer code + 快递类型描述:String desc + static ItemTypeEnum getByCode(Integer code) + .. extend info .. + toRpcClient:String yes + } + + enum "快递业务类型-ExpressBusTypeEnum" as ExpressBusTypeEnum{ + BIG_EXPRESS(1,"大件"), + SAME_CITY(2,"同城送"), + BATCH_EXPRESS(3,"批量寄"), + COOL_EXPRESS(4,"冷链生鲜"); + 快递业务类型类型:Integer code + 快递业务类型描述:String desc + static ExpressBusTypeEnum getByCode(Integer code) + .. extend info .. + toRpcClient:String yes + } + + enum "付款方式-PayMethodEnum" as PayMethodEnum{ + ADDRESSER_PAY(1,"现寄现付") + RECIPIENT_PAY(2,"现寄到付") + MONTHLY_PAY(3,"月结支付") + + 付款方式类型:Integer code + 付款方式描述:String desc + static PayMethodEnum getByCode(Integer code) + .. extend info .. + toRpcClient:String yes + } + + enum "订单来源-OrderSourceEnum" as OrderSourceEnum{ + MICR_SITE(1,"小程序"), + APP_SITE(2,"APP"), + WEB_SITE(3,"web网站"), + 订单来源类型:Integer code + 订单来源描述:String desc + static OrderSourceEnum getByCode(Integer code) + .. extend info .. + toRpcClient:String yes + + } + + enum "快递站点合作方式-CooperationTypeEnum" as CooperationTypeEnum{ + JOIN(1,"加盟"), + SLEF_SUPPORT(2,"自营"), + 合作方式类型:Integer code + 合作方式描述:String desc + static CooperationTypeEnum getByCode(Integer code) + .. extend info .. + toRpcClient:String yes + } +} + + +package domain.bo { + class "发件人-AddresserBO" as AddresserBO{ + 电话号码:String telPhone + 发件人姓名:String chineseName + 用户ID:String userId + 地址列表:List addressBOList + .. extend info .. + + tableKey:String address_list + + facadeKey:String AddresserFacade + + dtoKeyList:String UpdateAddressRequestDTO,AddressDTO,CreateAddressRequestDTO + + contextKey:String user + + 获取用户常用发件地址: List getByUserId(String userId) + 增加发件地址: Boolean addAddress(CreateAddressRequestDTO createAddressRequestDTO).@I + } + + class "地址-AddressBO" as AddressBO{ + 省份ID:String provinceID + 省份名称:String proviceName + 城市ID:String cityID + 城市名称:String cityName + 区域ID:String areaID + 区域名称:String areaName + 街道ID:String streetID + 街道名称:String streetName + 地址描述:String detailAddress + } + + class "收件人-RecipientBO" as RecipientBO{ + 电话号码:String telPhone + 收件人姓名:String chineseName + 用户ID:String userId + } + + class "快件-ExpressItemsBO" as ExpressItemsBO{ + 物品类型名词:String itemTypeName + 预估重量/kg:String weight + 备注:String remark + 物品体积/立方米:Integer volume + .. extend info .. + tableKey:String express_items + contextKey:String express + + } + + class "快递员-CourierBO" as CourierBO{ + 电话号码:String telPhone + 快递员姓名:String chineseName + 快递员工号:String staffNum + + } + + class "快递订单-ExpressOrderBO" as ExpressOrderBO{ + 发件人信息:AddresserBO addresserBO + 收件人信息:RecipientBO recipientBO + 订单状态:Integer orderStatus + 订单创建时间:Date dateCreate + 发件人地址:AddressBO addressSendBO + 收件人地址:AddressBO addressReceiveBO + 订单金额:Long price + 快递单号:String orderCode + 订单来源:String orderSource + 订单业务类型:String expressOrderBusType + 物品信息:ExpressItemsBO expressItemsBO + +支付订单: void payOrder() + +关闭订单: void closeOrder() + + .. extend info .. + + tableKey:String express_order + facadeKey:String ExpressOrderFacade + + dtoKeyList:String CreateOrderRequestDTO,ExpressOrderDTO + + contextKey:String order + + 创建快递订单: String createOrder(CreateOrderRequestDTO createOrderRequestDTO) + } + + class "快递网点-ExpressSiteBO" as ExpressSiteBO{ + 网点地址:AddressBO addressFirstBO + 快递网点负责人姓名:String ownerName + 快递网点负责人电话:String telPhone + 合作方式:Integer cooperationType + .. extend info .. + + tableKey:String express_site + facadeKey:String ExpressSiteFacade + + dtoKeyList:String CreateSiteRequestDTO,ExpressSiteDTO + + contextKey:String express + + 创建快递网点: String ExpressSiteFacade.create(CreateSiteRequestDTO createSiteRequestDTO) + } + + class "快递物流轨迹-ExpressTraceBO" as ExpressTraceBO{ + 快递单号:String orderCode + 快递到达地点:String addressName + 物流轨迹描述:String desc + 物流轨迹上传来源:String sourceCode + 快递到达时间:Date arriveDate + 轨迹创建时间:Date dateCreate + .. extend info .. + + tableKey:String express_trace + facadeKey:String ExpressTraceFacade + + dtoKeyList:String ExpressTraceDTO + + contextKey:String express + + 创建快递网点: List selectTrace(String expressOrderCode) + } + + + class "快递价格计算slot-PriceSlotBO" as PriceSlotBO{ + 发件人地址:AddressBO addressFirstBO + 收件人地址:AddressBO addressSecondBO + 订单业务类型:String expressOrderBusType + 物品信息:ExpressItemsBO expressItemsBO + } + +} + + +package domain.msgbody { + class "OrderPayedMsgBody-接收订单支付消息" as OrderPayedMsgBody{ + + } + + class "ExpressTracePushMsgBody-接收物流轨迹上传消息" as ExpressTracePushMsgBody{ + + } +} + +package domain.event{ + class "OrderCreatedEvent-订单创建事件" as OrderCreatedEvent{ + 订单号:String orderCode + } + + class "OrderPayedEvent-订单支付事件" as OrderPayedEvent{ + 订单号:String orderCode + } + + class "OrderCompletedEvent-订单完成事件" as OrderCompletedEvent{ + 订单号:String orderCode + } +} + + + +package domain.service { + interface "用户服务网关-UserGataway" as UserGataway{ + 根据电话号码和姓名查询是否已注册用户:String getUserId(String telPhone,String chineseName) + } + + + interface "地址服务网关-AddressGataway" as AddressGataway{ + 根据条件查询地址列表:List searchAddress() + } + + + interface "快递订单服务-OrderService" as OrderService{ + 创建快递订单: String createOrder(ExpressOrderBO expressOrderBO) + 取消快递订单: boolean cancelOrder(String orderCode) + 根据订单号聚合查询订单信息: ExpressOrderBO queryOrderByCode(String orderCode) + } + + + + interface "物流轨迹服务-ExpressTraceService" as ExpressTraceService{ + 推送物流轨迹: String pushTrace(ExpressTraceBO expressTraceBO) + } + + interface "快递网点服务-ExpressSiteService" as ExpressSiteService{ + 创建快递网点信息: String createOrder(ExpressSiteBO expressSiteBO) + } + +} + + +package "领域工厂服务包-domain.factory" { + class "快递订单工厂-OrderFactory" as OrderFactory{ + 构建快递订单:ExpressOrderBO build(String orderCode) + } + +} + + + +package app.command { + + class "抽象命令类-AbstractCmd" as AbstractCmd{ + +操作时间: Date operateTime + +操作人ID: Long userId + +命令类: Class commandClass + +命令数据: String payLoad; + + } + + class "创建订单命令-CreateOrderCmd" as CreateOrderCmd{ + + } + + + CreateOrderCmd --|> AbstractCmd + +} + +package app.exe { + + interface "命令执行接口-CmdExeService" as CmdExeService{ + 命令执行入口:String exe(AbstractCmd abstractCmd) + } + + class "订单cmd处理类-OrderCmdExe" as OrderCmdExe{ + + } + + class "价格计算组件-CalculateCmp" as CalculateCmp{ + } + OrderCmdExe ..|> CmdExeService + +} + + + +package "应用层事件监听器包支持域内消息和域外消息,在应用层处理消息-app.listener" as app.listener{ + class "支付结果监听-PayOrderResultListener" as PayOrderResultListener{ + +事务提交后权限变更监听:void authorityCreate(String authCode) + } +} + + + +package "基础设施层消息生产者-mq.producer" as mq.producer { + class "权限上下文消息生产者-ExpressOrderMqProducer" as ExpressOrderMqProducer{ + +订单创建:void orderCreate(String orderCode) + } +} + +package "基础设施层消息消费者-mq.consumer" as mq.consumer { + class "支付服务消息消费者或者监听-PaymentMqConsumer" as PaymentMqConsumer{ + +监听支付单结果消息:void consumePayOrderChange(String mqBody) + } +} + +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/er-plantuml/infosys-auth/infosys_auth.puml b/codemaker-parent/codemaker-core/src/main/resources/er-plantuml/infosys-auth/infosys_auth.puml new file mode 100644 index 0000000000000000000000000000000000000000..41dc434eb77ea3f9a6769e66fcdb095451c703da --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/er-plantuml/infosys-auth/infosys_auth.puml @@ -0,0 +1,164 @@ +@startuml +' hide the spot +hide circle + +' avoid problems with angled crows feet +skinparam linetype ortho + +entity " user_group 用户组" as user_group { + id: 主键/bigint(20) unsigned + group_name: 用户组名/varchar(50) + group_code: 用户组编码/varchar(50) + status: 用户组状态/bigint(20) + user_list: 用户组内用户列表/varchar(2000) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " data_column_config 数据字段管理表" as data_column_config { + id: 主键/bigint(20) unsigned + bus_database: 数据库业务系统名称/varchar(60) + table_name: 表名称/varchar(60) + table_desc: 表描述/varchar(60) + column_name: 字段名称/varchar(60) + column_desc: 字段描述/varchar(60) + bus_model: 业务模块/varchar(60) + field_name: 业务属性名称/varchar(60) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " role 角色表" as role { + id: 主键/bigint(20) unsigned + role_name: 角色名称/varchar(50) + role_code: 角色编码/varchar(50) + status: 角色组状态/bigint(20) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " role_group 角色组" as role_group { + id: 主键/bigint(20) unsigned + group_name: 角色组名/varchar(50) + group_code: 角色组编码/varchar(50) + role_code_list: 角色列表/varchar(2000) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " kv_instance " as kv_instance { + id: 主键/bigint(20) unsigned + k: key/varchar(64) + v: value值/tinytext + value_json: /json + group_key: 分组key/varchar(64) + parent_key: 父级key/varchar(64) + refer_key: 引用对象key/varchar(64) + refer_id: 引用对象实例ID/varchar(64) + value_type: value的Java数据类型/int(11) + key_type: key的Java数据类型/int(11) + status: 状态,跟着主对象走/int(11) +} + +entity " module 菜单模块表" as module { + id: 主键/bigint(20) unsigned + module_name: 菜单名称/varchar(50) + module_code: 菜单编码/varchar(50) + system_code: 系统编码/varchar(50) + module_url: 菜单链接/varchar(50) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " menu 按钮表" as menu { + id: 主键/bigint(20) unsigned + menu_name: 按钮名称/varchar(50) + menu_code: 按钮编码/varchar(50) + module_code: 所属菜单编码/varchar(50) + system_code: 所属系统编码/varchar(50) + menu_url: 菜单链接/varchar(50) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " data_authority 数据字段权限" as data_authority { + id: 主键/bigint(20) unsigned + auth_code: 权限标示/varchar(50) + data_column_id: 业务数据库标示/varchar(50) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " system 系统表" as system { + id: 主键/bigint(20) unsigned + system_name: 系统名称/varchar(50) + system_code: 系统编码/varchar(50) + system_url: 系统域名/varchar(50) + system_picurl: 系统图标/varchar(50) + tec_admin_user_id: 系统技术负责人/bigint(20) + bus_admin_user_id: 系统业务负责人/bigint(20) + department_id: 系统所属部门/bigint(20) + date_create: 创建时间/timestamp + create_user_id: 创建人/bigint(20) + status: /int(11) +} + +entity " system_authority 系统菜单权限表" as system_authority { + id: 主键/bigint(20) unsigned + auth_code: 权限标示/varchar(50) + system_code: 系统编码/varchar(50) + module_code: 菜单编码/varchar(50) + menu_code: 按钮编码/varchar(50) + date_create: 创建时间/timestamp + create_user_id: 创建人/bigint(20) +} + +entity " admin_authority 行政数据权限" as admin_authority { + id: 主键/bigint(20) unsigned + auth_code: 权限标示/varchar(50) + department_id: 组织部门ID/bigint(20) + city_id: 城市权限/bigint(20) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " authority 抽象权限表" as authority { + id: 主键/bigint(20) unsigned + auth_code: 权限编码/varchar(50) + authority_type: 权限类型/tinyint(4) + role_code: 关联角色编码/varchar(50) + role_group_code: 关联角色组/varchar(50) + status: 权限状态/tinyint(4) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity " role_user_relation 用户角色关联表" as role_user_relation { + id: 主键/bigint(20) unsigned + user_id: 用户ID/bigint(20) + role_code: 角色code/varchar(50) +} + + + + + +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/er-plantuml/infosys-express/infosys_express.puml b/codemaker-parent/codemaker-core/src/main/resources/er-plantuml/infosys-express/infosys_express.puml new file mode 100644 index 0000000000000000000000000000000000000000..634fcc0bbafdd0db08287b42adec11b6b828a306 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/er-plantuml/infosys-express/infosys_express.puml @@ -0,0 +1,109 @@ +@startuml +' hide the spot +hide circle + +' avoid problems with angled crows feet +skinparam linetype ortho + +entity "address_list 发件人常用地址" as address_list { + id: 主键/bigint(20) unsigned + province_id: 所在省份ID/varchar(20) + city_id: 所在城市ID/varchar(20) + area_id: 所在区域ID/varchar(20) + street_id: 所在街道ID/varchar(20) + site_code: 快递站点编码/varchar(30) + address_detail: 具体地址/varchar(256) + user_id: 用户ID/varchar(20) + is_often: 是否是常用地址/int(11) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity "express_items 快递物品信息" as express_items { + id: 主键/bigint(20) unsigned + item_type: 物品类型/int(11) + forecast_weight: 预估重量/int(11) + remark: 备注/varchar(256) + volume: 物品体积/int(11) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity "express_order 快递订单信息" as express_order { + id: 主键/bigint(20) unsigned + addresser_user_id: 发件人id/varchar(20) + addresser_user_name: 发件人姓名/varchar(20) + addresser_telphone: 发件人电话/varchar(20) + send_address: 发件人地址/varchar(256) + recipient_user_id: 收件人id/varchar(20) + recipient_user_name: 收件人姓名/varchar(20) + recipient_telphone: 收件人电话/varchar(20) + order_status: 订单状态/int(11) + receive_address: 收件人地址/varchar(256) + price: 订单金额/bigint(20) + order_code: 订单编号/varchar(64) + order_source: 订单来源/varchar(64) + express_order_bus_type: 订单业务类型/int(11) + express_item_id: 物品ID/bigint(11) + date_create: 订单创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) + mark_content: 快递备注/varchar(256) +} + + +entity "express_order_trace 快递订单轨迹信息" as express_order_trace { + id: 主键/bigint(20) unsigned + + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + + +entity "express_site 快递站点信息" as express_site { + id: 主键/bigint(20) unsigned + province_id: 所在省份ID/varchar(20) + city_id: 所在城市ID/varchar(20) + area_id: 所在区域ID/varchar(20) + street_id: 所在街道ID/varchar(20) + site_code: 快递站点编码/varchar(30) + address_detail: 具体地址/varchar(256) + owner_name: 快递网点负责人姓名/varchar(20) + tel_phone: 快递网点负责人电话/varchar(20) + cooperation_type: 合作方式/int(11) +} + +entity "express_trace 快递物流轨迹信息" as express_trace { + id: 主键/bigint(20) unsigned + order_code: 快递订单号/varchar(64) + address_name: 快递到达地点/varchar(128) + desc: 物流轨迹描述/varchar(256) + source_code: 物流轨迹上传来源/varchar(64) + arrive_date: 快递到达时间/timestamp + date_create: 轨迹创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +entity "price_config 快递价格配置" as price_config { + id: 主键/bigint(20) unsigned + start_province: 发送省份/varchar(20) + end_province: 接收省份/varchar(20) + weight_basic: 基本重量/int(11) + price_basic: 基本价格/int(11) + over_weight_price: 超重价格/int(11) + date_create: 创建时间/timestamp + date_update: 修改时间/timestamp + update_user_id: 修改人/bigint(20) + create_user_id: 创建人/bigint(20) +} + +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/api-json/readme b/codemaker-parent/codemaker-core/src/main/resources/er-plantuml/xxx similarity index 100% rename from codemaker-parent/codemaker-core/src/main/resources/api-json/readme rename to codemaker-parent/codemaker-core/src/main/resources/er-plantuml/xxx diff --git a/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/AuthorityRepository.puml b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/AuthorityRepository.puml new file mode 100644 index 0000000000000000000000000000000000000000..b3c2cfb816090c4f86642543dc274efb9135350b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/AuthorityRepository.puml @@ -0,0 +1,24 @@ +@startuml + + +participant AuthorityRepository as c +participant infrast as s + +group 禁用权限资源:disableAuthority(code,) +a -> i: bo=authorityMapper.getByCode(code).convert() +a -> a: ifnull(bo).throw(E1000002) +a -> a: bo.disable() +a -> i: bo.convertdo().mapper.update() => ret(var==1) +end + +group 禁用权限资源:updateAuthToRole(bo) +a -> i: adminAuthorityMapper.deleteByAuthCode(bo.authCode) +a -> i: systemAuthorityMapper.deleteByAuthCode(bo.authCode) +a -> i: dataAuthorityMapper.deleteByAuthCode(bo.authCode) + +a -> a: ifnotempty(bo.dataAuthorityBOList) => fore(bo.dataAuthorityBOList) => dataAuthorityMapper.insert + +end + + +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/SystemModuleRepository.puml b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/SystemModuleRepository.puml new file mode 100644 index 0000000000000000000000000000000000000000..161d87926b4e78334546b4aff971fbb5154c83eb --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/SystemModuleRepository.puml @@ -0,0 +1,22 @@ +@startuml + + +participant SystemModuleRepository as s +participant infrast as i + +group 禁用权限资源:registSystemMeta(systemBO) +s -> i: systemDO=varc(systemBO) +s -> a: ifnotempty(systemDO.systemCode) => systemMapper.insert(systemDO) +s -> i: ifnotemptys(systemBO.moduleBOList) => ret(systemDO.id) + +s -> i: moduleBOList = systemBO.moduleBOList.sfilter.isnotempty(moduleBO.moduleCode).cl +s -> i: ifnotemptys(moduleBOList) => ret(systemDO.id) +s -> i: moduleMapper.insertBatch(varc(moduleBOList)) + +s -> i: systemBO.moduleBOList.sfore(moduleBO) => ifnotemptys(moduleBO.menuBOList) => menuMapper.insertBatch(varc(moduleBO.menuBOList)) + +end + + + +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/infosys-auth/datacolumncontextseq.puml b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/infosys-auth/datacolumncontextseq.puml index 22af333b97e5d37aac04a1a255ccbe3fd9087a65..ae03cd24a59847814cb9df5b546f129bdb053dfe 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/infosys-auth/datacolumncontextseq.puml +++ b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/infosys-auth/datacolumncontextseq.puml @@ -1,4 +1,4 @@ -@startuml +9@startuml participant 应用facade层 as facade participant 应用http层 as http diff --git a/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/infosys-express/createorder.puml b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/infosys-express/createorder.puml new file mode 100644 index 0000000000000000000000000000000000000000..aadafa6182dd73f3d52054fed92fa64601702e3a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/infosys-express/createorder.puml @@ -0,0 +1,14 @@ +@startuml +participant 各个端侧入口 as endpoint +participant 物流订单系统 as order +participant 支付系统 as payment +participant 快递终端服务 as endexpress +endpoint -> order : 创建订单 +order -> order : api层校验转换cmd +order -> order : 进入应用层cmdexecutor +order -> order : 进入应用层-价格计算组件计算订单金额 +order -> order : 进入应用层保存业务订单 +order -> payment : 创建支付单并支付 +payment --> order : 消息回调支付完成 +order --> endexpress : 订单发出支付完成消息,通知揽收 +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/role.puml b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/role.puml new file mode 100644 index 0000000000000000000000000000000000000000..3237b5018c7cfc312e33e4c6f54f48e313de9b76 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/invoke-plantuml/role.puml @@ -0,0 +1,21 @@ +@startuml + +participant 角色服务 as roleFacade +participant 角色服务 as roleFacade + +participant 领域层 as domain +participant 基础设施层 as infrast +participant 组织服务 as infosysuser + +group 创建角色:createRole +roleFacade -> domain:userRoleRepository.saveRole.rets +end + +group 修改角色:updateRole +roleFacade -> domain:var=userRoleRepository.updateRole +note left: 我借钱肯定会还你的! +alt ifrets(var>0) +else retf +end + +@enduml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/mapper/sqlMapper.xml b/codemaker-parent/codemaker-core/src/main/resources/mapper/sqlMapper.xml index 9dfd0f57e03883c7acc71f76d6c989d8af4d729d..294da0269fab1147a8414242981809dcf2813490 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/mapper/sqlMapper.xml +++ b/codemaker-parent/codemaker-core/src/main/resources/mapper/sqlMapper.xml @@ -1,9 +1,9 @@ - + - SELECT TABLE_NAME AS tableName ,COLUMN_NAME columnName, COLUMN_DEFAULT AS columnDefaultValue,DATA_TYPE AS dataType, EXTRA AS extraInfo ,COLUMN_KEY AS columnKey,IS_NULLABLE AS isNullable, @@ -11,7 +11,7 @@ WHERE TABLE_SCHEMA = #{dbName} - SELECT TABLE_NAME AS tableName,TABLE_COMMENT AS tableComment FROM information_schema.TABLES WHERE TABLE_SCHEMA = #{dbName} diff --git a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-cola.properties b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-cola.properties index 9ee5b3050ee4e5a5f7cd8993f73adde3e8f2ef0a..a2074a1a9f248a579a95ea4bdcbba29b12186a32 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-cola.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-cola.properties @@ -1,29 +1,46 @@ #数据库名称 cola.global.dbName=infosys_auth +#cola.global.dbName=infosys_express -#应用名称 +#应用名称,作为工程名称 cola.global.applicationName=infosys-auth +#cola.global.applicationName=infosys-express + +#应用别名与目标工程输出目录一致 +cola.global.applicationNameAlias=auth +#cola.global.applicationNameAlias=express + + +#maven坐标-GAV---父级模块的GAV信息 +cola.pom.parent.groupId=com.coderman.infosys.express +cola.pom.parent.artifactId=infosys-express +cola.pom.parent.version=1.0.0.SNAPSHOT + +cola.code.app.project.path=/Users/shenshuai/scworkspace/myspace/code-maker #目标工程输出目录,这里填写对应的工程的绝对路径 -cola.code.outpath.cola-adapter=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-adapter -cola.code.outpath.cola-infrast=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-infrast -cola.code.outpath.cola-app=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-app -cola.code.outpath.cola-domain=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-domain -cola.code.outpath.cola-client=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-client -cola.code.outpath.cola-start=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-start -cola.code.outpath.cola-feign-api=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-feign-api +#cola.code.outpath.cola-adapter=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-adapter +#cola.code.outpath.cola-infrast=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-infrast +#cola.code.outpath.cola-app=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-app +#cola.code.outpath.cola-domain=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-domain +#cola.code.outpath.cola-client=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-client +#cola.code.outpath.cola-start=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-start +#cola.code.outpath.cola-feign-api=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-feign-api #应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 +#cola.domain.plantuml=express-domain.puml cola.domain.plantuml=auth-domainV5.puml -#cola.domain.plantuml= #是否构建api 文档,否则进行构建,默认构建 cola.api.generator=true +#是否将调用时序文档同步到项目工程里,默认同步 +cola.plantumldoc.sync=true #需要导入的组件列表,多个逗号分割,适用于cola模块下依赖的业务组件包或者对外api接口包,或者cola项目本身已有的代码类,或者其他偏业务的工具类组件等等。 #如要生成的项目会依赖 infosys-user 服务的api则在这里定义即可。 -cola.component.scan.config=apiresult,infosysuser,hutool-core +cola.component.scan.config=apiresult,infosysuser,hutool-core,mybatis-plus,springcloudalibaba-rocketmq +#cola.component.scan.config=apiresult,infosysuser,hutool-core,mybatis-plus,liteflow,rocketmq,springboot-redis #需要在领域文档和调用时序文档中识别的读操作统一语言 cola.component.dsl.read=check @@ -43,9 +60,26 @@ cola.subpackage.response=true cola.component.scan.beans=appCompScanService #应用级组件中间件工具包的组件装饰bean配置 -cola.component.decorate.beans=appCompDecorateService +cola.component.decorate.beans=appCompDecorateService,mybatisPlusDecorateService +#cola.component.decorate.beans=appCompDecorateService,mybatisPlusDecorateService,liteFlowDecorateService + +#应用级代码参数dto,vo所需要的参数验证逻辑构建bean,内置五种实现 +#支持validateAopService,validateJSRHibernateService,validateParamService,validateUtilService,validateServiceValidator +cola.component.validate.beans=validateParamService,validateServiceValidator + #代码工具类注册,项目初始化时可以帮助初始化对应的工具类 #后面生成代码的时候可以删掉工具类,只专注于生成业务代码 #格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 -cola.component.init.clazz=BaseEvent:domain,Application:start,BaseController:adapter,PageBO:domain,SpringApplicationContext:domain,AppEventPublisher:domain +cola.component.init.clazz=BaseEvent:domain,Application:start,BaseController:adapter,PageBO:domain,SpringApplicationContext:domain,AppEventPublisher:domain,LockA:domain,MqHandler:domain,IdemPotent:domain + +#项目各个模块需要依赖的pom gav配置 +#cola.component.init.pom=apiresult:adapter,apiresult:client,hutool-core:app,hutool-core:adapter,apiresult:feignapi,mybatis-plus:infrast,liteflow:domain,rocketmq:infrast,springboot-redis:infrast +cola.component.init.pom=apiresult:adapter,apiresult:client,hutool-core:app,hutool-core:adapter,apiresult:feignapi,mybatis-plus:infrast,springcloudalibaba-rocketmq:infrast + +#自定义ftl代码元素,eg ftlFileName:classType:moduleName +cola.code.template.custom.ftl=validator:class:app,cmp:class:app + +#项目各个模块需要导入的配置文件 +#cola.component.init.config=application_properties:start,log4j_properties:start,mybatis-config_xml:infrast,liteflow_properties:start +cola.component.init.config=application_properties:start,log4j_properties:start,mybatis-config_xml:infrast diff --git a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dubbo.properties b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dubbo.properties index fb6c548806bcf910c077c4defbc60dae9491a22a..4398895da235980b210f4c0b24c2afb6da65e957 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dubbo.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dubbo.properties @@ -1,21 +1,38 @@ #数据库名称 -dubbo.global.dbName=infosys_auth +dubbo.global.dbName=infosys_express #dubbo应用名 -dubbo.global.applicationName=infosys-auth +dubbo.global.applicationName=infosys-express + + +#应用别名与目标工程输出目录一致 +dubbo.global.applicationNameAlias=express + +#下面的绝对目录由project.path替代,简化配置 +dubbo.code.app.project.path=/Users/shenshuai/scworkspace/myspace/code-maker + +#maven坐标-GAV---父级模块的GAV信息 +dubbo.pom.parent.groupId=com.coderman.infosys.express +dubbo.pom.parent.artifactId=infosys-express +dubbo.pom.parent.version=1.0.0.SNAPSHOT + + + #目标工程输出目录,这里填写对应的工程的绝对路径 -dubbo.code.outpath.dubbo-common=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-common -dubbo.code.outpath.dubbo-api=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-api -dubbo.code.outpath.dubbo-core=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-core +#dubbo.code.outpath.dubbo-common=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-common +#dubbo.code.outpath.dubbo-api=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-api +#dubbo.code.outpath.dubbo-core=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-core #应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 -dubbo.domain.plantuml=auth-domainV5.puml +dubbo.domain.plantuml=express-domain.puml -#dubbo.domain.plantuml=SchoolManager.puml +#dubbo.domain.plantuml= #是否构建api 文档,否则进行构建,默认构建 dubbo.api.generator=true +#是否将调用时序文档同步到项目工程里,默认同步 +dubbo.plantumldoc.sync=true #是否需要根据该参数设置请求参数的最后一级包名为request,默认false dubbo.subpackage.request=false @@ -25,7 +42,8 @@ dubbo.subpackage.response=false #需要导入的组件列表,多个逗号分割 -dubbo.component.scan.config=apiresult,infosysuser,hutool-core +dubbo.component.scan.config=apiresult,infosysuser +#dubbo.component.scan.config=apiresult,infosysuser,hutool-core,rocketmq #需要在领域文档和调用时序文档中识别的读操作统一语言 dubbo.component.dsl.read=check @@ -43,5 +61,19 @@ dubbo.component.decorate.beans=appCompDecorateService #应用级代码工具类注册,项目初始化时可以帮助初始化对应的工具类 #后面生成代码的时候可以删掉工具类,只专注于生成业务代码 #格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 -dubbo.component.init.clazz=BaseEvent:core,Application:core,SpringApplicationContext:core,AppEventPublisher:core +dubbo.component.init.clazz=BaseEvent:core,Application:core,SpringApplicationContext:core,AppEventPublisher:core,PageBO:core,SpringApplicationContext:core,AppEventPublisher:core,LockA:core,MqHandler:core,IdemPotent:core + +#应用级代码参数dto,vo所需要的参数验证逻辑构建bean,内置五种实现 +#支持validateAopService,validateJSRHibernateService,validateParamService,validateUtilService,validateServiceValidator +dubbo.component.validate.beans=validateParamService,validateServiceValidator + + +#项目各个模块需要依赖的pom gav配置 +dubbo.component.init.pom=apiresult:api +#dubbo.component.init.pom=apiresult:api,hutool-core:core,hutool-core:common,rocketmq:core,springboot-redis:core + +#自定义ftl代码元素,eg ftlFileName:classType:moduleName +dubbo.code.template.custom.ftl=validator:class:core,cmp:class:core +#项目各个模块需要导入的配置文件 +dubbo.component.init.config=application_properties:core,log4j_properties:core,mybatis-config_xml:common diff --git a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dynamicddd.properties b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dynamicddd.properties index 155816fe17a25f82f3fa7c5a2c048fd692bf2643..7a448aa417372385658b2d9a7664eb17d1fc2b4b 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dynamicddd.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-dynamicddd.properties @@ -1,4 +1,4 @@ #目标工程输出目录,这里填写对应的codemaker-dynamicddd工程的绝对路径 -dynamicddd.code.outpath=/Users/shenshuai/myspace/code-maker/codemaker-dynamicddd +dynamicddd.code.outpath=/Users/shenshuai/scworkspace/myspace/code-maker/codemaker-dynamicddd #领域plantUML 类图 -dynamicddd.domain.plantuml=SchoolManager.puml \ No newline at end of file +dynamicddd.domain.plantuml=express-domain.puml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springboot.properties b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springboot.properties index bbf061eba82e8732ed54767b5de19b0bf74d4a6d..99d8026ad9646a1f34287bb929cf3b476dab1fef 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springboot.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springboot.properties @@ -1,26 +1,33 @@ #数据库名称 -springboot.global.dbName=infosys_auth +springboot.global.dbName=infosys_express #项目名称 -springboot.global.applicationName=infosys-auth +springboot.global.applicationName=infosys-express + +#应用别名与目标工程输出目录一致 +springboot.global.applicationNameAlias=express + +#下面的绝对目录由project.path替代,简化配置 +springboot.code.app.project.path=/Users/shenshuai/scworkspace/myspace/code-maker #maven坐标-GAV -codemaker.pom.groupId=com.snail.school.manager -codemaker.pom.artifactId=schoolmanager-web -codemaker.pom.version=1.0.0.SNAPSHOT +springboot.pom.groupId=com.coderman.infosys.express +springboot.pom.artifactId=infosys-express +springboot.pom.version=1.0.0.SNAPSHOT #目标工程输出目录,这里填写对应的codemaker-web工程的绝对路径 -codemaker.code.outpath=/Users/shenshuai/myspace/code-maker/codemaker-springboot +#codemaker.code.outpath=/Users/shenshuai/myspace/code-maker/codemaker-springboot #应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 -codemaker.domain.plantuml=auth-domainV5.puml -#codemaker.domain.plantuml=SchoolManager.puml +springboot.domain.plantuml= +#springboot.domain.plantuml=SchoolManager.puml #是否构建api 文档,否则进行构建,默认构建 springboot.api.generator=true +#是否将调用时序文档同步到项目工程里,默认同步 +springboot.plantumldoc.sync=true - -springboot.component.scan.config=apiresult,infosys-user +springboot.component.scan.config=apiresult,infosys-user,springcloudalibaba-rocketmq #需要在领域文档和调用时序文档中识别的读操作统一语言 @@ -45,7 +52,23 @@ springboot.component.scan.beans=appCompScanService springboot.component.decorate.beans=appCompDecorateService + +#应用级代码参数dto,vo所需要的参数验证逻辑构建bean,内置五种实现 +#支持validateAopService,validateJSRHibernateService,validateParamService,validateUtilService,validateServiceValidator +springboot.component.validate.beans=validateParamService,validateServiceValidator + + #应用级代码工具类注册,项目初始化时可以帮助初始化对应的工具类 #后面生成代码的时候可以删掉工具类,只专注于生成业务代码 #格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 -springboot.component.init.clazz=BaseEvent:springboot,Application:springboot,SpringApplicationContext:springboot,AppEventPublisher:springboot \ No newline at end of file +springboot.component.init.clazz=BaseController:springboot,BaseEvent:springboot,Application:springboot,SpringApplicationContext:springboot,AppEventPublisher:springboot + + +#项目各个模块需要依赖的pom gav配置 +springboot.component.init.pom=apiresult:springboot,springcloudalibaba-rocketmq:springboot + +#自定义ftl代码元素,eg ftlFileName:classType:moduleName +springboot.code.template.custom.ftl=validator:class:springboot + +#项目各个模块需要导入的配置文件 +springboot.component.init.config=application_yml:springboot,log4j_properties:springboot,mybatis-config_xml:springboot,rocketmq_yml:springboot diff --git a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springcloud.properties b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springcloud.properties index 0383715fc2a8d5b663b1fa41b93a74ec774fb015..dd0b86438715484ec1b4335b7b376b1442326bd9 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springcloud.properties +++ b/codemaker-parent/codemaker-core/src/main/resources/projecttemplate-springcloud.properties @@ -4,13 +4,20 @@ springcloud.global.dbName=infosys_auth #项目名称 springcloud.global.applicationName=infosys-auth +#应用别名与目标工程输出目录一致 +springcloud.global.applicationNameAlias=auth + +#下面的绝对目录由project.path替代,简化配置 +springcloud.code.app.project.path=/Users/shenshuai/scworkspace/myspace/code-maker + + #maven坐标-GAV -springcloud.pom.groupId=com.snail.school.manager -springcloud.pom.artifactId=schoolmanager-web +springcloud.pom.groupId=com.coderman.infosys.auth +springcloud.pom.artifactId=infosys-auth springcloud.pom.version=1.0.0.SNAPSHOT #目标工程输出目录,这里填写对应的codemaker-web工程的绝对路径 -springcloud.code.feign-api=/Users/shenshuai/myspace/code-maker/codemaker-springcloud/springcloud-api -springcloud.code.feign-provider=/Users/shenshuai/myspace/code-maker/codemaker-springcloud/springcloud-provider +#springcloud.code.feign-api=/Users/shenshuai/myspace/code-maker/codemaker-springcloud/springcloud-api +#springcloud.code.feign-provider=/Users/shenshuai/myspace/code-maker/codemaker-springcloud/springcloud-provider #应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 springcloud.domain.plantuml=auth-domainV5.puml @@ -19,6 +26,8 @@ springcloud.domain.plantuml=auth-domainV5.puml #是否构建api 文档,否则进行构建,默认构建 springcloud.api.generator=true +#是否将调用时序文档同步到项目工程里,默认同步 +springcloud.plantumldoc.sync=true #需要导入的组件列表,多个逗号分割,适用于cola模块下依赖的业务组件包或者对外api接口包,或者cola项目本身已有的代码类,或者其他偏业务的工具类组件等等。 #如要生成的项目会依赖 infosys-user 服务的api则在这里定义即可 @@ -50,4 +59,21 @@ springcloud.component.decorate.beans=appCompDecorateService #应用级代码工具类注册,项目初始化时可以帮助初始化对应的工具类 #后面生成代码的时候可以删掉工具类,只专注于生成业务代码 #格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 -springcloud.component.init.clazz=BaseEvent:provider,Application:provider,SpringApplicationContext:provider,AppEventPublisher:provider \ No newline at end of file +springcloud.component.init.clazz=BaseEvent:provider,Application:provider,SpringApplicationContext:provider,AppEventPublisher:provider + + + + +#应用级代码参数dto,vo所需要的参数验证逻辑构建bean,内置五种实现 +#支持validateAopService,validateJSRHibernateService,validateParamService,validateUtilService,validateServiceValidator +springcloud.component.validate.beans=validateParamService,validateServiceValidator + + +#项目各个模块需要依赖的pom gav配置 +springcloud.component.init.pom=apiresult:api,hutool-core:provider + +#自定义ftl代码元素,eg ftlFileName:classType:moduleName +springcloud.code.template.custom.ftl=validator:class:provider + +#项目各个模块需要导入的配置文件 +springcloud.component.init.config=application_properties:provider,log4j_properties:provider,mybatis-config_xml:provider diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/applicationproperties.ftl index 5e846f6a937074a53a02ec436451b8c27e61e13a..e0b6effa2a294f699e3847340a41cf906dff0c17 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/applicationproperties.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/applicationproperties.ftl @@ -16,6 +16,6 @@ spring.datasource.password=root mybatis.config-locations=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:mapper/*.xml #配置模型路径 -mybatis.type-aliases-package=com.coderman.codemaker.bean +mybatis.type-aliases-package=com.tianhua.codemaker.bean diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/adapterpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/adapterpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..b31ae48fbe3ec1ed2c3d7d5f7b083aa10f88da9d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/adapterpom.ftl @@ -0,0 +1,117 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-adapter + 1.0-SNAPSHOT + + ${modulePrefix}-adapter + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.springframework + spring-context + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.mapstruct + mapstruct + + + + ${groupId} + ${modulePrefix}-app + 1.0-SNAPSHOT + + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/apppom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/apppom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..468f42c361ce6dc8883f62b1584a48f60dd75565 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/apppom.ftl @@ -0,0 +1,135 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-app + 1.0-SNAPSHOT + + ${modulePrefix}-app + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + + org.springframework.boot + spring-boot-test + + + org.springframework + spring-test + + + + + org.projectlombok + lombok + + + + + org.apache.dubbo + dubbo-spring-boot-starter + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + + + org.mapstruct + mapstruct-jdk8 + + + org.aspectj + aspectjweaver + + + + org.assertj + assertj-core + + + + ${groupId} + ${modulePrefix}-client + 1.0-SNAPSHOT + + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + + + + ${groupId} + ${modulePrefix}-infrast + 1.0-SNAPSHOT + + + + org.apache.dubbo + dubbo + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/bo.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/bo.ftl index 79fea9d311357de16ed8e3d6fc0dbc83dbc3c445..c238015dfc9f84a942c62a0c84d832a82ab3fe4d 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/bo.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/bo.ftl @@ -1,4 +1,4 @@ -package ${package}.model.bo; +package ${package}.domain.bo; import java.util.Date; import java.math.BigDecimal; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/boddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/boddd.ftl index 6107567ccb4101f3e4384e086c235c719e343b36..fc44ebcb45a37c5a25de4a1f5a34c4db554ab12e 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/boddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/boddd.ftl @@ -30,6 +30,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/clientpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/clientpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9839473beadd609ed9e3254f9db98faabfa04c57 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/clientpom.ftl @@ -0,0 +1,60 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-client + 1.0-SNAPSHOT + + ${modulePrefix}-client + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/cmp.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/cmp.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6a43f0a56f9162c9e849eaa756553ddf1a843092 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/cmp.ftl @@ -0,0 +1,32 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import org.springframework.stereotype.Component; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Component("${class.className}") +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/controller.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/controller.ftl index 3c88f6d538a3d5c5784303201653be94a35443b2..04e491ddad614e2b8b4ac183cea8c92ed62fe256 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/controller.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/controller.ftl @@ -1,10 +1,12 @@ -package ${package}.controller; +package ${package}.adapter.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import ${package}.service.${table.humpClassName}Service; -import ${package}.vo.${table.humpClassName}VO; +import ${package}.controller.BaseController; + +import ${package}.domain.service.${table.humpClassName}Service; +import ${package}.adapter.vo.${table.humpClassName}VO; import com.coderman.utils.response.ResultDataDto; import com.coderman.utils.response.ResultDto; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/controllerddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/controllerddd.ftl index 570a4e93153a5f60083038aa4dca8e1a715ee0b6..a334ab622f5ee4829d7a72829c8a92c566b8836c 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/controllerddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/controllerddd.ftl @@ -17,7 +17,10 @@ import org.springframework.web.bind.annotation.*; * @version v1.0 */ @RestController -public class ${class.className} { +<#list class.annotationTagList as annotation> +${annotation} + +public class ${class.className} ${class.relationClassStr}{ protected Logger logger = LoggerFactory.getLogger(${class.className}.class); @@ -29,6 +32,9 @@ public class ${class.className} { <#list methods as method> ${method.doc} + <#list method.annotationTagList as annotation> + ${annotation} + @RequestMapping(value = "${method.pathValue}") public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/doboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/doboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/doboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/domainpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/domainpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9efc00a6492e067954d22b199880ce27d9417c55 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/domainpom.ftl @@ -0,0 +1,57 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + ${modulePrefix}-domain + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + org.projectlombok + lombok + + + + org.springframework + spring-context + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/dto.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/dto.ftl index 12465ba0cc11a90cdf0a02265ce52772ceeab0ac..87e531d39abc755305a0b13efbd77173e1fc035b 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/dto.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/dto.ftl @@ -1,4 +1,4 @@ -package ${package}.api.dto; +package ${package}.client.api.dto; import java.util.Date; import java.math.BigDecimal; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/dtoboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/dtoboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/dtoboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/dtoddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/dtoddd.ftl index 9d21fd692e7e09efe9f09957501c8a513bb16aba..5c183a28cfbfd6a7646a58a15b4a29fe64a5bd5a 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/dtoddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/dtoddd.ftl @@ -18,8 +18,11 @@ import lombok.ToString; public class ${class.className} ${class.relationClassStr}{ <#list fields as field> - /** ${field.desc} **/ + /** ${field.desc} **/ + <#list field.annotationTagList as annotation> + ${annotation} + ${field.visibility} ${field.fieldName}; @@ -30,7 +33,8 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ - ${method.returnBody} + ${method.methodContent} + ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/event.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/event.ftl index 9f15e120dfe9a271ea823b5e318410cbd3be5c44..8da69e93b67b80ecda855b6ce6ed8266e5567ac3 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/event.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/event.ftl @@ -28,6 +28,7 @@ public class ${class.className}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/exeimpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/exeimpl.ftl index e6a8d75475a8c42353b308de6c43e6e9bd173bca..dd3f647c7af4be565cc1ff1eff1886bedf676542 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/exeimpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/exeimpl.ftl @@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className} ${class.relationClassStr}{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -28,6 +31,9 @@ public class ${class.className} ${class.relationClassStr}{ <#list methods as method> + <#list method.annotationTagList as annotation> + ${annotation} + @Override public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/facade.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/facade.ftl index 25af93e70591fa7565dcc59cc3d5736f054cbd41..71cee3688b9b6f3b59394c5847b6268ebcb90970 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/facade.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/facade.ftl @@ -1,11 +1,11 @@ -package ${package}.api.facade; +package ${package}.client.api.facade; import java.util.List; import com.coderman.utils.response.ResultDataDto; import com.coderman.utils.response.ResultDto; import com.coderman.utils.response.PageDTO; -import ${package}.api.dto.${table.humpClassName}DTO; +import ${package}.client.api.dto.${table.humpClassName}DTO; /** * @Description:${table.tableComment}Facade接口 diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimpl.ftl index bc8bcef292d1c6ebe39129410b005d4ef1a7b941..52ac99b0fddec0a26217db3dc1b453501c6201f8 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimpl.ftl @@ -8,8 +8,8 @@ import com.coderman.utils.response.ResultDataDto; import com.coderman.utils.response.ResultDto; import com.coderman.utils.response.PageDTO; -import ${package}.api.facade.${table.humpClassName}Facade; -import ${package}.api.dto.${table.humpClassName}DTO; +import ${package}.client.api.facade.${table.humpClassName}Facade; +import ${package}.client.api.dto.${table.humpClassName}DTO; import java.util.List; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimplddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimplddd.ftl index ea57774dd92fcadb4f8c7a282e948a7fd2f04c2c..d96c04f0bcd6e8083764e0e7ea05d7b1a93c1dd1 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimplddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/facadeimplddd.ftl @@ -15,6 +15,9 @@ import ${importClass}; * @version v1.0 */ ${class.annotation} +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className} ${class.relationClassStr}{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -27,6 +30,9 @@ public class ${class.className} ${class.relationClassStr}{ <#list methods as method> + <#list method.annotationTagList as annotation> + ${annotation} + @Override public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/feignapipom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/feignapipom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..b341932ad7fdfe23d50a85931193b0feaaa7d53f --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/feignapipom.ftl @@ -0,0 +1,90 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-feignapi + 1.0-SNAPSHOT + + ${modulePrefix}-feign-api + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.springframework + spring-context + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/feignproviderpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/feignproviderpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..7f017e1c84f24972f21820607b74ca82860a1416 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/feignproviderpom.ftl @@ -0,0 +1,99 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + com.codemaker.cola + ${modulePrefix}-feign-api + 1.0-SNAPSHOT + + ${modulePrefix}-feign-api + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.11 + test + + + + org.projectlombok + lombok + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.springframework + spring-context + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + + com.codemaker.cola + cola-app + 1.0-SNAPSHOT + + + + com.codemaker.cola + cola-domain + 1.0-SNAPSHOT + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/infrastpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/infrastpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..94ebca11c742dabe1a7c46376e0d1a74ee860469 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/infrastpom.ftl @@ -0,0 +1,130 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-infrast + 1.0-SNAPSHOT + + ${modulePrefix}-infrast + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.springframework + spring-context + + + + org.springframework + spring-tx + + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-ext + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.mapstruct + mapstruct + + + + org.mybatis + mybatis + 3.4.6 + compile + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.0.1 + + + org.springframework.boot + spring-boot-starter + + + + + + + + + mysql + mysql-connector-java + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperddd.ftl index 786135a0d5679c34e40d3167f601a5b5dfb17f32..abbbb637d0ad5d1108a450c58b2512a5e156793a 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperddd.ftl @@ -15,7 +15,7 @@ import ${importClass}; * @version v1.0 */ @Mapper -public interface ${class.className}{ +public interface ${class.className} ${class.relationClassStr}{ <#list methods as method> ${method.doc} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxml.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxml.ftl index 09384958461d99720c6e3a04db346fa30b14f5ca..c5a2e7f750e5e4906575024e482e604292d4e7e8 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxml.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxml.ftl @@ -1,11 +1,11 @@ - + - + <#list columns as column> @@ -22,7 +22,7 @@ ${table.columnNameList} - + insert into ${table.tableName}( ${table.insertColumnNames} ) @@ -31,7 +31,7 @@ ) - + update ${table.tableName} set ${table.updateColumnNameList} @@ -42,7 +42,7 @@ select from ${table.tableName} - diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxmlddd.ftl index 7d50a9abc14735d5c345f581d318c4ba35bb7d4d..a51999f41b8998d4b95844572c5af965d1030d9e 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxmlddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mapperxmlddd.ftl @@ -22,34 +22,6 @@ ${table.columnNameList} - - insert into ${table.tableName}( - ${table.insertColumnNames} - ) - values( - ${table.insertColumnNameList} - ) - - - - update ${table.tableName} - set - ${table.updateColumnNameList} - where id = <#noparse>#{id<#noparse>} - - - - - - - - delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} - - <#list fields as field> ${field.fieldName} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqconsumer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..e40bf3075091413310c1cf897a4bdcfbdc264c89 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqconsumer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqconsumer.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,6 +29,9 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqhandler.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqhandler.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..4010cabcd7e5418594d2a887616d1e712bdf5967 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqhandler.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqhandler.ftl @@ -27,6 +27,7 @@ public class ${class.className}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqlistener.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqlistener.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..d702d67ca39611216bb4919ace98d70b1560bb61 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqlistener.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqlistener.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,7 +29,11 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqproducer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqproducer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..ae624a9c3b2e1f90de6d44bfda4aa87a8000c4fd 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqproducer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/mqproducer.ftl @@ -13,7 +13,11 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service -public class ${class.className}{ +${class.annotation} +<#list class.annotationTagList as annotation> +${annotation} + +public class ${class.className} ${class.relationClassStr}{ <#list fields as field> /** ${field.desc} **/ @@ -26,7 +30,11 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/parentpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/parentpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..98b738ee231042a2341ca576187baff26b53f62e --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/parentpom.ftl @@ -0,0 +1,255 @@ + + + + 4.0.0 + + ${groupId} + ${artifactId} + pom + ${version} + + ${modulePrefix}-adapter + ${modulePrefix}-domain + ${modulePrefix}-infrast + ${modulePrefix}-app + ${modulePrefix}-client + ${modulePrefix}-start + ${modulePrefix}-feignapi + + + ${artifactId} + + ${url} + + + UTF-8 + 1.8 + 1.8 + 1.8 + 2.1.9.RELEASE + 2.7.3 + 1.2.0.Final + 4.8.0 + Hoxton.SR3 + 2.2.0.RELEASE + + + + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${r'${spring-alibaba-cloud.version}'} + pom + import + + + + org.springframework.cloud + spring-cloud-dependencies + ${r'${spring-cloud.version}'} + pom + import + + + + + + org.springframework.boot + spring-boot-dependencies + ${r'${spring-boot.version}'} + pom + import + + + + + org.apache.dubbo + dubbo-dependencies-bom + ${r'${dubbo.version}'} + pom + import + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${r'${dubbo.version}'} + + + org.apache.dubbo + dubbo + ${r'${dubbo.version}'} + + + org.springframework + spring + + + javax.servlet + servlet-api + + + log4j + log4j + + + + + + com.alibaba.spring + spring-context-support + 1.0.5 + + + + org.mapstruct + mapstruct + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-processor + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-jdk8 + ${r'${mapstruct.version}'} + + + + + commons-collections + commons-collections + 3.2.1 + + + + com.alibaba + fastjson + 1.2.72 + + + + + commons-lang + commons-lang + 2.4 + + + + org.apache.dubbo + dubbo-registry-nacos + 2.7.3 + + + + + org.slf4j + slf4j-api + 1.7.28 + + + org.slf4j + slf4j-ext + 1.7.28 + + + + org.slf4j + slf4j-log4j12 + 1.7.28 + + + + org.springframework.boot + spring-boot-starter-log4j2 + ${r'${spring-boot.version}'} + + + + org.aspectj + aspectjweaver + 1.9.4 + + + + org.aspectj + aspectjrt + 1.8.13 + + + + org.assertj + assertj-core + 3.9.1 + + + + + org.apache.rocketmq + rocketmq-client + ${r'${rocketmq.version}'} + + + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + + + + aliyun-releases + 阿里云仓库 + https://maven.aliyun.com/repository/public + + + apache.snapshots.https + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots + + false + + + true + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/service.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/service.ftl index 83cea8c547d423d7aba65ce057b95c2851803693..d41d0ce3dbb71c2b8855a7c353539c8a88f32a0d 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/service.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/service.ftl @@ -1,8 +1,8 @@ -package ${package}.service; +package ${package}.domain.service; import java.util.List; -import ${package}.model.bo.${table.humpClassName}BO; +import ${package}.domain.bo.${table.humpClassName}BO; /** * @Description:${table.tableComment}Service接口 diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/serviceImpl.ftl index 03c66a6a87bc817e844aae662e3b5fcc6f19b7ae..7a58e327fe8fb0dd7ac9901f185773f8dac74386 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/serviceImpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/serviceImpl.ftl @@ -1,4 +1,4 @@ -package ${packageInfrast}.service.impl; +package ${packageInfrast}.serviceimpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -6,8 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import ${packageInfrast}.dao.mapper.${table.humpClassName}Mapper; -import ${package}.service.${table.humpClassName}Service; -import ${package}.model.bo.${table.humpClassName}BO; +import ${package}.domain.service.${table.humpClassName}Service; +import ${package}.domain.bo.${table.humpClassName}BO; import java.util.List; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/serviceddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/serviceddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c22e22b86d2bb4ab483e7e0215e5498c73decec9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/serviceddd.ftl @@ -0,0 +1,20 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + +${method.doc} + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/startpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/startpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..7132f2d4c8b3eb71e0a7e9fd1952ded72f061cbb --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/startpom.ftl @@ -0,0 +1,83 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-start + 1.0-SNAPSHOT + + ${modulePrefix}-start + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + + ${groupId} + ${modulePrefix}-app + 1.0-SNAPSHOT + + + + ${groupId} + ${modulePrefix}-infrast + 1.0-SNAPSHOT + + + + ${groupId} + ${modulePrefix}-adapter + 1.0-SNAPSHOT + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/testddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/testddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3266f5dd4c60c756bad6af78554fdaf1a85b98dd --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/testddd.ftl @@ -0,0 +1,110 @@ +package ${class.packageName}.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +<#list imports as importClass> +import ${importClass}; + + + +import ${package}.Application; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.alibaba.fastjson.JSON; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +/** +* @Description:${class.classDesc}单元测试 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT,classes = {Application.class}) +public class ${class.className}ServiceTest{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}ServiceTest.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + @Autowired + private TestRestTemplate restTemplate; + + /** + * @Description:测试新增${table.tableComment} 接口 + */ + @Test + public void testAdd(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/add",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试修改${table.tableComment} + */ + @Test + public void testUpdate(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/update",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试删除根据id删除${table.tableComment} + */ + @Test + public void testDelete(){ + //todo test code + long id = 1L; + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/delete",id, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:但是根据ID获取${table.tableComment}单条记录 + */ + @Test + public void testGetById(){ + //todo test code + ResultDataDto resultDataDto = restTemplate.getForEntity("/${table.humpTableName}/get?id=1",ResultDataDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDataDto)); + } + + /** + * @Description:测试分页获取${table.tableComment}记录 + */ + @Test + public void getPage(){ + //todo test code + } + + /** + * @Description:测试禁用${table.tableComment}状态 + */ + @Test + public void testDisable(){ + //todo test code + } + /** + * @Description:测试启用${table.tableComment}状态 + */ + @Test + public void testEnable(){ + //todo test code + } +} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/validator.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/validator.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/validator.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/vo.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/vo.ftl index 8113fd2240a602e78a54895474b39b7c1e56d0e4..c6d10eada09c5a5208a5e3dd828e1553145595c2 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/vo.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/vo.ftl @@ -1,4 +1,4 @@ -package ${package}.vo; +package ${package}.adapter.vo; import java.util.Date; import java.math.BigDecimal; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/voboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/voboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/voboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/cola/voddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/cola/voddd.ftl index 5c2f634e6bcd418c79556b914b5b2c9c4701aff5..eb41c7162315641c95eb38a7bb2f91c9596d103b 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/cola/voddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/cola/voddd.ftl @@ -18,7 +18,11 @@ import lombok.ToString; public class ${class.className} ${class.relationClassStr}{ <#list fields as field> - /** ${field.desc} **/ + + /** ${field.desc} **/ + <#list field.annotationTagList as annotation> + ${annotation} + ${field.visibility} ${field.fieldName}; @@ -29,6 +33,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/config/application_properties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/config/application_properties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..727254601cd1faf62cd6b0c6937b59597a32c459 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/config/application_properties.ftl @@ -0,0 +1,19 @@ +server.port=8080 + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/${projectBean.dataBaseName}?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username= +spring.datasource.password= + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=${packageInfrast}.dao.dataobject +spring.application.name=${projectBean.applicationName} +<#list configFileList as config> +${config} + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/config/application_yml.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/config/application_yml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..1b535ad98d19e9ef76470f33740b751f9fa62de3 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/config/application_yml.ftl @@ -0,0 +1,23 @@ +server: + port: 8080 + +spring: + application: + name: ${projectBean.applicationName} + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/${projectBean.dataBaseName}?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC + username: + password: + +#mybatis +mybatis: + config-locations: classpath:mybatis-config.xml + mapper-locations: classpath:mapper/*.xml + type-aliases-package: ${packageInfrast}.dao.dataobject + +<#list configFileList as config> +${config} + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/config/liteflow_properties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/config/liteflow_properties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..ba6bbe6b0c026b9b7385f84f741a273a12139c7d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/config/liteflow_properties.ftl @@ -0,0 +1 @@ +liteflow.ruleSource=liteflow/flow.xml diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/config/log4j_properties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/config/log4j_properties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9602da681fabd1d071959c4cfa3f24328b1b76ed --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/config/log4j_properties.ftl @@ -0,0 +1,10 @@ +log4j.rootLogger=info, ServerDailyRollingFile, stdout +log4j.appender.ServerDailyRollingFile=org.apache.log4j.DailyRollingFileAppender +log4j.appender.ServerDailyRollingFile.DatePattern='.'yyyy-MM-dd +log4j.appender.ServerDailyRollingFile.File=logs/notify-subscription.log +log4j.appender.ServerDailyRollingFile.layout=org.apache.log4j.PatternLayout +log4j.appender.ServerDailyRollingFile.layout.ConversionPattern=%d - %m%n +log4j.appender.ServerDailyRollingFile.Append=true +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} %p [%c] %m%n \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/config/log4j_xml.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/config/log4j_xml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2cefab055dce2f914225594f0deec105946a4fa --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/config/log4j_xml.ftl @@ -0,0 +1,117 @@ + + + + + + + + + + + + ${LOG_FILE}/toms-root.log + + + UTF-8 + + + ${LOG_PATH}/logs_saved/toms-root.%d{yyyy-MM-dd}.%i.log + 5 + 1GB + 20GB + + + + + + ${CONSOLE_LOG_PATTERN} + utf8 + + + + + + ${LOG_PATH}/toms-biz.log + + ${LOG_PATH}/logs_saved/toms-biz.%d{yyyy-MM-dd}.%i.log + 5 + 2GB + 20GB + + + + UTF-8 + + + + + + ${LOG_PATH}/toms-hsf.log + + ${LOG_PATH}/logs_saved/toms-hsf.%d{yyyy-MM-dd}.%i.log + 5 + 2GB + 20GB + + + + UTF-8 + + + + + + ${LOG_PATH}/toms-error.log + + ERROR + ACCEPT + DENY + + + ${LOG_PATH}/logs_saved/toms-error.%d{yyyy-MM-dd}.%i.log + 5 + 2GB + 10GB + + + + UTF-8 + + + + + + ${LOG_PATH}/toms-exception.log + + ${LOG_PATH}/logs_saved/toms-exception.%d{yyyy-MM-dd}.log + 5 + + + + UTF-8 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/config/mybatis-config_xml.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/config/mybatis-config_xml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..51d0a7ad7220505f91f4be99d4fb38d816866e12 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/config/mybatis-config_xml.ftl @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/apipom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/apipom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..36c02612bd82f25951bed1a93b5849b16571f961 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/apipom.ftl @@ -0,0 +1,60 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-api + 1.0-SNAPSHOT + + ${modulePrefix}-api + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/applicationproperties.ftl index 5e846f6a937074a53a02ec436451b8c27e61e13a..e0b6effa2a294f699e3847340a41cf906dff0c17 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/applicationproperties.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/applicationproperties.ftl @@ -16,6 +16,6 @@ spring.datasource.password=root mybatis.config-locations=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:mapper/*.xml #配置模型路径 -mybatis.type-aliases-package=com.coderman.codemaker.bean +mybatis.type-aliases-package=com.tianhua.codemaker.bean diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/bo.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/bo.ftl index 79fea9d311357de16ed8e3d6fc0dbc83dbc3c445..16daa621cbae2c37d910993f0e91fd1e11d46f51 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/bo.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/bo.ftl @@ -1,4 +1,4 @@ -package ${package}.model.bo; +package ${package}.core.bo; import java.util.Date; import java.math.BigDecimal; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/boddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/boddd.ftl index 1a43acac8202e47b8613705d0592615b6c3f14fd..8f2abdc4cb4ac3248ed5bdffe42fe83496c349b2 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/boddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/boddd.ftl @@ -32,6 +32,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/cmp.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/cmp.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6a43f0a56f9162c9e849eaa756553ddf1a843092 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/cmp.ftl @@ -0,0 +1,32 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import org.springframework.stereotype.Component; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Component("${class.className}") +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/commonpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/commonpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..77a7291f9e34b9197d514c13b75bb65e685298aa --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/commonpom.ftl @@ -0,0 +1,119 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-common + 1.0-SNAPSHOT + + ${modulePrefix}-common + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.springframework + spring-context + + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-ext + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.mapstruct + mapstruct + + + + org.mybatis + mybatis + 3.4.6 + compile + + + + org.projectlombok + lombok + + + + mysql + mysql-connector-java + + + + + + org.apache.dubbo + dubbo-spring-boot-starter + + + org.apache.dubbo + dubbo + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/corepom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/corepom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..db9c0123f763154f5a6619d7735eeac97f92b500 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/corepom.ftl @@ -0,0 +1,143 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-core + 1.0-SNAPSHOT + + ${modulePrefix}-core + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.springframework + spring-context + + + + ${groupId} + ${modulePrefix}-api + 1.0-SNAPSHOT + + + + + ${groupId} + ${modulePrefix}-common + 1.0-SNAPSHOT + + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-ext + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.mapstruct + mapstruct + + + + org.mybatis + mybatis + 3.4.6 + compile + + + + org.springframework.boot + spring-boot-test + + + + org.springframework + spring-test + + + + + org.apache.dubbo + dubbo-spring-boot-starter + + + org.apache.dubbo + dubbo + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.0.1 + + + org.springframework.boot + spring-boot-starter + + + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/doboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/doboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/doboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/dtoboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/dtoboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/dtoboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/dtoddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/dtoddd.ftl index 6a9dddea9b8cf3532406193faaf8945b45340d0a..41df042e936934ca758e72d7459c593d5e922f90 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/dtoddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/dtoddd.ftl @@ -1,7 +1,7 @@ package ${class.packageName}; <#list imports as importClass> - import ${importClass}; +import ${importClass}; import lombok.Data; @@ -18,20 +18,24 @@ import lombok.ToString; public class ${class.className} ${class.relationClassStr}{ <#list fields as field> - /** ${field.desc} **/ + /** ${field.desc} **/ + <#list field.annotationTagList as annotation> + ${annotation} + ${field.visibility} ${field.fieldName}; <#list methods as method> /** - * - * @Description:${method.desc} - * @return ${method.returnClass} - */ - ${method.visibility} ${method.returnClass} ${method.methodName}{ - ${method.returnBody} - } + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } } \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/exeimpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/exeimpl.ftl index e6a8d75475a8c42353b308de6c43e6e9bd173bca..dd3f647c7af4be565cc1ff1eff1886bedf676542 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/exeimpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/exeimpl.ftl @@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className} ${class.relationClassStr}{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -28,6 +31,9 @@ public class ${class.className} ${class.relationClassStr}{ <#list methods as method> + <#list method.annotationTagList as annotation> + ${annotation} + @Override public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeImpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeImpl.ftl index 96f996866c3cc43602bd618c24e84d9fcc208bfe..8b4c6a63c9dd9746ba47552b85807f7170e9818b 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeImpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeImpl.ftl @@ -1,4 +1,4 @@ -package ${package}.facade.impl; +package ${package}.core.facadeimpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeimplddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeimplddd.ftl index 650653a4624f437b75de3ac2c26d95d835645bcf..d96c04f0bcd6e8083764e0e7ea05d7b1a93c1dd1 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeimplddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/facadeimplddd.ftl @@ -3,10 +3,11 @@ package ${class.packageName}; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; - <#list imports as importClass> import ${importClass}; + + /** * @Description:${class.classDesc}接口实现类 * @Author:${class.author} @@ -14,6 +15,9 @@ import ${importClass}; * @version v1.0 */ ${class.annotation} +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className} ${class.relationClassStr}{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -26,6 +30,9 @@ public class ${class.className} ${class.relationClassStr}{ <#list methods as method> + <#list method.annotationTagList as annotation> + ${annotation} + @Override public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapper.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapper.ftl index a855883d26624e32fa303e6b5cb49818a0c5a723..61f8f97595bdb77c52e0e666a1447f5fe6de9453 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapper.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapper.ftl @@ -1,7 +1,7 @@ -package ${package}.dao.mapper; +package ${package}.common.dao.mapper; import java.util.List; -import ${package}.dao.dataobject.${table.humpClassName}DO; +import ${package}.infrast.dao.dataobject.${table.humpClassName}DO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperddd.ftl index 682b73594b3ee1f5decfdaf1482c2d8f7e4bafaa..9e03eb4f1d611d93a2e665374f00178f81ff072e 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperddd.ftl @@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Param; * @version v1.0 */ @Mapper -public interface ${class.className}{ +public interface ${class.className} ${class.relationClassStr}{ <#list methods as method> ${method.doc} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxml.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxml.ftl index 0a93342d04e426881e0e25f9ee3a0a4389097a14..0f9e6565da5f60d591c2edc4d46a4fee2d311df4 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxml.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxml.ftl @@ -1,11 +1,11 @@ - + - + <#list columns as column> @@ -21,7 +21,7 @@ ${table.columnNameList} - + insert into ${table.tableName}( ${table.insertColumnNames} ) @@ -30,7 +30,7 @@ ) - + update ${table.tableName} set ${table.updateColumnNameList} @@ -41,7 +41,7 @@ select from ${table.tableName} - diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxmlddd.ftl index 7d50a9abc14735d5c345f581d318c4ba35bb7d4d..7357a4bbe93c97a03c038e96058c44378980bd14 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxmlddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mapperxmlddd.ftl @@ -22,33 +22,6 @@ ${table.columnNameList} - - insert into ${table.tableName}( - ${table.insertColumnNames} - ) - values( - ${table.insertColumnNameList} - ) - - - - update ${table.tableName} - set - ${table.updateColumnNameList} - where id = <#noparse>#{id<#noparse>} - - - - - - - - delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} - <#list fields as field> ${field.fieldName} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqconsumer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..e40bf3075091413310c1cf897a4bdcfbdc264c89 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqconsumer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqconsumer.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,6 +29,9 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqlistener.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqlistener.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..d702d67ca39611216bb4919ace98d70b1560bb61 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqlistener.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqlistener.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,7 +29,11 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqproducer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqproducer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..ae624a9c3b2e1f90de6d44bfda4aa87a8000c4fd 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqproducer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/mqproducer.ftl @@ -13,7 +13,11 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service -public class ${class.className}{ +${class.annotation} +<#list class.annotationTagList as annotation> +${annotation} + +public class ${class.className} ${class.relationClassStr}{ <#list fields as field> /** ${field.desc} **/ @@ -26,7 +30,11 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/parentpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/parentpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..88657489a1bc3db2380bf9b7caad857affa82c76 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/parentpom.ftl @@ -0,0 +1,226 @@ + + + + 4.0.0 + + ${groupId} + ${artifactId} + pom + ${version} + + ${modulePrefix}-api + ${modulePrefix}-common + ${modulePrefix}-core + + + ${artifactId} + + ${url} + + + UTF-8 + 1.8 + 1.8 + 1.8 + 2.1.9.RELEASE + 2.7.3 + 1.2.0.Final + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${r'${spring-boot.version}'} + pom + import + + + + + org.apache.dubbo + dubbo-dependencies-bom + ${r'${dubbo.version}'} + pom + import + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${r'${dubbo.version}'} + + + org.apache.dubbo + dubbo + ${r'${dubbo.version}'} + + + org.springframework + spring + + + javax.servlet + servlet-api + + + log4j + log4j + + + + + + com.alibaba.spring + spring-context-support + 1.0.5 + + + + org.mapstruct + mapstruct + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-processor + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-jdk8 + ${r'${mapstruct.version}'} + + + + + commons-collections + commons-collections + 3.2.1 + + + + com.alibaba + fastjson + 1.2.72 + + + + org.springframework + spring-test + 5.1.10.RELEASE + + + + commons-lang + commons-lang + 2.4 + + + + org.apache.dubbo + dubbo-registry-nacos + 2.7.3 + + + + + org.slf4j + slf4j-api + 1.7.28 + + + org.slf4j + slf4j-ext + 1.7.28 + + + + org.slf4j + slf4j-log4j12 + 1.7.28 + + + + org.springframework.boot + spring-boot-starter-log4j2 + ${r'${spring-boot.version}'} + + + + org.aspectj + aspectjweaver + 1.9.4 + + + + org.aspectj + aspectjrt + 1.8.13 + + + + org.assertj + assertj-core + 3.9.1 + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + + aliyun-releases + 阿里云仓库 + https://maven.aliyun.com/repository/public + + + apache.snapshots.https + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots + + false + + + true + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/service.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/service.ftl index 83cea8c547d423d7aba65ce057b95c2851803693..81c37e95114b74222e6f543beb50303c95bfa247 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/service.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/service.ftl @@ -1,8 +1,8 @@ -package ${package}.service; +package ${package}.core.service; import java.util.List; -import ${package}.model.bo.${table.humpClassName}BO; +import ${package}.core.bo.${table.humpClassName}BO; /** * @Description:${table.tableComment}Service接口 diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/serviceImpl.ftl index 66ac9dda998fc18819d6913e3715d58bdea6fd51..9c869c60108c1c7e6c36cad876512daf4f56bb75 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/serviceImpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/serviceImpl.ftl @@ -1,12 +1,12 @@ -package ${package}.service.impl; +package ${package}.core.serviceimpl; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import ${package}.dao.mapper.${table.humpClassName}Mapper; -import ${package}.service.${table.humpClassName}Service; -import ${package}.model.bo.${table.humpClassName}BO; +import ${package}.common.dao.mapper.${table.humpClassName}Mapper; +import ${package}.core.service.${table.humpClassName}Service; +import ${package}.core.bo.${table.humpClassName}BO; import java.util.List; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/serviceddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/serviceddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c22e22b86d2bb4ab483e7e0215e5498c73decec9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/serviceddd.ftl @@ -0,0 +1,20 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + +${method.doc} + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/test.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/test.ftl index 5638829322a1a91fbc92e442a1aa9f5be072e1c9..6cc14b8d7b08a230909f9652c5c5dc02d200ad87 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/test.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/test.ftl @@ -1,4 +1,4 @@ -package ${package}.core.test; +package ${package}.test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -9,7 +9,7 @@ import ${package}.api.dto.${table.humpClassName}DTO; import com.coderman.utils.response.ResultDataDto; import com.coderman.utils.response.ResultDto; -import ${package}.core.Application; +import ${package}.Application; import org.apache.dubbo.config.annotation.Reference; import org.springframework.boot.test.context.SpringBootTest; @@ -17,14 +17,13 @@ import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import com.alibaba.fastjson.JSON; import org.junit.Test; import org.junit.runner.RunWith; /** * @Description:单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2021-06-25 09:19:38 * @version v1.0 */ diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/testddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/testddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..dc36d314c57ba06025c6351b323923d06ff801e5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/testddd.ftl @@ -0,0 +1,51 @@ +package ${package}.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +<#list imports as importClass> +import ${importClass}; + + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.Application; + +import org.apache.dubbo.config.annotation.Reference; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.Rollback; +import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; + +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @Description:单元测试 + * @Author:${author} + * @CreateTime:2021-06-25 09:19:38 + * @version v1.0 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = Application.class) +@Rollback +@Transactional +public class ${class.className}Test extends AbstractTransactionalJUnit4SpringContextTests{ + + protected Logger logger = LoggerFactory.getLogger(${class.className}Test.class); + + @Reference(url = "") + private ${class.className} ${class.className}; + + +<#list methods as method> + + @Test + public void ${method.simpleMethodNameInfo}Test(){ + //todo test + } + + +} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/validator.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/validator.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/dubbo/validator.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/fast/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/fast/applicationproperties.ftl index 5e846f6a937074a53a02ec436451b8c27e61e13a..e0b6effa2a294f699e3847340a41cf906dff0c17 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/fast/applicationproperties.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/fast/applicationproperties.ftl @@ -16,6 +16,6 @@ spring.datasource.password=root mybatis.config-locations=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:mapper/*.xml #配置模型路径 -mybatis.type-aliases-package=com.coderman.codemaker.bean +mybatis.type-aliases-package=com.tianhua.codemaker.bean diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/fast/controller.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/fast/controller.ftl index 3fd0d73765d4c94567e2cc097aec60a3a1e94ea9..ec21e92d43e319560fa8920253a88c6bb9584fef 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/fast/controller.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/fast/controller.ftl @@ -11,6 +11,8 @@ import com.coderman.utils.response.ResultDto; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import com.coderman.utils.error.CommonErrorEnum; + /** * @Description:${table.tableComment}控制层 @@ -38,7 +40,7 @@ public class ${table.humpClassName}Controller extends BaseController{ return ${table.humpTableName}Service.save(${table.humpTableName}Vo); } catch (Exception e) { log.error("保存失败",e); - return ResultDto.setErrorCodeMsg("保存失败"); + return ResultDto.fail(CommonErrorEnum.DEFAULT_ERROR.getErrorCode(),"保存失败"); } } @@ -55,7 +57,7 @@ public class ${table.humpClassName}Controller extends BaseController{ return ${table.humpTableName}Service.update(${table.humpTableName}Vo); } catch (Exception e) { log.error("修改失败",e); - return ResultDto.setErrorCodeMsg("修改失败"); + return ResultDto.fail(CommonErrorEnum.DEFAULT_ERROR.getErrorCode(),"修改失败"); } } @@ -82,7 +84,7 @@ public class ${table.humpClassName}Controller extends BaseController{ return ${table.humpTableName}Service.getById(id); } catch (Exception e) { log.error("获取数据失败",e); - return ResultDataDto.setErrorCodeMsg("获取数据失败"); + return ResultDataDto.fail(CommonErrorEnum.DEFAULT_ERROR.getErrorCode(), "获取数据失败"); } } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/Application.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/Application.ftl index cfa97cef405b41106b41e8fd203b7033887b61b5..464fdbf9d5493ab5ce5ff59a0d8100148a0c7b16 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/Application.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/Application.ftl @@ -1,9 +1,5 @@ package ${package}; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/IdemPotent.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/IdemPotent.ftl new file mode 100644 index 0000000000000000000000000000000000000000..44a408a7f6ecd16256996cdb77ed45e6cb6312a2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/IdemPotent.ftl @@ -0,0 +1,28 @@ +package ${package}.domain.support.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author shenshuai + * @see + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface IdemPotent { + + /** + * 接口幂等的请求号 + */ + String key() default "requestNo"; + +/** +* 消息幂等的消息id 多个需要 _msgId,xxNo,sfdsdf +* 使用需要指定 msgId属性 +*/ +String msgKey() default "_msgId"; + +} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/LockA.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/LockA.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d6986b06a7d721d5b97da187cc08aaba7ff23b81 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/LockA.ftl @@ -0,0 +1,37 @@ +package ${package}.domain.support.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +/** + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface LockA { + + /** + * 前缀 + */ + String prefixKey() default ""; +/** + * 锁 + */ +String key() default "orderId"; + +/** + * 默认 uuid + */ +String requestId() default "requestId"; + + +/** + * 提示消息 + */ +String msg() default "请不要重复提交"; + + +} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/MqHandler.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/MqHandler.ftl new file mode 100644 index 0000000000000000000000000000000000000000..2a1de2a218d93a7fd07865a7e6a030ccd0ca69fa --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/MqHandler.ftl @@ -0,0 +1,37 @@ +package ${package}.domain.support.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +/** + * + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface MqHandler { + + /** + * 前缀 + */ + String prefixKey() default ""; +/** + * 锁 + */ +String key() default "orderId"; + +/** + * 默认 uuid + */ +String requestId() default "requestId"; + + +/** + * 提示消息 + */ +String msg() default "请不要重复提交"; + + +} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/PageBO.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/PageBO.ftl index a2c28723eeb50b0ae52fe29611ad0f8a77277a4b..25a5652a83654f4a69b2c5bd348b1ecc0e629e8c 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/PageBO.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/PageBO.ftl @@ -8,7 +8,7 @@ import java.util.Map; * Description:参考Mybatis_PageHelper的Page对象封装的DTO * date: 2021/10/26 * -* @author fanchunshuai +* @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ @@ -77,10 +77,10 @@ public class PageBO implements Serializable { private List Items; - /** - * 针对简单场景 参数的查询map处理 - */ - private Map queryMap; + /** + * 针对简单场景 参数的查询map处理 + */ + private Map queryMap; /** * 针对复杂场景 参数的查询queryDTO对象处理 @@ -104,276 +104,12 @@ public class PageBO implements Serializable { this.queryDTO = queryDTO; } - public List getItems() { - return Items; - } - - public PageVO setItems(List items) { - Items = items; - return this; - } - - public PageVO() { - super(); - } - - public PageVO(int pageNum, int pageSize) { - this(pageNum, pageSize, true, null); - } - - public PageVO(int pageNum, int pageSize, boolean count) { - this(pageNum, pageSize, count, null); - } - - private PageVO(int pageNum, int pageSize, boolean count, Boolean reasonable) { - - if (pageNum == 1 && pageSize == Integer.MAX_VALUE) { - pageSizeZero = true; - pageSize = 0; - } - this.currentPageNum = pageNum; - this.pageSize = pageSize; - this.count = count; - calculateStartAndEndRow(); - setReasonable(reasonable); - } - - public int getNextIndex() { - if (this.currentPageNum >= this.getTotalPages()) { - this.nextPageNum = this.currentPageNum; - } else { - this.nextPageNum = this.currentPageNum + 1; - } - - return this.nextPageNum; - } - - public int getPreIndex() { - if (this.currentPageNum <= 1) { - this.prePageNum = 0; - } else { - this.prePageNum = this.currentPageNum - 1; - } - - return this.prePageNum; - } - - - public int getTotalPages() { - return totalPages; - } - - public PageVO setPages(int totalPages) { - this.totalPages = totalPages; - return this; - } - - public int getEndRow() { - return endRow; - } - - public PageVO setEndRow(int endRow) { - this.endRow = endRow; - return this; - } - - public int getCurrentPageNum() { - return currentPageNum; - } - - public PageVO setPageNum(int currentPageNum) { - //分页合理化,针对不合理的页码自动处理 - this.currentPageNum = ((reasonable != null && reasonable) && currentPageNum <= 0) ? 1 : currentPageNum; - return this; - } - - public int getPageSize() { - return pageSize; - } - - public PageVO setPageSize(int pageSize) { - this.pageSize = pageSize; - return this; - } - - public int getStartRow() { - return startRow; - } - - public PageVO setStartRow(int startRow) { - this.startRow = startRow; - return this; - } - - public long getTotalRows() { - return totalRows; - } - - public void setTotal(long totalRows) { - this.totalRows = totalRows; - if (totalRows == -1) { - totalPages = 1; - return; - } - if (pageSize > 0) { - totalPages = (int) (totalRows / pageSize + ((totalRows % pageSize == 0) ? 0 : 1)); - } else { - totalPages = 0; - } - //分页合理化,针对不合理的页码自动处理 - if ((reasonable != null && reasonable) && currentPageNum > totalPages) { - if(totalPages!=0){ - currentPageNum = totalPages; - } - calculateStartAndEndRow(); - } - } - - public Boolean getReasonable() { - return reasonable; - } - - public PageVO setReasonable(Boolean reasonable) { - if (reasonable == null) { - return this; - } - this.reasonable = reasonable; - //分页合理化,针对不合理的页码自动处理 - if (this.reasonable && this.currentPageNum <= 0) { - this.currentPageNum = 1; - calculateStartAndEndRow(); - } - return this; - } - - public Boolean getPageSizeZero() { - return pageSizeZero; - } - - public PageVO setPageSizeZero(Boolean pageSizeZero) { - if (pageSizeZero != null) { - this.pageSizeZero = pageSizeZero; - } - return this; - } - public String getOrderBy() { - return orderBy; - } - - public PageVO setOrderBy(String orderBy) { - this.orderBy = orderBy; - return (PageVO) this; - } - - public boolean isOrderByOnly() { - return orderByOnly; - } - - public void setOrderByOnly(boolean orderByOnly) { - this.orderByOnly = orderByOnly; - } - - /** - * 计算起止行号 - */ - private void calculateStartAndEndRow() { - this.startRow = this.currentPageNum > 0 ? (this.currentPageNum - 1) * this.pageSize : 0; - this.endRow = this.startRow + this.pageSize * (this.currentPageNum > 0 ? 1 : 0); - } - - public boolean isCount() { - return this.count; - } - - public PageVO setCount(boolean count) { - this.count = count; - return this; - } - - /** - * 设置页码 - * - * @param pageNum - * @return - */ - public PageVO pageNum(int pageNum) { - //分页合理化,针对不合理的页码自动处理 - this.currentPageNum = ((reasonable != null && reasonable) && pageNum <= 0) ? 1 : pageNum; - return this; - } - - /** - * 设置页面大小 - * - * @param pageSize - * @return - */ - public PageVO pageSize(int pageSize) { - this.pageSize = pageSize; - calculateStartAndEndRow(); - return this; - } - - - /** - * 设置合理化 - * - * @param reasonable - * @return - */ - public PageVO reasonable(Boolean reasonable) { - setReasonable(reasonable); - return this; - } - - /** - * 当设置为true的时候,如果pagesize设置为0(或RowBounds的limit=0),就不执行分页,返回全部结果 - * - * @param pageSizeZero - * @return - */ - public PageVO pageSizeZero(Boolean pageSizeZero) { - setPageSizeZero(pageSizeZero); - return this; - } - - /** - * 指定 count 查询列 - * - * @param columnName - * @return - */ - public PageVO countColumn(String columnName) { - this.countColumn = columnName; - return this; - } - - - - public String getCountColumn() { - return countColumn; - } - - public void setCountColumn(String countColumn) { - this.countColumn = countColumn; - } + public List getItems() { + return Items; + } - @Override - public String toString() { - return "PageDTO{" + - "currentPageNum=" + currentPageNum + - ", pageSize=" + pageSize + - ", startRow=" + startRow + - ", endRow=" + endRow + - ", totalRows=" + totalRows + - ", totalPages=" + totalPages + - ", count=" + count + - ", reasonable=" + reasonable + - ", pageSizeZero=" + pageSizeZero + - ", countColumn='" + countColumn + '\'' + - ", orderBy='" + orderBy + '\'' + - ", orderByOnly=" + orderByOnly + - ", Items=" + Items + - '}'; - } - } + public PageBO setItems(List items) { + Items = items; + return this; + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/ValidationUtils.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/ValidationUtils.ftl new file mode 100644 index 0000000000000000000000000000000000000000..935b2a99748fb626d2ea89f33535760f07f5d631 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/singleClass/ValidationUtils.ftl @@ -0,0 +1,44 @@ +package ${package}.support; + +package com.oyo.inventory.common.utils; + + +import com.google.common.collect.Lists; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.hibernate.validator.HibernateValidator; + +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import java.util.List; +import java.util.Set; + +/** + * @author kermit.liu on 2018/3/15 + */ +public class ValidationUtils { +/** +* 使用hibernate的注解来进行验证 +*/ +private static Validator validator = Validation.byProvider(HibernateValidator.class) +.configure().failFast(true).buildValidatorFactory().getValidator(); + +/** +* 功能描述:
+* 〈注解验证参数〉 +* +* @param obj obj +*/ + public static String validate(T obj) { + Set> constraintViolations = validator.validate(obj); + // 检验不合格处理 + if (CollectionUtils.isNotEmpty(constraintViolations)) { + List tipList = Lists.newArrayList(); + constraintViolations.forEach(constraintViolationImpl -> tipList.add(constraintViolationImpl.getMessage())); + return StringUtils.join(tipList, ","); + } else { + return ""; + } + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/applicationproperties.ftl index 5e846f6a937074a53a02ec436451b8c27e61e13a..e0b6effa2a294f699e3847340a41cf906dff0c17 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/applicationproperties.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/applicationproperties.ftl @@ -16,6 +16,6 @@ spring.datasource.password=root mybatis.config-locations=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:mapper/*.xml #配置模型路径 -mybatis.type-aliases-package=com.coderman.codemaker.bean +mybatis.type-aliases-package=com.tianhua.codemaker.bean diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/boddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/boddd.ftl index 1a43acac8202e47b8613705d0592615b6c3f14fd..8f2abdc4cb4ac3248ed5bdffe42fe83496c349b2 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/boddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/boddd.ftl @@ -32,6 +32,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/cmp.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/cmp.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6a43f0a56f9162c9e849eaa756553ddf1a843092 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/cmp.ftl @@ -0,0 +1,32 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import org.springframework.stereotype.Component; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Component("${class.className}") +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controller.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controller.ftl index 3c88f6d538a3d5c5784303201653be94a35443b2..8a46ff3b44d4c47a7b199d6572fc4700b50ba910 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controller.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controller.ftl @@ -6,6 +6,8 @@ import org.slf4j.LoggerFactory; import ${package}.service.${table.humpClassName}Service; import ${package}.vo.${table.humpClassName}VO; +import ${package}.controller.BaseController; + import com.coderman.utils.response.ResultDataDto; import com.coderman.utils.response.ResultDto; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controllerddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controllerddd.ftl index 570a4e93153a5f60083038aa4dca8e1a715ee0b6..a334ab622f5ee4829d7a72829c8a92c566b8836c 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controllerddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/controllerddd.ftl @@ -17,7 +17,10 @@ import org.springframework.web.bind.annotation.*; * @version v1.0 */ @RestController -public class ${class.className} { +<#list class.annotationTagList as annotation> +${annotation} + +public class ${class.className} ${class.relationClassStr}{ protected Logger logger = LoggerFactory.getLogger(${class.className}.class); @@ -29,6 +32,9 @@ public class ${class.className} { <#list methods as method> ${method.doc} + <#list method.annotationTagList as annotation> + ${annotation} + @RequestMapping(value = "${method.pathValue}") public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/doboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/doboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/doboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/dtoboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/dtoboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/dtoboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/dtoddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/dtoddd.ftl index d6243cb09279ec491a39bf98497e22aeef0b75b9..41df042e936934ca758e72d7459c593d5e922f90 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/dtoddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/dtoddd.ftl @@ -18,7 +18,11 @@ import lombok.ToString; public class ${class.className} ${class.relationClassStr}{ <#list fields as field> + /** ${field.desc} **/ + <#list field.annotationTagList as annotation> + ${annotation} + ${field.visibility} ${field.fieldName}; @@ -29,6 +33,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/exeimpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/exeimpl.ftl index e6a8d75475a8c42353b308de6c43e6e9bd173bca..dd3f647c7af4be565cc1ff1eff1886bedf676542 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/exeimpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/exeimpl.ftl @@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className} ${class.relationClassStr}{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -28,6 +31,9 @@ public class ${class.className} ${class.relationClassStr}{ <#list methods as method> + <#list method.annotationTagList as annotation> + ${annotation} + @Override public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/facadeimplddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/facadeimplddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d96c04f0bcd6e8083764e0e7ea05d7b1a93c1dd1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/facadeimplddd.ftl @@ -0,0 +1,43 @@ +package ${class.packageName}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +${class.annotation} +<#list class.annotationTagList as annotation> +${annotation} + +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + +<#list methods as method> + + <#list method.annotationTagList as annotation> + ${annotation} + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapper.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapper.ftl index db78b21dca8f442b236fe1bf20f5c7a80263c25d..26c48f943896ebaa23dafb909f0ccb815a48b2f4 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapper.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapper.ftl @@ -1,7 +1,7 @@ package ${package}.dao.mapper; import java.util.List; -import ${package}.dao.dataobject.${table.humpClassName}DO; +import ${package}.infrast.dao.dataobject.${table.humpClassName}DO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperddd.ftl index 43102bc46dc874bde3bcc9316203d6183e3adda9..09a239dd549e461617da6c9368a28ce9ca09ae98 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperddd.ftl @@ -16,7 +16,7 @@ import org.apache.ibatis.annotations.Param; * @version v1.0 */ @Mapper -public interface ${class.className}{ +public interface ${class.className} ${class.relationClassStr}{ <#list methods as method> ${method.doc} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxml.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxml.ftl index 3e3c284f13bb9414fe3d561bdc4f4a9453ced9bd..cf9b1a2eab28bd06ee92e86d1f9f5f8d20846227 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxml.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxml.ftl @@ -5,7 +5,7 @@ - + <#list columns as column> @@ -22,7 +22,7 @@ ${table.columnNameList} - + insert into ${table.tableName}( ${table.insertColumnNames} ) @@ -31,7 +31,7 @@ ) - + update ${table.tableName} set ${table.updateColumnNameList} @@ -42,7 +42,7 @@ select from ${table.tableName} - diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxmlddd.ftl index 7d50a9abc14735d5c345f581d318c4ba35bb7d4d..7357a4bbe93c97a03c038e96058c44378980bd14 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxmlddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mapperxmlddd.ftl @@ -22,33 +22,6 @@ ${table.columnNameList} - - insert into ${table.tableName}( - ${table.insertColumnNames} - ) - values( - ${table.insertColumnNameList} - ) - - - - update ${table.tableName} - set - ${table.updateColumnNameList} - where id = <#noparse>#{id<#noparse>} - - - - - - - - delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} - <#list fields as field> ${field.fieldName} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqconsumer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..d413e46cd406fe65b8ad8d46b968da177464412c 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqconsumer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqconsumer.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,7 +29,11 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqhandler.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqhandler.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..4010cabcd7e5418594d2a887616d1e712bdf5967 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqhandler.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqhandler.ftl @@ -27,6 +27,7 @@ public class ${class.className}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqlistener.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqlistener.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..d702d67ca39611216bb4919ace98d70b1560bb61 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqlistener.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqlistener.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,7 +29,11 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqproducer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqproducer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..ae624a9c3b2e1f90de6d44bfda4aa87a8000c4fd 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqproducer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/mqproducer.ftl @@ -13,7 +13,11 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service -public class ${class.className}{ +${class.annotation} +<#list class.annotationTagList as annotation> +${annotation} + +public class ${class.className} ${class.relationClassStr}{ <#list fields as field> /** ${field.desc} **/ @@ -26,7 +30,11 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/msgbody.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/msgbody.ftl index e6c85cb66d03e7f57dcafa118bdfe67d37ec6491..010efb849d90fbbab5e07949bd969b876a463a07 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/msgbody.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/msgbody.ftl @@ -26,6 +26,7 @@ public class ${class.className}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/parentpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/parentpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..1958c8892423764692541baf9f38ccca73744c91 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/parentpom.ftl @@ -0,0 +1,204 @@ + + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + + ${groupId} + ${artifactId} + ${version} + + ${modulePrefix} + + http://www.example.com + + + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${r'${spring-alibaba-cloud.version}'} + pom + import + + + + org.springframework.cloud + spring-cloud-dependencies + ${r'${spring-cloud.version}'} + pom + import + + + + + + UTF-8 + 1.8 + 1.8 + 1.2.0.Final + Hoxton.SR3 + 2.2.0.RELEASE + + + + + junit + junit + 4.12 + test + + + + org.springframework + spring-context + + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-ext + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + ${r'${mapstruct.version}'} + + + + org.mapstruct + mapstruct-jdk8 + ${r'${mapstruct.version}'} + + + + org.mapstruct + mapstruct + ${r'${mapstruct.version}'} + + + + org.mybatis + mybatis + 3.4.6 + compile + + + + org.projectlombok + lombok + + + + org.springframework.boot + spring-boot-test + + + + org.springframework + spring-test + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.0.1 + + + org.springframework.boot + spring-boot-starter + + + + + + mysql + mysql-connector-java + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter + + + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + <#if (dependency.exclusionGAContent)??> +${dependency.exclusionGAContent} + + + + + + + + + + + + + aliyun-releases + 阿里云仓库 + https://maven.aliyun.com/repository/public + + + apache.snapshots.https + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots + + false + + + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/serviceImpl.ftl index 496601eeae98d89de8913b72045c62a0a364ecf9..c65ab5f9dc883564b18e57db2e3e76ebb9e2addd 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/serviceImpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/serviceImpl.ftl @@ -1,20 +1,16 @@ -package ${package}.service.impl; +package ${package}.serviceimpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.coderman.utils.response.ResultDataDto; -import com.coderman.utils.response.ResultDto; - import ${package}.dao.mapper.${table.humpClassName}Mapper; import ${package}.service.${table.humpClassName}Service; import ${package}.bo.${table.humpClassName}BO; import java.util.List; import org.apache.commons.lang3.StringUtils; -import com.alibaba.fastjson.JSONObject; /** * @Description:${table.tableComment}Service接口实现类 diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/serviceddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/serviceddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c22e22b86d2bb4ab483e7e0215e5498c73decec9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/serviceddd.ftl @@ -0,0 +1,20 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + +${method.doc} + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/test.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/test.ftl index bddd6827a33d6e58ca7d55206efe1c2510a4a550..1c46b5975329363a66c46544ff50d1b8b071c95c 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/test.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/test.ftl @@ -1,4 +1,4 @@ -package ${package}.service.test; +package ${package}.test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,7 +47,7 @@ public class ${table.humpClassName}ServiceTest{ ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/add",vo, ResultDto.class).getBody(); - System.out.println(JSON.toJSONString(resultDto)); + //System.out.println(JSON.toJSONString(resultDto)); } /** @@ -58,7 +58,7 @@ public class ${table.humpClassName}ServiceTest{ //todo test code ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/update",vo, ResultDto.class).getBody(); - System.out.println(JSON.toJSONString(resultDto)); + //System.out.println(JSON.toJSONString(resultDto)); } /** @@ -69,7 +69,7 @@ public class ${table.humpClassName}ServiceTest{ //todo test code long id = 1L; ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/delete",id, ResultDto.class).getBody(); - System.out.println(JSON.toJSONString(resultDto)); + //System.out.println(JSON.toJSONString(resultDto)); } /** @@ -79,7 +79,7 @@ public class ${table.humpClassName}ServiceTest{ public void testGetById(){ //todo test code ResultDataDto resultDataDto = restTemplate.getForEntity("/${table.humpTableName}/get?id=1",ResultDataDto.class).getBody(); - System.out.println(JSON.toJSONString(resultDataDto)); + //System.out.println(JSON.toJSONString(resultDataDto)); } /** diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/testddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/testddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..dc36d314c57ba06025c6351b323923d06ff801e5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/testddd.ftl @@ -0,0 +1,51 @@ +package ${package}.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +<#list imports as importClass> +import ${importClass}; + + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.Application; + +import org.apache.dubbo.config.annotation.Reference; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.Rollback; +import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; + +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * @Description:单元测试 + * @Author:${author} + * @CreateTime:2021-06-25 09:19:38 + * @version v1.0 + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = Application.class) +@Rollback +@Transactional +public class ${class.className}Test extends AbstractTransactionalJUnit4SpringContextTests{ + + protected Logger logger = LoggerFactory.getLogger(${class.className}Test.class); + + @Reference(url = "") + private ${class.className} ${class.className}; + + +<#list methods as method> + + @Test + public void ${method.simpleMethodNameInfo}Test(){ + //todo test + } + + +} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/validator.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/validator.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/validator.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/voboconvert.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/voboconvert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/voboconvert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/voddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/voddd.ftl index 5c2f634e6bcd418c79556b914b5b2c9c4701aff5..45826147200533766f8e46052b1affac3ec3d9d6 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springboot/voddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springboot/voddd.ftl @@ -29,6 +29,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/apipom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/apipom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..36c02612bd82f25951bed1a93b5849b16571f961 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/apipom.ftl @@ -0,0 +1,60 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-api + 1.0-SNAPSHOT + + ${modulePrefix}-api + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/applicationproperties.ftl index 5e846f6a937074a53a02ec436451b8c27e61e13a..e0b6effa2a294f699e3847340a41cf906dff0c17 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/applicationproperties.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/applicationproperties.ftl @@ -16,6 +16,6 @@ spring.datasource.password=root mybatis.config-locations=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:mapper/*.xml #配置模型路径 -mybatis.type-aliases-package=com.coderman.codemaker.bean +mybatis.type-aliases-package=com.tianhua.codemaker.bean diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/boddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/boddd.ftl index 1a43acac8202e47b8613705d0592615b6c3f14fd..8f2abdc4cb4ac3248ed5bdffe42fe83496c349b2 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/boddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/boddd.ftl @@ -32,6 +32,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/controllerddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/controllerddd.ftl index 746c312f5a54c96461ee594b214cb3824ff9b69a..a334ab622f5ee4829d7a72829c8a92c566b8836c 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/controllerddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/controllerddd.ftl @@ -7,7 +7,7 @@ import org.slf4j.LoggerFactory; import ${importClass}; import org.springframework.beans.factory.annotation.Autowired; - +import org.springframework.web.bind.annotation.*; /** @@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; * @version v1.0 */ @RestController +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className} ${class.relationClassStr}{ protected Logger logger = LoggerFactory.getLogger(${class.className}.class); @@ -29,7 +32,10 @@ public class ${class.className} ${class.relationClassStr}{ <#list methods as method> ${method.doc} - @Override + <#list method.annotationTagList as annotation> + ${annotation} + + @RequestMapping(value = "${method.pathValue}") public ${method.returnClass} ${method.methodName}{ ${method.methodContent} ${method.returnBody} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/dtoddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/dtoddd.ftl index d6243cb09279ec491a39bf98497e22aeef0b75b9..41df042e936934ca758e72d7459c593d5e922f90 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/dtoddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/dtoddd.ftl @@ -18,7 +18,11 @@ import lombok.ToString; public class ${class.className} ${class.relationClassStr}{ <#list fields as field> + /** ${field.desc} **/ + <#list field.annotationTagList as annotation> + ${annotation} + ${field.visibility} ${field.fieldName}; @@ -29,6 +33,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/exeimpl.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/exeimpl.ftl index e6a8d75475a8c42353b308de6c43e6e9bd173bca..dd3f647c7af4be565cc1ff1eff1886bedf676542 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/exeimpl.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/exeimpl.ftl @@ -17,6 +17,9 @@ import org.springframework.beans.factory.annotation.Autowired; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className} ${class.relationClassStr}{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -28,6 +31,9 @@ public class ${class.className} ${class.relationClassStr}{ <#list methods as method> + <#list method.annotationTagList as annotation> + ${annotation} + @Override public ${method.returnClass} ${method.methodName}{ ${method.methodContent} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperddd.ftl index 43102bc46dc874bde3bcc9316203d6183e3adda9..09a239dd549e461617da6c9368a28ce9ca09ae98 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperddd.ftl @@ -16,7 +16,7 @@ import org.apache.ibatis.annotations.Param; * @version v1.0 */ @Mapper -public interface ${class.className}{ +public interface ${class.className} ${class.relationClassStr}{ <#list methods as method> ${method.doc} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperxmlddd.ftl index 7d50a9abc14735d5c345f581d318c4ba35bb7d4d..a51999f41b8998d4b95844572c5af965d1030d9e 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperxmlddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mapperxmlddd.ftl @@ -22,34 +22,6 @@ ${table.columnNameList} - - insert into ${table.tableName}( - ${table.insertColumnNames} - ) - values( - ${table.insertColumnNameList} - ) - - - - update ${table.tableName} - set - ${table.updateColumnNameList} - where id = <#noparse>#{id<#noparse>} - - - - - - - - delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} - - <#list fields as field> ${field.fieldName} diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqconsumer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..e40bf3075091413310c1cf897a4bdcfbdc264c89 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqconsumer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqconsumer.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,6 +29,9 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqlistener.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqlistener.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..1eb2fe16aa98a2caa318300fbb7eb89e1e586ea3 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqlistener.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqlistener.ftl @@ -13,6 +13,9 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service +<#list class.annotationTagList as annotation> +${annotation} + public class ${class.className}{ <#list fields as field> @@ -26,6 +29,9 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqproducer.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqproducer.ftl index 758b640f34c009f2f7a9a7659d06586a9d51db1a..934b492e4d1ab829f714080dd2c531cd846a9118 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqproducer.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/mqproducer.ftl @@ -13,7 +13,11 @@ import org.springframework.stereotype.Service; * @version v1.0 */ @Service -public class ${class.className}{ +${class.annotation} +<#list class.annotationTagList as annotation> +${annotation} + +public class ${class.className} ${class.relationClassStr}{ <#list fields as field> /** ${field.desc} **/ @@ -26,6 +30,9 @@ public class ${class.className}{ * @Description:${method.desc} * @return ${method.returnClass} */ + <#list method.annotationTagList as annotation> + ${annotation} + ${method.visibility} ${method.returnClass} ${method.methodName}{ ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/parentpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/parentpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4b7c41076ae48d4a5a46501a06d87a8155b3a784 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/parentpom.ftl @@ -0,0 +1,196 @@ + + + + 4.0.0 + + ${groupId} + ${artifactId} + pom + ${version} + + ${modulePrefix}-api + ${modulePrefix}-provider + + + ${artifactId} + + ${url} + + + UTF-8 + 1.8 + 1.8 + 1.8 + 2.1.9.RELEASE + 2.7.3 + 1.2.0.Final + 4.8.0 + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${r'${spring-boot.version}'} + pom + import + + + + com.alibaba.spring + spring-context-support + 1.0.5 + + + + org.mapstruct + mapstruct + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-processor + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-jdk8 + ${r'${mapstruct.version}'} + + + + + commons-collections + commons-collections + 3.2.1 + + + + com.alibaba + fastjson + 1.2.72 + + + + + commons-lang + commons-lang + 2.4 + + + + org.apache.dubbo + dubbo-registry-nacos + 2.7.3 + + + + + org.slf4j + slf4j-api + 1.7.28 + + + org.slf4j + slf4j-ext + 1.7.28 + + + + org.slf4j + slf4j-log4j12 + 1.7.28 + + + + org.springframework.boot + spring-boot-starter-log4j2 + ${r'${spring-boot.version}'} + + + + org.aspectj + aspectjweaver + 1.9.4 + + + + org.aspectj + aspectjrt + 1.8.13 + + + + org.assertj + assertj-core + 3.9.1 + + + + + org.apache.rocketmq + rocketmq-client + ${r'${rocketmq.version}'} + + + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + + aliyun-releases + 阿里云仓库 + https://maven.aliyun.com/repository/public + + + apache.snapshots.https + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots + + false + + + true + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/providerpom.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/providerpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f3836a9aeb09d73b9932c0fd2b8413cc14405a48 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/providerpom.ftl @@ -0,0 +1,122 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-provider + 1.0-SNAPSHOT + + ${modulePrefix}-provider + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.springframework + spring-context + + + + ${groupId} + ${modulePrefix}-api + 1.0-SNAPSHOT + + + + + ${groupId} + ${modulePrefix}-common + 1.0-SNAPSHOT + + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-ext + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.mapstruct + mapstruct + + + + org.mybatis + mybatis + 3.4.6 + compile + + + + + + org.apache.dubbo + dubbo-spring-boot-starter + + + org.apache.dubbo + dubbo + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + <#if (dependency.version)??> + ${dependency.version} + + <#if (dependency.scope)??> + ${dependency.scope} + + <#if (dependency.type)??> + ${dependency.type} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/serviceddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/serviceddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c22e22b86d2bb4ab483e7e0215e5498c73decec9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/serviceddd.ftl @@ -0,0 +1,20 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + +${method.doc} + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/validator.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/validator.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/validator.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/voddd.ftl b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/voddd.ftl index 5c2f634e6bcd418c79556b914b5b2c9c4701aff5..45826147200533766f8e46052b1affac3ec3d9d6 100644 --- a/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/voddd.ftl +++ b/codemaker-parent/codemaker-core/src/main/resources/template/springcloud/voddd.ftl @@ -29,6 +29,7 @@ public class ${class.className} ${class.relationClassStr}{ * @return ${method.returnClass} */ ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} ${method.returnBody} } diff --git a/codemaker-parent/codemaker-core/src/test/java/ClassUtils.java b/codemaker-parent/codemaker-core/src/test/java/ClassUtils.java deleted file mode 100644 index 7a95e91343df4397989253b268fa071d88e40ce8..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/test/java/ClassUtils.java +++ /dev/null @@ -1,307 +0,0 @@ -import javassist.ClassPool; -import javassist.CtClass; -import javassist.CtMethod; -import javassist.NotFoundException; -import javassist.bytecode.CodeAttribute; -import javassist.bytecode.LocalVariableAttribute; -import javassist.bytecode.MethodInfo; -import org.apache.commons.lang3.StringUtils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.net.JarURLConnection; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.*; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.stream.Stream; - -/** - * Created 2018-10-16. - * - * @author: fanchunshuai - * @version: V1.0 - * @Desc: class加载工具类 - */ -public class ClassUtils { - /** jar中的文件路径分隔符 */ - private static final char SLASH_CHAR = '/'; - /** 包名分隔符 */ - private static final char DOT_CHAR = '.'; - - /** - * 在当前项目中寻找指定包下的所有类 - * - * @param packageName 用'.'分隔的包名 - * @param recursive 是否递归搜索 - * @return 该包名下的所有类 - */ - public static List> getClass(String packageName, boolean recursive) { - List> classList = new ArrayList<>(); - try { - //获取当前线程的类装载器中相应包名对应的资源 - Enumeration iterator = Thread.currentThread().getContextClassLoader().getResources(packageName.replace(DOT_CHAR, File.separatorChar)); - while (iterator.hasMoreElements()) { - URL url = iterator.nextElement(); - String protocol = url.getProtocol(); - List> childClassList = Collections.emptyList(); - switch (protocol) { - case "file": - childClassList = getClassInFile(url, packageName, recursive); - break; - case "jar": - childClassList = getClassInJar(url, packageName, recursive); - break; - default: - //在某些WEB服务器中运行WAR包时,它不会像TOMCAT一样将WAR包解压为目录的,如JBOSS7,它是使用了一种叫VFS的协议 - System.out.println("unknown protocol " + protocol); - break; - } - classList.addAll(childClassList); - } - return classList; - } catch (IOException e) { - e.printStackTrace(); - } - return Collections.emptyList(); - } - - /** - * 在给定的文件或文件夹中寻找指定包下的所有类 - * - * @param filePath 包的路径 - * @param packageName 用'.'分隔的包名 - * @param recursive 是否递归搜索 - * @return 该包名下的所有类 - */ - public static List> getClassInFile(String filePath, String packageName, boolean recursive) { - Path path = Paths.get(filePath); - return getClassInFile(path, packageName, recursive); - } - - /** - * 在给定的文件或文件夹中寻找指定包下的所有类 - * - * @param url 包的统一资源定位符 - * @param packageName 用'.'分隔的包名 - * @param recursive 是否递归搜索 - * @return 该包名下的所有类 - */ - public static List> getClassInFile(URL url, String packageName, boolean recursive) { - try { - Path path = Paths.get(url.toURI()); - return getClassInFile(path, packageName, recursive); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - return Collections.emptyList(); - } - - /** - * 在给定的文件或文件夹中寻找指定包下的所有类 - * - * @param path 包的路径 - * @param packageName 用'.'分隔的包名 - * @param recursive 是否递归搜索 - * @return 该包名下的所有类 - */ - public static List> getClassInFile(Path path, String packageName, boolean recursive) { - if (!Files.exists(path)) { - return Collections.emptyList(); - } - List> classList = new ArrayList>(); - if (Files.isDirectory(path)) { - if (!recursive) { - return Collections.emptyList(); - } - try { - //获取目录下的所有文件 - Stream stream = Files.list(path); - Iterator iterator = stream.iterator(); - while (iterator.hasNext()) { - classList.addAll(getClassInFile(iterator.next(), packageName, recursive)); - } - } catch (IOException e) { - e.printStackTrace(); - } - } else { - try { - //由于传入的文件可能是相对路径, 这里要拿到文件的实际路径, 如果不存在则报IOException - path = path.toRealPath(); - String pathStr = path.toString(); - //这里拿到的一般的"aa:\bb\...\cc.class"格式的文件名, 要去除末尾的类型后缀(.class) - int lastDotIndex = pathStr.lastIndexOf(DOT_CHAR); - //Class.forName只允许使用用'.'分隔的类名的形式 - String className = pathStr.replace(File.separatorChar, DOT_CHAR); - //获取包名的起始位置 - int beginIndex = className.indexOf(packageName); - if (beginIndex == -1) { - return Collections.emptyList(); - } - className = lastDotIndex == -1 ? className.substring(beginIndex) : className.substring(beginIndex, lastDotIndex); - classList.add(Class.forName(className)); - } catch (IOException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - return classList; - } - - /** - * 在给定的jar包中寻找指定包下的所有类 - * - * @param filePath 包的路径 - * @param packageName 用'.'分隔的包名 - * @param recursive 是否递归搜索 - * @return 该包名下的所有类 - */ - public static List> getClassInJar(String filePath, String packageName, boolean recursive) { - try { - JarFile jar = new JarFile(filePath); - return getClassInJar(jar, packageName, recursive); - } catch (IOException e) { - e.printStackTrace(); - } - return Collections.emptyList(); - } - - /** - * 在给定的jar包中寻找指定包下的所有类 - * - * @param url jar包的统一资源定位符 - * @param packageName 用'.'分隔的包名 - * @param recursive 是否递归搜索 - * @return 该包名下的所有类 - */ - public static List> getClassInJar(URL url, String packageName, boolean recursive) { - try { - JarFile jar = ((JarURLConnection) url.openConnection()).getJarFile(); - return getClassInJar(jar, packageName, recursive); - } catch (IOException e) { - e.printStackTrace(); - } - return Collections.emptyList(); - } - - /** - * 在给定的jar包中寻找指定包下的所有类 - * - * @param jar jar对象 - * @param packageName 用'.'分隔的包名 - * @param recursive 是否递归搜索 - * @return 该包名下的所有类 - */ - public static List> getClassInJar(JarFile jar, String packageName, boolean recursive) { - List> classList = new ArrayList<>(); - //该迭代器会递归得到该jar底下所有的目录和文件 - Enumeration iterator = jar.entries(); - while (iterator.hasMoreElements()) { - //这里拿到的一般的"aa/bb/.../cc.class"格式的Entry或 "包路径" - JarEntry jarEntry = iterator.nextElement(); - if (!jarEntry.isDirectory()) { - String name = jarEntry.getName(); - //对于拿到的文件,要去除末尾的.class - int lastDotClassIndex = name.lastIndexOf(".class"); - if(lastDotClassIndex != -1) { - int lastSlashIndex = name.lastIndexOf(SLASH_CHAR); - name = name.replace(SLASH_CHAR, DOT_CHAR); - if(name.startsWith(packageName)) { - if(recursive || packageName.length() == lastSlashIndex) { - String className = name.substring(0, lastDotClassIndex); - try { - classList.add(Class.forName(className)); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - } - } - } - } - return classList; - } - - - public static Map getParameterNames(Class clazz){ - Map paramMap = new HashMap<>(); - try { - ClassPool pool = ClassPool.getDefault(); - CtClass cc = pool.get(clazz.getName()); - - Method [] methods = clazz.getDeclaredMethods(); - for (Method method : methods){ - - CtMethod cm = cc.getDeclaredMethod(method.getName()); - // 使用javaassist的反射方法获取方法的参数名 - MethodInfo methodInfo = cm.getMethodInfo(); - if(methodInfo.getName().contains("lambda") && methodInfo.getName().contains("$")){ - continue; - } - - - CodeAttribute codeAttribute = methodInfo.getCodeAttribute(); - LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute.getAttribute(LocalVariableAttribute.tag); - if (attr == null) { - paramMap.put(method.getName(),""); - } - String[] paramNames = new String[cm.getParameterTypes().length]; - int paramLength; - if(paramNames.length > 10){ - paramLength = 10; - }else { - paramLength = paramNames.length; - } - - int pos = Modifier.isStatic(cm.getModifiers()) ? 0 : 1; - for (int i = 0; i < paramLength; i++) { - paramNames[i] = attr.variableName(i + pos); - } - - paramMap.put(method.getName(), StringUtils.join(paramNames,",")); - } - } catch (NotFoundException e) { - e.printStackTrace(); - } - - return paramMap; - } - /** - * 读取class - * - * @param classFilePath - * @return - */ - public static byte[] readClassBytes(String classFilePath) { - byte[] raw = null; - InputStream stream = null; - try { - File file = new File(classFilePath); - stream = new FileInputStream(file); - raw = new byte[(int) file.length()]; - stream.read(raw); - } catch (Exception e) { - - } finally { - try { - stream.close(); - } catch (Exception e) { - } - } - return raw; - } - - public static void main(String[] args) { - - } - -} diff --git a/codemaker-parent/codemaker-core/src/test/java/DAOTest.java b/codemaker-parent/codemaker-core/src/test/java/DAOTest.java deleted file mode 100644 index 322e9fa54587f69411de1bdbfe055654ff1c2c87..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/test/java/DAOTest.java +++ /dev/null @@ -1,1042 +0,0 @@ -/* -import com.alibaba.fastjson.JSON; -import com.coderman.codemaker.Main; -import com.coderman.codemaker.bean.TableBean; -import com.coderman.codemaker.dao.SqlMapper; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import javax.annotation.Resource; -import java.util.List; - -*/ -/** - * description: DAOTest
- * date: 2020/7/7 8:57
- * author: coderman
- * version: 1.0
- *//* - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Main.class) -public class DAOTest { - - @Resource - public SqlMapper sqlMapper; - - @Test - public void test(){ - List tableBeanList = sqlMapper.getDBTableBeanList("coder_bank_product"); - System.out.println("tableBeanList= "+ JSON.toJSONString(tableBeanList)); - - } - - @Test - public void testB(){ - String x = "110101\t东城区\t1101\n" + - "110102\t西城区\t1101\n" + - "110105\t朝阳区\t1101\n" + - "110106\t丰台区\t1101\n" + - "110107\t石景山区\t1101\n" + - "110108\t海淀区\t1101\n" + - "110109\t门头沟区\t1101\n" + - "110111\t房山区\t1101\n" + - "110112\t通州区\t1101\n" + - "110113\t顺义区\t1101\n" + - "110114\t昌平区\t1101\n" + - "110115\t大兴区\t1101\n" + - "110116\t怀柔区\t1101\n" + - "110117\t平谷区\t1101\n" + - "110118\t密云区\t1101\n" + - "110119\t延庆区\t1101\n" + - "120101\t和平区\t1201\n" + - "120102\t河东区\t1201\n" + - "120103\t河西区\t1201\n" + - "120104\t南开区\t1201\n" + - "120105\t河北区\t1201\n" + - "120106\t红桥区\t1201\n" + - "120110\t东丽区\t1201\n" + - "120111\t西青区\t1201\n" + - "120112\t津南区\t1201\n" + - "120113\t北辰区\t1201\n" + - "120114\t武清区\t1201\n" + - "120115\t宝坻区\t1201\n" + - "120116\t滨海新区\t1201\n" + - "120117\t宁河区\t1201\n" + - "120118\t静海区\t1201\n" + - "120119\t蓟州区\t1201\n" + - "130102\t长安区\t1301\n" + - "130104\t桥西区\t1301\n" + - "130105\t新华区\t1301\n" + - "130107\t井陉矿区\t1301\n" + - "130108\t裕华区\t1301\n" + - "130109\t藁城区\t1301\n" + - "130110\t鹿泉区\t1301\n" + - "130111\t栾城区\t1301\n" + - "130121\t井陉县\t1301\n" + - "130123\t正定县\t1301\n" + - "130125\t行唐县\t1301\n" + - "130126\t灵寿县\t1301\n" + - "130127\t高邑县\t1301\n" + - "130128\t深泽县\t1301\n" + - "130129\t赞皇县\t1301\n" + - "130130\t无极县\t1301\n" + - "130131\t平山县\t1301\n" + - "130132\t元氏县\t1301\n" + - "130133\t赵县\t1301\n" + - "130171\t石家庄高新技术产业开发区\t1301\n" + - "130172\t石家庄循环化工园区\t1301\n" + - "130181\t辛集市\t1301\n" + - "130183\t晋州市\t1301\n" + - "130184\t新乐市\t1301\n" + - "130202\t路南区\t1302\n" + - "130203\t路北区\t1302\n" + - "130204\t古冶区\t1302\n" + - "130205\t开平区\t1302\n" + - "130207\t丰南区\t1302\n" + - "130208\t丰润区\t1302\n" + - "130209\t曹妃甸区\t1302\n" + - "130224\t滦南县\t1302\n" + - "130225\t乐亭县\t1302\n" + - "130227\t迁西县\t1302\n" + - "130229\t玉田县\t1302\n" + - "130271\t唐山市芦台经济技术开发区\t1302\n" + - "130272\t唐山市汉沽管理区\t1302\n" + - "130273\t唐山高新技术产业开发区\t1302\n" + - "130274\t河北唐山海港经济开发区\t1302\n" + - "130281\t遵化市\t1302\n" + - "130283\t迁安市\t1302\n" + - "130284\t滦州市\t1302\n" + - "130302\t海港区\t1303\n" + - "130303\t山海关区\t1303\n" + - "130304\t北戴河区\t1303\n" + - "130306\t抚宁区\t1303\n" + - "130321\t青龙满族自治县\t1303\n" + - "130322\t昌黎县\t1303\n" + - "130324\t卢龙县\t1303\n" + - "130371\t秦皇岛市经济技术开发区\t1303\n" + - "130372\t北戴河新区\t1303\n" + - "130402\t邯山区\t1304\n" + - "130403\t丛台区\t1304\n" + - "130404\t复兴区\t1304\n" + - "130406\t峰峰矿区\t1304\n" + - "130407\t肥乡区\t1304\n" + - "130408\t永年区\t1304\n" + - "130423\t临漳县\t1304\n" + - "130424\t成安县\t1304\n" + - "130425\t大名县\t1304\n" + - "130426\t涉县\t1304\n" + - "130427\t磁县\t1304\n" + - "130430\t邱县\t1304\n" + - "130431\t鸡泽县\t1304\n" + - "130432\t广平县\t1304\n" + - "130433\t馆陶县\t1304\n" + - "130434\t魏县\t1304\n" + - "130435\t曲周县\t1304\n" + - "130471\t邯郸经济技术开发区\t1304\n" + - "130473\t邯郸冀南新区\t1304\n" + - "130502\t桥东区\t1305\n" + - "130503\t桥西区\t1305\n" + - "130521\t邢台县\t1305\n" + - "130522\t临城县\t1305\n" + - "130523\t内丘县\t1305\n" + - "130524\t柏乡县\t1305\n" + - "130525\t隆尧县\t1305\n" + - "130526\t任县\t1305\n" + - "130527\t南和县\t1305\n" + - "130528\t宁晋县\t1305\n" + - "130529\t巨鹿县\t1305\n" + - "130530\t新河县\t1305\n" + - "130531\t广宗县\t1305\n" + - "130532\t平乡县\t1305\n" + - "130533\t威县\t1305\n" + - "130534\t清河县\t1305\n" + - "130535\t临西县\t1305\n" + - "130571\t河北邢台经济开发区\t1305\n" + - "130581\t南宫市\t1305\n" + - "130582\t沙河市\t1305\n" + - "130602\t竞秀区\t1306\n" + - "130606\t莲池区\t1306\n" + - "130607\t满城区\t1306\n" + - "130608\t清苑区\t1306\n" + - "130609\t徐水区\t1306\n" + - "130623\t涞水县\t1306\n" + - "130624\t阜平县\t1306\n" + - "130626\t定兴县\t1306\n" + - "130627\t唐县\t1306\n" + - "130628\t高阳县\t1306\n" + - "130629\t容城县\t1306\n" + - "130630\t涞源县\t1306\n" + - "130631\t望都县\t1306\n" + - "130632\t安新县\t1306\n" + - "130633\t易县\t1306\n" + - "130634\t曲阳县\t1306\n" + - "130635\t蠡县\t1306\n" + - "130636\t顺平县\t1306\n" + - "130637\t博野县\t1306\n" + - "130638\t雄县\t1306\n" + - "130671\t保定高新技术产业开发区\t1306\n" + - "130672\t保定白沟新城\t1306\n" + - "130681\t涿州市\t1306\n" + - "130682\t定州市\t1306\n" + - "130683\t安国市\t1306\n" + - "130684\t高碑店市\t1306\n" + - "130702\t桥东区\t1307\n" + - "130703\t桥西区\t1307\n" + - "130705\t宣化区\t1307\n" + - "130706\t下花园区\t1307\n" + - "130708\t万全区\t1307\n" + - "130709\t崇礼区\t1307\n" + - "130722\t张北县\t1307\n" + - "130723\t康保县\t1307\n" + - "130724\t沽源县\t1307\n" + - "130725\t尚义县\t1307\n" + - "130726\t蔚县\t1307\n" + - "130727\t阳原县\t1307\n" + - "130728\t怀安县\t1307\n" + - "130730\t怀来县\t1307\n" + - "130731\t涿鹿县\t1307\n" + - "130732\t赤城县\t1307\n" + - "130771\t张家口市高新技术产业开发区\t1307\n" + - "130772\t张家口市察北管理区\t1307\n" + - "130773\t张家口市塞北管理区\t1307\n" + - "130802\t双桥区\t1308\n" + - "130803\t双滦区\t1308\n" + - "130804\t鹰手营子矿区\t1308\n" + - "130821\t承德县\t1308\n" + - "130822\t兴隆县\t1308\n" + - "130824\t滦平县\t1308\n" + - "130825\t隆化县\t1308\n" + - "130826\t丰宁满族自治县\t1308\n" + - "130827\t宽城满族自治县\t1308\n" + - "130828\t围场满族蒙古族自治县\t1308\n" + - "130871\t承德高新技术产业开发区\t1308\n" + - "130881\t平泉市\t1308\n" + - "130902\t新华区\t1309\n" + - "130903\t运河区\t1309\n" + - "130921\t沧县\t1309\n" + - "130922\t青县\t1309\n" + - "130923\t东光县\t1309\n" + - "130924\t海兴县\t1309\n" + - "130925\t盐山县\t1309\n" + - "130926\t肃宁县\t1309\n" + - "130927\t南皮县\t1309\n" + - "130928\t吴桥县\t1309\n" + - "130929\t献县\t1309\n" + - "130930\t孟村回族自治县\t1309\n" + - "130971\t河北沧州经济开发区\t1309\n" + - "130972\t沧州高新技术产业开发区\t1309\n" + - "130973\t沧州渤海新区\t1309\n" + - "130981\t泊头市\t1309\n" + - "130982\t任丘市\t1309\n" + - "130983\t黄骅市\t1309\n" + - "130984\t河间市\t1309\n" + - "131002\t安次区\t1310\n" + - "131003\t广阳区\t1310\n" + - "131022\t固安县\t1310\n" + - "131023\t永清县\t1310\n" + - "131024\t香河县\t1310\n" + - "131025\t大城县\t1310\n" + - "131026\t文安县\t1310\n" + - "131028\t大厂回族自治县\t1310\n" + - "131071\t廊坊经济技术开发区\t1310\n" + - "131081\t霸州市\t1310\n" + - "131082\t三河市\t1310\n" + - "131102\t桃城区\t1311\n" + - "131103\t冀州区\t1311\n" + - "131121\t枣强县\t1311\n" + - "131122\t武邑县\t1311\n" + - "131123\t武强县\t1311\n" + - "131124\t饶阳县\t1311\n" + - "131125\t安平县\t1311\n" + - "131126\t故城县\t1311\n" + - "131127\t景县\t1311\n" + - "131128\t阜城县\t1311\n" + - "131171\t河北衡水高新技术产业开发区\t1311\n" + - "131172\t衡水滨湖新区\t1311\n" + - "131182\t深州市\t1311\n" + - "140105\t小店区\t1401\n" + - "140106\t迎泽区\t1401\n" + - "140107\t杏花岭区\t1401\n" + - "140108\t尖草坪区\t1401\n" + - "140109\t万柏林区\t1401\n" + - "140110\t晋源区\t1401\n" + - "140121\t清徐县\t1401\n" + - "140122\t阳曲县\t1401\n" + - "140123\t娄烦县\t1401\n" + - "140171\t山西转型综合改革示范区\t1401\n" + - "140181\t古交市\t1401\n" + - "140212\t新荣区\t1402\n" + - "140213\t平城区\t1402\n" + - "140214\t云冈区\t1402\n" + - "140215\t云州区\t1402\n" + - "140221\t阳高县\t1402\n" + - "140222\t天镇县\t1402\n" + - "140224\t灵丘县\t1402\n" + - "140225\t浑源县\t1402\n" + - "140226\t左云县\t1402\n" + - "140271\t山西大同经济开发区\t1402\n" + - "140302\t城区\t1403\n" + - "140303\t矿区\t1403\n" + - "140311\t郊区\t1403\n" + - "140321\t平定县\t1403\n" + - "140322\t盂县\t1403\n" + - "140403\t潞州区\t1404\n" + - "140404\t上党区\t1404\n" + - "140405\t屯留区\t1404\n" + - "140406\t潞城区\t1404\n" + - "140423\t襄垣县\t1404\n" + - "140425\t平顺县\t1404\n" + - "140426\t黎城县\t1404\n" + - "140427\t壶关县\t1404\n" + - "140428\t长子县\t1404\n" + - "140429\t武乡县\t1404\n" + - "140430\t沁县\t1404\n" + - "140431\t沁源县\t1404\n" + - "140471\t山西长治高新技术产业园区\t1404\n" + - "140502\t城区\t1405\n" + - "140521\t沁水县\t1405\n" + - "140522\t阳城县\t1405\n" + - "140524\t陵川县\t1405\n" + - "140525\t泽州县\t1405\n" + - "140581\t高平市\t1405\n" + - "140602\t朔城区\t1406\n" + - "140603\t平鲁区\t1406\n" + - "140621\t山阴县\t1406\n" + - "140622\t应县\t1406\n" + - "140623\t右玉县\t1406\n" + - "140681\t怀仁市\t1406\n" + - "140702\t榆次区\t1407\n" + - "140721\t榆社县\t1407\n" + - "140722\t左权县\t1407\n" + - "140723\t和顺县\t1407\n" + - "140724\t昔阳县\t1407\n" + - "140726\t太谷县\t1407\n" + - "140727\t祁县\t1407\n" + - "140728\t平遥县\t1407\n" + - "140729\t灵石县\t1407\n" + - "140781\t介休市\t1407\n" + - "140802\t盐湖区\t1408\n" + - "140821\t临猗县\t1408\n" + - "140822\t万荣县\t1408\n" + - "140823\t闻喜县\t1408\n" + - "140824\t稷山县\t1408\n" + - "140825\t新绛县\t1408\n" + - "140826\t绛县\t1408\n" + - "140827\t垣曲县\t1408\n" + - "140828\t夏县\t1408\n" + - "140829\t平陆县\t1408\n" + - "140830\t芮城县\t1408\n" + - "140881\t永济市\t1408\n" + - "140882\t河津市\t1408\n" + - "140902\t忻府区\t1409\n" + - "140921\t定襄县\t1409\n" + - "140922\t五台县\t1409\n" + - "140923\t代县\t1409\n" + - "140924\t繁峙县\t1409\n" + - "140925\t宁武县\t1409\n" + - "140926\t静乐县\t1409\n" + - "140927\t神池县\t1409\n" + - "140928\t五寨县\t1409\n" + - "140929\t岢岚县\t1409\n" + - "140930\t河曲县\t1409\n" + - "140932\t偏关县\t1409\n" + - "140971\t五台山风景名胜区\t1409\n" + - "140981\t原平市\t1409\n" + - "141002\t尧都区\t1410\n" + - "141021\t曲沃县\t1410\n" + - "141022\t翼城县\t1410\n" + - "141023\t襄汾县\t1410\n" + - "141024\t洪洞县\t1410\n" + - "141025\t古县\t1410\n" + - "141026\t安泽县\t1410\n" + - "141027\t浮山县\t1410\n" + - "141028\t吉县\t1410\n" + - "141029\t乡宁县\t1410\n" + - "141030\t大宁县\t1410\n" + - "141031\t隰县\t1410\n" + - "141032\t永和县\t1410\n" + - "141033\t蒲县\t1410\n" + - "141034\t汾西县\t1410\n" + - "141081\t侯马市\t1410\n" + - "141082\t霍州市\t1410\n" + - "141102\t离石区\t1411\n" + - "141121\t文水县\t1411\n" + - "141122\t交城县\t1411\n" + - "141123\t兴县\t1411\n" + - "141124\t临县\t1411\n" + - "141125\t柳林县\t1411\n" + - "141127\t岚县\t1411\n" + - "141128\t方山县\t1411\n" + - "141129\t中阳县\t1411\n" + - "141130\t交口县\t1411\n" + - "141181\t孝义市\t1411\n" + - "141182\t汾阳市\t1411\n" + - "150102\t新城区\t1501\n" + - "150103\t回民区\t1501\n" + - "150104\t玉泉区\t1501\n" + - "150105\t赛罕区\t1501\n" + - "150121\t土默特左旗\t1501\n" + - "150122\t托克托县\t1501\n" + - "150123\t和林格尔县\t1501\n" + - "150124\t清水河县\t1501\n" + - "150125\t武川县\t1501\n" + - "150171\t呼和浩特金海工业园区\t1501\n" + - "150172\t呼和浩特经济技术开发区\t1501\n" + - "150202\t东河区\t1502\n" + - "150203\t昆都仑区\t1502\n" + - "150205\t石拐区\t1502\n" + - "150206\t白云鄂博矿区\t1502\n" + - "150207\t九原区\t1502\n" + - "150221\t土默特右旗\t1502\n" + - "150222\t固阳县\t1502\n" + - "150223\t达尔罕茂明安联合旗\t1502\n" + - "150271\t包头稀土高新技术产业开发区\t1502\n" + - "150302\t海勃湾区\t1503\n" + - "150303\t海南区\t1503\n" + - "150304\t乌达区\t1503\n" + - "150402\t红山区\t1504\n" + - "150403\t元宝山区\t1504\n" + - "150404\t松山区\t1504\n" + - "150421\t阿鲁科尔沁旗\t1504\n" + - "150422\t巴林左旗\t1504\n" + - "150423\t巴林右旗\t1504\n" + - "150424\t林西县\t1504\n" + - "150425\t克什克腾旗\t1504\n" + - "150426\t翁牛特旗\t1504\n" + - "150428\t喀喇沁旗\t1504\n" + - "150429\t宁城县\t1504\n" + - "150430\t敖汉旗\t1504\n" + - "150502\t科尔沁区\t1505\n" + - "150521\t科尔沁左翼中旗\t1505\n" + - "150522\t科尔沁左翼后旗\t1505\n" + - "150523\t开鲁县\t1505\n" + - "150524\t库伦旗\t1505\n" + - "150525\t奈曼旗\t1505\n" + - "150526\t扎鲁特旗\t1505\n" + - "150571\t通辽经济技术开发区\t1505\n" + - "150581\t霍林郭勒市\t1505\n" + - "150602\t东胜区\t1506\n" + - "150603\t康巴什区\t1506\n" + - "150621\t达拉特旗\t1506\n" + - "150622\t准格尔旗\t1506\n" + - "150623\t鄂托克前旗\t1506\n" + - "150624\t鄂托克旗\t1506\n" + - "150625\t杭锦旗\t1506\n" + - "150626\t乌审旗\t1506\n" + - "150627\t伊金霍洛旗\t1506\n" + - "150802\t临河区\t1508\n" + - "150821\t五原县\t1508\n" + - "150822\t磴口县\t1508\n" + - "150823\t乌拉特前旗\t1508\n" + - "150824\t乌拉特中旗\t1508\n" + - "150825\t乌拉特后旗\t1508\n" + - "150826\t杭锦后旗\t1508\n" + - "150902\t集宁区\t1509\n" + - "150921\t卓资县\t1509\n" + - "150922\t化德县\t1509\n" + - "150923\t商都县\t1509\n" + - "150924\t兴和县\t1509\n" + - "150925\t凉城县\t1509\n" + - "150926\t察哈尔右翼前旗\t1509\n" + - "150927\t察哈尔右翼中旗\t1509\n" + - "150928\t察哈尔右翼后旗\t1509\n" + - "150929\t四子王旗\t1509\n" + - "150981\t丰镇市\t1509\n" + - "152201\t乌兰浩特市\t1522\n" + - "152202\t阿尔山市\t1522\n" + - "152221\t科尔沁右翼前旗\t1522\n" + - "152222\t科尔沁右翼中旗\t1522\n" + - "152223\t扎赉特旗\t1522\n" + - "152224\t突泉县\t1522\n" + - "152501\t二连浩特市\t1525\n" + - "152502\t锡林浩特市\t1525\n" + - "152522\t阿巴嘎旗\t1525\n" + - "152523\t苏尼特左旗\t1525\n" + - "152524\t苏尼特右旗\t1525\n" + - "152525\t东乌珠穆沁旗\t1525\n" + - "152526\t西乌珠穆沁旗\t1525\n" + - "152527\t太仆寺旗\t1525\n" + - "152528\t镶黄旗\t1525\n" + - "152529\t正镶白旗\t1525\n" + - "152530\t正蓝旗\t1525\n" + - "152531\t多伦县\t1525\n" + - "152571\t乌拉盖管委会\t1525\n" + - "152921\t阿拉善左旗\t1529\n" + - "152922\t阿拉善右旗\t1529\n" + - "152923\t额济纳旗\t1529\n" + - "152971\t内蒙古阿拉善经济开发区\t1529\n" + - "210102\t和平区\t2101\n" + - "210103\t沈河区\t2101\n" + - "210104\t大东区\t2101\n" + - "210105\t皇姑区\t2101\n" + - "210106\t铁西区\t2101\n" + - "210111\t苏家屯区\t2101\n" + - "210112\t浑南区\t2101\n" + - "210114\t于洪区\t2101\n" + - "210115\t辽中区\t2101\n" + - "210123\t康平县\t2101\n" + - "210124\t法库县\t2101\n" + - "210181\t新民市\t2101\n" + - "210202\t中山区\t2102\n" + - "210203\t西岗区\t2102\n" + - "210204\t沙河口区\t2102\n" + - "210211\t甘井子区\t2102\n" + - "210212\t旅顺口区\t2102\n" + - "210213\t金州区\t2102\n" + - "210214\t普兰店区\t2102\n" + - "210224\t长海县\t2102\n" + - "210281\t瓦房店市\t2102\n" + - "210283\t庄河市\t2102\n" + - "210302\t铁东区\t2103\n" + - "210303\t铁西区\t2103\n" + - "210304\t立山区\t2103\n" + - "210311\t千山区\t2103\n" + - "210321\t台安县\t2103\n" + - "210323\t岫岩满族自治县\t2103\n" + - "210381\t海城市\t2103\n" + - "210402\t新抚区\t2104\n" + - "210403\t东洲区\t2104\n" + - "210404\t望花区\t2104\n" + - "210411\t顺城区\t2104\n" + - "210421\t抚顺县\t2104\n" + - "210422\t新宾满族自治县\t2104\n" + - "210423\t清原满族自治县\t2104\n" + - "210502\t平山区\t2105\n" + - "210503\t溪湖区\t2105\n" + - "210504\t明山区\t2105\n" + - "210505\t南芬区\t2105\n" + - "210521\t本溪满族自治县\t2105\n" + - "210522\t桓仁满族自治县\t2105\n" + - "210602\t元宝区\t2106\n" + - "210603\t振兴区\t2106\n" + - "210604\t振安区\t2106\n" + - "210624\t宽甸满族自治县\t2106\n" + - "210681\t东港市\t2106\n" + - "210682\t凤城市\t2106\n" + - "210702\t古塔区\t2107\n" + - "210703\t凌河区\t2107\n" + - "210711\t太和区\t2107\n" + - "210726\t黑山县\t2107\n" + - "210727\t义县\t2107\n" + - "210781\t凌海市\t2107\n" + - "210782\t北镇市\t2107\n" + - "210802\t站前区\t2108\n" + - "210803\t西市区\t2108\n" + - "210804\t鲅鱼圈区\t2108\n" + - "210811\t老边区\t2108\n" + - "210881\t盖州市\t2108\n" + - "210882\t大石桥市\t2108\n" + - "211002\t白塔区\t2110\n" + - "211003\t文圣区\t2110\n" + - "211004\t宏伟区\t2110\n" + - "211005\t弓长岭区\t2110\n" + - "211011\t太子河区\t2110\n" + - "211021\t辽阳县\t2110\n" + - "211081\t灯塔市\t2110\n" + - "211103\t兴隆台区\t2111\n" + - "211104\t大洼区\t2111\n" + - "211122\t盘山县\t2111\n" + - "211202\t银州区\t2112\n" + - "211204\t清河区\t2112\n" + - "211221\t铁岭县\t2112\n" + - "211223\t西丰县\t2112\n" + - "211224\t昌图县\t2112\n" + - "211281\t调兵山市\t2112\n" + - "211282\t开原市\t2112\n" + - "211302\t双塔区\t2113\n" + - "211303\t龙城区\t2113\n" + - "211321\t朝阳县\t2113\n" + - "211322\t建平县\t2113\n" + - "211324\t喀喇沁左翼蒙古族自治县\t2113\n" + - "211381\t北票市\t2113\n" + - "211382\t凌源市\t2113\n" + - "211402\t连山区\t2114\n" + - "211403\t龙港区\t2114\n" + - "211404\t南票区\t2114\n" + - "211421\t绥中县\t2114\n" + - "211422\t建昌县\t2114\n" + - "211481\t兴城市\t2114\n" + - "220102\t南关区\t2201\n" + - "220103\t宽城区\t2201\n" + - "220104\t朝阳区\t2201\n" + - "220105\t二道区\t2201\n" + - "220106\t绿园区\t2201\n" + - "220112\t双阳区\t2201\n" + - "220113\t九台区\t2201\n" + - "220122\t农安县\t2201\n" + - "220171\t长春经济技术开发区\t2201\n" + - "220172\t长春净月高新技术产业开发区\t2201\n" + - "220173\t长春高新技术产业开发区\t2201\n" + - "220174\t长春汽车经济技术开发区\t2201\n" + - "220182\t榆树市\t2201\n" + - "220202\t昌邑区\t2202\n" + - "220203\t龙潭区\t2202\n" + - "220204\t船营区\t2202\n" + - "220211\t丰满区\t2202\n" + - "220221\t永吉县\t2202\n" + - "220271\t吉林经济开发区\t2202\n" + - "220272\t吉林高新技术产业开发区\t2202\n" + - "220273\t吉林中国新加坡食品区\t2202\n" + - "220281\t蛟河市\t2202\n" + - "220282\t桦甸市\t2202\n" + - "220283\t舒兰市\t2202\n" + - "220284\t磐石市\t2202\n" + - "220302\t铁西区\t2203\n" + - "220303\t铁东区\t2203\n" + - "220323\t伊通满族自治县\t2203\n" + - "220381\t公主岭市\t2203\n" + - "220382\t双辽市\t2203\n" + - "220402\t龙山区\t2204\n" + - "220403\t西安区\t2204\n" + - "220421\t东丰县\t2204\n" + - "220422\t东辽县\t2204\n" + - "220502\t东昌区\t2205\n" + - "220503\t二道江区\t2205\n" + - "220521\t通化县\t2205\n" + - "220523\t辉南县\t2205\n" + - "220524\t柳河县\t2205\n" + - "220581\t梅河口市\t2205\n" + - "220582\t集安市\t2205\n" + - "220602\t浑江区\t2206\n" + - "220605\t江源区\t2206\n" + - "220621\t抚松县\t2206\n" + - "220622\t靖宇县\t2206\n" + - "220623\t长白朝鲜族自治县\t2206\n" + - "220681\t临江市\t2206\n" + - "220702\t宁江区\t2207\n" + - "220721\t前郭尔罗斯蒙古族自治县\t2207\n" + - "220722\t长岭县\t2207\n" + - "220723\t乾安县\t2207\n" + - "220771\t吉林松原经济开发区\t2207\n" + - "220781\t扶余市\t2207\n" + - "220802\t洮北区\t2208\n" + - "220821\t镇赉县\t2208\n" + - "220822\t通榆县\t2208\n" + - "220871\t吉林白城经济开发区\t2208\n" + - "220881\t洮南市\t2208\n" + - "220882\t大安市\t2208\n" + - "222401\t延吉市\t2224\n" + - "222402\t图们市\t2224\n" + - "222403\t敦化市\t2224\n" + - "222404\t珲春市\t2224\n" + - "222405\t龙井市\t2224\n" + - "222406\t和龙市\t2224\n" + - "222424\t汪清县\t2224\n" + - "222426\t安图县\t2224\n" + - "230102\t道里区\t2301\n" + - "230103\t南岗区\t2301\n" + - "230104\t道外区\t2301\n" + - "230108\t平房区\t2301\n" + - "230109\t松北区\t2301\n" + - "230110\t香坊区\t2301\n" + - "230111\t呼兰区\t2301\n" + - "230112\t阿城区\t2301\n" + - "230113\t双城区\t2301\n" + - "230123\t依兰县\t2301\n" + - "230124\t方正县\t2301\n" + - "230125\t宾县\t2301\n" + - "230126\t巴彦县\t2301\n" + - "230127\t木兰县\t2301\n" + - "230128\t通河县\t2301\n" + - "230129\t延寿县\t2301\n" + - "230183\t尚志市\t2301\n" + - "230184\t五常市\t2301\n" + - "230202\t龙沙区\t2302\n" + - "230203\t建华区\t2302\n" + - "230204\t铁锋区\t2302\n" + - "230206\t富拉尔基区\t2302\n" + - "230207\t碾子山区\t2302\n" + - "230208\t梅里斯达斡尔族区\t2302\n" + - "230221\t龙江县\t2302\n" + - "230223\t依安县\t2302\n" + - "230224\t泰来县\t2302\n" + - "230225\t甘南县\t2302\n" + - "230227\t富裕县\t2302\n" + - "230229\t克山县\t2302\n" + - "230230\t克东县\t2302\n" + - "230231\t拜泉县\t2302\n" + - "230281\t讷河市\t2302\n" + - "230302\t鸡冠区\t2303\n" + - "230303\t恒山区\t2303\n" + - "230304\t滴道区\t2303\n" + - "230305\t梨树区\t2303\n" + - "230306\t城子河区\t2303\n" + - "230307\t麻山区\t2303\n" + - "230321\t鸡东县\t2303\n" + - "230381\t虎林市\t2303\n" + - "230382\t密山市\t2303\n" + - "230402\t向阳区\t2304\n" + - "230403\t工农区\t2304\n" + - "230404\t南山区\t2304\n" + - "230405\t兴安区\t2304\n" + - "230407\t兴山区\t2304\n" + - "230421\t萝北县\t2304\n" + - "230422\t绥滨县\t2304\n" + - "230502\t尖山区\t2305\n" + - "230503\t岭东区\t2305\n" + - "230505\t四方台区\t2305\n" + - "230506\t宝山区\t2305\n" + - "230521\t集贤县\t2305\n" + - "230522\t友谊县\t2305\n" + - "230523\t宝清县\t2305\n" + - "230524\t饶河县\t2305\n" + - "230602\t萨尔图区\t2306\n" + - "230603\t龙凤区\t2306\n" + - "230604\t让胡路区\t2306\n" + - "230605\t红岗区\t2306\n" + - "230606\t大同区\t2306\n" + - "230621\t肇州县\t2306\n" + - "230622\t肇源县\t2306\n" + - "230623\t林甸县\t2306\n" + - "230624\t杜尔伯特蒙古族自治县\t2306\n" + - "230671\t大庆高新技术产业开发区\t2306\n" + - "230702\t伊春区\t2307\n" + - "230703\t南岔区\t2307\n" + - "230704\t友好区\t2307\n" + - "230705\t西林区\t2307\n" + - "230706\t翠峦区\t2307\n" + - "230707\t新青区\t2307\n" + - "230708\t美溪区\t2307\n" + - "230709\t金山屯区\t2307\n" + - "230710\t五营区\t2307\n" + - "230711\t乌马河区\t2307\n" + - "230712\t汤旺河区\t2307\n" + - "230713\t带岭区\t2307\n" + - "230714\t乌伊岭区\t2307\n" + - "230715\t红星区\t2307\n" + - "230716\t上甘岭区\t2307\n" + - "230722\t嘉荫县\t2307\n" + - "230781\t铁力市\t2307\n" + - "230804\t前进区\t2308\n" + - "230805\t东风区\t2308\n" + - "230811\t郊区\t2308\n" + - "230822\t桦南县\t2308\n" + - "230826\t桦川县\t2308\n" + - "230828\t汤原县\t2308\n" + - "230881\t同江市\t2308\n" + - "230882\t富锦市\t2308\n" + - "230883\t抚远市\t2308\n" + - "230902\t新兴区\t2309\n" + - "230903\t桃山区\t2309\n" + - "230904\t茄子河区\t2309\n" + - "230921\t勃利县\t2309\n" + - "231002\t东安区\t2310\n" + - "231003\t阳明区\t2310\n" + - "231004\t爱民区\t2310\n" + - "231005\t西安区\t2310\n" + - "231025\t林口县\t2310\n" + - "231081\t绥芬河市\t2310\n" + - "231083\t海林市\t2310\n" + - "231084\t宁安市\t2310\n" + - "231085\t穆棱市\t2310\n" + - "231086\t东宁市\t2310\n" + - "231102\t爱辉区\t2311\n" + - "231121\t嫩江县\t2311\n" + - "231123\t逊克县\t2311\n" + - "231124\t孙吴县\t2311\n" + - "231181\t北安市\t2311\n" + - "231182\t五大连池市\t2311\n" + - "231202\t北林区\t2312\n" + - "231221\t望奎县\t2312\n" + - "231222\t兰西县\t2312\n" + - "231223\t青冈县\t2312\n" + - "231224\t庆安县\t2312\n" + - "231225\t明水县\t2312\n" + - "231226\t绥棱县\t2312\n" + - "231281\t安达市\t2312\n" + - "231282\t肇东市\t2312\n" + - "231283\t海伦市\t2312\n" + - "232701\t漠河市\t2327\n" + - "232721\t呼玛县\t2327\n" + - "232722\t塔河县\t2327\n" + - "232761\t加格达奇区\t2327\n" + - "232762\t松岭区\t2327\n" + - "232763\t新林区\t2327\n" + - "232764\t呼中区\t2327\n" + - "310101\t黄浦区\t3101\n" + - "310104\t徐汇区\t3101\n" + - "310105\t长宁区\t3101\n" + - "310106\t静安区\t3101\n" + - "310107\t普陀区\t3101\n" + - "310109\t虹口区\t3101\n" + - "310110\t杨浦区\t3101\n" + - "310112\t闵行区\t3101\n" + - "310113\t宝山区\t3101\n" + - "310114\t嘉定区\t3101\n" + - "310115\t浦东新区\t3101\n" + - "310116\t金山区\t3101\n" + - "310117\t松江区\t3101\n" + - "310120\t奉贤区\t3101\n" + - "310151\t崇明区\t3101\n" + - "320102\t玄武区\t3201\n" + - "320104\t秦淮区\t3201\n" + - "320105\t建邺区\t3201\n" + - "320106\t鼓楼区\t3201\n" + - "320111\t浦口区\t3201\n" + - "320113\t栖霞区\t3201\n" + - "320114\t雨花台区\t3201\n" + - "320115\t江宁区\t3201\n" + - "320116\t六合区\t3201\n" + - "320117\t溧水区\t3201\n" + - "320118\t高淳区\t3201\n" + - "320205\t锡山区\t3202\n" + - "320206\t惠山区\t3202\n" + - "320211\t滨湖区\t3202\n" + - "320213\t梁溪区\t3202\n" + - "320214\t新吴区\t3202\n" + - "320281\t江阴市\t3202\n" + - "320282\t宜兴市\t3202\n" + - "320302\t鼓楼区\t3203\n" + - "320303\t云龙区\t3203\n" + - "320305\t贾汪区\t3203\n" + - "320311\t泉山区\t3203\n" + - "320312\t铜山区\t3203\n" + - "320321\t丰县\t3203\n" + - "320322\t沛县\t3203\n" + - "320324\t睢宁县\t3203\n" + - "320371\t徐州经济技术开发区\t3203\n" + - "320381\t新沂市\t3203\n" + - "320382\t邳州市\t3203\n" + - "320402\t天宁区\t3204\n" + - "320404\t钟楼区\t3204\n" + - "320411\t新北区\t3204\n" + - "320412\t武进区\t3204\n" + - "320413\t金坛区\t3204\n" + - "320481\t溧阳市\t3204\n" + - "320505\t虎丘区\t3205\n" + - "320506\t吴中区\t3205\n" + - "320507\t相城区\t3205\n" + - "320508\t姑苏区\t3205\n" + - "320509\t吴江区\t3205\n" + - "320571\t苏州工业园区\t3205\n" + - "320582\t张家港市\t3205\n" + - "320583\t昆山市\t3205\n" + - "320585\t太仓市\t3205\n" + - "320602\t崇川区\t3206\n" + - "320611\t港闸区\t3206\n" + - "320612\t通州区\t3206\n" + - "320623\t如东县\t3206\n" + - "320671\t南通经济技术开发区\t3206\n" + - "320681\t启东市\t3206\n" + - "320682\t如皋市\t3206\n" + - "320684\t海门市\t3206\n" + - "320685\t海安市\t3206\n" + - "320703\t连云区\t3207\n" + - "320706\t海州区\t3207\n" + - "320707\t赣榆区\t3207\n" + - "320722\t东海县\t3207\n" + - "320723\t灌云县\t3207\n" + - "320724\t灌南县\t3207\n" + - "320771\t连云港经济技术开发区\t3207\n" + - "320772\t连云港高新技术产业开发区\t3207\n" + - "320803\t淮安区\t3208\n" + - "320804\t淮阴区\t3208\n" + - "320812\t清江浦区\t3208\n" + - "320813\t洪泽区\t3208\n" + - "320826\t涟水县\t3208\n" + - "320830\t盱眙县\t3208\n" + - "320831\t金湖县\t3208\n" + - "320871\t淮安经济技术开发区\t3208\n" + - "320902\t亭湖区\t3209\n" + - "320903\t盐都区\t3209\n" + - "320904\t大丰区\t3209\n" + - "320921\t响水县\t3209\n" + - "320922\t滨海县\t3209\n" + - "320923\t阜宁县\t3209\n" + - "320924\t射阳县\t3209\n" + - "320925\t建湖县\t3209\n" + - "320971\t盐城经济技术开发区\t3209\n" + - "320981\t东台市\t3209\n" + - "321002\t广陵区\t3210\n" + - "321003\t邗江区\t3210\n" + - "321012\t江都区\t3210\n" + - "321023\t宝应县\t3210\n" + - "321071\t扬州经济技术开发区\t3210\n" + - "321081\t仪征市\t3210\n" + - "321084\t高邮市\t3210\n" + - "321102\t京口区\t3211\n" + - "321111\t润州区\t3211\n" + - "321112\t丹徒区\t3211\n" + - "321171\t镇江新区\t3211\n" + - "321181\t丹阳市\t3211\n" + - "321182\t扬中市\t3211\n" + - "321183\t句容市\t3211\n" + - "321202\t海陵区\t3212\n" + - "321203\t高港区\t3212\n" + - "321204\t姜堰区\t3212\n" + - "321271\t泰州医药高新技术产业开发区\t3212\n" + - "321281\t兴化市\t3212\n" + - "321282\t靖江市\t3212\n" + - "321283\t泰兴市\t3212\n" + - "321302\t宿城区\t3213\n" + - "321311\t宿豫区\t3213\n" + - "321322\t沭阳县\t3213\n" + - "321323\t泗阳县\t3213\n" + - "321324\t泗洪县\t3213\n" + - "321371\t宿迁经济技术开发区\t3213\n" + - "330102\t上城区\t3301\n" + - "330103\t下城区\t3301\n" + - "330104\t江干区\t3301\n" + - "330105\t拱墅区\t3301\n" + - "330106\t西湖区\t3301\n" + - "330108\t滨江区\t3301\n" + - "330109\t萧山区\t3301\n" + - "330110\t余杭区\t3301\n" + - "330111\t富阳区\t3301\n" + - "330112\t临安区\t3301\n" + - "330127\t淳安县\t3301\n" + - "330182\t建德市\t3301\n" + - "330203\t海曙区\t3302\n" + - "330205\t江北区\t3302\n" + - "330206\t北仑区\t3302\n" + - "330211\t镇海区\t3302\n" + - "330212\t鄞州区\t3302\n" + - "330213\t奉化区\t3302\n" + - "330225\t象山县\t3302\n" + - "330226\t宁海县\t3302\n" + - "330282\t慈溪市\t3302\n" + - "330302\t鹿城区\t3303\n" + - "330304\t瓯海区\t3303\n" + - "330305\t洞头区\t3303\n" + - "330326\t平阳县\t3303\n" + - "330327\t苍南县\t3303\n" + - "330328\t文成县\t3303\n" + - "330329\t泰顺县\t3303\n" + - "330371\t温州经济技术开发区\t3303\n" + - "330381\t瑞安市\t3303\n" + - "330382\t乐清市\t3303\n" + - "330402\t南湖区\t3304\n" + - "330411\t秀洲区\t3304\n" + - "330421\t嘉善县\t3304\n" + - "330424\t海盐县\t3304\n" + - "330481\t海宁市\t3304\n" + - "330482\t平湖市\t3304\n" + - "330483\t桐乡市\t3304\n" + - "330502\t吴兴区\t3305\n" + - "330503\t南浔区\t3305\n" + - "330521\t德清县\t3305\n" + - "330522\t长兴县\t3305\n" + - "330523\t安吉县\t3305\n" + - "330602\t越城区\t3306\n" + - "330603\t柯桥区\t3306\n" + - "330604\t上虞区\t3306\n" + - "330681\t诸暨市\t3306\n" + - "330683\t嵊州市\t3306\n" + - "330702\t婺城区\t3307\n" + - "330703\t金东区\t3307\n" + - "330723\t武义县\t3307\n" + - "330726\t浦江县\t3307\n" + - "330727\t磐安县\t3307\n" + - "330781\t兰溪市\t3307\n" + - "330782\t义乌市\t3307\n" + - "330783\t东阳市\t3307\n" + - "330784\t永康市\t3307\n" + - "330802\t柯城区\t3308\n" + - "330803\t衢江区\t3308\n" + - "330822\t常山县\t3308\n" + - "330824\t开化县\t3308\n" + - "330825\t龙游县\t3308\n" + - "330881\t江山市\t3308\n" + - "330902\t定海区\t3309\n" + - "330903\t普陀区\t3309\n" + - "330921\t岱山县\t3309\n" + - "330922\t嵊泗县\t3309\n" + - "331002\t椒江区\t3310\n" + - "331003\t黄岩区\t3310\n" + - "331004\t路桥区\t3310\n" + - "331022\t三门县\t3310\n" + - "331023\t天台县\t3310\n" + - "331024\t仙居县\t3310\n" + - "331081\t温岭市\t3310\n" + - "331082\t临海市\t3310\n" + - "331102\t莲都区\t3311\n" + - "331121\t青田县\t3311\n" + - "331122\t缙云县\t3311\n" + - "331123\t遂昌县\t3311\n" + - "331124\t松阳县\t3311\n" + - "331125\t云和县\t3311\n" + - "331126\t庆元县\t3311\n" + - "331127\t景宁畲族自治县\t3311\n" + - "331181\t龙泉市\t3311\n" + - "340102\t瑶海区\t3401\n" + - "340103\t庐阳区\t3401\n" + - "340104\t蜀山区\t3401\n" + - "340111\t包河区\t3401\n" + - "340121\t长丰县\t3401\n" + - "340122\t肥东县\t3401\n" + - "340123\t肥西县\t3401\n" + - "340124\t庐江县\t3401\n" + - "340171\t合肥高新技术产业开发区\t3401\n" + - "340172\t合肥经济技术开发区\t3401\n" + - "340173\t合肥新站高新技术产业开发区\t3401\n" + - "340181\t巢湖市\t3401\n" + - "340202\t镜湖区\t3402\n" + - "340203\t弋江区\t3402\n" + - "340207\t鸠江区\t3402\n" + - "340208\t三山区\t3402\n" + - "340221\t芜湖县\t3402\n" + - "340222\t繁昌县\t3402\n" + - "340223\t南陵县\t3402\n" + - "340225\t无为县\t3402\n" + - "340271\t芜湖经济技术开发区\t3402\n" + - "340272\t安徽芜湖长江大桥经济开发区\t3402\n" + - "340302\t龙子湖区\t3403\n" + - "340303\t蚌山区\t3403\n" + - "340304\t禹会区\t3403\n" + - "340311\t淮上区\t3403\n" + - "340321\t怀远县\t3403\n" + - "340322\t五河县\t3403\n" + - "340323\t固镇县\t3403\n" + - "340371\t蚌埠市高新技术开发区\t3403\n" + - "340372\t蚌埠市经济开发区\t3403\n" + - "340402\t大通区\t3404\n" + - "340403\t田家庵区\t3404\n" + - "340404\t谢家集区\t3404\n" + - "340405\t八公山区\t3404\n" + - "340406\t潘集区\t3404\n" + - "340421\t凤台县\t3404\n" + - "340422\t寿县\t3404\n" + - "340503\t花山区\t3405\n" + - "340504\t雨山区\t3405\n" + - "340506\t博望区\t3405\n" + - "340521\t当涂县\t3405\n" + - "340522\t含山县\t3405\n" + - "340523\t和县\t3405\n" + - "340602\t杜集区\t3406\n" + - "340603\t相山区\t3406\n" + - "340604\t烈山区\t3406\n" + - "340621\t濉溪县\t3406\n" + - "340705\t铜官区\t3407\n" + - "340706\t义安区\t3407\n" + - "340711\t郊区\t3407\n" + - "340722\t枞阳县\t3407\n" + - "340802\t迎江区\t3408\n" + - "340803\t大观区\t3408\n" + - "340811\t宜秀区\t3408\n" + - "340822\t怀宁县\t3408\n" + - "340825\t太湖县\t3408\n" + - "340826\t宿松县\t3408\n" + - "340827\t望江县\t3408\n" + - "340828\t岳西县\t3408\n" + - "340871\t安徽安庆经济开发区\t3408\n" + - "340881\t桐城市\t3408\n" + - "340882\t潜山市\t3408\n" + - "341002\t屯溪区\t3410\n" + - "341003\t黄山区\t3410\n" + - "341004\t徽州区\t3410\n" + - "341021\t歙县\t3410\n" + - "341022\t休宁县\t3410\n" + - "341023\t黟县\t3410\n" + - "341024\t祁门县\t3410\n" + - "341102\t琅琊区\t3411\n" + - "341103\t南谯区\t3411\n" + - "341122\t来安县\t3411\n" + - "341124\t全椒县\t3411\n"; - System.out.println(x.replaceAll("\t",",")); - } - -} -*/ diff --git a/codemaker-parent/codemaker-core/src/test/java/ProjectTemplateConfigTest.java b/codemaker-parent/codemaker-core/src/test/java/ProjectTemplateConfigTest.java deleted file mode 100644 index a8cac22d716f369bb436e7537f99a4e6a6bc002e..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/test/java/ProjectTemplateConfigTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* -import com.coderman.codemaker.Main; -import com.coderman.codemaker.config.ProjectTemplateConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -*/ -/** - * description: ProjectTemplateConfigTest
- * date: 2020/7/7 22:34
- * author: coderman
- * version: 1.0
- *//* - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Main.class) -public class ProjectTemplateConfigTest { - @Autowired - private ProjectTemplateConfig projectTemplateConfig; - - @Test - public void testGetConfig(){ - System.out.println(projectTemplateConfig.toString()); - } - -} -*/ diff --git a/codemaker-parent/codemaker-core/src/test/java/TestTableName.java b/codemaker-parent/codemaker-core/src/test/java/TestTableName.java deleted file mode 100644 index c5e8d954cbf1c16b72ee1553368008b9307ee34e..0000000000000000000000000000000000000000 --- a/codemaker-parent/codemaker-core/src/test/java/TestTableName.java +++ /dev/null @@ -1,35 +0,0 @@ -/* -import org.junit.Test; - -*/ -/** - * description: TestTableName
- * date: 2020/7/7 20:42
- * author: coderman
- * version: 1.0
- *//* - -public class TestTableName { - @Test - public void testHumpTableName(){ - String resultName = ""; - String tableName1 = "room_source_equipment"; - if(!tableName1.contains("_")){ - resultName = tableName1; - }else { - String [] tableNameArr = tableName1.split("_"); - int length = tableNameArr.length; - - StringBuilder builder = new StringBuilder(); - builder.append(tableNameArr[0]); - for (int i = 1;i < length;i++){ - String tag = tableNameArr[i].substring(0,1).toUpperCase().concat(tableNameArr[i].substring(1).toLowerCase()); - builder.append(tag); - } - resultName = builder.toString(); - } - System.out.println("resultName = "+resultName); - - } -} -*/ diff --git a/codemaker-parent/codemaker-core/src/test/java/ClassLoaderTest.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/ClassLoaderTest.java similarity index 96% rename from codemaker-parent/codemaker-core/src/test/java/ClassLoaderTest.java rename to codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/ClassLoaderTest.java index ba2de1e79df240795372b20f3076325a9fa8083c..6ebe5d4e09245a19ba27635815599ccf0cb57674 100644 --- a/codemaker-parent/codemaker-core/src/test/java/ClassLoaderTest.java +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/ClassLoaderTest.java @@ -1,3 +1,5 @@ +package com.tianhua.codemaker.service.expertest; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -8,7 +10,7 @@ import java.lang.reflect.Method; * Description: * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/test/java/ClassLoaderTest2.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/ClassLoaderTest2.java similarity index 92% rename from codemaker-parent/codemaker-core/src/test/java/ClassLoaderTest2.java rename to codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/ClassLoaderTest2.java index f9d05eb2644b7643745ecbc4982d522480c88362..314e3e52459dcdf3761671a7948b099ce4203397 100644 --- a/codemaker-parent/codemaker-core/src/test/java/ClassLoaderTest2.java +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/ClassLoaderTest2.java @@ -1,13 +1,13 @@ -import java.io.File; +package com.tianhua.codemaker.service.expertest; + import java.lang.reflect.InvocationTargetException; import java.net.MalformedURLException; -import java.net.URLClassLoader; /** * Description: * date: 2021/12/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/test/java/RbcClassLoader.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/RbcClassLoader.java similarity index 96% rename from codemaker-parent/codemaker-core/src/test/java/RbcClassLoader.java rename to codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/RbcClassLoader.java index a0e97f428276ca23bb1abfb563c6105a4872a844..6c275c8019387258e9f0d4e2f06feffc910c2a16 100644 --- a/codemaker-parent/codemaker-core/src/test/java/RbcClassLoader.java +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/RbcClassLoader.java @@ -1,4 +1,4 @@ - +package com.tianhua.codemaker.service.expertest; import java.io.IOException; import java.lang.reflect.Field; @@ -11,7 +11,7 @@ import java.net.URLClassLoader; * Description: * date: 2021/11/22 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/test/java/Test2.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/Test2.java similarity index 94% rename from codemaker-parent/codemaker-core/src/test/java/Test2.java rename to codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/Test2.java index 0c4fbc491850ca5c5326e7a93948114a0d5f934e..cdb566b5257ce072187277761cc2d02e65a89894 100644 --- a/codemaker-parent/codemaker-core/src/test/java/Test2.java +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/Test2.java @@ -1,11 +1,12 @@ -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; +package com.tianhua.codemaker.service.expertest; + +import com.tianhua.codemaker.bean.ClassContentBean; +import com.tianhua.codemaker.bean.plantuml.ClassBean; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Map; -import java.lang.reflect.*; import java.util.*; @@ -13,7 +14,7 @@ import java.util.*; * Description: * date: 2021/12/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ diff --git a/codemaker-parent/codemaker-core/src/test/java/Test3.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/Test3.java similarity index 66% rename from codemaker-parent/codemaker-core/src/test/java/Test3.java rename to codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/Test3.java index d3b27a55a39678525f54b9ccd46498eeda9a4c7b..f37b526aa9e53c418d1d0648520a2f93c06defb1 100644 --- a/codemaker-parent/codemaker-core/src/test/java/Test3.java +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/expertest/Test3.java @@ -1,25 +1,22 @@ -import com.coderman.codemaker.bean.ClassContentBean; -import com.coderman.codemaker.bean.plantuml.ClassBean; +package com.tianhua.codemaker.service.expertest; + +import com.tianhua.codemaker.bean.ClassContentBean; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.regex.Pattern; /** * Description: * date: 2021/12/18 * - * @author fanchunshuai + * @author shenshuai * @version 1.0.0 * @since JDK 1.8 */ public class Test3 { public static void main(String[] args) throws NoSuchMethodException, SecurityException { - String paramStr = "java.util.List"; + String paramStr = "java.util.List"; String [] paramArr = paramStr.split("\\."); List paramList = new ArrayList<>(); diff --git a/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/AnnotationParseServiceTest.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/AnnotationParseServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a5df31d8460e64ccb5f65b8962643c49ddd0f732 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/AnnotationParseServiceTest.java @@ -0,0 +1,44 @@ +/* +package com.tianhua.codemaker.service.test; + +import com.tianhua.codemaker.service.AnnotationParseService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; +import org.springframework.stereotype.Service; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.util.ResourceUtils; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; + +*/ +/** + * Description: + * date: 2022/1/24 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + *//* + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {com.tianhua.codemaker.Main.class}) +public class AnnotationParseServiceTest{ + + @Autowired + private AnnotationParseService annotationParseService; + @Autowired + ResourceLoader resourceLoader; + @Test + public void testbuildAnnotationTagBeanMap(){ + annotationParseService.buildAnnotationTagBeanMap(); + } + +} +*/ diff --git a/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/BaseTest.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/BaseTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3dccdd9ac82ce33a9e9ea4057e7017afe1ee197a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/BaseTest.java @@ -0,0 +1,19 @@ +package com.tianhua.codemaker.service.test; + +import com.tianhua.codemaker.Main; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +/** + * Description: + * date: 2022/1/18 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {Main.class}) +public class BaseTest { +} diff --git a/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/ReadPlantUMLServiceTest.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/ReadPlantUMLServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..76501034db718aaa44ab59bb933a6663e35a276f --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/ReadPlantUMLServiceTest.java @@ -0,0 +1,47 @@ +/* +package com.tianhua.codemaker.service.test; + +import com.tianhua.codemaker.api.DomainElementHandler; +import com.tianhua.codemaker.api.IValidateService; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.service.plantuml.ReadDomainPlantDocService; +import com.tianhua.codemaker.service.plantuml.ReadPlantUMLDocService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; + +*/ +/** + * Description: + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + *//* + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {com.tianhua.codemaker.Main.class}) +public class ReadPlantUMLServiceTest { + + @Autowired + private ReadDomainPlantDocService readDomainPlantDocService; + + @Resource(name = "validateUtilService") + private IValidateService validateService; + @Resource(name = "domainBoElementHandler") + private DomainElementHandler domainElementHandler; + + @Test + public void testRead(){ + PlantUmlContextBean plantUmlContextBean = readDomainPlantDocService.getPlantUmlContextBean("auth-domainV5.puml"); + plantUmlContextBean.setDerivedPlantUmlContextBean(new PlantUmlContextBean()); + domainElementHandler.getElementBeanList(plantUmlContextBean); + validateService.dealValidate(plantUmlContextBean); + } +} +*/ diff --git a/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/VarRegistryServiceTest.java b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/VarRegistryServiceTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6749aa7199cafd6575b4d881c8115027ae657775 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/java/com/tianhua/codemaker/service/test/VarRegistryServiceTest.java @@ -0,0 +1,36 @@ +/* +package com.tianhua.codemaker.service.test; + +import com.tianhua.codemaker.service.registry.element.MapperXmlVarRegistry; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.annotation.Resource; +import java.util.Map; + +*/ +/** + * Description: + * date: 2022/1/25 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + *//* + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {com.tianhua.codemaker.Main.class}) +public class VarRegistryServiceTest { + + @Resource(name = "mapperXmlVarRegistry") + private MapperXmlVarRegistry mapperXmlVarRegistry; + + @Test + public void testGetTemplateVarMap(){ + Map map = mapperXmlVarRegistry.getTemplateVar(); + + } +} +*/ diff --git a/codemaker-parent/codemaker-core/src/test/resources/application.properties b/codemaker-parent/codemaker-core/src/test/resources/application.properties index 47848f37ee89dc90a844bae57ba1bff63ea09d7f..9f44f6a3c1fb19b968c557b43e5b61afee278226 100644 --- a/codemaker-parent/codemaker-core/src/test/resources/application.properties +++ b/codemaker-parent/codemaker-core/src/test/resources/application.properties @@ -10,32 +10,50 @@ spring.freemarker.expose-request-attributes=false spring.freemarker.expose-session-attributes=false spring.freemarker.expose-spring-macro-helpers=true spring.freemarker.prefer-file-system-access=true -# ص㣬 .ftl׺ļ +# 这是重点, 会过滤.ftl后缀的文件 spring.freemarker.suffix=.ftl -# spring boot ĬϵҳģĿ¼ +# spring boot 默认的页面模板存放目录 spring.freemarker.template-loader-path=classpath:/template/ spring.freemarker.settings.template_update_delay=0 spring.freemarker.settings.default_encoding=UTF-8 spring.freemarker.settings.classic_compatible=true -server.port=8083 -management.port=8073 +server.port=8099 -# -endpoints.cors.allowed-origins=http://127.0.0.1:8083 -endpoints.cors.allowed-methods=GET,POST - - -#ݿ +#数据库配置 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3306/coder_bank_product?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.url=jdbc:mysql://localhost:3306/infosys_auth?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=root -#.xmlļ· +#配置.xml文件路径 mybatis.config-locations=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:mapper/*.xml -#ģ· +#配置模型路径 mybatis.type-aliases-package=com.coderman.codemaker.bean +spring.application.name=codemaker +#生成的应用类型,支持springboot,dubbo,cola,springcloud +application.type=cola + +#目标应用根包名称 +application.global.package=com.coderman.infosys.auth +#作者 +application.global.author=shenshuai + +#是否链接目标数据库,默认是,不链接则需要在resources/er-plantuml文件夹下创建对应项目应用的plantuml e-r图文档, +#内部融合了codemaker-dberparse模块的功能可以解析并实现不链接具体应用的数据库而实现代码生成 +#application.global.linkdb=true +application.global.linkdb=false + + +#组件化需要的maven repository本地路径,用来扫描依赖的组件jar包 +application.maven.repo.path=jar:file:///Users/dasouche/programfile/maven/repo + +#代码生成需要的全局组件,框架中间件可以放到全局组件依赖配置里,类似于脚手架,或者自己封装的业务组件框架 +application.component.scan.config=dubbo,spring-web,openfeign +#自定义的组件扫描bean,defaultCompScanService为codeMaker默认实现支持全局组件的配置,开发者可以参考进行自定义扫描组件实现替代掉默认的 +application.component.scan.bean=defaultCompScanService +#自定义的组件装饰bean,defaultCompDecorateService默认实现支持全局组件的装饰,开发者可以参考进行自定义扫描组件实现替代掉默认的 +application.component.decorate.bean=defaultCompDecorateService diff --git a/codemaker-parent/codemaker-core/src/test/resources/class-import.properties b/codemaker-parent/codemaker-core/src/test/resources/class-import.properties new file mode 100644 index 0000000000000000000000000000000000000000..6d0f1f80dc66674e0486e86dc3b2be0aced416e9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/class-import.properties @@ -0,0 +1,4 @@ +ResultDataDto=com.coderman.utils.response.ResultDataDto +ResultDto=com.coderman.utils.response.ResultDto +PageDTO=com.coderman.utils.response.PageDTO +PageVO=com.coderman.utils.response.PageVO \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/LockA.properties b/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/LockA.properties new file mode 100644 index 0000000000000000000000000000000000000000..1bbe35ce22c1ef561db9d02c5beed528a8269ff9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/LockA.properties @@ -0,0 +1,3 @@ +packageName=${package}.domain.support.annotations +classAlias=@L +annotation= @Lock(key = "requestNo") \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/Transactional.properties b/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/Transactional.properties new file mode 100644 index 0000000000000000000000000000000000000000..66242879cea5db5cb1f69cbc4efa9587c65533ad --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/Transactional.properties @@ -0,0 +1,3 @@ +packageName=org.springframework.transaction.annotation.Transactional +classAlias=@T +annotation=@Transactional(rollbackFor = Exception.class) \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/TransactionalEventListener.properties b/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/TransactionalEventListener.properties new file mode 100644 index 0000000000000000000000000000000000000000..f27dc805cd85824c76a052d548e3c9fa2f64a22a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/component/annotationClass/TransactionalEventListener.properties @@ -0,0 +1,3 @@ +packageName=org.springframework.transaction.event.TransactionalEventListener +classAlias=@TE +annotation=@TransactionalEventListener(fallbackExecution = true) \ No newline at end of file diff --git a/doc/baseDB.md b/codemaker-parent/codemaker-core/src/test/resources/component/readme similarity index 100% rename from doc/baseDB.md rename to codemaker-parent/codemaker-core/src/test/resources/component/readme diff --git a/codemaker-parent/codemaker-core/src/test/resources/mapper/sqlMapper.xml b/codemaker-parent/codemaker-core/src/test/resources/mapper/sqlMapper.xml index 9dfd0f57e03883c7acc71f76d6c989d8af4d729d..294da0269fab1147a8414242981809dcf2813490 100644 --- a/codemaker-parent/codemaker-core/src/test/resources/mapper/sqlMapper.xml +++ b/codemaker-parent/codemaker-core/src/test/resources/mapper/sqlMapper.xml @@ -1,9 +1,9 @@ - + - SELECT TABLE_NAME AS tableName ,COLUMN_NAME columnName, COLUMN_DEFAULT AS columnDefaultValue,DATA_TYPE AS dataType, EXTRA AS extraInfo ,COLUMN_KEY AS columnKey,IS_NULLABLE AS isNullable, @@ -11,7 +11,7 @@ WHERE TABLE_SCHEMA = #{dbName} - SELECT TABLE_NAME AS tableName,TABLE_COMMENT AS tableComment FROM information_schema.TABLES WHERE TABLE_SCHEMA = #{dbName} diff --git a/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-cola.properties b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-cola.properties new file mode 100644 index 0000000000000000000000000000000000000000..406ba82e3cd4a70dd78f0310cebabb318f6b70cf --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-cola.properties @@ -0,0 +1,71 @@ + +#数据库名称 +cola.global.dbName=infosys_auth + +#应用名称,作为工程名称 +cola.global.applicationName=infosys-auth + +#应用别名与目标工程输出目录一致 +cola.global.applicationNameAlias=auth + + +#maven坐标-GAV---父级模块的GAV信息 +cola.pom.parent.groupId=com.coderman.infosys.auth +cola.pom.parent.artifactId=infosys-auth +cola.pom.parent.version=1.0.0.SNAPSHOT + +cola.code.app.project.path=/Users/dasouche/scworkspace/myspace/code-maker + +#目标工程输出目录,这里填写对应的工程的绝对路径 +#cola.code.outpath.cola-adapter=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-adapter +#cola.code.outpath.cola-infrast=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-infrast +#cola.code.outpath.cola-app=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-app +#cola.code.outpath.cola-domain=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-domain +#cola.code.outpath.cola-client=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-client +#cola.code.outpath.cola-start=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-start +#cola.code.outpath.cola-feign-api=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-feign-api + +#应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 +cola.domain.plantuml=auth-domainV5.puml +#cola.domain.plantuml= + +#是否构建api 文档,否则进行构建,默认构建 +cola.api.generator=true + +#需要导入的组件列表,多个逗号分割,适用于cola模块下依赖的业务组件包或者对外api接口包,或者cola项目本身已有的代码类,或者其他偏业务的工具类组件等等。 +#如要生成的项目会依赖 infosys-user 服务的api则在这里定义即可。 +cola.component.scan.config=apiresult,infosysuser,hutool-core + +#需要在领域文档和调用时序文档中识别的读操作统一语言 +cola.component.dsl.read=check + +#需要在领域文档和调用时序文档中识别的写操作统一语言 +cola.component.dsl.write=settle,apply + +#是否需要根据该参数设置请求参数的最后一级包名为request,默认false +cola.subpackage.request=true + +#是否需要根据该参数设置相应参数的最后一级包名为response,默认false +cola.subpackage.response=true + + + +#应用级组件中间件工具包的组件扫描bean配置 +cola.component.scan.beans=appCompScanService + +#应用级组件中间件工具包的组件装饰bean配置 +cola.component.decorate.beans=appCompDecorateService + +#代码工具类注册,项目初始化时可以帮助初始化对应的工具类 +#后面生成代码的时候可以删掉工具类,只专注于生成业务代码 +#格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 +cola.component.init.clazz=BaseEvent:domain,Application:start,BaseController:adapter,PageBO:domain,SpringApplicationContext:domain,AppEventPublisher:domain + +#项目各个模块需要依赖的pom gav配置 +cola.component.init.pom=apiresult:adapter,apiresult:client,hutool-core:app,hutool-core:adapter,apiresult:feignapi + +#自定义ftl代码元素,eg ftlFileName:classType:moduleName +cola.code.template.custom.ftl= + +#项目各个模块需要导入的配置文件 +cola.component.init.config=application_properties:start,log4j_properties:start,mybatis-config_xml:infrast diff --git a/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-dubbo.properties b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-dubbo.properties new file mode 100644 index 0000000000000000000000000000000000000000..fb6c548806bcf910c077c4defbc60dae9491a22a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-dubbo.properties @@ -0,0 +1,47 @@ + +#数据库名称 +dubbo.global.dbName=infosys_auth +#dubbo应用名 +dubbo.global.applicationName=infosys-auth + +#目标工程输出目录,这里填写对应的工程的绝对路径 +dubbo.code.outpath.dubbo-common=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-common +dubbo.code.outpath.dubbo-api=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-api +dubbo.code.outpath.dubbo-core=/Users/shenshuai/myspace/code-maker/codemaker-dubbo/dubbo-core + +#应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 +dubbo.domain.plantuml=auth-domainV5.puml + +#dubbo.domain.plantuml=SchoolManager.puml + +#是否构建api 文档,否则进行构建,默认构建 +dubbo.api.generator=true + +#是否需要根据该参数设置请求参数的最后一级包名为request,默认false +dubbo.subpackage.request=false + +#是否需要根据该参数设置相应参数的最后一级包名为response,默认false +dubbo.subpackage.response=false + + +#需要导入的组件列表,多个逗号分割 +dubbo.component.scan.config=apiresult,infosysuser,hutool-core + +#需要在领域文档和调用时序文档中识别的读操作统一语言 +dubbo.component.dsl.read=check + +#需要在领域文档和调用时序文档中识别的写操作统一语言 +dubbo.component.dsl.write=settle + + +#应用级组件中间件工具包的组件扫描bean配置 +dubbo.component.scan.beans=appCompScanService + +#应用级组件中间件工具包的组件装饰bean配置 +dubbo.component.decorate.beans=appCompDecorateService + +#应用级代码工具类注册,项目初始化时可以帮助初始化对应的工具类 +#后面生成代码的时候可以删掉工具类,只专注于生成业务代码 +#格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 +dubbo.component.init.clazz=BaseEvent:core,Application:core,SpringApplicationContext:core,AppEventPublisher:core + diff --git a/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-dynamicddd.properties b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-dynamicddd.properties new file mode 100644 index 0000000000000000000000000000000000000000..155816fe17a25f82f3fa7c5a2c048fd692bf2643 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-dynamicddd.properties @@ -0,0 +1,4 @@ +#目标工程输出目录,这里填写对应的codemaker-dynamicddd工程的绝对路径 +dynamicddd.code.outpath=/Users/shenshuai/myspace/code-maker/codemaker-dynamicddd +#领域plantUML 类图 +dynamicddd.domain.plantuml=SchoolManager.puml \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-springboot.properties b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-springboot.properties new file mode 100644 index 0000000000000000000000000000000000000000..bbf061eba82e8732ed54767b5de19b0bf74d4a6d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-springboot.properties @@ -0,0 +1,51 @@ +#数据库名称 +springboot.global.dbName=infosys_auth + +#项目名称 +springboot.global.applicationName=infosys-auth + +#maven坐标-GAV +codemaker.pom.groupId=com.snail.school.manager +codemaker.pom.artifactId=schoolmanager-web +codemaker.pom.version=1.0.0.SNAPSHOT +#目标工程输出目录,这里填写对应的codemaker-web工程的绝对路径 +codemaker.code.outpath=/Users/shenshuai/myspace/code-maker/codemaker-springboot + +#应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 +codemaker.domain.plantuml=auth-domainV5.puml +#codemaker.domain.plantuml=SchoolManager.puml + + +#是否构建api 文档,否则进行构建,默认构建 +springboot.api.generator=true + + +springboot.component.scan.config=apiresult,infosys-user + + +#需要在领域文档和调用时序文档中识别的读操作统一语言 +springboot.component.dsl.read=check + +#需要在领域文档和调用时序文档中识别的写操作统一语言 +springboot.component.dsl.write=settle + +#是否需要根据该参数设置请求参数的最后一级包名为request,默认false +springboot.subpackage.request=false + +#是否需要根据该参数设置相应参数的最后一级包名为response,默认false +springboot.subpackage.response=false + + + +#应用级组件中间件工具包的组件扫描bean配置 +springboot.component.scan.beans=appCompScanService + + +#应用级组件中间件工具包的组件装饰bean配置 +springboot.component.decorate.beans=appCompDecorateService + + +#应用级代码工具类注册,项目初始化时可以帮助初始化对应的工具类 +#后面生成代码的时候可以删掉工具类,只专注于生成业务代码 +#格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 +springboot.component.init.clazz=BaseEvent:springboot,Application:springboot,SpringApplicationContext:springboot,AppEventPublisher:springboot \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-springcloud.properties b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-springcloud.properties new file mode 100644 index 0000000000000000000000000000000000000000..0383715fc2a8d5b663b1fa41b93a74ec774fb015 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/projecttemplate-springcloud.properties @@ -0,0 +1,53 @@ +#数据库名称 +springcloud.global.dbName=infosys_auth + +#项目名称 +springcloud.global.applicationName=infosys-auth + +#maven坐标-GAV +springcloud.pom.groupId=com.snail.school.manager +springcloud.pom.artifactId=schoolmanager-web +springcloud.pom.version=1.0.0.SNAPSHOT +#目标工程输出目录,这里填写对应的codemaker-web工程的绝对路径 +springcloud.code.feign-api=/Users/shenshuai/myspace/code-maker/codemaker-springcloud/springcloud-api +springcloud.code.feign-provider=/Users/shenshuai/myspace/code-maker/codemaker-springcloud/springcloud-provider + +#应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 +springcloud.domain.plantuml=auth-domainV5.puml +#springcloud.domain.plantuml=SchoolManager.puml + + +#是否构建api 文档,否则进行构建,默认构建 +springcloud.api.generator=true + +#需要导入的组件列表,多个逗号分割,适用于cola模块下依赖的业务组件包或者对外api接口包,或者cola项目本身已有的代码类,或者其他偏业务的工具类组件等等。 +#如要生成的项目会依赖 infosys-user 服务的api则在这里定义即可 +springcloud.component.scan.config=apiresult + + +#需要在领域文档和调用时序文档中识别的读操作统一语言 +springcloud.component.dsl.read=check + +#需要在领域文档和调用时序文档中识别的写操作统一语言 +springcloud.component.dsl.write=settle + +#是否需要根据该参数设置请求参数的最后一级包名为request,默认false +springcloud.subpackage.request=false + +#是否需要根据该参数设置相应参数的最后一级包名为response,默认false +springcloud.subpackage.response=false + + + +#应用级组件中间件工具包的组件扫描bean配置,如无特定技术栈,无需更换该组件 +springcloud.component.scan.beans=appCompScanService + + +#应用级组件中间件工具包的组件装饰bean配置,如无特定技术栈,无需更换该组件 +springcloud.component.decorate.beans=appCompDecorateService + + +#应用级代码工具类注册,项目初始化时可以帮助初始化对应的工具类 +#后面生成代码的时候可以删掉工具类,只专注于生成业务代码 +#格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 +springcloud.component.init.clazz=BaseEvent:provider,Application:provider,SpringApplicationContext:provider,AppEventPublisher:provider \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/SpringApplicationContext.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/SpringApplicationContext.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f00b4e93e1d933067d247c6a32766ed4ffb6d60a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/SpringApplicationContext.ftl @@ -0,0 +1,40 @@ +/* + * Copyright 2014 Jeanfrancois Arcand + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + package ${package}.context; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringApplicationContext implements BeanFactoryAware { + + private static BeanFactory springBeanFactory; + + @Override + public synchronized void setBeanFactory(BeanFactory beanFactory) throws BeansException { + springBeanFactory = beanFactory; + } + + public synchronized static T getBean(Class klass) { + return springBeanFactory.getBean(klass); + } + + public synchronized static Object getBean(String beanName) { + return springBeanFactory.getBean(beanName); + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/api/http.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/api/http.ftl new file mode 100644 index 0000000000000000000000000000000000000000..92d57ee009efa2c83f362836020e473c2e688252 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/api/http.ftl @@ -0,0 +1,25 @@ +## 模块-${moduleDesc} + + +### API列表 +<#list apiList as api> + +#### ${api.interfaceDesc} +1. 访问路径:${api.httpPath} +2. 访问方式: +3. 接口参数: + +| 属性名 | 类型 | 描述 | 是否必填 | +| ---- | ---- | ---- | ---- | + <#list api.paramBeanList as param> +| ${param.fieldName} | ${param.fieldType} | ${param.fieldDesc} | ${param.nullable} | + + + + +4. 返回值:${api.returnClass} + + + +### 公共说明 + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/api/rpc.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/api/rpc.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c1afbf91c26950af7913f6a6093a7eda374aa75d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/api/rpc.ftl @@ -0,0 +1,24 @@ +## 模块-${moduleDesc} + +### 接口签名 + +${moduleApi} + + +### API列表 +<#list apiList as api> + +#### ${api.interfaceDesc} +1. 接口签名:${api.interfaceName} +2. 接口参数: + +| 属性名 | 类型 | 描述 | 是否必填 | +| ---- | ---- | ---- | ---- | +<#list api.paramBeanList as param> +| ${param.fieldName} | ${param.fieldType} | ${param.fieldDesc} | ${param.nullable} | + +3. 返回值:${api.returnClass} + + +### 公共说明 + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/application.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/application.ftl new file mode 100644 index 0000000000000000000000000000000000000000..b64ca55af5fd09d4bfe60c8a1d04390c378625ad --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/application.ftl @@ -0,0 +1,40 @@ +package ${package}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.client.RestTemplate; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:应用启动入口 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@EnableDiscoveryClient +@ComponentScan({"com.lightsnail.**","com.alibaba.nacos","com.coderman.**"}) +public class Application { + @LoadBalanced + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/applicationproperties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e0b6effa2a294f699e3847340a41cf906dff0c17 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/applicationproperties.ftl @@ -0,0 +1,21 @@ +server.port=8083 +management.port=8073 + +# 跨域 +endpoints.cors.allowed-origins=http://127.0.0.1:8083 +endpoints.cors.allowed-methods=GET,POST + + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/coder_bank_product?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=root + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=com.tianhua.codemaker.bean + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/baseController.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/baseController.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9aeaf34f9473743def40c5f43d47157f84466aa1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/baseController.ftl @@ -0,0 +1,45 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** +* @Description:控制层基础父类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class BaseController{ + + protected Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 从request中获取指定的字符串 + * @param parameterName + * @return + */ + protected String getParameterString(String parameterName) { + //return RequestUtil.getParameterString(parameterName); + return ""; + } + + /** + * 从request中获取指定的整型 + * @param parameterName + * @return + */ + protected Integer getParameterInteger(String parameterName) { + // return RequestUtil.getParameterInteger(parameterName); + return 0; + } + + /** + * 从request中获取指定的长整型 + * @param parameterName + * @return + */ + protected Long getParameterLong(String parameterName) { + //return RequestUtil.getParameterLong(parameterName); + return 0L; + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/AppEventPublisher.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/AppEventPublisher.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a46044426b5c0ba29e5c9aba113dbbac727f4761 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/AppEventPublisher.ftl @@ -0,0 +1,18 @@ +package ${package}.utils; + +import ${package}.domain.event.BaseEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +@Component +public class AppEventPublisher { + + @Autowired + private ApplicationContext applicationContext; + + public void publish(T t) { + applicationContext.publishEvent(t); + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/BaseEvent.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/BaseEvent.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4ff2d9325cbbb820b018940f57ffd1c6968cd2c7 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/BaseEvent.ftl @@ -0,0 +1,9 @@ +package ${package}.domain.event; + +import org.springframework.context.ApplicationEvent; + +public class BaseEvent extends ApplicationEvent { + public BaseEvent(Object source) { + super(source); + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/SpringApplicationContext.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/SpringApplicationContext.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a6e7b6374ce46bd405e58bf3bd179e2feffe8b6b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/SpringApplicationContext.ftl @@ -0,0 +1,40 @@ +/* + * Copyright 2014 Jeanfrancois Arcand + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + package ${package}.utils; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringApplicationContext implements BeanFactoryAware { + + private static BeanFactory springBeanFactory; + + @Override + public synchronized void setBeanFactory(BeanFactory beanFactory) throws BeansException { + springBeanFactory = beanFactory; + } + + public synchronized static T getBean(Class klass) { + return springBeanFactory.getBean(klass); + } + + public synchronized static Object getBean(String beanName) { + return springBeanFactory.getBean(beanName); + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/abstractexe.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/abstractexe.ftl new file mode 100644 index 0000000000000000000000000000000000000000..32d6d57cb6824b6e6c78eb7f8005e4cb0c33be41 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/abstractexe.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public abstract class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public abstract ${method.returnClass} ${method.methodName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/acl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/acl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/acl.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/aclimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/aclimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..0c1a4ee78200bbd0e9696da6c74044bd557816f9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/aclimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @${field.annotation} + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/adapterpom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/adapterpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..90d747976c0b08fd7ba378c2ac92516d6b4cbb4f --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/adapterpom.ftl @@ -0,0 +1,109 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-adapter + 1.0-SNAPSHOT + + ${modulePrefix}-adapter + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.springframework + spring-context + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.mapstruct + mapstruct + + + + ${groupId} + ${modulePrefix}-app + 1.0-SNAPSHOT + + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + ${dependency.version} + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/apppom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/apppom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c91ce56697cc09d2fe493ddd13f86540eb8c7b14 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/apppom.ftl @@ -0,0 +1,140 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-app + 1.0-SNAPSHOT + + ${modulePrefix}-app + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + + org.springframework.boot + spring-boot-test + + + org.springframework + spring-test + + + + + org.projectlombok + lombok + + + + + org.apache.dubbo + dubbo-spring-boot-starter + + + org.apache.dubbo + dubbo + + + + + + org.apache.dubbo + dubbo-registry-nacos + + + com.alibaba.nacos + nacos-client + + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.aspectj + aspectjweaver + + + + org.assertj + assertj-core + + + + ${groupId} + ${modulePrefix}-client + 1.0-SNAPSHOT + + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + + + + ${groupId} + ${modulePrefix}-infrast + 1.0-SNAPSHOT + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + ${dependency.version} + + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/baseController.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/baseController.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9aeaf34f9473743def40c5f43d47157f84466aa1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/baseController.ftl @@ -0,0 +1,45 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** +* @Description:控制层基础父类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class BaseController{ + + protected Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 从request中获取指定的字符串 + * @param parameterName + * @return + */ + protected String getParameterString(String parameterName) { + //return RequestUtil.getParameterString(parameterName); + return ""; + } + + /** + * 从request中获取指定的整型 + * @param parameterName + * @return + */ + protected Integer getParameterInteger(String parameterName) { + // return RequestUtil.getParameterInteger(parameterName); + return 0; + } + + /** + * 从request中获取指定的长整型 + * @param parameterName + * @return + */ + protected Long getParameterLong(String parameterName) { + //return RequestUtil.getParameterLong(parameterName); + return 0L; + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/bo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/bo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..79fea9d311357de16ed8e3d6fc0dbc83dbc3c445 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/bo.ftl @@ -0,0 +1,24 @@ +package ${package}.model.bo; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}BO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}BO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/boddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/boddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6107567ccb4101f3e4384e086c235c719e343b36 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/boddd.ftl @@ -0,0 +1,37 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/cache.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/cache.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/cache.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/clientpom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/clientpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..db135d9bec44cace0fe08db69c6c327ea91ecd8d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/clientpom.ftl @@ -0,0 +1,52 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-client + 1.0-SNAPSHOT + + ${modulePrefix}-client + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + ${dependency.version} + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/controller.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/controller.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3c88f6d538a3d5c5784303201653be94a35443b2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/controller.ftl @@ -0,0 +1,103 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${table.humpClassName}Controller extends BaseController{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}Controller.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + + + /** + * @Description:新增${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/add",method = RequestMethod.POST) + public ResultDto add(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:修改${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/update",method = RequestMethod.POST) + public ResultDto update(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据id删除${table.tableComment} + * @version v1.0 + * @param id + * @return ResultDto + */ + @PostMapping("/${table.humpTableName}/delete") + public ResultDto delete(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据ID获取${table.tableComment}单条记录 + * @version v1.0 + * @param id + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/get") + public ResultDataDto getById(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:分页获取${table.tableComment}记录 + * @version v1.0 + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/getpage") + public ResultDataDto getPage(){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:修改${table.tableComment}状态 + * @version v1.0 + * @param id + * @param status + * @return ResultDataDto + */ + @PostMapping("/${table.humpTableName}/changestatus") + public ResultDto changeStatus(@RequestParam(name = "id") Long id,@RequestParam(name = "status") int status){ + //todo impl code + return new ResultDto(); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/controllerddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/controllerddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..570a4e93153a5f60083038aa4dca8e1a715ee0b6 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/controllerddd.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +<#list imports as importClass> +import ${importClass}; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${class.className} { + + protected Logger logger = LoggerFactory.getLogger(${class.className}.class); + +<#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + +${method.doc} + @RequestMapping(value = "${method.pathValue}") + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/convert.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/convert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/convert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/do.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/do.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5cb6980c8680c78017324dca6939094acf5835ec --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/do.ftl @@ -0,0 +1,24 @@ +package ${packageInfrast}.dao.dataobject; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}DO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}DO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/domainpom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/domainpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..941dc81f7495197bd84a2e719f36bcc6c8b9abe3 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/domainpom.ftl @@ -0,0 +1,49 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + ${modulePrefix}-domain + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + org.projectlombok + lombok + + + + org.springframework + spring-context + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + ${dependency.version} + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/dto.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/dto.ftl new file mode 100644 index 0000000000000000000000000000000000000000..12465ba0cc11a90cdf0a02265ce52772ceeab0ac --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/dto.ftl @@ -0,0 +1,25 @@ +package ${package}.api.dto; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; +import java.io.Serializable; + + +/** +* @Description:${table.tableComment}DTO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${table.humpClassName}DTO implements Serializable { + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/dtoddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/dtoddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9d21fd692e7e09efe9f09957501c8a513bb16aba --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/dtoddd.ftl @@ -0,0 +1,37 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + +/** +* @Description:${class.classDesc}类 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + +<#list fields as field> + /** ${field.desc} **/ + + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/enum.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/enum.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a1b21d01802da8506845b0b35620698a22403f49 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/enum.ftl @@ -0,0 +1,47 @@ +package ${class.packageName}; + +import lombok.Getter; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Getter +public enum ${class.className}{ + + /** + * + */ + <#list enums as enumValue> + ${enumValue}, + + ; + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + + ${class.className}(${class.constructParamStr}){ + <#list bodys as body> + ${body}; + + } + + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public static ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/event.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/event.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9f15e120dfe9a271ea823b5e318410cbd3be5c44 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/event.ftl @@ -0,0 +1,35 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/exeimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/exeimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6a8d75475a8c42353b308de6c43e6e9bd173bca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/exeimpl.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import ${class.packageName}.${class.className}; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/facade.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facade.ftl new file mode 100644 index 0000000000000000000000000000000000000000..25af93e70591fa7565dcc59cc3d5736f054cbd41 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facade.ftl @@ -0,0 +1,68 @@ +package ${package}.api.facade; + +import java.util.List; +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; +import com.coderman.utils.response.PageDTO; + +import ${package}.api.dto.${table.humpClassName}DTO; + +/** + * @Description:${table.tableComment}Facade接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Facade{ + + /** + * @Description:新增${table.tableComment} + * @author: + * @param dto + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto save(${table.humpClassName}DTO dto) throws Exception; + + /** + * + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto delete(Long id); + + /** + * + * @Description: 通过id查询 + * @param @param id + * @return ResultDataDto<${table.humpClassName}DTO> + * @throws + */ + public ResultDataDto<${table.humpClassName}DTO> getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getAll() throws Exception; + + /** + * @Description:修改 + * @param @param ${table.humpTableName}DTO + * @return int + * @throws + */ + public ResultDto update(${table.humpClassName}DTO ${table.humpTableName}DTO) throws Exception; + + + /** + * @Description:分页查询记录 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getPageList(PageDTO pageDto) throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeaop.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeaop.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a55098013dd51cd0d11ff8e072098510dd117193 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeaop.ftl @@ -0,0 +1,37 @@ +package ${package}.core.aop; + + +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.reflection.ExceptionUtil; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +/** +* +*/ +@Component +@Aspect +@Slf4j +public class FacadeServiceAop { + @Around(value = "execution( public * ${package}.core.facade.impl..*(..))") + public Object transferException(ProceedingJoinPoint joinPoint) throws Exception { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + try { + log.info("=", method.getDeclaringClass().getName(), method.getName(), JSON.toJSONString(joinPoint.getArgs())); + Object result = joinPoint.proceed(); + log.info("=", method.getDeclaringClass().getName(), method.getName(), JSON.toJSONString(result)); + return result; + } catch (Throwable exception) { + throw new Exception(); + } + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..2ccce459c40a9dade9a9323e059fea5dae1a788d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeddd.ftl @@ -0,0 +1,20 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public interface ${class.className}{ +<#list methods as method> + +${method.doc} + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bc8bcef292d1c6ebe39129410b005d4ef1a7b941 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeimpl.ftl @@ -0,0 +1,72 @@ +package ${package}.app.facadeimpl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.dubbo.config.annotation.Service; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; +import com.coderman.utils.response.PageDTO; + +import ${package}.api.facade.${table.humpClassName}Facade; +import ${package}.api.dto.${table.humpClassName}DTO; + +import java.util.List; + +/** + * @Description:${table.tableComment}Facade接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${table.humpClassName}FacadeImpl implements ${table.humpClassName}Facade{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + @Override + public ResultDto save(${table.humpClassName}DTO dto) { + ResultDto resultDto = new ResultDto(); + //todo impl code + return resultDto; + } + + @Override + public ResultDto delete(Long id) { + ResultDto resultDto = new ResultDto(); + logger.info("${table.humpTableName}Service.delete,id="+id); + //todo impl code + return resultDto; + } + + @Override + public ResultDataDto<${table.humpClassName}DTO> getById(Long id) { + ResultDataDto<${table.humpClassName}DTO> resultDataDto = new ResultDataDto<${table.humpClassName}DTO>(); + logger.info("${table.humpTableName}Service.getById,id="+id); + //todo impl code + return resultDataDto; + } + + @Override + public ResultDataDto> getAll() { + ResultDataDto> resultDataDto = new ResultDataDto>(); + //todo impl code + return resultDataDto; + } + + @Override + public ResultDto update(${table.humpClassName}DTO dto) { + ResultDto resultDto = new ResultDto(); + //todo impl code + return resultDto; + } + + @Override + public ResultDataDto> getPageList(PageDTO pageDto) { + ResultDataDto> resultDataDto = new ResultDataDto>(); + //todo impl code + return resultDataDto; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeimplddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeimplddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..ea57774dd92fcadb4f8c7a282e948a7fd2f04c2c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/facadeimplddd.ftl @@ -0,0 +1,37 @@ +package ${class.packageName}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +${class.annotation} +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + +<#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/factory.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/factory.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/factory.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/feign.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feign.ftl new file mode 100644 index 0000000000000000000000000000000000000000..25af93e70591fa7565dcc59cc3d5736f054cbd41 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feign.ftl @@ -0,0 +1,68 @@ +package ${package}.api.facade; + +import java.util.List; +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; +import com.coderman.utils.response.PageDTO; + +import ${package}.api.dto.${table.humpClassName}DTO; + +/** + * @Description:${table.tableComment}Facade接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Facade{ + + /** + * @Description:新增${table.tableComment} + * @author: + * @param dto + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto save(${table.humpClassName}DTO dto) throws Exception; + + /** + * + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto delete(Long id); + + /** + * + * @Description: 通过id查询 + * @param @param id + * @return ResultDataDto<${table.humpClassName}DTO> + * @throws + */ + public ResultDataDto<${table.humpClassName}DTO> getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getAll() throws Exception; + + /** + * @Description:修改 + * @param @param ${table.humpTableName}DTO + * @return int + * @throws + */ + public ResultDto update(${table.humpClassName}DTO ${table.humpTableName}DTO) throws Exception; + + + /** + * @Description:分页查询记录 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getPageList(PageDTO pageDto) throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignapipom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignapipom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..8c0f2fcc05b76d29039017cf91d08f875abec4ed --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignapipom.ftl @@ -0,0 +1,74 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + com.codemaker.cola + ${modulePrefix}-feign-api + 1.0-SNAPSHOT + + ${modulePrefix}-feign-api + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.projectlombok + lombok + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.springframework + spring-context + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9607631a0695ae5b502f081cdc2b1756462455b0 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignddd.ftl @@ -0,0 +1,22 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +${class.annotation} +public interface ${class.className}{ +<#list methods as method> + +${method.doc} + @RequestMapping(value = "${method.pathValue}") + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignproviderpom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignproviderpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9421b195d91e2dccb047eb6015182bfa37eb9e80 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/feignproviderpom.ftl @@ -0,0 +1,84 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + com.codemaker.cola + ${modulePrefix}-feign-api + 1.0-SNAPSHOT + + ${modulePrefix}-feign-api + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.11 + test + + + + org.projectlombok + lombok + + + + org.slf4j + slf4j-ext + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-log4j12 + + + + org.springframework + spring-context + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + + com.codemaker.cola + cola-app + 1.0-SNAPSHOT + + + + com.codemaker.cola + cola-domain + 1.0-SNAPSHOT + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/gataway.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/gataway.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c22e22b86d2bb4ab483e7e0215e5498c73decec9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/gataway.ftl @@ -0,0 +1,20 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + +${method.doc} + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/gatawayimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/gatawayimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6f4af81d020f8b3407df0579a172f77ea443aad1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/gatawayimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/infrastpom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/infrastpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a43e58296605eb1c0ff44d340f0aaaca96b52267 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/infrastpom.ftl @@ -0,0 +1,108 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-infrast + 1.0-SNAPSHOT + + ${modulePrefix}-infrast + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.springframework + spring-context + + + + ${groupId} + ${modulePrefix}-domain + 1.0-SNAPSHOT + + + + + org.slf4j + slf4j-api + + + + org.slf4j + slf4j-ext + + + + org.slf4j + slf4j-log4j12 + + + + org.mapstruct + mapstruct-processor + + + + org.mapstruct + mapstruct-jdk8 + + + + org.mapstruct + mapstruct + + + + org.mybatis + mybatis + 3.4.6 + compile + + + + + + org.apache.dubbo + dubbo-spring-boot-starter + + + org.apache.dubbo + dubbo + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + ${dependency.version} + + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapper.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapper.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c66fddfca85b9627b4109953a770f81ec4575d04 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapper.ftl @@ -0,0 +1,65 @@ +package ${packageInfrast}.dao.mapper; + +import java.util.List; +import ${packageInfrast}.dao.dataobject.${table.humpClassName}DO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +/** + * @Description:${table.tableComment}mapperDAO接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Mapper +public interface ${table.humpClassName}Mapper{ + + /** + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public long insert(${table.humpClassName}DO ${table.humpTableName}DO); + + /** + * @Description: 通过id删除数据 + * @param id + * @return int + */ + public int deleteById(Long id); + + /** + * @Description: 通过id查询 + * @param id + * @return ResultDataDto<${table.humpClassName}DO> + */ + public ${table.humpClassName}DO getById(Long id); + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getAll(); + + /** + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public int update(${table.humpClassName}DO ${table.humpTableName}DO); + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getPageList(); + + + /** + * @Description:查询数量 + * @return int + */ + public int getCount(); + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..786135a0d5679c34e40d3167f601a5b5dfb17f32 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperddd.ftl @@ -0,0 +1,25 @@ +package ${class.packageName}; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +<#list imports as importClass> +import ${importClass}; + + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + +<#list methods as method> +${method.doc} + ${method.returnClass} ${method.methodName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperxml.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperxml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..09384958461d99720c6e3a04db346fa30b14f5ca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperxml.ftl @@ -0,0 +1,62 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperxmlddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..7d50a9abc14735d5c345f581d318c4ba35bb7d4d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mapperxmlddd.ftl @@ -0,0 +1,59 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + +<#list fields as field> +${field.fieldName} + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqconsumer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqconsumer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqhandler.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqhandler.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqhandler.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqlistener.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqlistener.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqlistener.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqproducer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqproducer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/mqproducer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/msgbody.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/msgbody.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9f15e120dfe9a271ea823b5e318410cbd3be5c44 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/msgbody.ftl @@ -0,0 +1,35 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/parentpom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/parentpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..b6dda14ccd60f5f35fe630fc2cc83a8b28209449 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/parentpom.ftl @@ -0,0 +1,227 @@ + + + + 4.0.0 + + ${groupId} + ${artifactId} + pom + ${version} + + ${modulePrefix}-adapter + ${modulePrefix}-domain + ${modulePrefix}-infrast + ${modulePrefix}-app + ${modulePrefix}-client + ${modulePrefix}-start + ${modulePrefix}-feignapi + + + ${artifactId} + + ${url} + + + UTF-8 + 1.8 + 1.8 + 1.8 + 2.1.9.RELEASE + 2.7.3 + 1.2.0.Final + 4.8.0 + + + + + + + + org.springframework.boot + spring-boot-dependencies + ${r'${spring-boot.version}'} + pom + import + + + + + org.apache.dubbo + dubbo-dependencies-bom + ${r'${dubbo.version}'} + pom + import + + + + org.apache.dubbo + dubbo-spring-boot-starter + ${r'${dubbo.version}'} + + + org.apache.dubbo + dubbo + ${r'${dubbo.version}'} + + + org.springframework + spring + + + javax.servlet + servlet-api + + + log4j + log4j + + + + + + com.alibaba.spring + spring-context-support + 1.0.5 + + + + org.mapstruct + mapstruct + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-processor + ${r'${mapstruct.version}'} + + + org.mapstruct + mapstruct-jdk8 + ${r'${mapstruct.version}'} + + + + + commons-collections + commons-collections + 3.2.1 + + + + com.alibaba + fastjson + 1.2.72 + + + + + commons-lang + commons-lang + 2.4 + + + + org.apache.dubbo + dubbo-registry-nacos + 2.7.3 + + + + + org.slf4j + slf4j-api + 1.7.28 + + + org.slf4j + slf4j-ext + 1.7.28 + + + + org.slf4j + slf4j-log4j12 + 1.7.28 + + + + org.springframework.boot + spring-boot-starter-log4j2 + ${r'${spring-boot.version}'} + + + + org.aspectj + aspectjweaver + 1.9.4 + + + + org.aspectj + aspectjrt + 1.8.13 + + + + org.assertj + assertj-core + 3.9.1 + + + + + org.apache.rocketmq + rocketmq-client + ${r'${rocketmq.version}'} + + + + + <#list dependencyList as dependency> + + ${dependency.groupId} + ${dependency.artifactId} + ${dependency.version} + + + + + + + + + + aliyun-releases + 阿里云仓库 + https://maven.aliyun.com/repository/public + + + apache.snapshots.https + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots + + false + + + true + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/service.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/service.ftl new file mode 100644 index 0000000000000000000000000000000000000000..83cea8c547d423d7aba65ce057b95c2851803693 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/service.ftl @@ -0,0 +1,62 @@ +package ${package}.service; + +import java.util.List; + +import ${package}.model.bo.${table.humpClassName}BO; + +/** + * @Description:${table.tableComment}Service接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Service{ + + /** + * @Description:新增 + * @param bo + * @return ResultDto 返回类型 + * @throws + */ + public ${table.humpClassName}BO save(${table.humpClassName}BO bo) throws Exception; + + /** + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public Boolean delete(Long id); + + /** + * @Description: 通过id查询 + * @param id + * @return ResultDataDto<${table.humpClassName}BO> + * @throws + */ + public ${table.humpClassName}BO getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getAll() throws Exception; + + /** + * @Description:修改 + * @param ${table.humpTableName}BO + * @return boolean + * @throws + */ + public Boolean update(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception; + + + /** + * @Description:分页查询数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getPageList() throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/serviceImpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..03c66a6a87bc817e844aae662e3b5fcc6f19b7ae --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/serviceImpl.ftl @@ -0,0 +1,58 @@ +package ${packageInfrast}.service.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import ${packageInfrast}.dao.mapper.${table.humpClassName}Mapper; +import ${package}.service.${table.humpClassName}Service; +import ${package}.model.bo.${table.humpClassName}BO; + +import java.util.List; + +/** + * @Description:${table.tableComment}Service接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${table.humpClassName}ServiceImpl implements ${table.humpClassName}Service{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private ${table.humpClassName}Mapper ${table.humpTableName}Mapper; + + @Override + public ${table.humpClassName}BO save(${table.humpClassName}BO bo) { + return null; + } + + @Override + public Boolean delete(Long id) { + return false; + } + + @Override + public ${table.humpClassName}BO getById(Long id) { + return null; + } + + @Override + public List<${table.humpClassName}BO> getAll() { + return null; + } + + @Override + public Boolean update(${table.humpClassName}BO bo) { + return false; + } + + + @Override + public List<${table.humpClassName}BO> getPageList() throws Exception { + return null; + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/startpom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/startpom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e2be5cb9a5b12e46ebad7f90865dd1fd088f0fff --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/startpom.ftl @@ -0,0 +1,55 @@ + + + + 4.0.0 + + + ${groupId} + ${artifactId} + ${version} + + + ${groupId} + ${modulePrefix}-start + 1.0-SNAPSHOT + + ${modulePrefix}-start + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.12 + test + + + + org.springframework.boot + spring-boot + + + + org.springframework.boot + spring-boot-starter-web + + + + org.mybatis + mybatis-spring + 2.0.5 + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/test.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/test.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bddd6827a33d6e58ca7d55206efe1c2510a4a550 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/test.ftl @@ -0,0 +1,107 @@ +package ${package}.service.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; +import ${package}.Application; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.alibaba.fastjson.JSON; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +/** +* @Description:${table.tableComment}单元测试 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT,classes = {Application.class}) +public class ${table.humpClassName}ServiceTest{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}ServiceTest.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + @Autowired + private TestRestTemplate restTemplate; + + /** + * @Description:测试新增${table.tableComment} 接口 + */ + @Test + public void testAdd(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/add",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试修改${table.tableComment} + */ + @Test + public void testUpdate(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/update",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试删除根据id删除${table.tableComment} + */ + @Test + public void testDelete(){ + //todo test code + long id = 1L; + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/delete",id, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:但是根据ID获取${table.tableComment}单条记录 + */ + @Test + public void testGetById(){ + //todo test code + ResultDataDto resultDataDto = restTemplate.getForEntity("/${table.humpTableName}/get?id=1",ResultDataDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDataDto)); + } + + /** + * @Description:测试分页获取${table.tableComment}记录 + */ + @Test + public void getPage(){ + //todo test code + } + + /** + * @Description:测试禁用${table.tableComment}状态 + */ + @Test + public void testDisable(){ + //todo test code + } + /** + * @Description:测试启用${table.tableComment}状态 + */ + @Test + public void testEnable(){ + //todo test code + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/valueobject.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/valueobject.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/valueobject.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/vo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/vo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..8113fd2240a602e78a54895474b39b7c1e56d0e4 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/vo.ftl @@ -0,0 +1,33 @@ +package ${package}.vo; + +import java.util.Date; +import java.math.BigDecimal; + +/** +* @Description:${table.tableComment}VO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class ${table.humpClassName}VO{ + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +<#list columns as column> + /** + * 描述:${column.columnComment} + */ + public ${column.columnTypeName} get${column.columnUperName}() { + return ${column.columnFieldName}; + } + /** + * 描述:${column.columnComment} + */ + public void set${column.columnUperName}(${column.columnTypeName} ${column.columnFieldName}) { + this.${column.columnFieldName} = ${column.columnFieldName}; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/cola/voddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/cola/voddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/cola/voddd.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/config/app_sql.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/config/app_sql.ftl new file mode 100644 index 0000000000000000000000000000000000000000..ae984f77e80966ab32b5c1826f6853b3b29228da --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/config/app_sql.ftl @@ -0,0 +1,15 @@ +server.port=8099 + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/infosys_auth?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username= +spring.datasource.password= + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=com.tianhua.codemaker.bean +spring.application.name=codemaker + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/config/application_properties.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/config/application_properties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..ae984f77e80966ab32b5c1826f6853b3b29228da --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/config/application_properties.ftl @@ -0,0 +1,15 @@ +server.port=8099 + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/infosys_auth?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username= +spring.datasource.password= + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=com.tianhua.codemaker.bean +spring.application.name=codemaker + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/config/log4j_properties.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/config/log4j_properties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9602da681fabd1d071959c4cfa3f24328b1b76ed --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/config/log4j_properties.ftl @@ -0,0 +1,10 @@ +log4j.rootLogger=info, ServerDailyRollingFile, stdout +log4j.appender.ServerDailyRollingFile=org.apache.log4j.DailyRollingFileAppender +log4j.appender.ServerDailyRollingFile.DatePattern='.'yyyy-MM-dd +log4j.appender.ServerDailyRollingFile.File=logs/notify-subscription.log +log4j.appender.ServerDailyRollingFile.layout=org.apache.log4j.PatternLayout +log4j.appender.ServerDailyRollingFile.layout.ConversionPattern=%d - %m%n +log4j.appender.ServerDailyRollingFile.Append=true +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH\:mm\:ss} %p [%c] %m%n \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/config/mybatis-config_xml.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/config/mybatis-config_xml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..51d0a7ad7220505f91f4be99d4fb38d816866e12 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/config/mybatis-config_xml.ftl @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/controller.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/controller.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3c88f6d538a3d5c5784303201653be94a35443b2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/controller.ftl @@ -0,0 +1,103 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${table.humpClassName}Controller extends BaseController{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}Controller.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + + + /** + * @Description:新增${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/add",method = RequestMethod.POST) + public ResultDto add(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:修改${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/update",method = RequestMethod.POST) + public ResultDto update(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据id删除${table.tableComment} + * @version v1.0 + * @param id + * @return ResultDto + */ + @PostMapping("/${table.humpTableName}/delete") + public ResultDto delete(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据ID获取${table.tableComment}单条记录 + * @version v1.0 + * @param id + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/get") + public ResultDataDto getById(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:分页获取${table.tableComment}记录 + * @version v1.0 + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/getpage") + public ResultDataDto getPage(){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:修改${table.tableComment}状态 + * @version v1.0 + * @param id + * @param status + * @return ResultDataDto + */ + @PostMapping("/${table.humpTableName}/changestatus") + public ResultDto changeStatus(@RequestParam(name = "id") Long id,@RequestParam(name = "status") int status){ + //todo impl code + return new ResultDto(); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/AppEventPublisher.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/AppEventPublisher.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a46044426b5c0ba29e5c9aba113dbbac727f4761 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/AppEventPublisher.ftl @@ -0,0 +1,18 @@ +package ${package}.utils; + +import ${package}.domain.event.BaseEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +@Component +public class AppEventPublisher { + + @Autowired + private ApplicationContext applicationContext; + + public void publish(T t) { + applicationContext.publishEvent(t); + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/BaseEvent.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/BaseEvent.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4ff2d9325cbbb820b018940f57ffd1c6968cd2c7 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/BaseEvent.ftl @@ -0,0 +1,9 @@ +package ${package}.domain.event; + +import org.springframework.context.ApplicationEvent; + +public class BaseEvent extends ApplicationEvent { + public BaseEvent(Object source) { + super(source); + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/SpringApplicationContext.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/SpringApplicationContext.ftl new file mode 100644 index 0000000000000000000000000000000000000000..53ad3cd74f27f7f37869a9398aa831801143335e --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/SpringApplicationContext.ftl @@ -0,0 +1,25 @@ +package ${package}.core.utils; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringApplicationContext implements BeanFactoryAware { + + private static BeanFactory springBeanFactory; + + @Override + public synchronized void setBeanFactory(BeanFactory beanFactory) throws BeansException { + springBeanFactory = beanFactory; + } + + public synchronized static T getBean(Class klass) { + return springBeanFactory.getBean(klass); + } + + public synchronized static Object getBean(String beanName) { + return springBeanFactory.getBean(beanName); + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/abstractexe.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/abstractexe.ftl new file mode 100644 index 0000000000000000000000000000000000000000..32d6d57cb6824b6e6c78eb7f8005e4cb0c33be41 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/abstractexe.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public abstract class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public abstract ${method.returnClass} ${method.methodName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/acl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/acl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/acl.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/aclimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/aclimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..0c1a4ee78200bbd0e9696da6c74044bd557816f9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/aclimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @${field.annotation} + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/application.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/application.ftl new file mode 100644 index 0000000000000000000000000000000000000000..0ad0924d1aec47d37779fe056a44b00d6bf4497a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/application.ftl @@ -0,0 +1,26 @@ +package ${package}; + + +import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan; +import org.apache.dubbo.config.spring.context.annotation.EnableDubbo; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** +* @Description:应用启动入口 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@DubboComponentScan(basePackages = "${package}") +@EnableDubbo //开启Dubbo的注解支持 +@SpringBootApplication(scanBasePackages = {"${package}"}) +@MapperScan(basePackages = "${package}.common.infrast") +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/applicationproperties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e0b6effa2a294f699e3847340a41cf906dff0c17 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/applicationproperties.ftl @@ -0,0 +1,21 @@ +server.port=8083 +management.port=8073 + +# 跨域 +endpoints.cors.allowed-origins=http://127.0.0.1:8083 +endpoints.cors.allowed-methods=GET,POST + + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/coder_bank_product?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=root + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=com.tianhua.codemaker.bean + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/bo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/bo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..79fea9d311357de16ed8e3d6fc0dbc83dbc3c445 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/bo.ftl @@ -0,0 +1,24 @@ +package ${package}.model.bo; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}BO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}BO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/boddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/boddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..1a43acac8202e47b8613705d0592615b6c3f14fd --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/boddd.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + + /** + * ${field.desc} + */ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/cache.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/cache.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/cache.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/convert.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/convert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/convert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/do.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/do.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5cb6980c8680c78017324dca6939094acf5835ec --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/do.ftl @@ -0,0 +1,24 @@ +package ${packageInfrast}.dao.dataobject; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}DO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}DO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/dto.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/dto.ftl new file mode 100644 index 0000000000000000000000000000000000000000..12465ba0cc11a90cdf0a02265ce52772ceeab0ac --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/dto.ftl @@ -0,0 +1,25 @@ +package ${package}.api.dto; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; +import java.io.Serializable; + + +/** +* @Description:${table.tableComment}DTO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${table.humpClassName}DTO implements Serializable { + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/dtoddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/dtoddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6a9dddea9b8cf3532406193faaf8945b45340d0a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/dtoddd.ftl @@ -0,0 +1,37 @@ +package ${class.packageName}; + +<#list imports as importClass> + import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + +/** +* @Description:${class.classDesc}类 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + +<#list fields as field> + /** ${field.desc} **/ + + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/enum.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/enum.ftl new file mode 100644 index 0000000000000000000000000000000000000000..27c66dd0e0190604a3c1c039819a08895cb3449c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/enum.ftl @@ -0,0 +1,47 @@ +package ${class.packageName}; + +import lombok.Getter; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Getter +public enum ${class.className}{ + + /** + * + */ + <#list enums as enumValue> + ${enumValue}, + + ; + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + + ${class.className}(${class.constructParamStr}){ + <#list bodys as body> + ${body}; + + } + + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public static ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/event.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/event.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9f15e120dfe9a271ea823b5e318410cbd3be5c44 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/event.ftl @@ -0,0 +1,35 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/exeimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/exeimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6a8d75475a8c42353b308de6c43e6e9bd173bca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/exeimpl.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import ${class.packageName}.${class.className}; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facade.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facade.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a86a9b4b43e105bc517f37c4769171e05a5525d2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facade.ftl @@ -0,0 +1,66 @@ +package ${package}.api.facade; + +import java.util.List; +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; +import com.coderman.utils.response.PageDTO; + +import ${package}.api.dto.${table.humpClassName}DTO; + +/** + * @Description:${table.tableComment}Facade接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Facade{ + + /** + * @Description:新增 + * @param dto + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto save(${table.humpClassName}DTO dto) throws Exception; + + /** + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto delete(Long id); + + /** + * @Description: 通过id查询 + * @param @param id + * @return ResultDataDto<${table.humpClassName}DTO> + * @throws + */ + public ResultDataDto<${table.humpClassName}DTO> getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getAll() throws Exception; + + /** + * @Description:修改 + * @param @param ${table.humpTableName}DTO + * @return int + * @throws + */ + public ResultDto update(${table.humpClassName}DTO ${table.humpTableName}DTO) throws Exception; + + + + /** + * @Description:分页查询记录 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getPageList(PageDTO pageDto) throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeImpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeImpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..96f996866c3cc43602bd618c24e84d9fcc208bfe --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeImpl.ftl @@ -0,0 +1,72 @@ +package ${package}.facade.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.dubbo.config.annotation.Service; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; +import com.coderman.utils.response.PageDTO; + +import ${package}.api.facade.${table.humpClassName}Facade; +import ${package}.api.dto.${table.humpClassName}DTO; + +import java.util.List; + +/** + * @Description:${table.tableComment}Facade接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${table.humpClassName}FacadeImpl implements ${table.humpClassName}Facade{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + @Override + public ResultDto save(${table.humpClassName}DTO dto) { + ResultDto resultDto = new ResultDto(); + //todo impl code + return resultDto; + } + + @Override + public ResultDto delete(Long id) { + ResultDto resultDto = new ResultDto(); + logger.info("${table.humpTableName}Service.delete,id="+id); + //todo impl code + return resultDto; + } + + @Override + public ResultDataDto<${table.humpClassName}DTO> getById(Long id) { + ResultDataDto<${table.humpClassName}DTO> resultDataDto = new ResultDataDto<${table.humpClassName}DTO>(); + logger.info("${table.humpTableName}Service.getById,id="+id); + //todo impl code + return resultDataDto; + } + + @Override + public ResultDataDto> getAll() { + ResultDataDto> resultDataDto = new ResultDataDto>(); + //todo impl code + return resultDataDto; + } + + @Override + public ResultDto update(${table.humpClassName}DTO dto) { + ResultDto resultDto = new ResultDto(); + //todo impl code + return resultDto; + } + + @Override + public ResultDataDto> getPageList(PageDTO pageDto) { + ResultDataDto> resultDataDto = new ResultDataDto>(); + //todo impl code + return resultDataDto; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeaop.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeaop.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4b8c4f9a441315ec6a094f1b4f7b557bc72a9152 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeaop.ftl @@ -0,0 +1,37 @@ +package ${package}.aop; + + +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.reflection.ExceptionUtil; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +/** +* +*/ +@Component +@Aspect +@Slf4j +public class FacadeServiceAop { + @Around(value = "execution( public * ${package}.app.facadeimpl..*(..))") + public Object transferException(ProceedingJoinPoint joinPoint) throws Exception { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + try { + log.info("=", method.getDeclaringClass().getName(), method.getName(), JSON.toJSONString(joinPoint.getArgs())); + Object result = joinPoint.proceed(); + log.info("=", method.getDeclaringClass().getName(), method.getName(), JSON.toJSONString(result)); + return result; + } catch (Throwable exception) { + throw new Exception(); + } + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..2ccce459c40a9dade9a9323e059fea5dae1a788d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeddd.ftl @@ -0,0 +1,20 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public interface ${class.className}{ +<#list methods as method> + +${method.doc} + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeimplddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeimplddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..650653a4624f437b75de3ac2c26d95d835645bcf --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/facadeimplddd.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +<#list imports as importClass> +import ${importClass}; + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +${class.annotation} +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + +<#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/factory.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/factory.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/factory.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/gataway.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/gataway.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/gataway.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/gatawayimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/gatawayimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6f4af81d020f8b3407df0579a172f77ea443aad1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/gatawayimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapper.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapper.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a855883d26624e32fa303e6b5cb49818a0c5a723 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapper.ftl @@ -0,0 +1,67 @@ +package ${package}.dao.mapper; + +import java.util.List; +import ${package}.dao.dataobject.${table.humpClassName}DO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +/** + * @Description:${table.tableComment}mapperDAO接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Mapper{ + + /** + * + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public long insert(${table.humpClassName}DO ${table.humpTableName}DO); + + /** + * + * @Description: 通过id删除数据 + * @param id + * @return int + */ + public int deleteById(Long id); + + /** + * + * @Description: 通过id查询 + * @param id + * @return ${table.humpClassName}DO + */ + public ${table.humpClassName}DO getById(Long id); + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getAll(); + + /** + * + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public int update(${table.humpClassName}DO ${table.humpTableName}DO); + + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getPageList(); + + /** + * @Description:查询数量 + * @return int + */ + public int getCount(); +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..682b73594b3ee1f5decfdaf1482c2d8f7e4bafaa --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperddd.ftl @@ -0,0 +1,24 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + +<#list methods as method> + ${method.doc} + ${method.returnClass} ${method.methodName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperxml.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperxml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..0a93342d04e426881e0e25f9ee3a0a4389097a14 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperxml.ftl @@ -0,0 +1,62 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperxmlddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..7d50a9abc14735d5c345f581d318c4ba35bb7d4d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mapperxmlddd.ftl @@ -0,0 +1,59 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + +<#list fields as field> +${field.fieldName} + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqconsumer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqconsumer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqhandler.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqhandler.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqhandler.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqlistener.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqlistener.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqlistener.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqproducer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqproducer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/mqproducer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/msgbody.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/msgbody.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6c85cb66d03e7f57dcafa118bdfe67d37ec6491 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/msgbody.ftl @@ -0,0 +1,33 @@ +package ${class.packageName}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/service.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/service.ftl new file mode 100644 index 0000000000000000000000000000000000000000..83cea8c547d423d7aba65ce057b95c2851803693 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/service.ftl @@ -0,0 +1,62 @@ +package ${package}.service; + +import java.util.List; + +import ${package}.model.bo.${table.humpClassName}BO; + +/** + * @Description:${table.tableComment}Service接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Service{ + + /** + * @Description:新增 + * @param bo + * @return ResultDto 返回类型 + * @throws + */ + public ${table.humpClassName}BO save(${table.humpClassName}BO bo) throws Exception; + + /** + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public Boolean delete(Long id); + + /** + * @Description: 通过id查询 + * @param id + * @return ResultDataDto<${table.humpClassName}BO> + * @throws + */ + public ${table.humpClassName}BO getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getAll() throws Exception; + + /** + * @Description:修改 + * @param ${table.humpTableName}BO + * @return boolean + * @throws + */ + public Boolean update(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception; + + + /** + * @Description:分页查询数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getPageList() throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/serviceImpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..66ac9dda998fc18819d6913e3715d58bdea6fd51 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/serviceImpl.ftl @@ -0,0 +1,58 @@ +package ${package}.service.impl; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; + +import ${package}.dao.mapper.${table.humpClassName}Mapper; +import ${package}.service.${table.humpClassName}Service; +import ${package}.model.bo.${table.humpClassName}BO; + +import java.util.List; + + +/** + * @Description:${table.tableComment}Service接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +@Slf4j +public class ${table.humpClassName}ServiceImpl implements ${table.humpClassName}Service{ + + + @Resource + private ${table.humpClassName}Mapper ${table.humpTableName}Mapper; + + + @Override + public ${table.humpClassName}BO save(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception{ + return ${table.humpTableName}BO; + } + + @Override + public Boolean delete(Long id) { + return false; + } + + @Override + public ${table.humpClassName}BO getById(Long id) throws Exception { + return null; + } + + @Override + public List<${table.humpClassName}BO> getAll() throws Exception { + return null; + } + + @Override + public Boolean update(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception { + return false; + } + + @Override + public List<${table.humpClassName}BO> getPageList() throws Exception { + return null; + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/test.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/test.ftl new file mode 100644 index 0000000000000000000000000000000000000000..09f783748b206205c5a238317d7af644e148b3bf --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/test.ftl @@ -0,0 +1,102 @@ +package ${package}.core.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.api.facade.${table.humpClassName}Facade; +import ${package}.api.dto.${table.humpClassName}DTO; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.core.Application; + +import org.apache.dubbo.config.annotation.Reference; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.Rollback; +import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; +import com.alibaba.fastjson.JSON; + +import org.junit.Test; +import org.junit.runner.RunWith; + +/** +* @Description:单元测试 +* @Author:shenshuai +* @CreateTime:2021-06-25 09:19:38 +* @version v1.0 +*/ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = Application.class) +@Rollback +@Transactional +public class ${table.humpClassName}FacadeTest extends AbstractTransactionalJUnit4SpringContextTests{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}FacadeTest.class); + + @Reference(url = "") + private ${table.humpClassName}Facade ${table.humpTableName}Facade; + + + /** + * @Description:测试新增${table.tableComment} 接口 + */ + @Test + public void testAdd(){ + //todo test code + ${table.humpClassName}DTO dto = new ${table.humpClassName}DTO(); + + + } + + /** + * @Description:测试修改${table.tableComment} + */ + @Test + public void testUpdate(){ + //todo test code + ${table.humpClassName}DTO vo = new ${table.humpClassName}DTO(); + } + + /** + * @Description:测试删除根据id删除${table.tableComment} + */ + @Test + public void testDelete(){ + //todo test code + long id = 1L; + } + + /** + * @Description:根据ID获取${table.tableComment}单条记录 + */ + @Test + public void testGetById(){ + //todo test code + } + + /** + * @Description:测试分页获取${table.tableComment}记录 + */ + @Test + public void getPage(){ + //todo test code + } + + /** + * @Description:测试禁用${table.tableComment}状态 + */ + @Test + public void testDisable(){ + //todo test code + } + /** + * @Description:测试启用${table.tableComment}状态 + */ + @Test + public void testEnable(){ + //todo test code + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/valueobject.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/valueobject.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dubbo/valueobject.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/abstractexe.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/abstractexe.ftl new file mode 100644 index 0000000000000000000000000000000000000000..32d6d57cb6824b6e6c78eb7f8005e4cb0c33be41 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/abstractexe.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public abstract class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public abstract ${method.returnClass} ${method.methodName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/acl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/acl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/acl.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/boddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/boddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/boddd.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/dtoddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/dtoddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..12465ba0cc11a90cdf0a02265ce52772ceeab0ac --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/dtoddd.ftl @@ -0,0 +1,25 @@ +package ${package}.api.dto; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; +import java.io.Serializable; + + +/** +* @Description:${table.tableComment}DTO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${table.humpClassName}DTO implements Serializable { + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/enum.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/enum.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a1b21d01802da8506845b0b35620698a22403f49 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/enum.ftl @@ -0,0 +1,47 @@ +package ${class.packageName}; + +import lombok.Getter; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Getter +public enum ${class.className}{ + + /** + * + */ + <#list enums as enumValue> + ${enumValue}, + + ; + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + + ${class.className}(${class.constructParamStr}){ + <#list bodys as body> + ${body}; + + } + + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public static ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/event.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/event.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9f15e120dfe9a271ea823b5e318410cbd3be5c44 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/event.ftl @@ -0,0 +1,35 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/exeimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/exeimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6a8d75475a8c42353b308de6c43e6e9bd173bca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/exeimpl.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import ${class.packageName}.${class.className}; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/factory.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/factory.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/factory.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/gataway.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/gataway.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/gataway.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/gatawayimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/gatawayimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6f4af81d020f8b3407df0579a172f77ea443aad1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/gatawayimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqconsumer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqconsumer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqhandler.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqhandler.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqhandler.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqproducer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqproducer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/mqproducer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/msgbody.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/msgbody.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6c85cb66d03e7f57dcafa118bdfe67d37ec6491 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/msgbody.ftl @@ -0,0 +1,33 @@ +package ${class.packageName}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/service.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/service.ftl new file mode 100644 index 0000000000000000000000000000000000000000..381ab6fa2634a4dae50ffeaadfed77834c42e338 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/service.ftl @@ -0,0 +1,70 @@ +package ${package}; + +import java.util.List; + +import ${package}.core.model.bo.${table.humpClassName}BO; + +/** + * @Description:${table.tableComment}Service接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Service{ + + /** + * + * @Title: save + * @Description:新增 + * @author: + * @param @param dto + * @param @param userId + * @return ${table.humpClassName}BO 返回类型 + * @throws + */ + public ${table.humpClassName}BO save(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception; + + /** + * + * @Title: delete + * @Description: 通过id删除数据 + * @author: + * @param @param id + * @return ResultDto 返回类型 + * @throws + */ + public Boolean delete(Long id); + + /** + * + * @Title: getById + * @Description: 通过id查询 + * @author: + * @param @param id + * @return ${table.humpClassName}BO + * @throws + */ + public ${table.humpClassName}BO getById(Long id) throws Exception; + + /** + * + * @Title: getAll + * @Description:查询所有数据 + * @author: + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getAll() throws Exception; + + /** + * + * @Title: update + * @Description:修改 + * @author: + * @param @param ${table.humpTableName}BO + * @return ${table.humpClassName}BO + * @throws + */ + public ${table.humpClassName}BO update(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/valueobject.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/valueobject.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/dynamicddd/valueobject.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/entity.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/entity.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c45bed22e584d61b58d6675286412e84755d1a9c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/entity.ftl @@ -0,0 +1,33 @@ +package ${package}.entity; + +import java.util.Date; +import java.math.BigDecimal; + + /** + * @Description:${table.tableComment}Entity类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public class ${table.humpClassName}Entity{ + + <#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + + <#list columns as column> + /** + * 描述:${column.columnComment} + */ + public ${column.columnTypeName} get${column.columnUperName}() { + return ${column.columnFieldName}; + } + /** + * 描述:${column.columnComment} + */ + public void set${column.columnUperName}(${column.columnTypeName} ${column.columnFieldName}) { + this.${column.columnFieldName} = ${column.columnFieldName}; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/SpringApplicationContext.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/SpringApplicationContext.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f00b4e93e1d933067d247c6a32766ed4ffb6d60a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/SpringApplicationContext.ftl @@ -0,0 +1,40 @@ +/* + * Copyright 2014 Jeanfrancois Arcand + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + package ${package}.context; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringApplicationContext implements BeanFactoryAware { + + private static BeanFactory springBeanFactory; + + @Override + public synchronized void setBeanFactory(BeanFactory beanFactory) throws BeansException { + springBeanFactory = beanFactory; + } + + public synchronized static T getBean(Class klass) { + return springBeanFactory.getBean(klass); + } + + public synchronized static Object getBean(String beanName) { + return springBeanFactory.getBean(beanName); + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/application.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/application.ftl new file mode 100644 index 0000000000000000000000000000000000000000..29299b73fd2e57fca68f26f5409aa816c2f5ef0e --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/application.ftl @@ -0,0 +1,47 @@ +package ${package}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.coderman.utils.bean.CglibConvertService; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.client.RestTemplate; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:应用启动入口 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@EnableDiscoveryClient +@ComponentScan({"com.lightsnail.**","com.alibaba.nacos","com.coderman.**"}) +public class Application { + + @Bean + public CglibConvertService cglibConvertService(){ + return new CglibConvertService(); + } + + @LoadBalanced + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/applicationproperties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e0b6effa2a294f699e3847340a41cf906dff0c17 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/applicationproperties.ftl @@ -0,0 +1,21 @@ +server.port=8083 +management.port=8073 + +# 跨域 +endpoints.cors.allowed-origins=http://127.0.0.1:8083 +endpoints.cors.allowed-methods=GET,POST + + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/coder_bank_product?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=root + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=com.tianhua.codemaker.bean + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/baseController.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/baseController.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9aeaf34f9473743def40c5f43d47157f84466aa1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/baseController.ftl @@ -0,0 +1,45 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** +* @Description:控制层基础父类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class BaseController{ + + protected Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 从request中获取指定的字符串 + * @param parameterName + * @return + */ + protected String getParameterString(String parameterName) { + //return RequestUtil.getParameterString(parameterName); + return ""; + } + + /** + * 从request中获取指定的整型 + * @param parameterName + * @return + */ + protected Integer getParameterInteger(String parameterName) { + // return RequestUtil.getParameterInteger(parameterName); + return 0; + } + + /** + * 从request中获取指定的长整型 + * @param parameterName + * @return + */ + protected Long getParameterLong(String parameterName) { + //return RequestUtil.getParameterLong(parameterName); + return 0L; + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/controller.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/controller.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3fd0d73765d4c94567e2cc097aec60a3a1e94ea9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/controller.ftl @@ -0,0 +1,113 @@ +package ${package}.controller; + +import lombok.extern.slf4j.Slf4j; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +@Slf4j +public class ${table.humpClassName}Controller extends BaseController{ + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + + + /** + * @Description:新增${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}Vo + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/add",method = RequestMethod.POST) + public ResultDto save(@RequestBody ${table.humpClassName}VO ${table.humpTableName}Vo){ + try { + return ${table.humpTableName}Service.save(${table.humpTableName}Vo); + } catch (Exception e) { + log.error("保存失败",e); + return ResultDto.setErrorCodeMsg("保存失败"); + } + + } + + /** + * @Description:修改${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}Vo + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/update",method = RequestMethod.POST) + public ResultDto update(@RequestBody ${table.humpClassName}VO ${table.humpTableName}Vo){ + try { + return ${table.humpTableName}Service.update(${table.humpTableName}Vo); + } catch (Exception e) { + log.error("修改失败",e); + return ResultDto.setErrorCodeMsg("修改失败"); + } + } + + /** + * @Description:根据id删除${table.tableComment} + * @version v1.0 + * @param id + * @return ResultDto + */ + @PostMapping("/${table.humpTableName}/delete") + public ResultDto delete(@RequestParam(name = "id") Long id){ + return ${table.humpTableName}Service.delete(id); + } + + /** + * @Description:根据ID获取${table.tableComment}单条记录 + * @version v1.0 + * @param id + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/get") + public ResultDataDto getById(@RequestParam(name = "id") Long id){ + try { + return ${table.humpTableName}Service.getById(id); + } catch (Exception e) { + log.error("获取数据失败",e); + return ResultDataDto.setErrorCodeMsg("获取数据失败"); + } + } + + /** + * @Description:分页获取${table.tableComment}记录 + * @version v1.0 + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/getpage") + public ResultDataDto getPage(){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:修改${table.tableComment}状态 + * @version v1.0 + * @param id + * @param status + * @return ResultDataDto + */ + @PostMapping("/${table.humpTableName}/changestatus") + public ResultDto changeStatus(@RequestParam(name = "id") Long id,@RequestParam(name = "status") int status){ + //todo impl code + return new ResultDto(); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/entity.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/entity.ftl new file mode 100644 index 0000000000000000000000000000000000000000..dbaf12bde6c182ead7c3de414162141bc46987b9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/entity.ftl @@ -0,0 +1,24 @@ +package ${package}.entity; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}Entity类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}Entity{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/mapper.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/mapper.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4c7d42a59f4dafb07f16404886fe6a65e91056e2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/mapper.ftl @@ -0,0 +1,69 @@ +package ${package}.mapper; + +import java.util.List; +import ${package}.entity.${table.humpClassName}Entity; + + +/** + * @Description:${table.tableComment}mapperDAO接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Mapper{ + + /** + * + * @Title: save + * @Description:新增或修改 + * @author: + * @param @param ${table.humpTableName}Entity + * @return int + * @throws + */ + public int insert(${table.humpClassName}Entity ${table.humpTableName}Entity); + + /** + * + * @Title: delete + * @Description: 通过id删除数据 + * @author: + * @param @param id + * @return int + * @throws + */ + public int deleteById(Long id); + + /** + * + * @Title: getById + * @Description: 通过id查询 + * @author: + * @param @param id + * @return ResultDataDto<${table.humpClassName}Entity> 返回类型 + * @throws + */ + public ${table.humpClassName}Entity getById(Long id); + + /** + * + * @Title: getAll + * @Description:查询所有数据 + * @author: + * @return List<${table.humpClassName}Entity 返回类型 + * @throws + */ + public List<${table.humpClassName}Entity> getAll(); + + /** + * + * @Title: update + * @Description:新增或修改 + * @author: + * @param @param ${table.humpTableName}Entity + * @return int + * @throws + */ + public int update(${table.humpClassName}Entity ${table.humpTableName}Entity); + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/mapperxml.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/mapperxml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..df86dd75ecdefbf668e02be5e2f10cb448449873 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/mapperxml.ftl @@ -0,0 +1,49 @@ + + + + + + + + + <#list columns as column> + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/service.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/service.ftl new file mode 100644 index 0000000000000000000000000000000000000000..28aa36212c45e8464dece9fff6f6d86ba682d837 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/service.ftl @@ -0,0 +1,72 @@ +package ${package}.service; + +import java.util.List; +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.vo.${table.humpClassName}VO; + +/** + * @Description:${table.tableComment}Service接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Service{ + + /** + * + * @Title: save + * @Description:新增 + * @author: + * @param @param dto + * @param @param userId + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto save(${table.humpClassName}VO ${table.humpTableName}Vo) throws Exception; + + /** + * + * @Title: delete + * @Description: 通过id删除数据 + * @author: + * @param @param id + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto delete(Long id); + + /** + * + * @Title: getById + * @Description: 通过id查询 + * @author: + * @param @param id + * @return ResultDataDto<${table.humpClassName}VO> + * @throws + */ + public ResultDataDto<${table.humpClassName}VO> getById(Long id) throws Exception; + + /** + * + * @Title: getAll + * @Description:查询所有数据 + * @author: + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getAll() throws Exception; + + /** + * + * @Title: update + * @Description:修改 + * @author: + * @param @param ${table.humpTableName}Entity + * @return int + * @throws + */ + public ResultDto update(${table.humpClassName}VO ${table.humpTableName}Vo) throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/serviceImpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..77fa4b8cc549f8f9e0d0f9c0bb5de0a3c942018c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/serviceImpl.ftl @@ -0,0 +1,77 @@ +package ${package}.service.impl; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; + +import com.coderman.utils.bean.CglibConvertService; +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.mapper.${table.humpClassName}Mapper; +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; +import ${package}.entity.${table.humpClassName}Entity; + +import java.util.List; + + +/** + * @Description:${table.tableComment}Service接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +@Slf4j +public class ${table.humpClassName}ServiceImpl implements ${table.humpClassName}Service{ + + + @Resource + private ${table.humpClassName}Mapper ${table.humpTableName}Mapper; + + @Autowired + private CglibConvertService cglibConvertService; + + @Override + public ResultDto save(${table.humpClassName}VO ${table.humpTableName}Vo) throws Exception{ + ResultDto resultDto = new ResultDto(); + ${table.humpClassName}Entity ${table.humpTableName}Entity = cglibConvertService.copyPropertity(${table.humpClassName}Entity.class,${table.humpTableName}Vo); + ${table.humpTableName}Mapper.insert(${table.humpTableName}Entity); + return resultDto; + } + + @Override + public ResultDto delete(Long id) { + ResultDto resultDto = new ResultDto(); + log.info("${table.humpTableName}Service.delete,id="+id); + ${table.humpTableName}Mapper.deleteById(id); + return resultDto; + } + + @Override + public ResultDataDto<${table.humpClassName}VO> getById(Long id) throws Exception { + ResultDataDto<${table.humpClassName}VO> resultDataDto = new ResultDataDto<${table.humpClassName}VO>(); + ${table.humpClassName}Entity ${table.humpTableName}Entity = ${table.humpTableName}Mapper.getById(id); + ${table.humpClassName}VO ${table.humpTableName}Vo = cglibConvertService.copyPropertity(${table.humpClassName}VO.class,${table.humpTableName}Entity); + resultDataDto.setData(${table.humpTableName}Vo); + return resultDataDto; + } + + @Override + public ResultDataDto> getAll() throws Exception { + ResultDataDto> resultDataDto = new ResultDataDto>(); + //todo impl code + return resultDataDto; + } + + @Override + public ResultDto update(${table.humpClassName}VO ${table.humpTableName}Vo) throws Exception { + ResultDto resultDto = new ResultDto(); + ${table.humpClassName}Entity ${table.humpTableName}Entity = cglibConvertService.copyPropertity(${table.humpClassName}Entity.class,${table.humpTableName}Vo); + ${table.humpTableName}Mapper.update(${table.humpTableName}Entity); + return resultDto; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/test.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/test.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bddd6827a33d6e58ca7d55206efe1c2510a4a550 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/test.ftl @@ -0,0 +1,107 @@ +package ${package}.service.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; +import ${package}.Application; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.alibaba.fastjson.JSON; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +/** +* @Description:${table.tableComment}单元测试 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT,classes = {Application.class}) +public class ${table.humpClassName}ServiceTest{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}ServiceTest.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + @Autowired + private TestRestTemplate restTemplate; + + /** + * @Description:测试新增${table.tableComment} 接口 + */ + @Test + public void testAdd(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/add",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试修改${table.tableComment} + */ + @Test + public void testUpdate(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/update",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试删除根据id删除${table.tableComment} + */ + @Test + public void testDelete(){ + //todo test code + long id = 1L; + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/delete",id, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:但是根据ID获取${table.tableComment}单条记录 + */ + @Test + public void testGetById(){ + //todo test code + ResultDataDto resultDataDto = restTemplate.getForEntity("/${table.humpTableName}/get?id=1",ResultDataDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDataDto)); + } + + /** + * @Description:测试分页获取${table.tableComment}记录 + */ + @Test + public void getPage(){ + //todo test code + } + + /** + * @Description:测试禁用${table.tableComment}状态 + */ + @Test + public void testDisable(){ + //todo test code + } + /** + * @Description:测试启用${table.tableComment}状态 + */ + @Test + public void testEnable(){ + //todo test code + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/fast/vo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/fast/vo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..1c415be57134f68321d47281f34092a8bfe5949b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/fast/vo.ftl @@ -0,0 +1,25 @@ +package ${package}.vo; + +import java.util.Date; +import java.math.BigDecimal; + +import lombok.Data; +import lombok.ToString; +/** +* @Description:${table.tableComment}VO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${table.humpClassName}VO{ + +<#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/mapper.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/mapper.ftl new file mode 100644 index 0000000000000000000000000000000000000000..8ce3a049661467550a950e9007ee4084567963ca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/mapper.ftl @@ -0,0 +1,69 @@ +package ${package}.mapper; + +import java.util.List; +import ${package}.entity.${table.humpClassName}Entity; + + +/** + * @Description:${table.tableComment}mapperDAO接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Mapper{ + + /** + * + * @Title: save + * @Description:新增或修改 + * @author: + * @param @param ${table.humpTableName}Entity + * @return int + * @throws + */ + public int insert(${table.humpClassName}Entity ${table.humpTableName}Entity); + + /** + * + * @Title: delete + * @Description: 通过id删除数据 + * @author: + * @param @param id + * @return int + * @throws + */ + public int deleteById(Long id); + + /** + * + * @Title: getById + * @Description: 通过id查询 + * @author: + * @param @param id + * @return ResultDataDto<${table.humpClassName}Entity> 返回类型 + * @throws + */ + public ${table.humpClassName}Entity getById(Long id); + + /** + * + * @Title: getAll + * @Description:查询所有数据 + * @author: + * @return List<${table.humpClassName}Entity 返回类型 + * @throws + */ + public List<${table.humpClassName}Entity> getAll(); + + /** + * + * @Title: update + * @Description:新增或修改 + * @author: + * @param @param ${table.humpTableName}Entity + * @return int + * @throws + */ + public int update(${table.humpClassName}Entity ${table.humpTableName}Entity); + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/mapperxml.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/mapperxml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..67b2598b65d222b68d7d02776f44d0887161baf9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/mapperxml.ftl @@ -0,0 +1,57 @@ + + + + + + + + + <#list columns as column> + + + + + + + + <#list columns as column> + ${column.columnName}, + + + + + insert into ${table.tableName}( + <#list columns as column> + ${column.columnName}, + + ) + values( + <#list columns as column> + <#noparse>#{${column.columnFieldName}<#noparse>}, + + ) + + + + update ${table.tableName} + set + <#list columns as column> + ${column.columnName}=<#noparse>#{${column.columnFieldName}<#noparse>}, + + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/service.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/service.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9ca5bf61637bac64d18cc981a450659586122813 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/service.ftl @@ -0,0 +1,72 @@ +package ${package}.service; + +import java.util.List; +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.vo.${table.humpClassName}VO; + +/** + * @Description:${table.tableComment}Service接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Service{ + + /** + * + * @Title: save + * @Description:新增 + * @author: + * @param @param dto + * @param @param userId + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto save(${table.humpClassName}VO dto) throws Exception; + + /** + * + * @Title: delete + * @Description: 通过id删除数据 + * @author: + * @param @param id + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto delete(Long id); + + /** + * + * @Title: getById + * @Description: 通过id查询 + * @author: + * @param @param id + * @return ResultDataDto<${table.humpClassName}VO> + * @throws + */ + public ResultDataDto<${table.humpClassName}VO> getById(Long id) throws Exception; + + /** + * + * @Title: getAll + * @Description:查询所有数据 + * @author: + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getAll() throws Exception; + + /** + * + * @Title: update + * @Description:修改 + * @author: + * @param @param ${table.humpTableName}Entity + * @return int + * @throws + */ + public ResultDto update(${table.humpClassName}VO ${table.humpTableName}VO) throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/serviceImpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..8974666ce1f29c8fde702b2c43fb00879fbaef19 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/serviceImpl.ftl @@ -0,0 +1,71 @@ +package ${package}.service.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.mapper.${table.humpClassName}Mapper; +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; +import ${package}.entity.${table.humpClassName}Entity; + +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import com.alibaba.fastjson.JSONObject; + +/** + * @Description:${table.tableComment}Service接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${table.humpClassName}ServiceImpl implements ${table.humpClassName}Service{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private ${table.humpClassName}Mapper ${table.humpTableName}Mapper; + + @Override + public ResultDto save(${table.humpClassName}VO vo) { + ResultDto resultDto = new ResultDto(); + //todo impl code + return resultDto; + } + + @Override + public ResultDto delete(Long id) { + ResultDto resultDto = new ResultDto(); + logger.info("${table.humpTableName}Service.delete,id="+id); + //todo impl code + return resultDto; + } + + @Override + public ResultDataDto<${table.humpClassName}VO> getById(Long id) { + ResultDataDto<${table.humpClassName}VO> resultDataDto = new ResultDataDto<${table.humpClassName}VO>(); + logger.info("${table.humpTableName}Service.getById,id="+id); + //todo impl code + return resultDataDto; + } + + @Override + public ResultDataDto> getAll() { + ResultDataDto> resultDataDto = new ResultDataDto>(); + //todo impl code + return resultDataDto; + } + + @Override + public ResultDto update(${table.humpClassName}VO vo) { + ResultDto resultDto = new ResultDto(); + //todo impl code + return resultDto; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/AppEventPublisher.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/AppEventPublisher.ftl new file mode 100644 index 0000000000000000000000000000000000000000..b8db74c79e584b623f8eddb10d2ce5a2b4041cc3 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/AppEventPublisher.ftl @@ -0,0 +1,21 @@ +package ${package}.domain.support.utils; + +import ${package}.domain.event.BaseEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +@Component +public class AppEventPublisher { + + @Autowired + private ApplicationContext applicationContext; + + /** + * 发送spring容器事件入口方法 + */ + public void publish(T t) { + applicationContext.publishEvent(t); + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/Main.java b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/Application.ftl similarity index 52% rename from codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/Main.java rename to codemaker-parent/codemaker-core/src/test/resources/template/singleClass/Application.ftl index 93351bce064bba75e43f8ddf503b69081ccf8aa3..cfa97cef405b41106b41e8fd203b7033887b61b5 100644 --- a/codemaker-parent/codemaker-core/src/main/java/com/coderman/codemaker/Main.java +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/Application.ftl @@ -1,26 +1,28 @@ -package com.coderman.codemaker; +package ${package}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; + /** - * description: Main
- * date: 2020/7/6 23:07
- * author: coderman
- * version: 1.0
- */ +* @Description:应用启动入口 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ @SpringBootApplication -@MapperScan(value = "com.coderman.codemaker.dao") +@MapperScan(value = "${package}.infrast.dao") @EnableConfigurationProperties -public class Main { - public static void main(String[] args) { +public class Application { - - - - SpringApplication.run(Main.class, args); + public static void main(String[] args) { + SpringApplication.run(Application.class, args); } } diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseBO.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseBO.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e43d72431ae92fb6be391fdd985930dc8a1bec45 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseBO.ftl @@ -0,0 +1,40 @@ +package ${package}.domain.bo; + +import lombok.ToString; +import lombok.Data; + +import java.io.Serializable; + +/** + * DTO基类 + */ +@ToString +@Data +public class BaseBO implements Serializable { + /** + * 修改时间 + */ + private Date dateUpdate; + + /** + * 创建时间 + */ + private Date dateCreate; + + /** + * 修改人 + */ + private Long updateUserId; + + /** + * 创建人 + */ + private Long createUserId; + + /** + * 请求号 + */ + private String requestNo; + + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseController.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseController.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9aeaf34f9473743def40c5f43d47157f84466aa1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseController.ftl @@ -0,0 +1,45 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** +* @Description:控制层基础父类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class BaseController{ + + protected Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 从request中获取指定的字符串 + * @param parameterName + * @return + */ + protected String getParameterString(String parameterName) { + //return RequestUtil.getParameterString(parameterName); + return ""; + } + + /** + * 从request中获取指定的整型 + * @param parameterName + * @return + */ + protected Integer getParameterInteger(String parameterName) { + // return RequestUtil.getParameterInteger(parameterName); + return 0; + } + + /** + * 从request中获取指定的长整型 + * @param parameterName + * @return + */ + protected Long getParameterLong(String parameterName) { + //return RequestUtil.getParameterLong(parameterName); + return 0L; + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseDTO.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseDTO.ftl new file mode 100644 index 0000000000000000000000000000000000000000..450386a9c7c2256128ea27d9fa1ab739ba7662f1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseDTO.ftl @@ -0,0 +1,13 @@ +package ${package}.api.dto; + +import lombok.ToString; + +import java.io.Serializable; + +/** + * DTO基类 + */ +@ToString +public class BaseDTO implements Serializable { + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseEvent.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseEvent.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4ff2d9325cbbb820b018940f57ffd1c6968cd2c7 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/BaseEvent.ftl @@ -0,0 +1,9 @@ +package ${package}.domain.event; + +import org.springframework.context.ApplicationEvent; + +public class BaseEvent extends ApplicationEvent { + public BaseEvent(Object source) { + super(source); + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/FacadeAspect.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/FacadeAspect.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6811adc8355f4256a377337832242f186f08a29c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/FacadeAspect.ftl @@ -0,0 +1,37 @@ +package ${package}.app.support; + + +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.ibatis.reflection.ExceptionUtil; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +/** +* +*/ +@Component +@Aspect +@Slf4j +public class FacadeServiceAop { + @Around(value = "execution( public * ${package}.app.facadeimpl..*(..))") + public Object transferException(ProceedingJoinPoint joinPoint) throws Exception { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + try { + log.info("=", method.getDeclaringClass().getName(), method.getName(), JSON.toJSONString(joinPoint.getArgs())); + Object result = joinPoint.proceed(); + log.info("=", method.getDeclaringClass().getName(), method.getName(), JSON.toJSONString(result)); + return result; + } catch (Throwable exception) { + throw new Exception(); + } + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/LockA.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/LockA.ftl new file mode 100644 index 0000000000000000000000000000000000000000..47aedd101881dbdc2ace12ce3b04540f260b4312 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/LockA.ftl @@ -0,0 +1,37 @@ +package ${package}.domain.support.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +/** + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface LockA { + + /** + * 前缀 + */ + String prefixKey() default Constant.TRADE_CENTER_CORE_LOCK_PREFIX; +/** + * 锁 + */ +String key() default "orderId"; + +/** + * 默认 uuid + */ +String requestId() default "requestId"; + + +/** + * 提示消息 + */ +String msg() default "请不要重复提交"; + + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/MqHandler.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/MqHandler.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d49dde2b9d2e2246d3f2597351b0ed03ed319dc1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/MqHandler.ftl @@ -0,0 +1,37 @@ +package ${package}.domain.support.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + + +/** + * + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface MqHandler { + + /** + * 前缀 + */ + String prefixKey() default Constant.TRADE_CENTER_CORE_LOCK_PREFIX; +/** + * 锁 + */ +String key() default "orderId"; + +/** + * 默认 uuid + */ +String requestId() default "requestId"; + + +/** + * 提示消息 + */ +String msg() default "请不要重复提交"; + + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/PageBO.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/PageBO.ftl new file mode 100644 index 0000000000000000000000000000000000000000..25a5652a83654f4a69b2c5bd348b1ecc0e629e8c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/PageBO.ftl @@ -0,0 +1,115 @@ +package ${package}.domain.bo; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** +* Description:参考Mybatis_PageHelper的Page对象封装的DTO +* date: 2021/10/26 +* +* @author shenshuai +* @version 1.0.0 +* @since JDK 1.8 +*/ +public class PageBO implements Serializable { + + private static final long serialVersionUID = -2470832822882514457L; + /** + * 页码,从1开始 + */ + private int currentPageNum; + + /** + * 当前页的下一页 + */ + private int nextPageNum; + + /** + * 当前页的上一页 + */ + private int prePageNum; + /** + * 页面大小 + */ + private int pageSize; + /** + * 起始行 + */ + private int startRow; + /** + * 末行 + */ + private int endRow; + /** + * 总数 + */ + private long totalRows; + /** + * 总页数 + */ + private int totalPages; + /** + * 包含count查询 + */ + private boolean count = true; + /** + * 分页合理化 + */ + private Boolean reasonable; + /** + * 当设置为true的时候,如果pagesize设置为0(或RowBounds的limit=0),就不执行分页,返回全部结果 + */ + private Boolean pageSizeZero; + /** + * 进行count查询的列名 + */ + private String countColumn; + /** + * 排序 + */ + private String orderBy; + /** + * 只增加排序 + */ + private boolean orderByOnly; + + private List Items; + + + /** + * 针对简单场景 参数的查询map处理 + */ + private Map queryMap; + + /** + * 针对复杂场景 参数的查询queryDTO对象处理 + */ + private Object queryDTO; + + + public Map getQueryMap() { + return queryMap; + } + + public void setQueryMap(Map queryMap) { + this.queryMap = queryMap; + } + + public Object getQueryDTO() { + return queryDTO; + } + + public void setQueryDTO(Object queryDTO) { + this.queryDTO = queryDTO; + } + + public List getItems() { + return Items; + } + + public PageBO setItems(List items) { + Items = items; + return this; + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/SpringApplicationContext.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/SpringApplicationContext.ftl new file mode 100644 index 0000000000000000000000000000000000000000..77317f9baff8a84029a82292ad8c177bab87b6b0 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/SpringApplicationContext.ftl @@ -0,0 +1,25 @@ +package ${package}.domain.support.utils; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringApplicationContext implements BeanFactoryAware { + + private static BeanFactory springBeanFactory; + + @Override + public synchronized void setBeanFactory(BeanFactory beanFactory) throws BeansException { + springBeanFactory = beanFactory; + } + + public synchronized static T getBean(Class klass) { + return springBeanFactory.getBean(klass); + } + + public synchronized static Object getBean(String beanName) { + return springBeanFactory.getBean(beanName); + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/pom.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/pom.ftl new file mode 100644 index 0000000000000000000000000000000000000000..662639299ba9673ef115ec3495443b9a61b19e49 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/singleClass/pom.ftl @@ -0,0 +1,73 @@ + + + + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + 4.0.0 + ${makeConf.dsfClientProjectName} + ${makeConf.dsfClientProjectName} + + + UTF-8 + 1.8 + 1.8 + + + + + + com.coderman.utils + coderman-utils + 1.0.0-SNAPSHOT + + + + junit + junit + 4.11 + test + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-configuration-processor + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + UTF8 + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/AppEventPublisher.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/AppEventPublisher.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a46044426b5c0ba29e5c9aba113dbbac727f4761 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/AppEventPublisher.ftl @@ -0,0 +1,18 @@ +package ${package}.utils; + +import ${package}.domain.event.BaseEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +@Component +public class AppEventPublisher { + + @Autowired + private ApplicationContext applicationContext; + + public void publish(T t) { + applicationContext.publishEvent(t); + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/BaseEvent.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/BaseEvent.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4ff2d9325cbbb820b018940f57ffd1c6968cd2c7 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/BaseEvent.ftl @@ -0,0 +1,9 @@ +package ${package}.domain.event; + +import org.springframework.context.ApplicationEvent; + +public class BaseEvent extends ApplicationEvent { + public BaseEvent(Object source) { + super(source); + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/SpringApplicationContext.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/SpringApplicationContext.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a6e7b6374ce46bd405e58bf3bd179e2feffe8b6b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/SpringApplicationContext.ftl @@ -0,0 +1,40 @@ +/* + * Copyright 2014 Jeanfrancois Arcand + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + package ${package}.utils; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringApplicationContext implements BeanFactoryAware { + + private static BeanFactory springBeanFactory; + + @Override + public synchronized void setBeanFactory(BeanFactory beanFactory) throws BeansException { + springBeanFactory = beanFactory; + } + + public synchronized static T getBean(Class klass) { + return springBeanFactory.getBean(klass); + } + + public synchronized static Object getBean(String beanName) { + return springBeanFactory.getBean(beanName); + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/acl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/acl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/acl.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/aclimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/aclimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..0c1a4ee78200bbd0e9696da6c74044bd557816f9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/aclimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @${field.annotation} + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/application.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/application.ftl new file mode 100644 index 0000000000000000000000000000000000000000..62e9e70e4cbd4eff27bc42c1405ffd0281b152bc --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/application.ftl @@ -0,0 +1,28 @@ +package ${package}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; + + +/** +* @Description:应用启动入口 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@ComponentScan({"${package}.**"}) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/applicationproperties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e0b6effa2a294f699e3847340a41cf906dff0c17 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/applicationproperties.ftl @@ -0,0 +1,21 @@ +server.port=8083 +management.port=8073 + +# 跨域 +endpoints.cors.allowed-origins=http://127.0.0.1:8083 +endpoints.cors.allowed-methods=GET,POST + + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/coder_bank_product?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=root + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=com.tianhua.codemaker.bean + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/baseController.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/baseController.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9aeaf34f9473743def40c5f43d47157f84466aa1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/baseController.ftl @@ -0,0 +1,45 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** +* @Description:控制层基础父类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class BaseController{ + + protected Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 从request中获取指定的字符串 + * @param parameterName + * @return + */ + protected String getParameterString(String parameterName) { + //return RequestUtil.getParameterString(parameterName); + return ""; + } + + /** + * 从request中获取指定的整型 + * @param parameterName + * @return + */ + protected Integer getParameterInteger(String parameterName) { + // return RequestUtil.getParameterInteger(parameterName); + return 0; + } + + /** + * 从request中获取指定的长整型 + * @param parameterName + * @return + */ + protected Long getParameterLong(String parameterName) { + //return RequestUtil.getParameterLong(parameterName); + return 0L; + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/bo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/bo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bda879528eb4348db9074de60a254d187dec78ea --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/bo.ftl @@ -0,0 +1,24 @@ +package ${package}.bo; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}BO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}BO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/boddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/boddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..1a43acac8202e47b8613705d0592615b6c3f14fd --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/boddd.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + + /** + * ${field.desc} + */ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/cache.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/cache.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/cache.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/controller.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/controller.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3c88f6d538a3d5c5784303201653be94a35443b2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/controller.ftl @@ -0,0 +1,103 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${table.humpClassName}Controller extends BaseController{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}Controller.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + + + /** + * @Description:新增${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/add",method = RequestMethod.POST) + public ResultDto add(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:修改${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/update",method = RequestMethod.POST) + public ResultDto update(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据id删除${table.tableComment} + * @version v1.0 + * @param id + * @return ResultDto + */ + @PostMapping("/${table.humpTableName}/delete") + public ResultDto delete(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据ID获取${table.tableComment}单条记录 + * @version v1.0 + * @param id + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/get") + public ResultDataDto getById(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:分页获取${table.tableComment}记录 + * @version v1.0 + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/getpage") + public ResultDataDto getPage(){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:修改${table.tableComment}状态 + * @version v1.0 + * @param id + * @param status + * @return ResultDataDto + */ + @PostMapping("/${table.humpTableName}/changestatus") + public ResultDto changeStatus(@RequestParam(name = "id") Long id,@RequestParam(name = "status") int status){ + //todo impl code + return new ResultDto(); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/controllerddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/controllerddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..570a4e93153a5f60083038aa4dca8e1a715ee0b6 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/controllerddd.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +<#list imports as importClass> +import ${importClass}; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${class.className} { + + protected Logger logger = LoggerFactory.getLogger(${class.className}.class); + +<#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + +${method.doc} + @RequestMapping(value = "${method.pathValue}") + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/convert.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/convert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/convert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/do.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/do.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5cb6980c8680c78017324dca6939094acf5835ec --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/do.ftl @@ -0,0 +1,24 @@ +package ${packageInfrast}.dao.dataobject; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}DO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}DO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/dto.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/dto.ftl new file mode 100644 index 0000000000000000000000000000000000000000..53b7d4e007d74fb912a31d9b3f39979a36d3c88e --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/dto.ftl @@ -0,0 +1,25 @@ +package ${package}.dto; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; +import java.io.Serializable; + + +/** +* @Description:${table.tableComment}DTO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${table.humpClassName}DTO implements Serializable { + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/dtoddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/dtoddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d6243cb09279ec491a39bf98497e22aeef0b75b9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/dtoddd.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + +/** +* @Description:${class.classDesc}类 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + +<#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/entity.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/entity.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c45bed22e584d61b58d6675286412e84755d1a9c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/entity.ftl @@ -0,0 +1,33 @@ +package ${package}.entity; + +import java.util.Date; +import java.math.BigDecimal; + + /** + * @Description:${table.tableComment}Entity类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public class ${table.humpClassName}Entity{ + + <#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + + <#list columns as column> + /** + * 描述:${column.columnComment} + */ + public ${column.columnTypeName} get${column.columnUperName}() { + return ${column.columnFieldName}; + } + /** + * 描述:${column.columnComment} + */ + public void set${column.columnUperName}(${column.columnTypeName} ${column.columnFieldName}) { + this.${column.columnFieldName} = ${column.columnFieldName}; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/enum.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/enum.ftl new file mode 100644 index 0000000000000000000000000000000000000000..27c66dd0e0190604a3c1c039819a08895cb3449c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/enum.ftl @@ -0,0 +1,47 @@ +package ${class.packageName}; + +import lombok.Getter; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Getter +public enum ${class.className}{ + + /** + * + */ + <#list enums as enumValue> + ${enumValue}, + + ; + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + + ${class.className}(${class.constructParamStr}){ + <#list bodys as body> + ${body}; + + } + + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public static ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/event.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/event.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9f15e120dfe9a271ea823b5e318410cbd3be5c44 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/event.ftl @@ -0,0 +1,35 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/exeimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/exeimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6a8d75475a8c42353b308de6c43e6e9bd173bca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/exeimpl.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import ${class.packageName}.${class.className}; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/factory.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/factory.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/factory.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/gataway.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/gataway.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/gataway.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/gatawayimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/gatawayimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6f4af81d020f8b3407df0579a172f77ea443aad1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/gatawayimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapper.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapper.ftl new file mode 100644 index 0000000000000000000000000000000000000000..db78b21dca8f442b236fe1bf20f5c7a80263c25d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapper.ftl @@ -0,0 +1,68 @@ +package ${package}.dao.mapper; + +import java.util.List; +import ${package}.dao.dataobject.${table.humpClassName}DO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +/** + * @Description:${table.tableComment}mapperDAO接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Mapper +public interface ${table.humpClassName}Mapper{ + + /** + * + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public long insert(${table.humpClassName}DO ${table.humpTableName}DO); + + /** + * @Description: 通过id删除数据 + * @param id + * @return int + */ + public int deleteById(Long id); + + /** + * @Description: 通过id查询 + * @param id + * @return ResultDataDto<${table.humpClassName}DO> + */ + public ${table.humpClassName}DO getById(Long id); + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getAll(); + + /** + * + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public int update(${table.humpClassName}DO ${table.humpTableName}DO); + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getPageList(); + + + /** + * @Description:查询数量 + * @return int + */ + public int getCount(); + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..43102bc46dc874bde3bcc9316203d6183e3adda9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperddd.ftl @@ -0,0 +1,26 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + +<#list methods as method> + ${method.doc} + ${method.returnClass} ${method.methodName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperxml.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperxml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3e3c284f13bb9414fe3d561bdc4f4a9453ced9bd --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperxml.ftl @@ -0,0 +1,62 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperxmlddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..7d50a9abc14735d5c345f581d318c4ba35bb7d4d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mapperxmlddd.ftl @@ -0,0 +1,59 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + +<#list fields as field> +${field.fieldName} + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqconsumer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqconsumer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqhandler.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqhandler.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqhandler.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqlistener.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqlistener.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqlistener.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqproducer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqproducer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/mqproducer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/msgbody.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/msgbody.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6c85cb66d03e7f57dcafa118bdfe67d37ec6491 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/msgbody.ftl @@ -0,0 +1,33 @@ +package ${class.packageName}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/service.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/service.ftl new file mode 100644 index 0000000000000000000000000000000000000000..13903d7f54e740c4970624dde9be6eccc4ad068c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/service.ftl @@ -0,0 +1,69 @@ +package ${package}.service; + +import java.util.List; + +import ${package}.bo.${table.humpClassName}BO; + +/** + * @Description:${table.tableComment}Service接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Service{ + + /** + * @Description:新增 + * @param bo + * @return ResultDto 返回类型 + * @throws + */ + public ${table.humpClassName}BO save(${table.humpClassName}BO bo) throws Exception; + + /** + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public Boolean delete(Long id); + + /** + * @Description: 通过id查询 + * @param id + * @return ResultDataDto<${table.humpClassName}BO> + * @throws + */ + public ${table.humpClassName}BO getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getAll() throws Exception; + + /** + * @Description:修改 + * @param ${table.humpTableName}BO + * @return boolean + * @throws + */ + public Boolean update(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception; + + + /** + * @Description:分页查询数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getPageList() throws Exception; + + /** + * @Description:查询数量 + * @return int + */ + public int getCount() throws Exception; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/serviceImpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..496601eeae98d89de8913b72045c62a0a364ecf9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/serviceImpl.ftl @@ -0,0 +1,77 @@ +package ${package}.service.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.dao.mapper.${table.humpClassName}Mapper; +import ${package}.service.${table.humpClassName}Service; +import ${package}.bo.${table.humpClassName}BO; + +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import com.alibaba.fastjson.JSONObject; + +/** + * @Description:${table.tableComment}Service接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${table.humpClassName}ServiceImpl implements ${table.humpClassName}Service{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private ${table.humpClassName}Mapper ${table.humpTableName}Mapper; + + @Override + public ${table.humpClassName}BO save(${table.humpClassName}BO bo) { + //todo impl code + return null; + } + + @Override + public Boolean delete(Long id) { + logger.info("${table.humpTableName}Service.delete,id="+id); + //todo impl code + return false; + } + + @Override + public ${table.humpClassName}BO getById(Long id) { + logger.info("${table.humpTableName}Service.getById,id="+id); + //todo impl code + return null; + } + + @Override + public List<${table.humpClassName}BO> getAll() { + //todo impl code + return null; + } + + @Override + public Boolean update(${table.humpClassName}BO bo) { + //todo impl code + return false; + } + + + @Override + public List<${table.humpClassName}BO> getPageList() throws Exception { + return null; + } + + + @Override + public int getCount() throws Exception { + return 0; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/test.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/test.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bddd6827a33d6e58ca7d55206efe1c2510a4a550 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/test.ftl @@ -0,0 +1,107 @@ +package ${package}.service.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; +import ${package}.Application; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.alibaba.fastjson.JSON; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +/** +* @Description:${table.tableComment}单元测试 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT,classes = {Application.class}) +public class ${table.humpClassName}ServiceTest{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}ServiceTest.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + @Autowired + private TestRestTemplate restTemplate; + + /** + * @Description:测试新增${table.tableComment} 接口 + */ + @Test + public void testAdd(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/add",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试修改${table.tableComment} + */ + @Test + public void testUpdate(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/update",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试删除根据id删除${table.tableComment} + */ + @Test + public void testDelete(){ + //todo test code + long id = 1L; + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/delete",id, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:但是根据ID获取${table.tableComment}单条记录 + */ + @Test + public void testGetById(){ + //todo test code + ResultDataDto resultDataDto = restTemplate.getForEntity("/${table.humpTableName}/get?id=1",ResultDataDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDataDto)); + } + + /** + * @Description:测试分页获取${table.tableComment}记录 + */ + @Test + public void getPage(){ + //todo test code + } + + /** + * @Description:测试禁用${table.tableComment}状态 + */ + @Test + public void testDisable(){ + //todo test code + } + /** + * @Description:测试启用${table.tableComment}状态 + */ + @Test + public void testEnable(){ + //todo test code + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/valueobject.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/valueobject.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/valueobject.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/vo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/vo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..8113fd2240a602e78a54895474b39b7c1e56d0e4 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/vo.ftl @@ -0,0 +1,33 @@ +package ${package}.vo; + +import java.util.Date; +import java.math.BigDecimal; + +/** +* @Description:${table.tableComment}VO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class ${table.humpClassName}VO{ + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +<#list columns as column> + /** + * 描述:${column.columnComment} + */ + public ${column.columnTypeName} get${column.columnUperName}() { + return ${column.columnFieldName}; + } + /** + * 描述:${column.columnComment} + */ + public void set${column.columnUperName}(${column.columnTypeName} ${column.columnFieldName}) { + this.${column.columnFieldName} = ${column.columnFieldName}; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springboot/voddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/voddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springboot/voddd.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/AppEventPublisher.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/AppEventPublisher.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a46044426b5c0ba29e5c9aba113dbbac727f4761 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/AppEventPublisher.ftl @@ -0,0 +1,18 @@ +package ${package}.utils; + +import ${package}.domain.event.BaseEvent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +@Component +public class AppEventPublisher { + + @Autowired + private ApplicationContext applicationContext; + + public void publish(T t) { + applicationContext.publishEvent(t); + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/BaseEvent.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/BaseEvent.ftl new file mode 100644 index 0000000000000000000000000000000000000000..4ff2d9325cbbb820b018940f57ffd1c6968cd2c7 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/BaseEvent.ftl @@ -0,0 +1,9 @@ +package ${package}.domain.event; + +import org.springframework.context.ApplicationEvent; + +public class BaseEvent extends ApplicationEvent { + public BaseEvent(Object source) { + super(source); + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/SpringApplicationContext.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/SpringApplicationContext.ftl new file mode 100644 index 0000000000000000000000000000000000000000..a6e7b6374ce46bd405e58bf3bd179e2feffe8b6b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/SpringApplicationContext.ftl @@ -0,0 +1,40 @@ +/* + * Copyright 2014 Jeanfrancois Arcand + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + package ${package}.utils; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.stereotype.Component; + +@Component +public class SpringApplicationContext implements BeanFactoryAware { + + private static BeanFactory springBeanFactory; + + @Override + public synchronized void setBeanFactory(BeanFactory beanFactory) throws BeansException { + springBeanFactory = beanFactory; + } + + public synchronized static T getBean(Class klass) { + return springBeanFactory.getBean(klass); + } + + public synchronized static Object getBean(String beanName) { + return springBeanFactory.getBean(beanName); + } +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/acl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/acl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/acl.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/aclimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/aclimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..0c1a4ee78200bbd0e9696da6c74044bd557816f9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/aclimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @${field.annotation} + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/application.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/application.ftl new file mode 100644 index 0000000000000000000000000000000000000000..62e9e70e4cbd4eff27bc42c1405ffd0281b152bc --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/application.ftl @@ -0,0 +1,28 @@ +package ${package}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; + + +/** +* @Description:应用启动入口 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@ComponentScan({"${package}.**"}) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/applicationproperties.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/applicationproperties.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e0b6effa2a294f699e3847340a41cf906dff0c17 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/applicationproperties.ftl @@ -0,0 +1,21 @@ +server.port=8083 +management.port=8073 + +# 跨域 +endpoints.cors.allowed-origins=http://127.0.0.1:8083 +endpoints.cors.allowed-methods=GET,POST + + +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/coder_bank_product?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username=root +spring.datasource.password=root + +#配置.xml文件路径 +mybatis.config-locations=classpath:mybatis-config.xml +mybatis.mapper-locations=classpath:mapper/*.xml +#配置模型路径 +mybatis.type-aliases-package=com.tianhua.codemaker.bean + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/baseController.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/baseController.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9aeaf34f9473743def40c5f43d47157f84466aa1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/baseController.ftl @@ -0,0 +1,45 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** +* @Description:控制层基础父类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class BaseController{ + + protected Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 从request中获取指定的字符串 + * @param parameterName + * @return + */ + protected String getParameterString(String parameterName) { + //return RequestUtil.getParameterString(parameterName); + return ""; + } + + /** + * 从request中获取指定的整型 + * @param parameterName + * @return + */ + protected Integer getParameterInteger(String parameterName) { + // return RequestUtil.getParameterInteger(parameterName); + return 0; + } + + /** + * 从request中获取指定的长整型 + * @param parameterName + * @return + */ + protected Long getParameterLong(String parameterName) { + //return RequestUtil.getParameterLong(parameterName); + return 0L; + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/bo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/bo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bda879528eb4348db9074de60a254d187dec78ea --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/bo.ftl @@ -0,0 +1,24 @@ +package ${package}.bo; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}BO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}BO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/boddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/boddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..1a43acac8202e47b8613705d0592615b6c3f14fd --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/boddd.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + + /** + * ${field.desc} + */ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/cache.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/cache.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/cache.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/controller.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/controller.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3c88f6d538a3d5c5784303201653be94a35443b2 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/controller.ftl @@ -0,0 +1,103 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${table.humpClassName}Controller extends BaseController{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}Controller.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + + + /** + * @Description:新增${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/add",method = RequestMethod.POST) + public ResultDto add(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:修改${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/update",method = RequestMethod.POST) + public ResultDto update(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据id删除${table.tableComment} + * @version v1.0 + * @param id + * @return ResultDto + */ + @PostMapping("/${table.humpTableName}/delete") + public ResultDto delete(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据ID获取${table.tableComment}单条记录 + * @version v1.0 + * @param id + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/get") + public ResultDataDto getById(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:分页获取${table.tableComment}记录 + * @version v1.0 + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/getpage") + public ResultDataDto getPage(){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:修改${table.tableComment}状态 + * @version v1.0 + * @param id + * @param status + * @return ResultDataDto + */ + @PostMapping("/${table.humpTableName}/changestatus") + public ResultDto changeStatus(@RequestParam(name = "id") Long id,@RequestParam(name = "status") int status){ + //todo impl code + return new ResultDto(); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/controllerddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/controllerddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..746c312f5a54c96461ee594b214cb3824ff9b69a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/controllerddd.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +<#list imports as importClass> +import ${importClass}; + +import org.springframework.beans.factory.annotation.Autowired; + + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${class.className} ${class.relationClassStr}{ + + protected Logger logger = LoggerFactory.getLogger(${class.className}.class); + +<#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + +${method.doc} + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/convert.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/convert.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6fe60c1bbf6b49ed0ddcb1193761b8093091fa98 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/convert.ftl @@ -0,0 +1,30 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.factory.Mappers; + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + ${class.className} INSTANCE = Mappers.getMapper(${class.className}.class); + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/do.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/do.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5cb6980c8680c78017324dca6939094acf5835ec --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/do.ftl @@ -0,0 +1,24 @@ +package ${packageInfrast}.dao.dataobject; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${table.tableComment}DO类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${table.humpClassName}DO{ + + <#list columns as column> + + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/dto.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/dto.ftl new file mode 100644 index 0000000000000000000000000000000000000000..53b7d4e007d74fb912a31d9b3f39979a36d3c88e --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/dto.ftl @@ -0,0 +1,25 @@ +package ${package}.dto; + +import java.util.Date; +import java.math.BigDecimal; +import lombok.Data; +import lombok.ToString; +import java.io.Serializable; + + +/** +* @Description:${table.tableComment}DTO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${table.humpClassName}DTO implements Serializable { + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/dtoddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/dtoddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d6243cb09279ec491a39bf98497e22aeef0b75b9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/dtoddd.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + +/** +* @Description:${class.classDesc}类 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + +<#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/entity.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/entity.ftl new file mode 100644 index 0000000000000000000000000000000000000000..c45bed22e584d61b58d6675286412e84755d1a9c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/entity.ftl @@ -0,0 +1,33 @@ +package ${package}.entity; + +import java.util.Date; +import java.math.BigDecimal; + + /** + * @Description:${table.tableComment}Entity类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public class ${table.humpClassName}Entity{ + + <#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + + <#list columns as column> + /** + * 描述:${column.columnComment} + */ + public ${column.columnTypeName} get${column.columnUperName}() { + return ${column.columnFieldName}; + } + /** + * 描述:${column.columnComment} + */ + public void set${column.columnUperName}(${column.columnTypeName} ${column.columnFieldName}) { + this.${column.columnFieldName} = ${column.columnFieldName}; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/enum.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/enum.ftl new file mode 100644 index 0000000000000000000000000000000000000000..27c66dd0e0190604a3c1c039819a08895cb3449c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/enum.ftl @@ -0,0 +1,47 @@ +package ${class.packageName}; + +import lombok.Getter; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Getter +public enum ${class.className}{ + + /** + * + */ + <#list enums as enumValue> + ${enumValue}, + + ; + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + + ${class.className}(${class.constructParamStr}){ + <#list bodys as body> + ${body}; + + } + + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + public static ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/event.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/event.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9f15e120dfe9a271ea823b5e318410cbd3be5c44 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/event.ftl @@ -0,0 +1,35 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/exeimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/exeimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6a8d75475a8c42353b308de6c43e6e9bd173bca --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/exeimpl.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import ${class.packageName}.${class.className}; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/factory.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/factory.ftl new file mode 100644 index 0000000000000000000000000000000000000000..d7514abef0dc2444f918828f8f828e846a2c489b --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/factory.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + +${method.doc} + ${method.visibility} ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feign.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feign.ftl new file mode 100644 index 0000000000000000000000000000000000000000..25af93e70591fa7565dcc59cc3d5736f054cbd41 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feign.ftl @@ -0,0 +1,68 @@ +package ${package}.api.facade; + +import java.util.List; +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; +import com.coderman.utils.response.PageDTO; + +import ${package}.api.dto.${table.humpClassName}DTO; + +/** + * @Description:${table.tableComment}Facade接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Facade{ + + /** + * @Description:新增${table.tableComment} + * @author: + * @param dto + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto save(${table.humpClassName}DTO dto) throws Exception; + + /** + * + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public ResultDto delete(Long id); + + /** + * + * @Description: 通过id查询 + * @param @param id + * @return ResultDataDto<${table.humpClassName}DTO> + * @throws + */ + public ResultDataDto<${table.humpClassName}DTO> getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getAll() throws Exception; + + /** + * @Description:修改 + * @param @param ${table.humpTableName}DTO + * @return int + * @throws + */ + public ResultDto update(${table.humpClassName}DTO ${table.humpTableName}DTO) throws Exception; + + + /** + * @Description:分页查询记录 + * @return ResultDataDto> + * @throws + */ + public ResultDataDto> getPageList(PageDTO pageDto) throws Exception; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feigncontroller.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feigncontroller.ftl new file mode 100644 index 0000000000000000000000000000000000000000..b8a174a61d57c094a61d497670fd098957e3fc64 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feigncontroller.ftl @@ -0,0 +1,103 @@ +package ${package}.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.dto.${table.humpClassName}DTO; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${table.humpClassName}Controller extends BaseController{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}Controller.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + + + /** + * @Description:新增${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/add",method = RequestMethod.POST) + public ResultDto add(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:修改${table.tableComment} + * @version v1.0 + * @param ${table.humpTableName}VO + * @return ResultDto + */ + @RequestMapping(value = "/${table.humpTableName}/update",method = RequestMethod.POST) + public ResultDto update(@RequestBody ${table.humpClassName}VO ${table.humpTableName}VO){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据id删除${table.tableComment} + * @version v1.0 + * @param id + * @return ResultDto + */ + @PostMapping("/${table.humpTableName}/delete") + public ResultDto delete(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDto(); + } + + /** + * @Description:根据ID获取${table.tableComment}单条记录 + * @version v1.0 + * @param id + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/get") + public ResultDataDto getById(@RequestParam(name = "id") Long id){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:分页获取${table.tableComment}记录 + * @version v1.0 + * @return ResultDataDto + */ + @GetMapping("/${table.humpTableName}/getpage") + public ResultDataDto getPage(){ + //todo impl code + return new ResultDataDto(); + } + + /** + * @Description:修改${table.tableComment}状态 + * @version v1.0 + * @param id + * @param status + * @return ResultDataDto + */ + @PostMapping("/${table.humpTableName}/changestatus") + public ResultDto changeStatus(@RequestParam(name = "id") Long id,@RequestParam(name = "status") int status){ + //todo impl code + return new ResultDto(); + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feigncontrollerddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feigncontrollerddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..974cd45d8c0edcea7d92487ad7ed20ef3d1112f1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feigncontrollerddd.ftl @@ -0,0 +1,38 @@ +package ${class.packageName}; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +<#list imports as importClass> +import ${importClass}; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** +* @Description:${table.tableComment}控制层 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RestController +public class ${class.className} ${class.relationClassStr}{ + + protected Logger logger = LoggerFactory.getLogger(${class.className}.class); + +<#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + +<#list methods as method> + +${method.doc} + @RequestMapping(value = "${method.pathValue}") + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feignddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feignddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..9607631a0695ae5b502f081cdc2b1756462455b0 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/feignddd.ftl @@ -0,0 +1,22 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +${class.annotation} +public interface ${class.className}{ +<#list methods as method> + +${method.doc} + @RequestMapping(value = "${method.pathValue}") + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/gataway.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/gataway.ftl new file mode 100644 index 0000000000000000000000000000000000000000..f2689c4553a21b9c0f9b83b22c31b7d364c48433 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/gataway.ftl @@ -0,0 +1,23 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + + +/** + * @Description:${class.classDesc}接口 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${class.className}{ + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.returnClass} ${method.methodName}; + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/gatawayimpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/gatawayimpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..6f4af81d020f8b3407df0579a172f77ea443aad1 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/gatawayimpl.ftl @@ -0,0 +1,39 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; + + +/** + * @Description:${class.classDesc}接口实现类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className} ${class.relationClassStr}{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + + <#list fields as field> + @Autowired + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + + @Override + public ${method.returnClass} ${method.methodName}{ +${method.methodContent} + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapper.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapper.ftl new file mode 100644 index 0000000000000000000000000000000000000000..db78b21dca8f442b236fe1bf20f5c7a80263c25d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapper.ftl @@ -0,0 +1,68 @@ +package ${package}.dao.mapper; + +import java.util.List; +import ${package}.dao.dataobject.${table.humpClassName}DO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + +/** + * @Description:${table.tableComment}mapperDAO接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Mapper +public interface ${table.humpClassName}Mapper{ + + /** + * + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public long insert(${table.humpClassName}DO ${table.humpTableName}DO); + + /** + * @Description: 通过id删除数据 + * @param id + * @return int + */ + public int deleteById(Long id); + + /** + * @Description: 通过id查询 + * @param id + * @return ResultDataDto<${table.humpClassName}DO> + */ + public ${table.humpClassName}DO getById(Long id); + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getAll(); + + /** + * + * @Description:新增或修改 + * @param ${table.humpTableName}DO + * @return int + */ + public int update(${table.humpClassName}DO ${table.humpTableName}DO); + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}DO + */ + public List<${table.humpClassName}DO> getPageList(); + + + /** + * @Description:查询数量 + * @return int + */ + public int getCount(); + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..43102bc46dc874bde3bcc9316203d6183e3adda9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperddd.ftl @@ -0,0 +1,26 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + + + +/** +* @Description:${class.classDesc}接口 +* @Author:${class.author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@Mapper +public interface ${class.className}{ + +<#list methods as method> + ${method.doc} + ${method.returnClass} ${method.methodName}; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperxml.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperxml.ftl new file mode 100644 index 0000000000000000000000000000000000000000..3e3c284f13bb9414fe3d561bdc4f4a9453ced9bd --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperxml.ftl @@ -0,0 +1,62 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperxmlddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperxmlddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..7d50a9abc14735d5c345f581d318c4ba35bb7d4d --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mapperxmlddd.ftl @@ -0,0 +1,59 @@ + + + + + + + + + <#list columns as column> + + + + + + + + + + + + + ${table.columnNameList} + + + + insert into ${table.tableName}( + ${table.insertColumnNames} + ) + values( + ${table.insertColumnNameList} + ) + + + + update ${table.tableName} + set + ${table.updateColumnNameList} + where id = <#noparse>#{id<#noparse>} + + + + + + + + delete from ${table.tableName} where id = <#noparse>#{id<#noparse>} + + +<#list fields as field> +${field.fieldName} + + + + + diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqconsumer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqconsumer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqconsumer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqhandler.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqhandler.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqhandler.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqlistener.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqlistener.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqlistener.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqproducer.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqproducer.ftl new file mode 100644 index 0000000000000000000000000000000000000000..758b640f34c009f2f7a9a7659d06586a9d51db1a --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/mqproducer.ftl @@ -0,0 +1,34 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import org.springframework.stereotype.Service; + + /** + * @Description:${class.className}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/msgbody.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/msgbody.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e6c85cb66d03e7f57dcafa118bdfe67d37ec6491 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/msgbody.ftl @@ -0,0 +1,33 @@ +package ${class.packageName}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/service.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/service.ftl new file mode 100644 index 0000000000000000000000000000000000000000..13903d7f54e740c4970624dde9be6eccc4ad068c --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/service.ftl @@ -0,0 +1,69 @@ +package ${package}.service; + +import java.util.List; + +import ${package}.bo.${table.humpClassName}BO; + +/** + * @Description:${table.tableComment}Service接口 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +public interface ${table.humpClassName}Service{ + + /** + * @Description:新增 + * @param bo + * @return ResultDto 返回类型 + * @throws + */ + public ${table.humpClassName}BO save(${table.humpClassName}BO bo) throws Exception; + + /** + * @Description: 通过id删除数据 + * @param id + * @return ResultDto 返回类型 + * @throws + */ + public Boolean delete(Long id); + + /** + * @Description: 通过id查询 + * @param id + * @return ResultDataDto<${table.humpClassName}BO> + * @throws + */ + public ${table.humpClassName}BO getById(Long id) throws Exception; + + /** + * @Description:查询所有数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getAll() throws Exception; + + /** + * @Description:修改 + * @param ${table.humpTableName}BO + * @return boolean + * @throws + */ + public Boolean update(${table.humpClassName}BO ${table.humpTableName}BO) throws Exception; + + + /** + * @Description:分页查询数据 + * @return List<${table.humpClassName}BO> + * @throws + */ + public List<${table.humpClassName}BO> getPageList() throws Exception; + + /** + * @Description:查询数量 + * @return int + */ + public int getCount() throws Exception; + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/serviceImpl.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/serviceImpl.ftl new file mode 100644 index 0000000000000000000000000000000000000000..496601eeae98d89de8913b72045c62a0a364ecf9 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/serviceImpl.ftl @@ -0,0 +1,77 @@ +package ${package}.service.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import ${package}.dao.mapper.${table.humpClassName}Mapper; +import ${package}.service.${table.humpClassName}Service; +import ${package}.bo.${table.humpClassName}BO; + +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import com.alibaba.fastjson.JSONObject; + +/** + * @Description:${table.tableComment}Service接口实现类 + * @Author:${author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Service +public class ${table.humpClassName}ServiceImpl implements ${table.humpClassName}Service{ + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private ${table.humpClassName}Mapper ${table.humpTableName}Mapper; + + @Override + public ${table.humpClassName}BO save(${table.humpClassName}BO bo) { + //todo impl code + return null; + } + + @Override + public Boolean delete(Long id) { + logger.info("${table.humpTableName}Service.delete,id="+id); + //todo impl code + return false; + } + + @Override + public ${table.humpClassName}BO getById(Long id) { + logger.info("${table.humpTableName}Service.getById,id="+id); + //todo impl code + return null; + } + + @Override + public List<${table.humpClassName}BO> getAll() { + //todo impl code + return null; + } + + @Override + public Boolean update(${table.humpClassName}BO bo) { + //todo impl code + return false; + } + + + @Override + public List<${table.humpClassName}BO> getPageList() throws Exception { + return null; + } + + + @Override + public int getCount() throws Exception { + return 0; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/test.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/test.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bddd6827a33d6e58ca7d55206efe1c2510a4a550 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/test.ftl @@ -0,0 +1,107 @@ +package ${package}.service.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; +import ${package}.Application; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.alibaba.fastjson.JSON; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +/** +* @Description:${table.tableComment}单元测试 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT,classes = {Application.class}) +public class ${table.humpClassName}ServiceTest{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}ServiceTest.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + @Autowired + private TestRestTemplate restTemplate; + + /** + * @Description:测试新增${table.tableComment} 接口 + */ + @Test + public void testAdd(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/add",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试修改${table.tableComment} + */ + @Test + public void testUpdate(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/update",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试删除根据id删除${table.tableComment} + */ + @Test + public void testDelete(){ + //todo test code + long id = 1L; + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/delete",id, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:但是根据ID获取${table.tableComment}单条记录 + */ + @Test + public void testGetById(){ + //todo test code + ResultDataDto resultDataDto = restTemplate.getForEntity("/${table.humpTableName}/get?id=1",ResultDataDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDataDto)); + } + + /** + * @Description:测试分页获取${table.tableComment}记录 + */ + @Test + public void getPage(){ + //todo test code + } + + /** + * @Description:测试禁用${table.tableComment}状态 + */ + @Test + public void testDisable(){ + //todo test code + } + /** + * @Description:测试启用${table.tableComment}状态 + */ + @Test + public void testEnable(){ + //todo test code + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/valueobject.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/valueobject.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/valueobject.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/vo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/vo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..8113fd2240a602e78a54895474b39b7c1e56d0e4 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/vo.ftl @@ -0,0 +1,33 @@ +package ${package}.vo; + +import java.util.Date; +import java.math.BigDecimal; + +/** +* @Description:${table.tableComment}VO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class ${table.humpClassName}VO{ + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +<#list columns as column> + /** + * 描述:${column.columnComment} + */ + public ${column.columnTypeName} get${column.columnUperName}() { + return ${column.columnFieldName}; + } + /** + * 描述:${column.columnComment} + */ + public void set${column.columnUperName}(${column.columnTypeName} ${column.columnFieldName}) { + this.${column.columnFieldName} = ${column.columnFieldName}; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/voddd.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/voddd.ftl new file mode 100644 index 0000000000000000000000000000000000000000..5c2f634e6bcd418c79556b914b5b2c9c4701aff5 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/springcloud/voddd.ftl @@ -0,0 +1,36 @@ +package ${class.packageName}; + +<#list imports as importClass> +import ${importClass}; + + +import lombok.Data; +import lombok.ToString; + + /** + * @Description:${class.classDesc}类 + * @Author:${class.author} + * @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} + * @version v1.0 + */ +@Data +@ToString +public class ${class.className} ${class.relationClassStr}{ + + <#list fields as field> + /** ${field.desc} **/ + ${field.visibility} ${field.fieldName}; + + + <#list methods as method> + /** + * + * @Description:${method.desc} + * @return ${method.returnClass} + */ + ${method.visibility} ${method.returnClass} ${method.methodName}{ + ${method.returnBody} + } + + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/test.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/test.ftl new file mode 100644 index 0000000000000000000000000000000000000000..bddd6827a33d6e58ca7d55206efe1c2510a4a550 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/test.ftl @@ -0,0 +1,107 @@ +package ${package}.service.test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ${package}.service.${table.humpClassName}Service; +import ${package}.vo.${table.humpClassName}VO; +import ${package}.Application; + +import com.coderman.utils.response.ResultDataDto; +import com.coderman.utils.response.ResultDto; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import com.alibaba.fastjson.JSON; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +/** +* @Description:${table.tableComment}单元测试 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT,classes = {Application.class}) +public class ${table.humpClassName}ServiceTest{ + + protected Logger logger = LoggerFactory.getLogger(${table.humpClassName}ServiceTest.class); + + @Autowired + private ${table.humpClassName}Service ${table.humpTableName}Service; + @Autowired + private TestRestTemplate restTemplate; + + /** + * @Description:测试新增${table.tableComment} 接口 + */ + @Test + public void testAdd(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/add",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试修改${table.tableComment} + */ + @Test + public void testUpdate(){ + //todo test code + ${table.humpClassName}VO vo = new ${table.humpClassName}VO(); + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/update",vo, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:测试删除根据id删除${table.tableComment} + */ + @Test + public void testDelete(){ + //todo test code + long id = 1L; + ResultDto resultDto = restTemplate.postForEntity("/${table.humpTableName}/delete",id, ResultDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDto)); + } + + /** + * @Description:但是根据ID获取${table.tableComment}单条记录 + */ + @Test + public void testGetById(){ + //todo test code + ResultDataDto resultDataDto = restTemplate.getForEntity("/${table.humpTableName}/get?id=1",ResultDataDto.class).getBody(); + System.out.println(JSON.toJSONString(resultDataDto)); + } + + /** + * @Description:测试分页获取${table.tableComment}记录 + */ + @Test + public void getPage(){ + //todo test code + } + + /** + * @Description:测试禁用${table.tableComment}状态 + */ + @Test + public void testDisable(){ + //todo test code + } + /** + * @Description:测试启用${table.tableComment}状态 + */ + @Test + public void testEnable(){ + //todo test code + } +} diff --git a/codemaker-parent/codemaker-core/src/test/resources/template/vo.ftl b/codemaker-parent/codemaker-core/src/test/resources/template/vo.ftl new file mode 100644 index 0000000000000000000000000000000000000000..8113fd2240a602e78a54895474b39b7c1e56d0e4 --- /dev/null +++ b/codemaker-parent/codemaker-core/src/test/resources/template/vo.ftl @@ -0,0 +1,33 @@ +package ${package}.vo; + +import java.util.Date; +import java.math.BigDecimal; + +/** +* @Description:${table.tableComment}VO类 +* @Author:${author} +* @CreateTime:${.now?string('yyyy-MM-dd HH:mm:ss')} +* @version v1.0 +*/ +public class ${table.humpClassName}VO{ + +<#list columns as column> + /** ${column.columnComment} **/ + private ${column.columnTypeName} ${column.columnFieldName}; + + +<#list columns as column> + /** + * 描述:${column.columnComment} + */ + public ${column.columnTypeName} get${column.columnUperName}() { + return ${column.columnFieldName}; + } + /** + * 描述:${column.columnComment} + */ + public void set${column.columnUperName}(${column.columnTypeName} ${column.columnFieldName}) { + this.${column.columnFieldName} = ${column.columnFieldName}; + } + +} \ No newline at end of file diff --git a/codemaker-parent/codemaker-javs/pom.xml b/codemaker-parent/codemaker-javs/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..20ec6f2ef18f867fe01811ee3af048b119018ea6 --- /dev/null +++ b/codemaker-parent/codemaker-javs/pom.xml @@ -0,0 +1,75 @@ + + + + + com.coderman.codemaker + codemaker-parent + 1.3.0-SNAPSHOT + + 4.0.0 + + codemaker-javs + com.coderman.codemaker + 1.0.0-SNAPSHOT + + + jar + + codemaker-javs + + http://www.example.com + + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.11 + test + + + + com.tianhua.javs + javs-core + 1.0.0-SNAPSHOT + + + + com.coderman.codemaker + codemaker-api + 1.1-SNAPSHOT + + + + org.springframework + spring-context + + + + org.apache.commons + commons-io + 1.3.2 + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + + diff --git a/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/Constants.java b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/Constants.java new file mode 100644 index 0000000000000000000000000000000000000000..2cb2546da1ee4388ea5b00f0dc16ac937d6aae5f --- /dev/null +++ b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/Constants.java @@ -0,0 +1,14 @@ +package com.tianhua.codemaker.javs; + +/** + * Description: + * date: 2022/3/11 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +public class Constants { + + public static final String JAVS = "javs"; +} diff --git a/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/factory/ModelFactory.java b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/factory/ModelFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..f6c9c86912c29a32a7fd0144cd90c51e636bcfdb --- /dev/null +++ b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/factory/ModelFactory.java @@ -0,0 +1,215 @@ +package com.tianhua.codemaker.javs.factory; + +import com.tianhua.codemaker.bean.component.ComponentContextBean; +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.javs.client.bean.DomainModelBean; +import com.tianhua.javs.client.model.*; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Description: + * date: 2022/3/10 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class ModelFactory { + /** + * 将代码生成平台的plantuml模型适配到javs引擎的模型 + * @param plantUmlContextBean + * @return + */ + public DomainModelBean buildJavsDomainModel(PlantUmlContextBean plantUmlContextBean) { + DomainModelBean domainModelBean = new DomainModelBean(); + domainModelBean.setCurrentCompName(plantUmlContextBean.getAppName()); + plantUmlContextBean.getClassBeanMap().forEach((k,v)-> domainModelBean.addClassBean(buildClassModel(v, plantUmlContextBean.getAppName()))); + plantUmlContextBean.getInterfaceBeanMap().forEach((k,v)-> domainModelBean.addInterfaceBean(buildInterfaceModel(v, plantUmlContextBean.getAppName()))); + plantUmlContextBean.getEnumBeanMap().forEach((k,v)-> domainModelBean.addEnumBean(buildEnumModel(v, plantUmlContextBean.getAppName()))); + + if(plantUmlContextBean.getDerivedPlantUmlContextBean() != null){ + PlantUmlContextBean derivedPlantUmlContextBean = plantUmlContextBean.getDerivedPlantUmlContextBean(); + derivedPlantUmlContextBean.getClassBeanMap().forEach((k,v)-> domainModelBean.addClassBean(buildClassModel(v, plantUmlContextBean.getAppName()))); + derivedPlantUmlContextBean.getInterfaceBeanMap().forEach((k,v)-> domainModelBean.addInterfaceBean(buildInterfaceModel(v, plantUmlContextBean.getAppName()))); + derivedPlantUmlContextBean.getEnumBeanMap().forEach((k,v)-> domainModelBean.addEnumBean(buildEnumModel(v, plantUmlContextBean.getAppName()))); + + } + Map componentContextBeanMap = plantUmlContextBean.getCompContextBeanMap(); + if(componentContextBeanMap == null || componentContextBeanMap.isEmpty()){ + return domainModelBean; + } + + componentContextBeanMap.forEach((k,componentContextBean)->{ + if(CollectionUtils.isNotEmpty(componentContextBean.getClassBeanList())){ + componentContextBean.getClassBeanList().forEach(classBean -> domainModelBean.addClassBean(buildClassModel(classBean,componentContextBean.getComponentName()))); + } + if(CollectionUtils.isNotEmpty(componentContextBean.getInterfaceBeanList())){ + componentContextBean.getInterfaceBeanList().forEach(interfaceBean -> domainModelBean.addInterfaceBean(buildInterfaceModel(interfaceBean,componentContextBean.getComponentName()))); + } + + if(CollectionUtils.isNotEmpty(componentContextBean.getEnumBeanList())){ + componentContextBean.getEnumBeanList().forEach(enumBean -> domainModelBean.addEnumBean(buildEnumModel(enumBean,componentContextBean.getComponentName()))); + } + }); + + + return domainModelBean; + } + + + /** + * 转换枚举元数据模型 + * @param enumBean + * @param compName + * @return + */ + private EnumModel buildEnumModel(EnumBean enumBean,String compName){ + EnumModel enumModel = new EnumModel(); + enumModel.setCompName(compName); + enumModel.setClassDesc(enumBean.getClassDesc()); + enumModel.setPackageName(enumBean.getPackageName()); + enumModel.setFieldBeanList(buildFieldList(enumBean.getFieldBeanList(),enumBean.getClassName())); + enumModel.setEnumValueList(enumBean.getEnumValueList()); + enumModel.setMethodBeanList(buildMethodList(enumBean.getMethodBeanList())); + enumModel.setImplInterfaceBean(buildInterfaceModel(enumBean.getImplInterfaceBean(),compName)); + return enumModel; + } + + /** + * 转换接口元数据模型 + * @param interfaceBean + * @param compName + * @return + */ + private InterfaceModel buildInterfaceModel(InterfaceBean interfaceBean,String compName){ + if(interfaceBean == null){ + return null; + } + InterfaceModel interfaceModel = new InterfaceModel(); + interfaceModel.setCompName(compName); + interfaceModel.setClassDesc(interfaceBean.getClassDesc()); + interfaceModel.setClassName(interfaceBean.getClassName()); + interfaceModel.setPackageName(interfaceBean.getPackageName()); + interfaceModel.setRelationClassStr(interfaceBean.getRelationClassStr()); + interfaceModel.setMethodBeanList(buildMethodList(interfaceBean.getMethodBeanList())); + return interfaceModel; + } + + + + + /** + * 转换class元数据模型 + * @param classBean + * @param compName + * @return + */ + private ClassModel buildClassModel(ClassBean classBean,String compName){ + ClassModel classModel = new ClassModel(); + classModel.setCompName(compName); + classModel.setClassName(classBean.getClassName()); + classModel.setPackageName(classBean.getPackageName()); + classModel.setClassDesc(classBean.getClassDesc()); + classModel.setRelationClassStr(classBean.getRelationClassStr()); + classModel.setImplInterfaceBean(buildInterfaceModel(classBean.getImplInterfaceBean(),compName)); + classModel.setFieldBeanList(buildFieldList(classBean.getFieldBeanList(),classBean.getClassName())); + classModel.setMethodBeanList(buildMethodList(classBean.getMethodBeanList())); + + classModel.setSuperFieldBeanList(buildFieldList(classBean.getSuperFieldBeanList(),classBean.getClassName())); + classModel.setSuperMethodBeanList(buildMethodList(classBean.getSuperMethodBeanList())); + + + classModel.setClassName(classBean.getClassName()); + return classModel; + } + + + + + + + + + /** + * 转换属性元数据模型 + * @param fieldBeanList + * @param className + * @return + */ + private List buildFieldList(List fieldBeanList, String className){ + List fieldModelList = new ArrayList<>(); + if(CollectionUtils.isEmpty(fieldBeanList)){ + return fieldModelList; + } + for (FieldBean fieldBean : fieldBeanList){ + FieldModel fieldModel = new FieldModel(); + fieldModel.setFieldType(fieldBean.getFieldType()); + fieldModel.setFieldName(fieldBean.getFieldName()); + fieldModel.setClassName(className); + fieldModel.setDesc(fieldBean.getDesc()); + fieldModelList.add(fieldModel); + } + + return fieldModelList; + } + + /** + * 转换方法元数据模型 + * @param methodBeanList + * @return + */ + private List buildMethodList(List methodBeanList){ + List methodModelList = new ArrayList<>(); + if(CollectionUtils.isEmpty(methodBeanList)){ + return methodModelList; + } + for (MethodBean methodBean : methodBeanList){ + MethodModel methodModel = new MethodModel(); + methodModel.setStatic(methodBean.isStatic()); + methodModel.setMethodName(methodBean.getMethodName()); + methodModel.setReturnClass(methodBean.getReturnClass()); + methodModel.setGenericReturnType(methodBean.getGenericReturnType()); + methodModel.setDesc(methodBean.getDesc()); + methodModel.setReturnClassPackage(methodBean.getReturnClassPackage()); + methodModel.setParamModelList(buildParamModelList(methodBean.getMethodName())); + methodModelList.add(methodModel); + } + + return methodModelList; + } + + + /** + * 从方法名称中解析到方法参数 + */ + private List buildParamModelList(String methodName){ + List paramModelList = new ArrayList<>(); + if(!methodName.contains("(") && !methodName.contains(")")){ + return paramModelList; + } + if (!methodName.contains("()")){ + String [] paramArr = methodName.replace(")","").split("\\(")[1].split(","); + if(paramArr != null && paramArr.length>=1){ + for (String paramStr : paramArr){ + ParamModel paramModel = new ParamModel(); + if(paramStr.trim().contains(" ")){ + paramModel.setParamName(paramStr.split(" ")[1]); + paramModel.setParamType(paramStr.split(" ")[0]); + }else { + paramModel.setParamType(paramStr); + } + paramModelList.add(paramModel); + } + } + } + + return paramModelList; + } + +} diff --git a/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/IJavsAdapterSerivceImpl.java b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/IJavsAdapterSerivceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2d82faaeec5de81108e21bd19d53620961748075 --- /dev/null +++ b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/IJavsAdapterSerivceImpl.java @@ -0,0 +1,61 @@ +package com.tianhua.codemaker.javs.service; + +import com.tianhua.codemaker.api.IJavsAdapterSerivce; +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import com.tianhua.codemaker.javs.translate.JavsTranslateService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.List; +import java.util.Map; + +/** + * Description: + * date: 2022/3/11 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Component(value = "javsAdapterService") +public class IJavsAdapterSerivceImpl implements IJavsAdapterSerivce { + + private Logger logger = LoggerFactory.getLogger(IJavsAdapterSerivceImpl.class); + + @Autowired + private JavsTranslateService javsTranslateService; + + @Autowired + private JavsWriteService javsWriteService; + + @Autowired + private JavsReadService javsReadService; + + @Override + public void translateJavsScript(PlantUmlContextBean plantUmlContextBean, String javsScriptProjectPath) { + Map> javsScriptFileContentMap = javsReadService.readJavsScriptFileContent(plantUmlContextBean, javsScriptProjectPath); + if(javsScriptFileContentMap == null){ + logger.warn("javs项目文件为空,不再进行javs扫描解析......."); + return; + } + javsTranslateService.translateJavsScripte(plantUmlContextBean, javsScriptFileContentMap); + } + + @Override + public void generateJavsScriptProject(PlantUmlContextBean plantUmlContextBean, String javsScriptProjectPath) { + File file = new File(javsScriptProjectPath); + if(file.exists()){ + return; + } + plantUmlContextBean.getClassBeanMap().forEach((k, classBean) -> javsWriteService.writeJavs(javsScriptProjectPath, classBean)); + if (plantUmlContextBean.getDerivedPlantUmlContextBean() != null) { + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k, classBean) -> javsWriteService.writeJavs(javsScriptProjectPath, classBean)); + } + } + + +} diff --git a/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/JavsReadService.java b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/JavsReadService.java new file mode 100644 index 0000000000000000000000000000000000000000..3075ae0e305f846ccd6ef5cbc2d1e756d687115a --- /dev/null +++ b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/JavsReadService.java @@ -0,0 +1,77 @@ +package com.tianhua.codemaker.javs.service; + +import com.tianhua.codemaker.bean.plantuml.PlantUmlContextBean; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Description: + * date: 2022/3/11 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class JavsReadService { + + @Autowired + private JavsWriteService javsWriteService; + + /** + * 读取javsscript项目的脚本内容 + * @param javsScriptProjectPath + * @return + */ + public Map> readJavsScriptFileContent(PlantUmlContextBean plantUmlContextBean, String javsScriptProjectPath){ + Map> javsFileContentMap = new HashMap<>(); + File file = new File(javsScriptProjectPath); + if(!file.exists()){ + return null; + } + plantUmlContextBean.getClassBeanMap().forEach((k, classBean) -> { + String filePath = javsWriteService.getFilePath(javsScriptProjectPath, classBean); + + + if(!StringUtils.isEmpty(filePath) ){ + File javsFile = new File(filePath); + if(javsFile.exists()){ + try { + List fileList = FileUtils.readLines(javsFile,"UTF-8"); + javsFileContentMap.put(classBean.getClassName(),fileList); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + }); + if (plantUmlContextBean.getDerivedPlantUmlContextBean() != null) { + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k, classBean) -> { + String filePath = javsWriteService.getFilePath(javsScriptProjectPath, classBean); + if(!StringUtils.isEmpty(filePath)){ + File javsFile = new File(filePath); + if(javsFile.exists()){ + try { + List fileList = FileUtils.readLines(new File(filePath),"UTF-8"); + javsFileContentMap.put(classBean.getClassName(),fileList); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + }); + } + return javsFileContentMap; + } + +} diff --git a/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/JavsWriteService.java b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/JavsWriteService.java new file mode 100644 index 0000000000000000000000000000000000000000..0fa4838f7203665683e63380f6d954d2b492fca0 --- /dev/null +++ b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/service/JavsWriteService.java @@ -0,0 +1,117 @@ +package com.tianhua.codemaker.javs.service; + +import com.alibaba.fastjson.JSON; +import com.tianhua.codemaker.bean.plantuml.AbstractClassBean; +import com.tianhua.codemaker.bean.plantuml.FieldBean; +import com.tianhua.codemaker.bean.plantuml.MethodBean; +import com.tianhua.codemaker.javs.Constants; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * Description: + * date: 2022/3/11 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class JavsWriteService { + private Logger logger = LoggerFactory.getLogger(JavsWriteService.class); + /** + * 写javs文件 + * @param javsScriptProjectPath + * @param abstractClassBean + */ + public void writeJavs(String javsScriptProjectPath, AbstractClassBean abstractClassBean){ + String filePath = getFilePath(javsScriptProjectPath, abstractClassBean); + //对没有方法的Java类进行过滤 + if(CollectionUtils.isEmpty(abstractClassBean.getMethodBeanList())){ + return; + } + if(StringUtils.isEmpty(filePath)){ + logger.warn("java class "+abstractClassBean.getClassName()+" has no className.no javs file"); + return; + } + try { + FileUtils.writeLines(new File(filePath), generateJavsFileContent(abstractClassBean)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 获取javs文件路径 + * @param javsScriptProjectPath + * @param abstractClassBean + * @return + */ + public String getFilePath(String javsScriptProjectPath, AbstractClassBean abstractClassBean) { + String packageName = abstractClassBean.getPackageName(); + if(StringUtils.isEmpty(packageName)){ + System.out.println("abstractClassBean = "+ JSON.toJSONString(abstractClassBean)); + return null; + } + String packagePath = packageName.replace(".", "/") ; + packagePath = Constants.JAVS + "/" + packagePath + "/"; + String fileName = abstractClassBean.getClassName() + "."+Constants.JAVS; + return javsScriptProjectPath + "/" + packagePath + fileName; + } + + + /** + * 生成javs文件内容 + * @param abstractClassBean + * @return + */ + private List generateJavsFileContent(AbstractClassBean abstractClassBean){ + List list = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(abstractClassBean.getFieldBeanList())){ + for (FieldBean fieldBean : abstractClassBean.getFieldBeanList()){ + list.add(fieldBean.getFieldName()); + } + } + list.add("\n"); + if(CollectionUtils.isNotEmpty(abstractClassBean.getMethodBeanList())){ + for (MethodBean methodBean : abstractClassBean.getMethodBeanList()){ + list.add("func "+getNewMethod(methodBean)+"{"); + list.add("}"); + list.add("\n"); + } + } + return list; + } + + /** + * 简化函数声明 + * @param methodBean + * @return + */ + private String getNewMethod(MethodBean methodBean){ + if(methodBean.getParamArr() == null || methodBean.getParamArr().length ==0){ + return methodBean.getSimplMethodName()+"()"; + } + + List paramNameList = new ArrayList<>(); + for (String param : methodBean.getParamArr()){ + if(param.contains(" ")){ + String paramName = param.split(" ")[1]; + paramNameList.add(paramName); + }else { + paramNameList.add(param); + } + } + return methodBean.getSimplMethodName()+"("+StringUtils.join(paramNameList,",")+")"; + + } +} diff --git a/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/translate/JavsTranslateService.java b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/translate/JavsTranslateService.java new file mode 100644 index 0000000000000000000000000000000000000000..b159ff58dfd69dcb8f8e4c2892f8d5cea5891a83 --- /dev/null +++ b/codemaker-parent/codemaker-javs/src/main/java/com/tianhua/codemaker/javs/translate/JavsTranslateService.java @@ -0,0 +1,106 @@ +package com.tianhua.codemaker.javs.translate; + +import com.tianhua.codemaker.bean.plantuml.*; +import com.tianhua.codemaker.javs.factory.ModelFactory; +import com.tianhua.javs.client.bean.DomainModelBean; +import com.tianhua.javs.client.bean.context.TranslateResultContext; +import com.tianhua.javs.client.model.FieldModel; +import com.tianhua.javs.client.model.MethodModel; +import com.tianhua.javs.client.service.JavsScriptEngine; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Description: + * date: 2022/3/10 + * + * @author shenshuai + * @version 1.0.0 + * @since JDK 1.8 + */ +@Service +public class JavsTranslateService { + + + @Autowired + private JavsScriptEngine javsScriptEngine; + + @Autowired + private ModelFactory modelFactory; + + /** + * codemaker与javs引擎项目整合的入口 + * @param plantUmlContextBean + */ + public void translateJavsScripte(PlantUmlContextBean plantUmlContextBean, Map> javsScriptFileContentMap){ + DomainModelBean domainModelBean = modelFactory.buildJavsDomainModel(plantUmlContextBean); + + List translateResultContextList = javsScriptEngine.exeParse(domainModelBean, javsScriptFileContentMap); + Map translateResultContextMap = translateResultContextList.stream().collect(Collectors.toMap(TranslateResultContext::getClassName,o->o)); + + plantUmlContextBean.getClassBeanMap().forEach((k,classBean)->{ + TranslateResultContext translateResultContext = translateResultContextMap.get(classBean.getClassName()); + refreshBean(classBean,translateResultContext); + }); + PlantUmlContextBean derivedPlantUmlContextBean = plantUmlContextBean.getDerivedPlantUmlContextBean(); + if(derivedPlantUmlContextBean != null){ + plantUmlContextBean.getDerivedPlantUmlContextBean().getClassBeanMap().forEach((k,classBean)->{ + TranslateResultContext translateResultContext = translateResultContextMap.get(classBean.getClassName()); + refreshBean(classBean,translateResultContext); + }); + } + } + + /** + * 将经过翻译的javs代码刷回模型上下文中 + * @param classBean + * @param translateResultContext + */ + private void refreshBean(AbstractClassBean classBean,TranslateResultContext translateResultContext){ + if(translateResultContext == null){ + return; + } + classBean.addImportClassBatch(translateResultContext.getPackageList()); + Map fieldModelMap = translateResultContext.getFieldModelMap(); + if(!fieldModelMap.isEmpty()){ + fieldModelMap.forEach((k,fieldModel)->{ + FieldBean fieldBean = new FieldBean(); + fieldBean.setFieldName(fieldModel.getFieldName()); + fieldBean.setFieldSimpleName(fieldModel.getFieldSimpleName()); + fieldBean.setVisibility(fieldModel.getVisibility()); + classBean.addField(fieldBean); + }); + } + + if(CollectionUtils.isEmpty(classBean.getMethodBeanList())){ + return; + } + classBean.getMethodBeanList().forEach(methodBean -> refreshMethodContent(methodBean, translateResultContext.getMethodModelList())); + } + + /** + * 刷新方法内容 + * @param methodBean + * @param methodModelList + */ + private void refreshMethodContent(MethodBean methodBean , List methodModelList){ + if(CollectionUtils.isEmpty(methodModelList)){ + return; + } + for (MethodModel methodModel : methodModelList){ + if(methodModel.getMethodName().equals(methodBean.getMethodName()) && methodModel.getReturnClass().equals(methodBean.getReturnClass())){ + if(StringUtils.isNotEmpty(methodModel.getMethodContent())){ + methodBean.setMethodContent(methodModel.getMethodContent()); + } + break; + } + } + } + +} diff --git a/codemaker-parent/componentmodel.puml b/codemaker-parent/componentmodel.puml new file mode 100644 index 0000000000000000000000000000000000000000..a82494100d22d2b89f563f3fe3d31a4260de3f1e --- /dev/null +++ b/codemaker-parent/componentmodel.puml @@ -0,0 +1,66 @@ +@startuml + +class FtlBean as "自定义模板bean-FtlBean"{ + String moduleName:模块名称 + + String classType:class类型 + + String codeTempFileName:代码元素模板名称 + + String ftlStr:自定义模板配置字符串 +} + +class ConfigFileBean as "配置文件模型bean-ConfigFileBean"{ + + String configFileName:文件名 + + String configFileSuffix:文件后缀 + + String moduleName:所属模块 + + String templateName:ftl文件模板名称 +} + + +class AnnotationTagBean as "自定义注解模型Bean-AnnotationTagBean"{ + + String packageName:注解所在包 + + String classAlias:注解在plantuml 文档中的别名 + + String annotation:注解在方法或者类上的展示形式 + + String className:注解类名称 +} + +class GAVBean as "mavenGAV模型bean-GAVBean"{ + String groupId + String artifactId + String version + String type + String scope + String componentName:所属服务组件名称 +} + +class PomBean as "Pom文件的bean模型-PomBean"{ + + String modulePrefix:模块前缀 + String appName + String url:pom.url + String moduleName:模块名称 + String groupId + String artifactId + String version + String templateCode + String moduleCode + List dependencyList:依赖的mv +} + +class ProjectBean as "项目模型bean-ProjectBean"{ + String packageName:全局包名 + String applicationName:应用名 + String dataBaseName:数据库名 + Map configFileMap:业务配置信息 +} + +@enduml \ No newline at end of file diff --git a/codemaker-parent/pom.xml b/codemaker-parent/pom.xml index 92b08a38772216226b528b10827ef5495189494a..50d8372fe12eeb168cd43f04e9bd941d7cb5eb98 100644 --- a/codemaker-parent/pom.xml +++ b/codemaker-parent/pom.xml @@ -12,7 +12,7 @@ pom com.coderman.codemaker codemaker-parent - 1.2.2-SNAPSHOT + 1.3.0-SNAPSHOT codemaker-parent @@ -22,6 +22,7 @@ codemaker-apiImpl codemaker-api codemaker-core + codemaker-javs UTF-8 @@ -36,6 +37,14 @@ 4.11 test + + + com.coderman.codermaker.dberparse + codemaker-dberparse + 1.0.1-SNAPSHOT + + + diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/Application.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/Application.java index 38bb7fef72a3d8c7715225827a4273f8f61519df..069855fe5d1accc7bc3795b539db5ca6c237ab93 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/Application.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/Application.java @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:应用启动入口 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AccountController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AccountController.java index fe86a429ddef4a6f2e42a14328790e78bdf996d6..9b0fd7228fb7e6348c68423410e49cff34a835da 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AccountController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AccountController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:合作用户表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AttractInvestmentController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AttractInvestmentController.java index 84026bd4c3d374e55c8f104617e96568ca1cdb6d..df1533798ab2d2d6041771926ffb16da546d13e7 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AttractInvestmentController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/AttractInvestmentController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:招商服务注册表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/BaseController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/BaseController.java index 2e406e41639944d0f478fe3fee8e9af85cce02f9..e6b989a2aa1fd86b7e2a51647aacc97388c58117 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/BaseController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/BaseController.java @@ -5,7 +5,7 @@ import org.slf4j.LoggerFactory; /** * @Description:控制层基础父类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordContractTemplateController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordContractTemplateController.java index 7f25e4a9dae1a524951e89b34aab66c6bdcaa6be..133b0a7c3aef0a16553719eaca139b4840d0c514 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordContractTemplateController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordContractTemplateController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:房东合同模板表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomRentRecordController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomRentRecordController.java index b1b064fceea31f3c4cde3032c074ba61208e744e..792289e7eb60290b511503d3e5aa6f93b1ec8997 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomRentRecordController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomRentRecordController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:房源出租记录表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomSourceController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomSourceController.java index d9a3f6583c0daf304a28ca1f3e6ebceb889e7cd9..244c1b4b1f03a4e2882a806d6b5fb3d0d36e6f92 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomSourceController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/LandlordRoomSourceController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:房东-房源表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RealRoomSourceController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RealRoomSourceController.java index 82f585629c88ba2a95ba40745b01078db150cc6b..6253c51773bdc57294a0192fd60b93bf4f98e045 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RealRoomSourceController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RealRoomSourceController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:房东-房源表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentController.java index 69719a51aa8ea79e61f9128a3272c43c4ed2243c..af2ec7181dd693241eef692e289736356ad0f9eb 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:代理人表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentOrderController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentOrderController.java index 9f70f6de7eb47381802a099c47918ee58ef9a428..175e3abe8275ba017ba4f6e7bf4c65dca3890617 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentOrderController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomAgentOrderController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:代理人-签单表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomLandlordController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomLandlordController.java index 4d80067d98b99c87c0c03292c05259937528d396..06d5f5abfbdfa43adc527bf87c2c644b2af62cb3 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomLandlordController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomLandlordController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:房东表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomPublishController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomPublishController.java index e03429c4436a84799e3bf31be124ede9a5eb6079..e712ef817a40bbfd3d2cbce447dd90173951350a 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomPublishController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomPublishController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:代理人-房源发布表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomSubscribeController.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomSubscribeController.java index 21cc24c88a853eb1d860408e3cda4f3209230984..314aba4fea471b30291eb94724d8d4f27aa46eb3 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomSubscribeController.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/controller/RoomSubscribeController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*; /** * @Description:代理人-预约看房记录表控制层 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AccountEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AccountEntity.java index c2642dc24a4c13e7888317163cf80f3c6de2becc..0edb5ec53d1a5da50688c7a1db3c25fa861caab3 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AccountEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AccountEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:合作用户表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AttractInvestmentEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AttractInvestmentEntity.java index 872ee000550c4f1ca35bf14bf048b2200cd0301e..cebb92206ce46c3344bfa7a826c0aa2e60b678bd 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AttractInvestmentEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/AttractInvestmentEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:招商服务注册表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordContractTemplateEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordContractTemplateEntity.java index ee21481616e469bed3ef27aaee9b52f7a0479acb..8b1a560178ec8efa69b04d99809f10ae24d55533 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordContractTemplateEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordContractTemplateEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:房东合同模板表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomRentRecordEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomRentRecordEntity.java index ffeb518896be963d5d1e8cd9d26d44b91d4a0c33..e9daae2e56713f500adfaed526cd2e447abe721e 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomRentRecordEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomRentRecordEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:房源出租记录表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomSourceEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomSourceEntity.java index d50a5d00b027c837544ab1113b060ea365a6ff3a..e40433533e78b8218dce0319fd8068de0a8fcb93 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomSourceEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/LandlordRoomSourceEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:房东-房源表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RealRoomSourceEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RealRoomSourceEntity.java index 601a8b03b9fa8270a4409426efd1eedd592c14ff..3ddcf341a2b24544ae316b90104d58391a111ae1 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RealRoomSourceEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RealRoomSourceEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:房东-房源表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentEntity.java index 118836df59611ecdbfc40194e89e4d2fdc26badf..2d7922ea6156cde8857596237c5a80297af8f299 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:代理人表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentOrderEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentOrderEntity.java index 758ede4b188059f1dccf42ec3e9ed97dc8336800..1daa8065afe3b2bdb133297f04131ce781d21525 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentOrderEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomAgentOrderEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:代理人-签单表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomLandlordEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomLandlordEntity.java index f7896564e9eec0c5c4eb9ebe3b5a77d6311a89af..69a19e45b9683680ecce6ed83352bea4d5313e3d 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomLandlordEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomLandlordEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:房东表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomPublishEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomPublishEntity.java index 975422434ce91370eba11ee086dd13e3232ae0cf..aba26fe83a02f66209b742a7468500de26f563c5 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomPublishEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomPublishEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:代理人-房源发布表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomSubscribeEntity.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomSubscribeEntity.java index d4ec9e4c15f38340fc478851d831210d9fe7ef13..67192c38c8c204022dd9d8112c30b2968662d4af 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomSubscribeEntity.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/entity/RoomSubscribeEntity.java @@ -7,7 +7,7 @@ import lombok.ToString; /** * @Description:代理人-预约看房记录表Entity类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AccountMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AccountMapper.java index df82c2d7eee754113941b13606846b28c50116ad..2c516b204e2109fa3bd40005b35bb5f92c36b77c 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AccountMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AccountMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.AccountEntity; /** * @Description:合作用户表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AttractInvestmentMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AttractInvestmentMapper.java index e0307788aefe3b4cfb943eb1dc5ad50d7029ace6..a978711ad6e6c11c71621f9c0acbae504e553d56 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AttractInvestmentMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/AttractInvestmentMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.AttractInvestmentEntity; /** * @Description:招商服务注册表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordContractTemplateMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordContractTemplateMapper.java index 9659b130c1f4ed7a1d6c44baf91f8238152efb65..8517c597fdd36b057ec2183c04f08097ad661344 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordContractTemplateMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordContractTemplateMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.LandlordContractTemplateEntity; /** * @Description:房东合同模板表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomRentRecordMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomRentRecordMapper.java index 3de40cf7d5c7aabd0047cd41041b86f38d77a03d..7c6428b303bd09009f55d3df1cbb8d847f7ff7d5 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomRentRecordMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomRentRecordMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.LandlordRoomRentRecordEntity; /** * @Description:房源出租记录表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomSourceMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomSourceMapper.java index f4969241989f008c31c8b218dca6657a117a3641..62af66de98bbe92e6c5c83421ed5add779413d60 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomSourceMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/LandlordRoomSourceMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.LandlordRoomSourceEntity; /** * @Description:房东-房源表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RealRoomSourceMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RealRoomSourceMapper.java index 443ee6e9f76c88cf6e494701d46246b653aee733..96ee33fafa74372d52df03d85e7396ed4ad94637 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RealRoomSourceMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RealRoomSourceMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.RealRoomSourceEntity; /** * @Description:房东-房源表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentMapper.java index 7c7e1b6c91ef9ba5b2d7a6546eb43319bc87a211..a707c9ec2df12f03eac281a87cb82cf2ebb91550 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.RoomAgentEntity; /** * @Description:代理人表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentOrderMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentOrderMapper.java index 0eb14fd54cbe14c718dea5c67d36dbb2cf855c03..3b4eaf1ae74da3c09b8d94a4e6719ace410ccf63 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentOrderMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomAgentOrderMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.RoomAgentOrderEntity; /** * @Description:代理人-签单表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomLandlordMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomLandlordMapper.java index 8d9a09bc831db17937b0a24ab9e991093ceb9c65..76fa5d38c8170705eb4731433f3faa8e5e56e30d 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomLandlordMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomLandlordMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.RoomLandlordEntity; /** * @Description:房东表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomPublishMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomPublishMapper.java index c9f60a167231eeaac76307fabb042b419099c278..0f287b5ce837544a5887df07226828b6ad12a52c 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomPublishMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomPublishMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.RoomPublishEntity; /** * @Description:代理人-房源发布表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomSubscribeMapper.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomSubscribeMapper.java index f3195c579e401ff66911ed3d488bb28f06a53713..4b0e6a6f58240eb47217baa12b4dd308b61740d1 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomSubscribeMapper.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/mapper/RoomSubscribeMapper.java @@ -6,7 +6,7 @@ import com.lightsnail.app.user.crm.core.entity.RoomSubscribeEntity; /** * @Description:代理人-预约看房记录表mapperDAO接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AccountService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AccountService.java index 6736e2bef045b085feb815a59eb79aaa19ac8504..d9257202728af2f803dca41137482df01365d9b3 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AccountService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AccountService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.AccountVO; /** * @Description:合作用户表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AttractInvestmentService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AttractInvestmentService.java index 10c4babbde9dc8e4df1ade372617e419daf4479b..f20bf3cde765d40c5cedd67cbe7e42e9c233327b 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AttractInvestmentService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/AttractInvestmentService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.AttractInvestmentVO; /** * @Description:招商服务注册表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordContractTemplateService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordContractTemplateService.java index 9e088da73481054d2bacfb7835a3615347774c66..a290c89d62c1b4cf639b308a18faf57729c7d786 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordContractTemplateService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordContractTemplateService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.LandlordContractTemplateVO; /** * @Description:房东合同模板表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomRentRecordService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomRentRecordService.java index 2c78a75a280252cdac9a01bd5cc8ccb92ed5d7de..fab0f1c539e5f21093ea0e1c42dabc0955bdc64c 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomRentRecordService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomRentRecordService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.LandlordRoomRentRecordVO; /** * @Description:房源出租记录表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomSourceService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomSourceService.java index aec4b3e7ac7e8465cff7816f0346ed4d7c5e897c..5598c13ba41442d2dfc617d7fdda01f69253f698 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomSourceService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/LandlordRoomSourceService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.LandlordRoomSourceVO; /** * @Description:房东-房源表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RealRoomSourceService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RealRoomSourceService.java index 899ab6df7e8d838569c2f0da471ea99b0f5c4569..e76a687b1e4d5d02cf31f050af4ce1046c573417 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RealRoomSourceService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RealRoomSourceService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.RealRoomSourceVO; /** * @Description:房东-房源表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentOrderService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentOrderService.java index 567aa3ff3b34979af3ac7ad03b1c02ef6b85cbad..a31d4693c0f47e622ded83c6f06b1ba0afde5445 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentOrderService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentOrderService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.RoomAgentOrderVO; /** * @Description:代理人-签单表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentService.java index dfd746137e115082a902b4751c60daadf95d297a..7be389dae185a2ba61735c3a97870ec1b2e19fd4 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomAgentService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.RoomAgentVO; /** * @Description:代理人表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomLandlordService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomLandlordService.java index 96efe733a113f49f78fba6ccaaca20a42d2c9749..d17efb9c8d96f090df081198819faeb739d316f8 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomLandlordService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomLandlordService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.RoomLandlordVO; /** * @Description:房东表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomPublishService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomPublishService.java index 8a75aaa2fab74dffdefd43c8367a0a7e22dca3b9..0261ad0c012f33b8fdff682030c1a1d7f789c5c0 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomPublishService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomPublishService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.RoomPublishVO; /** * @Description:代理人-房源发布表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomSubscribeService.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomSubscribeService.java index 791b0418fa35f3b03e6552838e92fe604db1bc40..196c29950ff0de2709606d60fae2e5e55ebb2dcc 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomSubscribeService.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/RoomSubscribeService.java @@ -8,7 +8,7 @@ import com.lightsnail.app.user.crm.core.vo.RoomSubscribeVO; /** * @Description:代理人-预约看房记录表Service接口 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AccountServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AccountServiceImpl.java index d46214fa69597bc04fd280735897e0256ebd4a12..29b3920e0e4be8abcf57a28f35266da05bdef75b 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AccountServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AccountServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:合作用户表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AttractInvestmentServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AttractInvestmentServiceImpl.java index bed27cbca85fb46f7055688572d1e6bd0fc0b1e0..9514defe3b1f904ba392cdd18fe297c61cf75c06 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AttractInvestmentServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/AttractInvestmentServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:招商服务注册表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordContractTemplateServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordContractTemplateServiceImpl.java index 4bb6835da5bccdcf96f733e0b9efde9b31ae5cc7..7d3e753abc7e16d23be43efb595cdbc8548bcb6d 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordContractTemplateServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordContractTemplateServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:房东合同模板表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomRentRecordServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomRentRecordServiceImpl.java index 8d109394ed795097f8f365098a623da77be47ab7..07f767579fedd9af7f64d8a711cad7b2d9a7bf0c 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomRentRecordServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomRentRecordServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:房源出租记录表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomSourceServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomSourceServiceImpl.java index c99269a5d4653bfd455ee718434070a94725cf3d..0b9036f7478c3a13cb8285ff486ab416f92aa1d1 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomSourceServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/LandlordRoomSourceServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:房东-房源表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RealRoomSourceServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RealRoomSourceServiceImpl.java index 2226799790072fc380db96cad98f6968e32d1841..46cd555bcd2df7cd0d672c4d326360dd6c1eeef5 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RealRoomSourceServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RealRoomSourceServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:房东-房源表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentOrderServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentOrderServiceImpl.java index b86abbc33010ee548444f671154a2e70bf30d917..8681087afb884e7ad94f3cbda2f0cc07cf579e7b 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentOrderServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentOrderServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:代理人-签单表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentServiceImpl.java index 237c151cd1e117be2b8a22584654b0666f1a8d57..23871f1a36334ce2265748a493ef5818a80492c6 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomAgentServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:代理人表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomLandlordServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomLandlordServiceImpl.java index 312ce584ca9f95a2b33b775f7f05b0b6fa3c40b0..545ed81eb999785db4aea4ba70028ec54731ddd1 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomLandlordServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomLandlordServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:房东表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomPublishServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomPublishServiceImpl.java index ce9a579ffd38adaf71e8ad22c185275720a74970..e016cd5fc0e6aeb997904daa7f925d17aa13d969 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomPublishServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomPublishServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:代理人-房源发布表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomSubscribeServiceImpl.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomSubscribeServiceImpl.java index 289060892e94148cad02cc0c867552f42c0ae1b3..67daf784f4c55965bff918370a6780b4cb502568 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomSubscribeServiceImpl.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/service/impl/RoomSubscribeServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; /** * @Description:代理人-预约看房记录表Service接口实现类 - * @Author:fanchunshuai + * @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AccountVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AccountVO.java index 260ff52079eb280dc82508afb66c5abbe538a3a3..d04cbc28ec23b26d327b1c9003fa9bb3b961e9c0 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AccountVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AccountVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:合作用户表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AttractInvestmentVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AttractInvestmentVO.java index 14a9f94a7609ab8fa09e14365954736f0507944a..34797af06a4797bd3192dffb89ee07ba7c3999ca 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AttractInvestmentVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/AttractInvestmentVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:招商服务注册表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordContractTemplateVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordContractTemplateVO.java index 97e91bb2253554bcc6faeabffbc3f1983cc4b295..ae62c25a799c374d9dbe8037bdb6c652bf2446c0 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordContractTemplateVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordContractTemplateVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:房东合同模板表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomRentRecordVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomRentRecordVO.java index 61a3ab262ea1f0084f6d0d205a8256b2d99fc77f..92957bd5f7bf91764e7393dabb04f86378d41809 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomRentRecordVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomRentRecordVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:房源出租记录表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomSourceVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomSourceVO.java index 8352d336230ed02df5208384ff1a198699be273e..7f8ec149de99fb8feae2686e90eaaabbf973bf7d 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomSourceVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/LandlordRoomSourceVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:房东-房源表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RealRoomSourceVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RealRoomSourceVO.java index 9cc412d8bc0a235267e1945c23f786fc9324ae66..5d752687d644957f6edb1c5b2905562db63f78c6 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RealRoomSourceVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RealRoomSourceVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:房东-房源表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentOrderVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentOrderVO.java index e5cd466f9217eb3f6e663672f5f7ae888fb5f764..6bda43b54e398dccde0651af66d677f20e707f76 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentOrderVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentOrderVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:代理人-签单表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentVO.java index 73d0401c0016c5f9749133c92aa6246c61afdc97..b7aa8034121e2fb971069330f846a7d15cce9711 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomAgentVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:代理人表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomLandlordVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomLandlordVO.java index 769383cb9bb5b6378653d3dddae77710835fc0d0..3090ed3255a6adb339969efdd41ca7e128d68745 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomLandlordVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomLandlordVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:房东表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomPublishVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomPublishVO.java index 80362653e53939685716f745a5540531e0584779..a627f79c930f0e9e46dc0279517c14daa4fa9e36 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomPublishVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomPublishVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:代理人-房源发布表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomSubscribeVO.java b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomSubscribeVO.java index a009f900001c5bafc0a140522f9df5f8aab6196b..63f93774dda29a79938eaf9a34c06e12de75b6bf 100644 --- a/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomSubscribeVO.java +++ b/codemaker-web/src/main/java/com/lightsnail/app/user/crm/core/vo/RoomSubscribeVO.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.ToString; /** * @Description:代理人-预约看房记录表VO类 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AccountServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AccountServiceTest.java index 3b0dfcf3d6a3cbe63e46f2e5e934f454865f48ff..a920a39779feea926d4eb3f5ca25c449aa1b7f21 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AccountServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AccountServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:合作用户表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AttractInvestmentServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AttractInvestmentServiceTest.java index d36d646090a1ffdb1531746aef0c2337caded111..5a3e28c78adb9e6624d38edce5a78e7fc5f40056 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AttractInvestmentServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/AttractInvestmentServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:招商服务注册表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordContractTemplateServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordContractTemplateServiceTest.java index f172e6b264cca1faefde08f2135c1274e3145b75..10223c5bde7462bba180aa91bec65c991fc98f7c 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordContractTemplateServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordContractTemplateServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:房东合同模板表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomRentRecordServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomRentRecordServiceTest.java index 034fc84436677354de9d51dba12f6a01958cd3ae..db111210051db2489d7be3694c1009fb220e9eac 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomRentRecordServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomRentRecordServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:房源出租记录表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomSourceServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomSourceServiceTest.java index 09da91df9cde3e1629646f31b7d924b6bc480001..146dd748572d3588795d0451802d10d6b4519ffd 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomSourceServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/LandlordRoomSourceServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:房东-房源表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RealRoomSourceServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RealRoomSourceServiceTest.java index ca12330acfd121b9d5f4ce665585be3ab901c33a..35bc731ab60e78e8df2b9baec1c4f2cc64330a20 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RealRoomSourceServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RealRoomSourceServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:房东-房源表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentOrderServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentOrderServiceTest.java index 98c281ad1663a6c74735590e98754674f65fa725..acd6c7b6805018b6524a81358b036e1690b4d32c 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentOrderServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentOrderServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:代理人-签单表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:54 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentServiceTest.java index 1550a279c73aed0bc1c7e9081adac729e6dd19b2..1075e144007fa7a0a225ba09947d99e828f2f4be 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomAgentServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:代理人表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomLandlordServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomLandlordServiceTest.java index dba8e4f28c04ad905a331589f5e1137432c43d1d..ee159b7e1def4a179b92d93177e1058226908aae 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomLandlordServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomLandlordServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:房东表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomPublishServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomPublishServiceTest.java index aac3c9c2bc9aa4bdb6f3f213f1c95892ceab71e8..604b9815257b30d0deb7105baf0d7ad705d4b0a8 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomPublishServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomPublishServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:代理人-房源发布表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomSubscribeServiceTest.java b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomSubscribeServiceTest.java index 72ed25665e939424c9ab76ca2ac0c92634de085b..79bc32c05a38247a77ecbfba8e1f4b7082d4f43a 100644 --- a/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomSubscribeServiceTest.java +++ b/codemaker-web/src/test/java/com/lightsnail/app/user/crm/core/service/test/RoomSubscribeServiceTest.java @@ -23,7 +23,7 @@ import org.springframework.test.context.junit4.SpringRunner; /** * @Description:代理人-预约看房记录表单元测试 -* @Author:fanchunshuai +* @Author:shenshuai * @CreateTime:2020-11-17 00:02:53 * @version v1.0 */ diff --git a/doc/baseDBandDDD.md b/doc/baseDBandDDD.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/doc/baseDBandDDDandInvoke.md b/doc/baseDBandDDDandInvoke.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/doc/baseDDD.md b/doc/baseDDD.md deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/doc/img/\345\244\251\347\224\273-\344\275\216\344\273\243\347\240\201\345\271\263\345\217\260(codeMaker)-v3\347\211\210\346\234\254.png" "b/doc/img/\345\244\251\347\224\273-\344\275\216\344\273\243\347\240\201\345\271\263\345\217\260(codeMaker)-v3\347\211\210\346\234\254.png" new file mode 100644 index 0000000000000000000000000000000000000000..6316fb649c83481c93436b3c54a6f0030f19198c Binary files /dev/null and "b/doc/img/\345\244\251\347\224\273-\344\275\216\344\273\243\347\240\201\345\271\263\345\217\260(codeMaker)-v3\347\211\210\346\234\254.png" differ diff --git a/API.md b/doc/md/API.md similarity index 100% rename from API.md rename to doc/md/API.md diff --git a/CHANGELIST.md b/doc/md/CHANGELIST.md similarity index 78% rename from CHANGELIST.md rename to doc/md/CHANGELIST.md index 168520231a429eeb8129e7dfbe88be1bc061aa0c..d69ff14633bad111d87bf735711435e827ff6551 100644 --- a/CHANGELIST.md +++ b/doc/md/CHANGELIST.md @@ -128,3 +128,28 @@ 19. 重构codeMaker模块,增加codemaker-api,codemaker-apiImpl模块开放低代码设计模型,组件扫描,代码元素装饰接口能力 20. 根据20条的改动整体支持组件化和提供二次开发能力 + +### 1.3.0 版本(进行一次整体的架构升级) +1.支持在调用时序中增加自定义流程控制语句如if else,fori,fore,fors,filter,mappingby,groupby(该方案容易导致时序图过于细化同时时序图不容易表达代码化的东西,已通过javsScript解决) +2.支持可配置化的多种入参校验模式策略(方案设计) +3.支持在plantuml领域文档中增加方法注解并解析生成到项目代码里(transactional,lock,logrecord注解等) +4.降低对数据库链接的强依赖,以数据库e-r图或者excel表作为数据库元数据信息的来源(链接默认数据库即可) +5.自定义代码元素模板/片段,并融入到代码生成流程中,进一步开放代码生成能力接口(方案设计)(代码元素模板自定义实现完成) +6.自定义代码元素模板/片段,并融入到动态调用时序中(同第一点,代码片段可能需要结合JavsScript构建方法内容) +7.在代码生成流程中调用时序中增加代码段(同第一点) +8.在代码生成流程中调用时序识别范型 +9.增加配置项相关代码生成(方案设计) +10.将数据库sql文件复制到项目工程里 +11.将plantUMl文档调用时序文档复制到项目工程里 +12.打通语雀等api文档管理软件(技术上存在问题,不一定完全兼容) +13.管理pom依赖,走自动生成,统一maven技术栈 +14.扩展plantUML生成代码时允许依赖外部代码类(如plantUML类中定义了xxxBO,但是需要显示的继承BaseBO,BaseBO可以不用单独声明class)(?) +15.基于plantUML 的e-r图模式构建数据库模型 +16.支持mybatis-plus组件,网关组件,脚手架等案例适配(mp,liteflow) +17.使用map+function重构各个应用类型下的代码生成逻辑 +18.支持每个组件的配置项同步到项目工程中 +19.新建codemaker-javs集成javs引擎 +20.增加参数配置是否集成javs并生成javs脚本项目 +21.支持纯数据库模式引入配置信息生成,自定义类信息生成,支持自定义组件导入 +22.支持极速模式引入配置信息生成,自定义类信息生成,支持自定义组件导入 + diff --git a/COMPOENTREGIST.md b/doc/md/COMPOENTREGIST.md similarity index 100% rename from COMPOENTREGIST.md rename to doc/md/COMPOENTREGIST.md diff --git a/CONFIG.md b/doc/md/CONFIG.md similarity index 99% rename from CONFIG.md rename to doc/md/CONFIG.md index 4a67e80e8e1fd182a5ca21868f3497db095bc74c..da9a81d833acf9d0fee8f7e436bfd5171dab85f4 100644 --- a/CONFIG.md +++ b/doc/md/CONFIG.md @@ -24,7 +24,7 @@ spring.datasource.password= mybatis.config-locations=classpath:mybatis-config.xml mybatis.mapper-locations=classpath:mapper/*.xml #配置模型路径 -mybatis.type-aliases-package=com.coderman.codemaker.bean +mybatis.type-aliases-package=com.tianhua.codemaker.bean spring.application.name=codemaker #生成的应用类型,支持springboot,dubbo,cola,springcloud application.type=dubbo @@ -122,7 +122,7 @@ codemaker.domain.plantuml= #目标工程根包名称 dynamicddd.global.package=com.lightsnail.snailapp.usercrm #作者 -dynamicddd.global.author=fanchunshuai +dynamicddd.global.author=shenshuai #目标工程输出目录,这里填写对应的codemaker-dynamicddd工程的绝对路径 dynamicddd.code.outpath=E:\\workspace\\tianhua-workspace\\code-maker\\codemaker-dynamicddd diff --git a/DDDPLANTUMLDOC.md b/doc/md/DDDPLANTUMLDOC.md similarity index 100% rename from DDDPLANTUMLDOC.md rename to doc/md/DDDPLANTUMLDOC.md diff --git a/MODULE.md b/doc/md/MODULE.md similarity index 100% rename from MODULE.md rename to doc/md/MODULE.md diff --git a/doc/md/USEDBYALLDOC.md b/doc/md/USEDBYALLDOC.md new file mode 100644 index 0000000000000000000000000000000000000000..83a21c6f5baa90ea4d0416fb2c34ee88fd987b74 --- /dev/null +++ b/doc/md/USEDBYALLDOC.md @@ -0,0 +1,145 @@ +#基于全文档模式(推荐) + +## 说明 +此模式是为了摆脱codeMaker必须要链接目标数据库才能获取数据模型的限制。基于此模型开发者只需要提供 +数据模型和领域模型以及调用时序图文档(可选)即可完成整个项目的代码生成。 + +## 使用步骤 +现在按照codeMaker内置的express数据库表结构进行演示,具体使用过程已在README文档的技术实现链接里。 +这里再详细说明一下使用过程。 + +### 1.修改配置 +1. 修改application.global.linkdb属性为false +2. 默认的数据库链接可以不用管,或者随便链接到一个数据源 + +### 1.修改codemaker-core工程下resources目录的项目配置文件application.properties +1. 修改application.global.linkdb属性为false,默认的数据库链接可以不用管,或者随便链接到一个数据源 +2. 设置生成项目的应用类型(application.type)的属性 +3. 设置目标应用根包名称 +4. 设置项目构建的作者名称 +5. 组件化相关配置(可选) + 1. 配置本地maven仓库的绝对路径 + 2. 配置框架级中间件或者框架的组件列表(默认即可) + 3. 配置组件扫描bean(默认即可) + 4. 配置组件装饰bean(默认即可) +6. 配置示例 +```properties +#数据库配置 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/infosys_auth?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC +spring.datasource.username=shenshuai +spring.datasource.password= + +#应用类型配置,支持springboot,dubbo,cola,springcloud +application.type=cola + +#目标应用根包名称 +application.global.package=com.coderman.infosys.auth + +# 作者 +application.global.author=shenshuai + +# 组件化需要的maven repository本地路径,用来扫描依赖的组件jar包 +application.maven.repo.path=jar:file:///Users/shenshuai/.m2/repository + +#代码生成需要的全局组件,框架中间件可以放到全局组件依赖配置里,类似于脚手架,或者自己封装的业务组件框架,属于框架中间件级别的 +application.component.scan.config=dubbo,spring-web,openfeign + +#自定义的组件扫描bean,defaultCompScanService为codeMaker默认实现支持全局组件的配置,开发者可以参考进行自定义扫描组件实现来替代掉默认的用以适配自己公司的技术栈 +application.component.scan.bean=defaultCompScanService + +#自定义的组件装饰bean,defaultCompDecorateService默认实现支持全局组件的装饰,开发者可以参考进行自定义装饰组件的实现来替代掉默认的用以适配自己公司的技术栈 +application.component.decorate.bean=defaultCompDecorateService + +``` + +### 3.根据配置的应用类型修改projecttemplate-application.properties配置 +1. 配置数据库名称 +2. 配置应用名称 +3. 配置项目工程代码输出绝对路径 +4. 配置应用服务的数据库模型plantUML类图文件(可选) + 1. 在codemaker-core模块下配置/er-express/infosys-express/infosys_express.puml + 2. infosys_express为数据库名称 +5. 配置应用服务的DDD 领域模型plantUML类图文件(可选) + 1. 领域模型plantUML类图可以只包括DDD相关的代码元素 + 2. 也可以引入接口API + 3. 也可以引入调用时序 + 4. 领域模型plantUML类图文档参考/ddd-plantuml/infosys-express目录下的文件 + 5. 调用时序plantUML文档参考/invoke-plantumlinfosys-express目录下的文件 +6. 配置是否构建api文档(默认为true) +7. 配置需要导入的组件列表(业务组件,工具组件,可选) + 1. 框架级组件请参考/component目录下的dubbo,spring-web,openfeign文件夹 + 2. 业务组件或者封装的工具组件请参考/component目录下的hutool-core,infosysuser,apiresult文件夹 + 3. 独立类组件请参考/component目录下的/singleClass文件夹 + 4. 如果需要新定义独立类组件并被初始化项目使用还需要在/template目录下的singleClass文件夹中配置ftl模板 +8. 配置DDD中的读写领域特定语言标示(可选) +9. 配置子包是否按照request,response进行分包 +10. 配置应用级组件的扫描bean和装饰bean(可选) +11. 配置代码工具类级别的初始化依赖工具集(可选) +12. 配置示例 +```properties + +#数据库名称 +cola.global.dbName=infosys_auth + +#应用名称 +cola.global.applicationName=infosys-auth + +#目标工程输出目录,这里填写对应的工程的绝对路径 +cola.code.outpath.cola-adapter=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-adapter +cola.code.outpath.cola-infrast=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-infrast +cola.code.outpath.cola-app=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-app +cola.code.outpath.cola-domain=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-domain +cola.code.outpath.cola-client=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-client +cola.code.outpath.cola-start=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-start +cola.code.outpath.cola-feign-api=/Users/shenshuai/myspace/code-maker/codemaker-cola/cola-feign-api + +#应用服务的plantUML类图文件,不配置则走基于数据表的方式生成代码 +cola.domain.plantuml=auth-domainV4-feign.puml + +#是否构建api 文档,否则进行构建,默认构建 +cola.api.generator=true + +# 需要导入的组件列表,多个逗号分割,适用于cola模块下依赖的业务组件包或者对外api接口包,或者cola项目本身已有的代码类,或者其他偏业务的工具类组件等等。 +# 如要生成的项目会依赖 infosys-user 服务的api则在这里定义即可。 +cola.component.scan.config=apiresult,infosysuser,hutool-core + +# 需要在领域文档和调用时序文档中识别的读操作统一语言 +# 纯数据库模式可以不需要 +cola.component.dsl.read=check + +#需要在领域文档和调用时序文档中识别的写操作统一语言 +cola.component.dsl.write=settle,apply + +#是否需要根据该参数设置请求参数的最后一级包名为request,默认false +cola.subpackage.request=true + +#是否需要根据该参数设置相应参数的最后一级包名为response,默认false +cola.subpackage.response=true + +#应用级组件中间件工具包的组件扫描bean配置 +cola.component.scan.beans=appCompScanService + +#应用级组件中间件工具包的组件装饰bean配置 +cola.component.decorate.beans=appCompDecorateService + +# 代码工具类注册,项目初始化时可以帮助初始化对应的工具类 +# 后面生成代码的时候可以删掉工具类,只专注于生成业务代码 +# 格式说明 eg:BaseEvent:core 前面是需要初始化的类,后面是这个类放到哪个模块下 +cola.component.init.clazz=BaseEvent:domain,Application:start,BaseController:adapter,SpringApplicationContext:domain,AppEventPublisher:domain + +``` + +### 4.codeMaker-core启动 +1. codemaker-core项目已迁移到codemaker-parent父级工程下 +2. 使用Main方法启动即可 + 1. 启动时会通过类加载机制扫描配置的组件 + 2. 如有报错信息请按上述步骤检查相关配置 +### 5.准备生成代码 +#### 第一种方式 +直接访问:http://127.0.0.1:8099/makeall,构建所有代码元素 +#### 第二种方式 +访问:http://127.0.0.1:8099/getproject/mapper,构建指定代码元素 +#### 第三种方式 +访问:http://127.0.0.1:8099/makemodules?tableNames=,增量构建模块级别的对应代码元素 + diff --git a/USEDBYDBANDDDD.md b/doc/md/USEDBYDBANDDDD.md similarity index 100% rename from USEDBYDBANDDDD.md rename to doc/md/USEDBYDBANDDDD.md diff --git a/USEDBYDBANDPLANTUML.md b/doc/md/USEDBYDBANDPLANTUML.md similarity index 100% rename from USEDBYDBANDPLANTUML.md rename to doc/md/USEDBYDBANDPLANTUML.md diff --git a/USEDBYDYNAMICDDD.md b/doc/md/USEDBYDYNAMICDDD.md similarity index 100% rename from USEDBYDYNAMICDDD.md rename to doc/md/USEDBYDYNAMICDDD.md diff --git a/doc/md/USEDBYJAVSSCRIPT.md b/doc/md/USEDBYJAVSSCRIPT.md new file mode 100644 index 0000000000000000000000000000000000000000..7ebe310604c886203fb2569b9979948dc222f180 --- /dev/null +++ b/doc/md/USEDBYJAVSSCRIPT.md @@ -0,0 +1,16 @@ +#基于JavsScript模式 + +## 说明 +此模式是为了更加细化代码方法的内容逻辑,在构建文档的同时使用JavsScript业务脚本语言来表达业务逻辑的伪代码形式 +基于伪代码文件构建方法内容的核心逻辑。 + +## 使用步骤 +1. 基于领域文档编写javsScript内容 +2. 开启使用javsScript模式的配置 +3. 准备生成代码 + +### 1.修改配置 +1. 修改application.javsscript.enable属性为true +2. 其他配置不变 + + diff --git a/USEDBYONLYDB.md b/doc/md/USEDBYONLYDB.md similarity index 100% rename from USEDBYONLYDB.md rename to doc/md/USEDBYONLYDB.md diff --git a/todoList b/todoList index b8715d1d6722a97cf90cef0ef8c56fd00874939c..0e3101bf35af7b6d808c673806440266189b93e4 100644 --- a/todoList +++ b/todoList @@ -71,34 +71,40 @@ 1.3.0 版本(进行一次整体的架构升级) - 1.支持在调用时序中增加自定义流程控制语句如if else,fori,fore,fors,filter,mappingby,groupby - 2.支持可配置化的多种入参校验模式策略 - 3.支持在plantuml领域文档中增加方法注解并解析生成到项目代码里(transactional,lock,aop注解等) - 5.降低对数据库链接的强依赖,以数据库e-r图或者excel表作为数据库元数据信息的来源(链接默认数据库即可) - 7.自定义代码模板/片段,并融入到代码生成流程中,进一步开放代码生成能力接口 - 8.自定义代码模板/片段,并融入到动态调用时序中 - 9.在代码生成流程中调用时序中增加代码段 - 10.在代码生成流程中调用时序识别范型 - 11.增加配置项相关代码生成 - 12.将数据库sql文件复制到项目工程里 - 13.将plantUMl文档调用时序文档复制到项目工程里 - 14.打通语雀等api文档管理软件 - 15.管理pom依赖,走自动生成,统一maven技术栈 - 16.扩展plantUML生成代码时允许依赖外部代码类(如plantUML类中定义了xxxBO,但是需要显示的继承BaseBO,BaseBO可以不用单独声明class) - - + 1.支持在调用时序中增加自定义流程控制语句如if else,fori,fore,fors,filter,mappingby,groupby(该方案容易导致时序图过于细化同时时序图不容易表达代码化的东西,已通过javsScript解决) + 2.支持可配置化的多种入参校验模式策略(方案设计)(down) + 3.支持在plantuml领域文档中增加方法注解并解析生成到项目代码里(transactional,lock,logrecord注解等)(down) + 4.降低对数据库链接的强依赖,以数据库e-r图或者excel表作为数据库元数据信息的来源(链接默认数据库即可)(down) + 5.自定义代码元素模板/片段,并融入到代码生成流程中,进一步开放代码生成能力接口(方案设计)(代码元素模板自定义实现完成 down) + 6.自定义代码元素模板/片段,并融入到动态调用时序中(同第一点,代码片段可能需要结合JavsScript构建方法内容) + 7.在代码生成流程中调用时序中增加代码段(同第一点) + 8.在代码生成流程中调用时序识别范型 + 9.增加配置项相关代码生成(方案设计)(down) + 10.将数据库sql文件复制到项目工程里(down) + 11.将plantUMl文档调用时序文档复制到项目工程里(down) + 12.打通语雀等api文档管理软件(技术上存在问题,不一定完全兼容) + 13.管理pom依赖,走自动生成,统一maven技术栈(down) + 14.扩展plantUML生成代码时允许依赖外部代码类(如plantUML类中定义了xxxBO,但是需要显示的继承BaseBO,BaseBO可以不用单独声明class)(?) + 15.基于plantUML 的e-r图模式构建数据库模型(down) + 16.支持mybatis-plus组件,网关组件,脚手架等案例适配(mp,liteflow down) + 17.使用map+function重构各个应用类型下的代码生成逻辑(down) + 18.支持每个组件的配置项同步到项目工程中(down) + 19.新建codemaker-javs集成javs引擎(down) + 20.增加参数配置是否集成javs并生成javs脚本项目(down) + 21.支持纯数据库模式引入配置信息生成,自定义类信息生成,支持自定义组件导入(down) + 22.支持极速模式引入配置信息生成,自定义类信息生成,支持自定义组件导入(down) 6.支持 基于数据库模式, - 基于e-r图模式或者excel模式(todo), + 基于e-r图模式或者excel模式(e-r图模式down), 基于动态DDD领域文档模式, 基于动态DDD领域文档+数据库模式, 基于动态DDD领域文档+数据库/e-r图模式+调用时序文档模式 1.4 平台化,是否具有平台化的能力 - 1.持久层存储 - 2.页面交互设计 + 1.持久层存储(低代码底层表结构设计) + 2.页面交互设计(web页面配置交互) diff --git "a/v3\346\240\270\345\277\203\351\232\276\347\202\271\345\256\236\347\216\260\346\212\200\346\234\257\346\226\271\346\241\210\346\226\207\346\241\243" "b/v3\346\240\270\345\277\203\351\232\276\347\202\271\345\256\236\347\216\260\346\212\200\346\234\257\346\226\271\346\241\210\346\226\207\346\241\243" new file mode 100644 index 0000000000000000000000000000000000000000..f381345daa2617e75fa3571adf18c32ec0bb9f09 --- /dev/null +++ "b/v3\346\240\270\345\277\203\351\232\276\347\202\271\345\256\236\347\216\260\346\212\200\346\234\257\346\226\271\346\241\210\346\226\207\346\241\243" @@ -0,0 +1,30 @@ +一、多种方式的参数校验实现策略 +1.-->导入api参数模型dto/vo-->结合bo +2.-->plantuml bo中走extend key构建必填参数校验属性 +3.-->必填参数校验实现走配置化 + 1.在dto,vo中构建参数验证逻辑,-->代码片段模式(down) + 2.独立构建一个validator包 + 3.走aop+属性注解(相当于自定义实现)(down) + 4.走工具类+反射的方式(down) + 5.spring validator注解 + + + +二、以数据库e-r图或者excel表作为数据库元数据信息的来源(e-r图模式down) + +三、自定义代码元素模板/片段 +代码片段模型 走note 标签--函数 +SegmentBean +String code:代码段内容 +List packageNameList:代码段中需要导入的包 +String identifer: 代码段类型标示 +String segmentTemplate:代码段模板 +Map templateVarMap:代码段模板对应的变量列表map +String relationClassName: 关联的代码类名称 + + + + +1. 自定义代码元素模板解析走重构(down) +2. 项目配置文件相关走自定义代码元素模板,这里pom也可以(down) +3. pom.xml文件按项目格式走,定义pom相关的服务名等(down)