Browse Source

格式化代码,增加基于AOP的日志访问和错误日志记录就功能

luoguangyi 3 years ago
parent
commit
e5723f010a
100 changed files with 1539 additions and 1136 deletions
  1. 1 0
      .gitignore
  2. 2 1
      README.md
  3. 10 10
      iot-admin-server/pom.xml
  4. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/controller/codegen/ToolCodegenController.java
  5. 3 3
      iot-admin-server/src/main/java/com/persagy/modules/tool/controller/codegen/vo/table/ToolCodegenTablePageReqVO.java
  6. 3 3
      iot-admin-server/src/main/java/com/persagy/modules/tool/controller/test/vo/ToolTestDemoExportReqVO.java
  7. 3 3
      iot-admin-server/src/main/java/com/persagy/modules/tool/controller/test/vo/ToolTestDemoPageReqVO.java
  8. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolCodegenColumnDO.java
  9. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolCodegenTableDO.java
  10. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolSchemaColumnDO.java
  11. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolSchemaTableDO.java
  12. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/enums/ToolDictTypeConstants.java
  13. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/enums/codegen/ToolCodegenImportTypeEnum.java
  14. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/enums/codegen/ToolCodegenTemplateTypeEnum.java
  15. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/framework/errorcode/core/dto/ErrorCodeRespDTO.java
  16. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/ToolCodegenService.java
  17. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/impl/ToolCodegenEngine.java
  18. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/impl/ToolCodegenSQLParser.java
  19. 1 1
      iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/impl/ToolCodegenServiceImpl.java
  20. 61 45
      iot-admin-server/src/main/resources/codegen/java/controller/controller.vm
  21. 7 6
      iot-admin-server/src/main/resources/codegen/java/controller/vo/_column.vm
  22. 8 8
      iot-admin-server/src/main/resources/codegen/java/controller/vo/baseVO.vm
  23. 8 8
      iot-admin-server/src/main/resources/codegen/java/controller/vo/createReqVO.vm
  24. 15 15
      iot-admin-server/src/main/resources/codegen/java/controller/vo/excelVO.vm
  25. 19 18
      iot-admin-server/src/main/resources/codegen/java/controller/vo/exportReqVO.vm
  26. 19 18
      iot-admin-server/src/main/resources/codegen/java/controller/vo/pageReqVO.vm
  27. 4 3
      iot-admin-server/src/main/resources/codegen/java/controller/vo/respVO.vm
  28. 8 8
      iot-admin-server/src/main/resources/codegen/java/controller/vo/updateReqVO.vm
  29. 18 12
      iot-admin-server/src/main/resources/codegen/java/convert/convert.vm
  30. 15 15
      iot-admin-server/src/main/resources/codegen/java/dal/do.vm
  31. 52 47
      iot-admin-server/src/main/resources/codegen/java/dal/mapper.vm
  32. 54 51
      iot-admin-server/src/main/resources/codegen/java/service/service.vm
  33. 51 48
      iot-admin-server/src/main/resources/codegen/java/service/serviceImpl.vm
  34. 109 107
      iot-admin-server/src/main/resources/codegen/java/test/serviceTest.vm
  35. 9 9
      iot-admin-server/src/main/resources/codegen/sql/sql.vm
  36. 29 29
      iot-admin-server/src/main/resources/codegen/vue/api/api.js.vm
  37. 412 386
      iot-admin-server/src/main/resources/codegen/vue/views/index.vue.vm
  38. 8 6
      iot-admin-server/src/main/resources/rebel.xml
  39. 9 5
      iot-common/pom.xml
  40. 1 1
      iot-common/src/main/java/com.persagy/framework/common/core/IntArrayValuable.java
  41. 1 1
      iot-common/src/main/java/com.persagy/framework/common/core/KeyValue.java
  42. 2 2
      iot-common/src/main/java/com.persagy/framework/common/exception/ErrorCode.java
  43. 6 6
      iot-common/src/main/java/com.persagy/framework/common/exception/enums/GlobalErrorCodeConstants.java
  44. 18 18
      iot-common/src/main/java/com.persagy/framework/common/exception/enums/ServiceErrorCodeRange.java
  45. 5 5
      iot-common/src/main/java/com.persagy/framework/common/exception/util/ServiceExceptionUtil.java
  46. 9 9
      iot-common/src/main/java/com.persagy/framework/common/pojo/CommonResult.java
  47. 2 2
      iot-common/src/main/java/com.persagy/framework/common/pojo/PageParam.java
  48. 1 1
      iot-common/src/main/java/com.persagy/framework/common/pojo/SortingField.java
  49. 2 2
      iot-common/src/main/java/com.persagy/framework/common/test/WebFilterOrderEnum.java
  50. 3 3
      iot-common/src/main/java/com.persagy/framework/common/util/collection/ArrayUtils.java
  51. 2 2
      iot-common/src/main/java/com.persagy/framework/common/util/collection/CollectionUtils.java
  52. 5 5
      iot-common/src/main/java/com.persagy/framework/common/util/collection/MapUtils.java
  53. 1 1
      iot-common/src/main/java/com.persagy/framework/common/util/collection/SetUtils.java
  54. 277 49
      iot-common/src/main/java/com.persagy/framework/common/util/date/DateUtils.java
  55. 73 0
      iot-common/src/main/java/com.persagy/framework/common/util/json/FastJsonUtil.java
  56. 1 1
      iot-common/src/main/java/com.persagy/framework/common/util/json/JsonUtils.java
  57. 2 2
      iot-common/src/main/java/com.persagy/framework/common/util/monitor/TracerUtils.java
  58. 3 3
      iot-common/src/main/java/com.persagy/framework/common/util/servlet/ServletUtils.java
  59. 1 1
      iot-common/src/main/java/com.persagy/framework/common/util/sping/SpringAopUtils.java
  60. 3 3
      iot-common/src/main/java/com.persagy/framework/common/util/sping/SpringExpressionUtils.java
  61. 2 1
      iot-common/src/main/java/com.persagy/framework/common/util/string/StrUtils.java
  62. 8 6
      iot-common/src/main/resources/rebel.xml
  63. 16 19
      iot-dependencies/pom.xml
  64. 3 3
      iot-spring-boot-starter-excel/pom.xml
  65. 4 6
      iot-spring-boot-starter-excel/src/main/java/com.persagy.framework.excel.core.convert/JsonConvert.java
  66. 1 2
      iot-spring-boot-starter-excel/src/main/java/com.persagy.framework.excel.core.util/ExcelListener.java
  67. 1 1
      iot-spring-boot-starter-excel/src/main/java/com.persagy.framework.excel.core.util/ExcelUtils.java
  68. 8 6
      iot-spring-boot-starter-excel/src/main/resources/rebel.xml
  69. 2 2
      iot-spring-boot-starter-extension/pom.xml
  70. 5 1
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/config/ExtensionAutoConfiguration.java
  71. 31 27
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/BusinessScenario.java
  72. 2 2
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/ExtensionBootstrap.java
  73. 14 5
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/AbstractComponentExecutor.java
  74. 8 4
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/ExtensionContext.java
  75. 3 3
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/ExtensionContextHolder.java
  76. 3 3
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/ExtensionExecutor.java
  77. 3 2
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/factory/ExtensionDefinition.java
  78. 4 2
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/factory/ExtensionFactory.java
  79. 7 6
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/factory/ExtensionRegisterFactory.java
  80. 1 1
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/package-info.java
  81. 2 2
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/point/ExtensionPoint.java
  82. 5 2
      iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/stereotype/Extension.java
  83. 2 2
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/Application.java
  84. 2 2
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/ExtensionTest.java
  85. 1 1
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/package-info.java
  86. 3 2
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/PayExtensionPoint.java
  87. 2 2
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/command/TransactionsCommand.java
  88. 4 3
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/domain/TransactionsResult.java
  89. 2 2
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/impl/AlipayService.java
  90. 2 2
      iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/impl/WechatPayService.java
  91. 3 3
      iot-spring-boot-starter-mybatis/pom.xml
  92. 2 2
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/datasource/config/DataSourceAutoConfiguration.java
  93. 2 2
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/datasource/core/enums/DataSourceEnum.java
  94. 1 1
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/datasource/core/filter/DruidAdRemoveFilter.java
  95. 4 4
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/config/MybatisAutoConfiguration.java
  96. 2 2
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/dataobject/BaseDO.java
  97. 2 2
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/handler/DefaultDBFieldHandler.java
  98. 3 3
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/mapper/BaseMapperX.java
  99. 1 1
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/query/QueryWrapperX.java
  100. 0 0
      iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/type/JsonLongSetTypeHandler.java

+ 1 - 0
.gitignore

@@ -30,3 +30,4 @@ build/
 ### VS Code ###
 .vscode/
 demo/
+rebel.xml

+ 2 - 1
README.md

@@ -1,7 +1,9 @@
 # 工程简介
 
 ## Jackson
+
 ### Jackson简介
+
 这个工程基于常见的MVC架构,展示了Jackson(the Java JSON library)的使用。学习这个工程之前,需要同学们对MVC有一定的了解。
 
 ### Jackson工程解读
@@ -38,7 +40,6 @@
 11 directories, 15 files
 ```
 
-
 # 延伸阅读
 
 ### Jackson延伸阅读

+ 10 - 10
iot-admin-server/pom.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <groupId>com.persagy</groupId>
@@ -35,16 +35,16 @@
             <artifactId>iot-spring-boot-starter-mybatis</artifactId>
         </dependency>
 
-<!--        <dependency>-->
-<!--            <groupId>com.persagy</groupId>-->
-<!--            <artifactId>iot-spring-boot-starter-redis</artifactId>-->
-<!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.persagy</groupId>-->
+        <!--            <artifactId>iot-spring-boot-starter-redis</artifactId>-->
+        <!--        </dependency>-->
 
         <!-- 监控相关 -->
-<!--        <dependency>-->
-<!--            <groupId>com.persagy</groupId>-->
-<!--            <artifactId>iot-spring-boot-starter-monitor</artifactId>-->
-<!--        </dependency>-->
+        <!--        <dependency>-->
+        <!--            <groupId>com.persagy</groupId>-->
+        <!--            <artifactId>iot-spring-boot-starter-monitor</artifactId>-->
+        <!--        </dependency>-->
 
         <dependency>
             <groupId>de.codecentric</groupId>

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/controller/codegen/ToolCodegenController.java

@@ -137,7 +137,7 @@ public class ToolCodegenController {
     }
 
     @ApiOperation("下载生成代码")
-    @GetMapping(value = "/download",produces = {"application/octet-stream"})
+    @GetMapping(value = "/download", produces = {"application/octet-stream"})
     @ApiImplicitParam(name = "tableId", value = "表编号", required = true, example = "1024", dataTypeClass = Long.class)
     public void downloadCodegen(@RequestParam("tableId") Long tableId,
                                 HttpServletResponse response) throws IOException {

+ 3 - 3
iot-admin-server/src/main/java/com/persagy/modules/tool/controller/codegen/vo/table/ToolCodegenTablePageReqVO.java

@@ -10,7 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 
-import static com.persagy.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+import static com.persagy.framework.common.util.date.DateUtils.DATE_TIME_FORMAT_SHOW;
 
 @ApiModel("表定义分页 Request VO")
 @Data
@@ -25,11 +25,11 @@ public class ToolCodegenTablePageReqVO extends PageParam {
     private String tableComment;
 
     @ApiModelProperty(value = "开始创建时间", example = "2020-10-24 00:00:00")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    @DateTimeFormat(pattern = DATE_TIME_FORMAT_SHOW)
     private Date beginCreateTime;
 
     @ApiModelProperty(value = "结束创建时间", example = "2020-10-24 23:59:59")
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    @DateTimeFormat(pattern = DATE_TIME_FORMAT_SHOW)
     private Date endCreateTime;
 
 }

+ 3 - 3
iot-admin-server/src/main/java/com/persagy/modules/tool/controller/test/vo/ToolTestDemoExportReqVO.java

@@ -7,7 +7,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 
-import static com.persagy.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+import static com.persagy.framework.common.util.date.DateUtils.DATE_TIME_FORMAT_SHOW;
 
 @ApiModel(value = "字典类型 Excel 导出 Request VO", description = "参数和 ToolTestDemoPageReqVO 是一致的")
 @Data
@@ -28,11 +28,11 @@ public class ToolTestDemoExportReqVO {
     @ApiModelProperty(value = "备注", example = "我是备注")
     private String remark;
 
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    @DateTimeFormat(pattern = DATE_TIME_FORMAT_SHOW)
     @ApiModelProperty(value = "开始创建时间")
     private Date beginCreateTime;
 
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    @DateTimeFormat(pattern = DATE_TIME_FORMAT_SHOW)
     @ApiModelProperty(value = "结束创建时间")
     private Date endCreateTime;
 

+ 3 - 3
iot-admin-server/src/main/java/com/persagy/modules/tool/controller/test/vo/ToolTestDemoPageReqVO.java

@@ -10,7 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.util.Date;
 
-import static com.persagy.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+import static com.persagy.framework.common.util.date.DateUtils.DATE_TIME_FORMAT_SHOW;
 
 @ApiModel("字典类型分页 Request VO")
 @Data
@@ -33,11 +33,11 @@ public class ToolTestDemoPageReqVO extends PageParam {
     @ApiModelProperty(value = "备注", example = "我是备注")
     private String remark;
 
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    @DateTimeFormat(pattern = DATE_TIME_FORMAT_SHOW)
     @ApiModelProperty(value = "开始创建时间")
     private Date beginCreateTime;
 
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    @DateTimeFormat(pattern = DATE_TIME_FORMAT_SHOW)
     @ApiModelProperty(value = "结束创建时间")
     private Date endCreateTime;
 

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolCodegenColumnDO.java

@@ -12,7 +12,7 @@ import lombok.experimental.Accessors;
 /**
  * 代码生成 column 字段定义
  *
- * @author 
+ * @author
  */
 @TableName(value = "tool_codegen_column", autoResultMap = true)
 @Data

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolCodegenTableDO.java

@@ -10,7 +10,7 @@ import lombok.experimental.Accessors;
 /**
  * 代码生成 table 表定义
  *
- * @author 
+ * @author
  */
 @TableName(value = "tool_codegen_table", autoResultMap = true)
 @Data

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolSchemaColumnDO.java

@@ -8,7 +8,7 @@ import lombok.Data;
 /**
  * MySQL 数据库中的 column 字段定义
  *
- * @author 
+ * @author
  */
 @TableName(value = "information_schema.columns", autoResultMap = true)
 @Data

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/dal/dataobject/codegen/ToolSchemaTableDO.java

@@ -9,7 +9,7 @@ import java.util.Date;
 /**
  * MySQL 数据库中的 table 表定义
  *
- * @author 
+ * @author
  */
 @TableName(value = "information_schema.tables", autoResultMap = true)
 @Data

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/enums/ToolDictTypeConstants.java

@@ -3,7 +3,7 @@ package com.persagy.modules.tool.enums;
 /**
  * Tool 字典类型的枚举类
  *
- * @author 
+ * @author
  */
 public interface ToolDictTypeConstants {
 

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/enums/codegen/ToolCodegenImportTypeEnum.java

@@ -6,7 +6,7 @@ import lombok.Getter;
 /**
  * 代码生成的导入类型
  *
- * @author 
+ * @author
  */
 @AllArgsConstructor
 @Getter

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/enums/codegen/ToolCodegenTemplateTypeEnum.java

@@ -6,7 +6,7 @@ import lombok.Getter;
 /**
  * 代码生成模板类型
  *
- * @author 
+ * @author
  */
 @AllArgsConstructor
 @Getter

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/framework/errorcode/core/dto/ErrorCodeRespDTO.java

@@ -7,7 +7,7 @@ import java.util.Date;
 /**
  * 错误码的 Response DTO
  *
- * @author 
+ * @author
  */
 @Data
 public class ErrorCodeRespDTO {

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/ToolCodegenService.java

@@ -13,7 +13,7 @@ import java.util.Map;
 /**
  * 代码生成 Service 接口
  *
- * @author 
+ * @author
  */
 public interface ToolCodegenService {
 

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/impl/ToolCodegenEngine.java

@@ -37,7 +37,7 @@ import static cn.hutool.core.text.CharSequenceUtil.*;
  * <p>
  * 考虑到 Java 模板引擎的框架非常多,Freemarker、Velocity、Thymeleaf 等等,所以我们采用 hutool 封装的 {@link cn.hutool.extra.template.Template} 抽象
  *
- * @author 
+ * @author
  */
 @Component
 public class ToolCodegenEngine {

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/impl/ToolCodegenSQLParser.java

@@ -23,7 +23,7 @@ import static com.alibaba.druid.sql.SQLUtils.normalize;
  * SQL 解析器,将创建表的 SQL,解析成 {@link ToolSchemaTableDO} 和 {@link ToolSchemaColumnDO} 对象,
  * 后续可以基于它们,生成代码~
  *
- * @author 
+ * @author
  */
 public class ToolCodegenSQLParser {
 

+ 1 - 1
iot-admin-server/src/main/java/com/persagy/modules/tool/service/codegen/impl/ToolCodegenServiceImpl.java

@@ -34,7 +34,7 @@ import static com.persagy.modules.tool.enums.ToolErrorCodeConstants.*;
 /**
  * 代码生成 Service 实现类
  *
- * @author 
+ * @author
  */
 @Service
 public class ToolCodegenServiceImpl implements ToolCodegenService {

+ 61 - 45
iot-admin-server/src/main/resources/codegen/java/controller/controller.vm

@@ -31,62 +31,78 @@ import ${basePackage}.modules.${table.moduleName}.service.${table.businessName}.
 @Validated
 public class ${table.className}Controller {
 
-    @Resource
-    private ${table.className}Service ${classNameVar}Service;
+@Resource
+private ${table.className}Service ${classNameVar}Service;
 
-    @PostMapping("/create")
-    @ApiOperation("创建${table.classComment}")
-    public CommonResult<${primaryColumn.javaType}> create${simpleClassName}(@Valid @RequestBody ${table.className}CreateReqVO createReqVO) {
-        return success(${classNameVar}Service.create${simpleClassName}(createReqVO));
-    }
+@PostMapping("/create")
+@ApiOperation("创建${table.classComment}")
+public CommonResult<${primaryColumn.javaType}> create${simpleClassName}(@Valid @RequestBody ${table.className}CreateReqVO createReqVO) {
+return success(${classNameVar}Service.create${simpleClassName}(createReqVO));
+}
 
-    @PutMapping("/update")
-    @ApiOperation("更新${table.classComment}")
-    public CommonResult<Boolean> update${simpleClassName}(@Valid @RequestBody ${table.className}UpdateReqVO updateReqVO) {
-        ${classNameVar}Service.update${simpleClassName}(updateReqVO);
-        return success(true);
+@PutMapping("/update")
+@ApiOperation("更新${table.classComment}")
+public CommonResult
+<Boolean> update${simpleClassName}(@Valid @RequestBody ${table.className}UpdateReqVO updateReqVO) {
+    ${classNameVar}Service.update${simpleClassName}(updateReqVO);
+    return success(true);
     }
 
     @DeleteMapping("/delete")
     @ApiOperation("删除${table.classComment}")
     @ApiImplicitParam(name = "id", value = "编号", required = true)
-    public CommonResult<Boolean> delete${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) {
+    public CommonResult
+    <Boolean> delete${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) {
         ${classNameVar}Service.delete${simpleClassName}(id);
         return success(true);
-    }
+        }
 
-    @GetMapping("/get")
-    @ApiOperation("获得${table.classComment}")
-    @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = ${primaryColumn.javaType}.class)
-    public CommonResult<${table.className}RespVO> get${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) {
-        ${table.className}DO ${classNameVar} = ${classNameVar}Service.get${simpleClassName}(id);
-        return success(${table.className}Convert.INSTANCE.convert(${classNameVar}));
-    }
+        @GetMapping("/get")
+        @ApiOperation("获得${table.classComment}")
+        @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass
+        = ${primaryColumn.javaType}.class)
+        public CommonResult
+        <${table.className}RespVO> get${simpleClassName}(@RequestParam("id") ${primaryColumn.javaType} id) {
+            ${table.className}DO ${classNameVar} = ${classNameVar}Service.get${simpleClassName}(id);
+            return success(${table.className}Convert.INSTANCE.convert(${classNameVar}));
+            }
 
-    @GetMapping("/list")
-    @ApiOperation("获得${table.classComment}列表")
-    @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
-    public CommonResult<List<${table.className}RespVO>> get${simpleClassName}List(@RequestParam("ids") Collection<${primaryColumn.javaType}> ids) {
-        List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(ids);
-        return success(${table.className}Convert.INSTANCE.convertList(list));
-    }
+            @GetMapping("/list")
+            @ApiOperation("获得${table.classComment}列表")
+            @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass =
+            List.class)
+            public CommonResult
+            <List
+            <${table.className}RespVO>> get${simpleClassName}List(@RequestParam("ids")
+                Collection<${primaryColumn.javaType}> ids) {
+                List
+                <${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(ids);
+                    return success(${table.className}Convert.INSTANCE.convertList(list));
+                    }
 
-    @GetMapping("/page")
-    @ApiOperation("获得${table.classComment}分页")
-    public CommonResult<PageResult<${table.className}RespVO>> get${simpleClassName}Page(@Valid ${table.className}PageReqVO pageVO) {
-        PageResult<${table.className}DO> pageResult = ${classNameVar}Service.get${simpleClassName}Page(pageVO);
-        return success(${table.className}Convert.INSTANCE.convertPage(pageResult));
-    }
+                    @GetMapping("/page")
+                    @ApiOperation("获得${table.classComment}分页")
+                    public CommonResult
+                    <PageResult
+                    <${table.className}RespVO>> get${simpleClassName}Page(@Valid ${table.className}PageReqVO pageVO) {
+                        PageResult
+                        <${table.className}DO> pageResult = ${classNameVar}Service.get${simpleClassName}Page(pageVO);
+                            return success(${table.className}Convert.INSTANCE.convertPage(pageResult));
+                            }
 
-    @GetMapping("/export-excel")
-    @ApiOperation("导出${table.classComment} Excel")
-    @OperateLog(type = EXPORT)
-    public void export${simpleClassName}Excel(@Valid ${table.className}ExportReqVO exportReqVO,
-              HttpServletResponse response) throws IOException {
-        List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(exportReqVO);
-        // 导出 Excel
-        List<${table.className}ExcelVO> datas = ${table.className}Convert.INSTANCE.convertList02(list);
-        ExcelUtils.write(response, "${table.classComment}.xls", "数据", ${table.className}ExcelVO.class, datas);
-    }
+                            @GetMapping("/export-excel")
+                            @ApiOperation("导出${table.classComment} Excel")
+                            @OperateLog(type = EXPORT)
+                            public void export${simpleClassName}Excel(@Valid ${table.className}ExportReqVO exportReqVO,
+                            HttpServletResponse response) throws IOException {
+                            List
+                            <${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(exportReqVO);
+                                // 导出 Excel
+                                List
+                                <${table.className}ExcelVO> datas = ${table.className}
+                                    Convert.INSTANCE.convertList02(list);
+                                    ExcelUtils.write(response, "${table.classComment}.xls", "数据", ${table.className}
+                                    ExcelVO.class, datas);
+                                    }
 
-}
+                                    }

+ 7 - 6
iot-admin-server/src/main/resources/codegen/java/controller/vo/_column.vm

@@ -1,13 +1,14 @@
 ## 提供给 baseVO、createVO、updateVO 生成字段
-    @ApiModelProperty(value = "${column.columnComment}"#if (!${column.nullable}), required = true#end#if ("$!column.example" != ""), example = "${column.example}"#end)
+@ApiModelProperty(value = "${column.columnComment}"#if (!${column.nullable}), required = true#end#if (
+    "$!column.example" != ""), example = "${column.example}"#end)
 #if (!${column.nullable})## 判断 @NotEmpty 和 @NotNull 注解
-#if (${field.fieldType} == 'String')
+    #if (${field.fieldType} == 'String')
     @NotEmpty(message = "${column.columnComment}不能为空")
-#else
+    #else
     @NotNull(message = "${column.columnComment}不能为空")
-#end
+    #end
 #end
 #if (${column.javaType} == "Date")## 时间类型
-    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 #end
-    private ${column.javaType} ${column.javaField};
+private ${column.javaType} ${column.javaField};

+ 8 - 8
iot-admin-server/src/main/resources/codegen/java/controller/vo/baseVO.vm

@@ -6,13 +6,13 @@ import io.swagger.annotations.*;
 import javax.validation.constraints.*;
 ## 处理 Date 字段的引入
 #foreach ($column in $columns)
-#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult}
+    #if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult}
     && ${column.javaType} == "Date")## 时间类型
-import org.springframework.format.annotation.DateTimeFormat;
+    import org.springframework.format.annotation.DateTimeFormat;
 
-import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-#break
-#end
+    import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+        #break
+    #end
 #end
 
 /**
@@ -23,9 +23,9 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 public class ${table.className}BaseVO {
 
 #foreach ($column in $columns)
-#if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult})##通用操作
-    #parse("codegen/java/controller/vo/_column.vm")
+    #if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult})##通用操作
+        #parse("codegen/java/controller/vo/_column.vm")
 
-#end
+    #end
 #end
 }

+ 8 - 8
iot-admin-server/src/main/resources/codegen/java/controller/vo/createReqVO.vm

@@ -6,13 +6,13 @@ import io.swagger.annotations.*;
 import javax.validation.constraints.*;
 ## 处理 Date 字段的引入
 #foreach ($column in $columns)
-#if (${column.createOperation} && (!${column.updateOperation} || !${column.listOperationResult})
+    #if (${column.createOperation} && (!${column.updateOperation} || !${column.listOperationResult})
     && ${column.javaType} == "Date")## 时间类型
-import org.springframework.format.annotation.DateTimeFormat;
+    import org.springframework.format.annotation.DateTimeFormat;
 
-import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-#break
-#end
+    import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+        #break
+    #end
 #end
 
 @ApiModel("${table.classComment}创建 Request VO")
@@ -22,9 +22,9 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 public class ${table.className}CreateReqVO extends ${table.className}BaseVO {
 
 #foreach ($column in $columns)
-#if (${column.createOperation} && (!${column.updateOperation} || !${column.listOperationResult}))##不是通用字段
-    #parse("codegen/java/controller/vo/_column.vm")
+    #if (${column.createOperation} && (!${column.updateOperation} || !${column.listOperationResult}))##不是通用字段
+        #parse("codegen/java/controller/vo/_column.vm")
 
-#end
+    #end
 #end
 }

+ 15 - 15
iot-admin-server/src/main/resources/codegen/java/controller/vo/excelVO.vm

@@ -6,30 +6,30 @@ import io.swagger.annotations.*;
 
 import com.alibaba.excel.annotation.ExcelProperty;
 #foreach ($column in $columns)
-#if ("$!column.dictType" != "")## 有设置数据字典
-import ${DictFormatClassName};
-import ${DictConvertClassName};
+    #if ("$!column.dictType" != "")## 有设置数据字典
+    import ${DictFormatClassName};
+    import ${DictConvertClassName};
 
-#break
-#end
+        #break
+    #end
 #end
 
 /**
- * ${table.classComment} Excel VO
- *
- * @author ${table.author}
- */
+* ${table.classComment} Excel VO
+*
+* @author ${table.author}
+*/
 @Data
 public class ${table.className}ExcelVO {
 
 #foreach ($column in $columns)
     #if (${column.listOperationResult})##返回字段
-    #if ("$!column.dictType" != "")##处理枚举值
-    @ExcelProperty(value = "${column.columnComment}", converter = DictConvert.class)
-    @DictFormat("${column.dictType}") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
-    #else
-    @ExcelProperty("${column.columnComment}")
-    #end
+        #if ("$!column.dictType" != "")##处理枚举值
+        @ExcelProperty(value = "${column.columnComment}", converter = DictConvert.class)
+        @DictFormat("${column.dictType}") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
+        #else
+        @ExcelProperty("${column.columnComment}")
+        #end
     private ${column.javaType} ${column.javaField};
 
     #end

+ 19 - 18
iot-admin-server/src/main/resources/codegen/java/controller/vo/exportReqVO.vm

@@ -6,20 +6,21 @@ import io.swagger.annotations.*;
 import ${PageParamClassName};
 ## 处理 Date 字段的引入
 #foreach ($column in $columns)
-#if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型
-import org.springframework.format.annotation.DateTimeFormat;
+    #if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型
+    import org.springframework.format.annotation.DateTimeFormat;
 
-import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-#break
-#end
+    import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+        #break
+    #end
 #end
 ## 字段模板
 #macro(columnTpl $prefix $prefixStr)
-#if (${column.javaType} == "Date")## 时间类型
+    #if (${column.javaType} == "Date")## 时间类型
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-#end
-    @ApiModelProperty(value = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
-    private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
+    #end
+@ApiModelProperty(value = "${prefixStr}${column.columnComment}"#if (
+    "$!column.example" != ""), example = "${column.example}"#end)
+private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
 #end
 
 @ApiModel(value = "${table.classComment} Excel 导出 Request VO", description = "参数和 ${table.className}PageReqVO 是一致的")
@@ -27,16 +28,16 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 public class ${table.className}ExportReqVO {
 
 #foreach ($column in $columns)
-#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
-#if (${column.listOperation})##查询操作
-#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
-    #columnTpl('begin', '开始')
+    #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
+    #if (${column.listOperation})##查询操作
+        #if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
+            #columnTpl('begin', '开始')
 
-    #columnTpl('end', '结束')
-#else##情况二,非 Between 的时间
-    #columnTpl('', '')
-#end
+            #columnTpl('end', '结束')
+        #else##情况二,非 Between 的时间
+            #columnTpl('', '')
+        #end
 
-#end
+    #end
 #end
 }

+ 19 - 18
iot-admin-server/src/main/resources/codegen/java/controller/vo/pageReqVO.vm

@@ -6,20 +6,21 @@ import io.swagger.annotations.*;
 import ${PageParamClassName};
 ## 处理 Date 字段的引入
 #foreach ($column in $columns)
-#if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型
-import org.springframework.format.annotation.DateTimeFormat;
+    #if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型
+    import org.springframework.format.annotation.DateTimeFormat;
 
-import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-#break
-#end
+    import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+        #break
+    #end
 #end
 ## 字段模板
 #macro(columnTpl $prefix $prefixStr)
-#if (${column.javaType} == "Date")## 时间类型
+    #if (${column.javaType} == "Date")## 时间类型
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
-#end
-    @ApiModelProperty(value = "${prefixStr}${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
-    private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
+    #end
+@ApiModelProperty(value = "${prefixStr}${column.columnComment}"#if (
+    "$!column.example" != ""), example = "${column.example}"#end)
+private ${column.javaType}#if ("$!prefix" != "") ${prefix}${JavaField}#else ${column.javaField}#end;
 #end
 
 @ApiModel("${table.classComment}分页 Request VO")
@@ -29,16 +30,16 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 public class ${table.className}PageReqVO extends PageParam {
 
 #foreach ($column in $columns)
-#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
-#if (${column.listOperation})##查询操作
-#if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
-    #columnTpl('begin', '开始')
+    #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
+    #if (${column.listOperation})##查询操作
+        #if (${column.listOperationCondition} == "BETWEEN")## 情况一,Between 的时候
+            #columnTpl('begin', '开始')
 
-    #columnTpl('end', '结束')
-#else##情况二,非 Between 的时间
-    #columnTpl('', '')
-#end
+            #columnTpl('end', '结束')
+        #else##情况二,非 Between 的时间
+            #columnTpl('', '')
+        #end
 
-#end
+    #end
 #end
 }

+ 4 - 3
iot-admin-server/src/main/resources/codegen/java/controller/vo/respVO.vm

@@ -11,10 +11,11 @@ import io.swagger.annotations.*;
 public class ${table.className}RespVO extends ${table.className}BaseVO {
 
 #foreach ($column in $columns)
-#if (${column.listOperationResult} && (!${column.createOperation} || !${column.updateOperation}))##不是通用字段
-    @ApiModelProperty(value = "${column.columnComment}"#if (!${column.nullable}), required = true#end#if ("$!column.example" != ""), example = "${column.example}"#end)
+    #if (${column.listOperationResult} && (!${column.createOperation} || !${column.updateOperation}))##不是通用字段
+    @ApiModelProperty(value = "${column.columnComment}"#if (!${column.nullable}), required = true#end#if (
+        "$!column.example" != ""), example = "${column.example}"#end)
     private ${column.javaType} ${column.javaField};
 
-#end
+    #end
 #end
 }

+ 8 - 8
iot-admin-server/src/main/resources/codegen/java/controller/vo/updateReqVO.vm

@@ -6,13 +6,13 @@ import io.swagger.annotations.*;
 import javax.validation.constraints.*;
 ## 处理 Date 字段的引入
 #foreach ($column in $columns)
-#if (${column.updateOperation} && (!${column.createOperation} || !${column.listOperationResult})
+    #if (${column.updateOperation} && (!${column.createOperation} || !${column.listOperationResult})
     && ${column.javaType} == "Date"))## 时间类型
-import org.springframework.format.annotation.DateTimeFormat;
+    import org.springframework.format.annotation.DateTimeFormat;
 
-import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
-#break
-#end
+    import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+        #break
+    #end
 #end
 
 @ApiModel("${table.classComment}更新 Request VO")
@@ -22,9 +22,9 @@ import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 public class ${table.className}UpdateReqVO extends ${table.className}BaseVO {
 
 #foreach ($column in $columns)
-#if (${column.updateOperation} && (!${column.createOperation} || !${column.listOperationResult}))##不是通用字段
-    #parse("codegen/java/controller/vo/_column.vm")
+    #if (${column.updateOperation} && (!${column.createOperation} || !${column.listOperationResult}))##不是通用字段
+        #parse("codegen/java/controller/vo/_column.vm")
 
-#end
+    #end
 #end
 }

+ 18 - 12
iot-admin-server/src/main/resources/codegen/java/convert/convert.vm

@@ -10,25 +10,31 @@ import ${basePackage}.modules.${table.moduleName}.controller.${table.businessNam
 import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
 
 /**
- * ${table.classComment} Convert
- *
- * @author ${table.author}
- */
+* ${table.classComment} Convert
+*
+* @author ${table.author}
+*/
 @Mapper
 public interface ${table.className}Convert {
 
-    ${table.className}Convert INSTANCE = Mappers.getMapper(${table.className}Convert.class);
+${table.className}Convert INSTANCE = Mappers.getMapper(${table.className}Convert.class);
 
-    ${table.className}DO convert(${table.className}CreateReqVO bean);
+${table.className}DO convert(${table.className}CreateReqVO bean);
 
-    ${table.className}DO convert(${table.className}UpdateReqVO bean);
+${table.className}DO convert(${table.className}UpdateReqVO bean);
 
-    ${table.className}RespVO convert(${table.className}DO bean);
+${table.className}RespVO convert(${table.className}DO bean);
 
-    List<${table.className}RespVO> convertList(List<${table.className}DO> list);
+List
+<${table.className}RespVO> convertList(List
+    <${table.className}DO> list);
 
-    PageResult<${table.className}RespVO> convertPage(PageResult<${table.className}DO> page);
+        PageResult
+        <${table.className}RespVO> convertPage(PageResult
+            <${table.className}DO> page);
 
-    List<${table.className}ExcelVO> convertList02(List<${table.className}DO> list);
+                List
+                <${table.className}ExcelVO> convertList02(List
+                    <${table.className}DO> list);
 
-}
+                        }

+ 15 - 15
iot-admin-server/src/main/resources/codegen/java/dal/do.vm

@@ -6,10 +6,10 @@ import com.baomidou.mybatisplus.annotation.*;
 import ${BaseDOClassName};
 
 /**
- * ${table.classComment} DO
- *
- * @author ${table.author}
- */
+* ${table.classComment} DO
+*
+* @author ${table.author}
+*/
 @TableName("${table.tableName}")
 @Data
 @EqualsAndHashCode(callSuper = true)
@@ -20,19 +20,19 @@ import ${BaseDOClassName};
 public class ${table.className}DO extends BaseDO {
 
 #foreach ($column in $columns)
-#if (!${baseDOFields.contains(${column.javaField})})##排除 BaseDO 的字段
+    #if (!${baseDOFields.contains(${column.javaField})})##排除 BaseDO 的字段
     /**
-     * ${column.columnComment}
-    #if ("$!column.dictType" != "")##处理枚举值
-     *
-     * 枚举 {@link TODO ${column.dictType} 对应的类}
-    #end
-     */
-    #if (${column.primaryKey})##处理主键
-    @TableId#if (${column.javaType} == 'String')type = IdType.INPUT)#end
-    #end
+    * ${column.columnComment}
+        #if ("$!column.dictType" != "")##处理枚举值
+        *
+        * 枚举 {@link TODO ${column.dictType} 对应的类}
+        #end
+    */
+        #if (${column.primaryKey})##处理主键
+        @TableId#if (${column.javaType} == 'String')type = IdType.INPUT)#end
+        #end
     private ${column.javaType} ${column.javaField};
-#end
+    #end
 #end
 
 }

+ 52 - 47
iot-admin-server/src/main/resources/codegen/java/dal/mapper.vm

@@ -11,56 +11,61 @@ import ${basePackage}.modules.${table.moduleName}.controller.${table.businessNam
 
 ## 字段模板
 #macro(listCondition)
-#foreach ($column in $columns)
-#if (${column.listOperation})
-#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
-#if (${column.listOperationCondition} == "=")##情况一,= 的时候
-                .eqIfPresent("${column.columnName}", reqVO.get${JavaField}())
-#end
-#if (${column.listOperationCondition} == "!=")##情况二,!= 的时候
-                .neIfPresent("${column.columnName}", reqVO.get${JavaField}())
-#end
-#if (${column.listOperationCondition} == ">")##情况三,> 的时候
-                .gtIfPresent("${column.columnName}", reqVO.get${JavaField}())
-#end
-#if (${column.listOperationCondition} == ">=")##情况四,>= 的时候
-                .geIfPresent("${column.columnName}", reqVO.get${JavaField}())
-#end
-#if (${column.listOperationCondition} == "<")##情况五,< 的时候
-                .ltIfPresent("${column.columnName}", reqVO.get${JavaField}())
-#end
-#if (${column.listOperationCondition} == "<=")##情况五,<= 的时候
-                .leIfPresent("${column.columnName}", reqVO.get${JavaField}())
-#end
-#if (${column.listOperationCondition} == "LIKE")##情况七,Like 的时候
-                .likeIfPresent("${column.columnName}", reqVO.get${JavaField}())
-#end
-#if (${column.listOperationCondition} == "BETWEEN")##情况八,Between 的时候
-                .betweenIfPresent("${column.columnName}", reqVO.getBegin${JavaField}(), reqVO.getEnd${JavaField}())
-#end
-#end
-#end
+    #foreach ($column in $columns)
+        #if (${column.listOperation})
+            #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
+            #if (${column.listOperationCondition} == "=")##情况一,= 的时候
+            .eqIfPresent("${column.columnName}", reqVO.get${JavaField}())
+            #end
+            #if (${column.listOperationCondition} == "!=")##情况二,!= 的时候
+            .neIfPresent("${column.columnName}", reqVO.get${JavaField}())
+            #end
+            #if (${column.listOperationCondition} == ">")##情况三,> 的时候
+            .gtIfPresent("${column.columnName}", reqVO.get${JavaField}())
+            #end
+            #if (${column.listOperationCondition} == ">=")##情况四,>= 的时候
+            .geIfPresent("${column.columnName}", reqVO.get${JavaField}())
+            #end
+            #if (${column.listOperationCondition} == "<")##情况五,< 的时候
+            .ltIfPresent("${column.columnName}", reqVO.get${JavaField}())
+            #end
+            #if (${column.listOperationCondition} == "<=")##情况五,<= 的时候
+            .leIfPresent("${column.columnName}", reqVO.get${JavaField}())
+            #end
+            #if (${column.listOperationCondition} == "LIKE")##情况七,Like 的时候
+            .likeIfPresent("${column.columnName}", reqVO.get${JavaField}())
+            #end
+            #if (${column.listOperationCondition} == "BETWEEN")##情况八,Between 的时候
+            .betweenIfPresent("${column.columnName}", reqVO.getBegin${JavaField}(), reqVO.getEnd${JavaField}())
+            #end
+        #end
+    #end
 #end
 /**
- * ${table.classComment} Mapper
- *
- * @author ${table.author}
- */
+* ${table.classComment} Mapper
+*
+* @author ${table.author}
+*/
 @Mapper
-public interface ${table.className}Mapper extends BaseMapperX<${table.className}DO> {
+public interface ${table.className}Mapper extends BaseMapperX
+<${table.className}DO> {
 
-    default PageResult<${table.className}DO> selectPage(${table.className}PageReqVO reqVO) {
-        return selectPage(reqVO, new QueryWrapperX<${table.className}DO>()
-			#listCondition()
-                .orderByDesc("id")## 大多数情况下,id 倒序
-        );
-    }
+    default PageResult
+    <${table.className}DO> selectPage(${table.className}PageReqVO reqVO) {
+        return selectPage(reqVO, new QueryWrapperX
+        <${table.className}DO>()
+            #listCondition()
+            .orderByDesc("id")## 大多数情况下,id 倒序
+            );
+            }
 
-    default List<${table.className}DO> selectList(${table.className}ExportReqVO reqVO) {
-        return selectList(new QueryWrapperX<${table.className}DO>()
-			#listCondition()
-                .orderByDesc("id")## 大多数情况下,id 倒序
-        );
-    }
+            default List
+            <${table.className}DO> selectList(${table.className}ExportReqVO reqVO) {
+                return selectList(new QueryWrapperX
+                <${table.className}DO>()
+                    #listCondition()
+                    .orderByDesc("id")## 大多数情况下,id 倒序
+                    );
+                    }
 
-}
+                    }

+ 54 - 51
iot-admin-server/src/main/resources/codegen/java/service/service.vm

@@ -7,64 +7,67 @@ import ${basePackage}.modules.${table.moduleName}.dal.dataobject.${table.busines
 import ${PageResultClassName};
 
 /**
- * ${table.classComment} Service 接口
- *
- * @author ${table.author}
- */
+* ${table.classComment} Service 接口
+*
+* @author ${table.author}
+*/
 public interface ${table.className}Service {
 
-    /**
-     * 创建${table.classComment}
-     *
-     * @param createReqVO 创建信息
-     * @return 编号
-     */
-    ${primaryColumn.javaType} create${simpleClassName}(@Valid ${table.className}CreateReqVO createReqVO);
+/**
+* 创建${table.classComment}
+*
+* @param createReqVO 创建信息
+* @return 编号
+*/
+${primaryColumn.javaType} create${simpleClassName}(@Valid ${table.className}CreateReqVO createReqVO);
 
-    /**
-     * 更新${table.classComment}
-     *
-     * @param updateReqVO 更新信息
-     */
-    void update${simpleClassName}(@Valid ${table.className}UpdateReqVO updateReqVO);
+/**
+* 更新${table.classComment}
+*
+* @param updateReqVO 更新信息
+*/
+void update${simpleClassName}(@Valid ${table.className}UpdateReqVO updateReqVO);
 
-    /**
-     * 删除${table.classComment}
-     *
-     * @param id 编号
-     */
-    void delete${simpleClassName}(${primaryColumn.javaType} id);
+/**
+* 删除${table.classComment}
+*
+* @param id 编号
+*/
+void delete${simpleClassName}(${primaryColumn.javaType} id);
 
-    /**
-     * 获得${table.classComment}
-     *
-     * @param id 编号
-     * @return ${table.classComment}
-     */
-    ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id);
+/**
+* 获得${table.classComment}
+*
+* @param id 编号
+* @return ${table.classComment}
+*/
+${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id);
 
-    /**
-     * 获得${table.classComment}列表
-     *
-     * @param ids 编号
-     * @return ${table.classComment}列表
-     */
-    List<${table.className}DO> get${simpleClassName}List(Collection<${primaryColumn.javaType}> ids);
+/**
+* 获得${table.classComment}列表
+*
+* @param ids 编号
+* @return ${table.classComment}列表
+*/
+List
+<${table.className}DO> get${simpleClassName}List(Collection<${primaryColumn.javaType}> ids);
 
     /**
-     * 获得${table.classComment}分页
-     *
-     * @param pageReqVO 分页查询
-     * @return ${table.classComment}分页
-     */
-    PageResult<${table.className}DO> get${simpleClassName}Page(${table.className}PageReqVO pageReqVO);
+    * 获得${table.classComment}分页
+    *
+    * @param pageReqVO 分页查询
+    * @return ${table.classComment}分页
+    */
+    PageResult
+    <${table.className}DO> get${simpleClassName}Page(${table.className}PageReqVO pageReqVO);
 
-    /**
-     * 获得${table.classComment}列表, 用于 Excel 导出
-     *
-     * @param exportReqVO 查询条件
-     * @return ${table.classComment}列表
-     */
-    List<${table.className}DO> get${simpleClassName}List(${table.className}ExportReqVO exportReqVO);
+        /**
+        * 获得${table.classComment}列表, 用于 Excel 导出
+        *
+        * @param exportReqVO 查询条件
+        * @return ${table.classComment}列表
+        */
+        List
+        <${table.className}DO> get${simpleClassName}List(${table.className}ExportReqVO exportReqVO);
 
-}
+            }

+ 51 - 48
iot-admin-server/src/main/resources/codegen/java/service/serviceImpl.vm

@@ -17,67 +17,70 @@ import static ${ServiceExceptionUtilClassName}.exception;
 import static ${basePackage}.modules.${table.moduleName}.enums.${simpleModuleName_upperFirst}ErrorCodeConstants.*;
 
 /**
- * ${table.classComment} Service 实现类
- *
- * @author ${table.author}
- */
+* ${table.classComment} Service 实现类
+*
+* @author ${table.author}
+*/
 @Service
 @Validated
 public class ${table.className}ServiceImpl implements ${table.className}Service {
 
-    @Resource
-    private ${table.className}Mapper ${classNameVar}Mapper;
+@Resource
+private ${table.className}Mapper ${classNameVar}Mapper;
 
-    @Override
-    public ${primaryColumn.javaType} create${simpleClassName}(${table.className}CreateReqVO createReqVO) {
-        // 插入
-        ${table.className}DO ${classNameVar} = ${table.className}Convert.INSTANCE.convert(createReqVO);
-        ${classNameVar}Mapper.insert(${classNameVar});
-        // 返回
-        return ${classNameVar}.getId();
-    }
+@Override
+public ${primaryColumn.javaType} create${simpleClassName}(${table.className}CreateReqVO createReqVO) {
+// 插入
+${table.className}DO ${classNameVar} = ${table.className}Convert.INSTANCE.convert(createReqVO);
+${classNameVar}Mapper.insert(${classNameVar});
+// 返回
+return ${classNameVar}.getId();
+}
 
-    @Override
-    public void update${simpleClassName}(${table.className}UpdateReqVO updateReqVO) {
-        // 校验存在
-        this.validate${simpleClassName}Exists(updateReqVO.getId());
-        // 更新
-        ${table.className}DO updateObj = ${table.className}Convert.INSTANCE.convert(updateReqVO);
-        ${classNameVar}Mapper.updateById(updateObj);
-    }
+@Override
+public void update${simpleClassName}(${table.className}UpdateReqVO updateReqVO) {
+// 校验存在
+this.validate${simpleClassName}Exists(updateReqVO.getId());
+// 更新
+${table.className}DO updateObj = ${table.className}Convert.INSTANCE.convert(updateReqVO);
+${classNameVar}Mapper.updateById(updateObj);
+}
 
-    @Override
-    public void delete${simpleClassName}(${primaryColumn.javaType} id) {
-        // 校验存在
-        this.validate${simpleClassName}Exists(id);
-        // 删除
-        ${classNameVar}Mapper.deleteById(id);
-    }
+@Override
+public void delete${simpleClassName}(${primaryColumn.javaType} id) {
+// 校验存在
+this.validate${simpleClassName}Exists(id);
+// 删除
+${classNameVar}Mapper.deleteById(id);
+}
 
-    private void validate${simpleClassName}Exists(${primaryColumn.javaType} id) {
-        if (${classNameVar}Mapper.selectById(id) == null) {
-            throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
-        }
-    }
+private void validate${simpleClassName}Exists(${primaryColumn.javaType} id) {
+if (${classNameVar}Mapper.selectById(id) == null) {
+throw exception(${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
+}
+}
 
-    @Override
-    public ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id) {
-        return ${classNameVar}Mapper.selectById(id);
-    }
+@Override
+public ${table.className}DO get${simpleClassName}(${primaryColumn.javaType} id) {
+return ${classNameVar}Mapper.selectById(id);
+}
 
-    @Override
-    public List<${table.className}DO> get${simpleClassName}List(Collection<${primaryColumn.javaType}> ids) {
-        return ${classNameVar}Mapper.selectBatchIds(ids);
+@Override
+public List
+<${table.className}DO> get${simpleClassName}List(Collection<${primaryColumn.javaType}> ids) {
+    return ${classNameVar}Mapper.selectBatchIds(ids);
     }
 
     @Override
-    public PageResult<${table.className}DO> get${simpleClassName}Page(${table.className}PageReqVO pageReqVO) {
+    public PageResult
+    <${table.className}DO> get${simpleClassName}Page(${table.className}PageReqVO pageReqVO) {
         return ${classNameVar}Mapper.selectPage(pageReqVO);
-    }
+        }
 
-    @Override
-    public List<${table.className}DO> get${simpleClassName}List(${table.className}ExportReqVO exportReqVO) {
-        return ${classNameVar}Mapper.selectList(exportReqVO);
-    }
+        @Override
+        public List
+        <${table.className}DO> get${simpleClassName}List(${table.className}ExportReqVO exportReqVO) {
+            return ${classNameVar}Mapper.selectList(exportReqVO);
+            }
 
-}
+            }

+ 109 - 107
iot-admin-server/src/main/resources/codegen/java/test/serviceTest.vm

@@ -27,36 +27,36 @@ import static org.mockito.Mockito.*;
 
 ## 字段模板
 #macro(getPageCondition $VO)
-       // mock 数据
-       ${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class, o -> { // 等会查询到
-       #foreach ($column in $columns)
-       #if (${column.listOperation})
-       #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
-           o.set$JavaField(null);
-       #end
-       #end
-       });
-       ${classNameVar}Mapper.insert(db${simpleClassName});
-       #foreach ($column in $columns)
-       #if (${column.listOperation})
-       #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
-       // 测试 ${column.javaField} 不匹配
-       ${classNameVar}Mapper.insert(ObjectUtils.clone(db${simpleClassName}, o -> o.set$JavaField(null)));
-       #end
-       #end
-       // 准备参数
-       ${table.className}${VO} reqVO = new ${table.className}${VO}();
-       #foreach ($column in $columns)
-       #if (${column.listOperation})
-       #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
-       #if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况
-       reqVO.setBegin${JavaField}(null);
-       reqVO.setEnd${JavaField}(null);
-       #else
-       reqVO.set$JavaField(null);
-       #end
-       #end
-       #end
+// mock 数据
+    ${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class, o -> { // 等会查询到
+    #foreach ($column in $columns)
+        #if (${column.listOperation})
+            #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
+        o.set$JavaField(null);
+        #end
+    #end
+});
+    ${classNameVar}Mapper.insert(db${simpleClassName});
+    #foreach ($column in $columns)
+        #if (${column.listOperation})
+            #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
+        // 测试 ${column.javaField} 不匹配
+            ${classNameVar}Mapper.insert(ObjectUtils.clone(db${simpleClassName}, o -> o.set$JavaField(null)));
+        #end
+    #end
+// 准备参数
+    ${table.className}${VO} reqVO = new ${table.className}${VO}();
+    #foreach ($column in $columns)
+        #if (${column.listOperation})
+            #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
+            #if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况
+            reqVO.setBegin${JavaField}(null);
+            reqVO.setEnd${JavaField}(null);
+            #else
+            reqVO.set$JavaField(null);
+            #end
+        #end
+    #end
 #end
 /**
 * {@link ${table.className}ServiceImpl} 的单元测试类
@@ -66,96 +66,98 @@ import static org.mockito.Mockito.*;
 @Import(${table.className}ServiceImpl.class)
 public class ${table.className}ServiceTest extends BaseDbUnitTest {
 
-    @Resource
-    private ${table.className}ServiceImpl ${classNameVar}Service;
+@Resource
+private ${table.className}ServiceImpl ${classNameVar}Service;
 
-    @Resource
-    private ${table.className}Mapper ${classNameVar}Mapper;
+@Resource
+private ${table.className}Mapper ${classNameVar}Mapper;
 
-    @Test
-    public void testCreate${simpleClassName}_success() {
-        // 准备参数
-        ${table.className}CreateReqVO reqVO = randomPojo(${table.className}CreateReqVO.class);
+@Test
+public void testCreate${simpleClassName}_success() {
+// 准备参数
+${table.className}CreateReqVO reqVO = randomPojo(${table.className}CreateReqVO.class);
 
-        // 调用
-        ${primaryColumn.javaType} ${classNameVar}Id = ${classNameVar}Service.create${simpleClassName}(reqVO);
-        // 断言
-        assertNotNull(${classNameVar}Id);
-        // 校验记录的属性是否正确
-        ${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(${classNameVar}Id);
-        assertPojoEquals(reqVO, ${classNameVar});
-    }
+// 调用
+${primaryColumn.javaType} ${classNameVar}Id = ${classNameVar}Service.create${simpleClassName}(reqVO);
+// 断言
+assertNotNull(${classNameVar}Id);
+// 校验记录的属性是否正确
+${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(${classNameVar}Id);
+assertPojoEquals(reqVO, ${classNameVar});
+}
 
-    @Test
-    public void testUpdate${simpleClassName}_success() {
-        // mock 数据
-        ${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class);
-        ${classNameVar}Mapper.insert(db${simpleClassName});// @Sql: 先插入出一条存在的数据
-        // 准备参数
-        ${table.className}UpdateReqVO reqVO = randomPojo(${table.className}UpdateReqVO.class, o -> {
-            o.setId(db${simpleClassName}.getId()); // 设置更新的 ID
-        });
-
-        // 调用
-        ${classNameVar}Service.update${simpleClassName}(reqVO);
-        // 校验是否更新正确
-        ${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(reqVO.getId()); // 获取最新的
-        assertPojoEquals(reqVO, ${classNameVar});
-    }
+@Test
+public void testUpdate${simpleClassName}_success() {
+// mock 数据
+${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class);
+${classNameVar}Mapper.insert(db${simpleClassName});// @Sql: 先插入出一条存在的数据
+// 准备参数
+${table.className}UpdateReqVO reqVO = randomPojo(${table.className}UpdateReqVO.class, o -> {
+o.setId(db${simpleClassName}.getId()); // 设置更新的 ID
+});
+
+// 调用
+${classNameVar}Service.update${simpleClassName}(reqVO);
+// 校验是否更新正确
+${table.className}DO ${classNameVar} = ${classNameVar}Mapper.selectById(reqVO.getId()); // 获取最新的
+assertPojoEquals(reqVO, ${classNameVar});
+}
 
-    @Test
-    public void testUpdate${simpleClassName}_notExists() {
-        // 准备参数
-        ${table.className}UpdateReqVO reqVO = randomPojo(${table.className}UpdateReqVO.class);
+@Test
+public void testUpdate${simpleClassName}_notExists() {
+// 准备参数
+${table.className}UpdateReqVO reqVO = randomPojo(${table.className}UpdateReqVO.class);
 
-        // 调用, 并断言异常
-        assertServiceException(() -> ${classNameVar}Service.update${simpleClassName}(reqVO), ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
-    }
+// 调用, 并断言异常
+assertServiceException(() -> ${classNameVar}Service.update${simpleClassName}(reqVO), ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
+}
 
-    @Test
-    public void testDelete${simpleClassName}_success() {
-        // mock 数据
-        ${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class);
-        ${classNameVar}Mapper.insert(db${simpleClassName});// @Sql: 先插入出一条存在的数据
-        // 准备参数
-        ${primaryColumn.javaType} id = db${simpleClassName}.getId();
-
-        // 调用
-        ${classNameVar}Service.delete${simpleClassName}(id);
-       // 校验数据不存在了
-       assertNull(${classNameVar}Mapper.selectById(id));
-    }
+@Test
+public void testDelete${simpleClassName}_success() {
+// mock 数据
+${table.className}DO db${simpleClassName} = randomPojo(${table.className}DO.class);
+${classNameVar}Mapper.insert(db${simpleClassName});// @Sql: 先插入出一条存在的数据
+// 准备参数
+${primaryColumn.javaType} id = db${simpleClassName}.getId();
+
+// 调用
+${classNameVar}Service.delete${simpleClassName}(id);
+// 校验数据不存在了
+assertNull(${classNameVar}Mapper.selectById(id));
+}
 
-    @Test
-    public void testDelete${simpleClassName}_notExists() {
-        // 准备参数
-        ${primaryColumn.javaType} id = random${primaryColumn.javaType}Id();
+@Test
+public void testDelete${simpleClassName}_notExists() {
+// 准备参数
+${primaryColumn.javaType} id = random${primaryColumn.javaType}Id();
 
-        // 调用, 并断言异常
-        assertServiceException(() -> ${classNameVar}Service.delete${simpleClassName}(id), ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
-    }
+// 调用, 并断言异常
+assertServiceException(() -> ${classNameVar}Service.delete${simpleClassName}(id), ${simpleClassName_underlineCase.toUpperCase()}_NOT_EXISTS);
+}
 
-    @Test // TODO 请修改 null 为需要的值
-    public void testGet${simpleClassName}Page() {
-       #getPageCondition("PageReqVO")
-
-       // 调用
-       PageResult<${table.className}DO> pageResult = ${classNameVar}Service.get${simpleClassName}Page(reqVO);
-       // 断言
-       assertEquals(1, pageResult.getTotal());
-       assertEquals(1, pageResult.getList().size());
-       assertPojoEquals(db${simpleClassName}, pageResult.getList().get(0));
+@Test // TODO 请修改 null 为需要的值
+public void testGet${simpleClassName}Page() {
+#getPageCondition("PageReqVO")
+
+// 调用
+PageResult
+<${table.className}DO> pageResult = ${classNameVar}Service.get${simpleClassName}Page(reqVO);
+    // 断言
+    assertEquals(1, pageResult.getTotal());
+    assertEquals(1, pageResult.getList().size());
+    assertPojoEquals(db${simpleClassName}, pageResult.getList().get(0));
     }
 
     @Test // TODO 请修改 null 为需要的值
     public void testGet${simpleClassName}List() {
-       #getPageCondition("ExportReqVO")
+    #getPageCondition("ExportReqVO")
 
-       // 调用
-       List<${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(reqVO);
-       // 断言
-       assertEquals(1, list.size());
-       assertPojoEquals(db${simpleClassName}, list.get(0));
-    }
+    // 调用
+    List
+    <${table.className}DO> list = ${classNameVar}Service.get${simpleClassName}List(reqVO);
+        // 断言
+        assertEquals(1, list.size());
+        assertPojoEquals(db${simpleClassName}, list.get(0));
+        }
 
-}
+        }

+ 9 - 9
iot-admin-server/src/main/resources/codegen/sql/sql.vm

@@ -1,11 +1,11 @@
 -- 菜单 SQL
 INSERT INTO `sys_menu`(
-    `name`, `permission`, `menu_type`, `sort`, `parent_id`,
-    `path`, `icon`, `component`, `status`
+`name`, `permission`, `menu_type`, `sort`, `parent_id`,
+`path`, `icon`, `component`, `status`
 )
 VALUES (
-    '${table.classComment}管理', '', 2, 0, ${table.parentMenuId},
-    '${simpleClassName_strikeCase}', '', '${table.moduleName}/${classNameVar}/index', 0
+'${table.classComment}管理', '', 2, 0, ${table.parentMenuId},
+'${simpleClassName_strikeCase}', '', '${table.moduleName}/${classNameVar}/index', 0
 );
 
 -- 按钮父菜单ID
@@ -15,13 +15,13 @@ SELECT @parentId := LAST_INSERT_ID();
 #set ($functionNames = ['查询', '创建', '更新', '删除', '导出'])
 #set ($functionOps = ['query', 'create', 'update', 'delete', 'export'])
 #foreach ($functionName in $functionNames)
-#set ($index = $foreach.count - 1)
+    #set ($index = $foreach.count - 1)
 INSERT INTO `sys_menu`(
-    `name`, `permission`, `menu_type`, `sort`, `parent_id`,
-    `path`, `icon`, `component`, `status`
+`name`, `permission`, `menu_type`, `sort`, `parent_id`,
+`path`, `icon`, `component`, `status`
 )
 VALUES (
-    '${table.classComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId,
-    '', '', '', 0
+'${table.classComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId,
+'', '', '', 0
 );
 #end

+ 29 - 29
iot-admin-server/src/main/resources/codegen/vue/api/api.js.vm

@@ -3,53 +3,53 @@ import request from '@/utils/request'
 
 // 创建${table.classComment}
 export function create${simpleClassName}(data) {
-  return request({
-    url: '${baseURL}/create',
-    method: 'post',
-    data: data
-  })
+    return request({
+        url: '${baseURL}/create',
+        method: 'post',
+        data: data
+    })
 }
 
 // 更新${table.classComment}
 export function update${simpleClassName}(data) {
-  return request({
-    url: '${baseURL}/update',
-    method: 'put',
-    data: data
-  })
+    return request({
+        url: '${baseURL}/update',
+        method: 'put',
+        data: data
+    })
 }
 
 // 删除${table.classComment}
 export function delete${simpleClassName}(id) {
-  return request({
-    url: '${baseURL}/delete?id=' + id,
-    method: 'delete'
-  })
+    return request({
+        url: '${baseURL}/delete?id=' + id,
+        method: 'delete'
+    })
 }
 
 // 获得${table.classComment}
 export function get${simpleClassName}(id) {
-  return request({
-    url: '${baseURL}/get?id=' + id,
-    method: 'get'
-  })
+    return request({
+        url: '${baseURL}/get?id=' + id,
+        method: 'get'
+    })
 }
 
 // 获得${table.classComment}分页
 export function get${simpleClassName}Page(query) {
-  return request({
-    url: '${baseURL}/page',
-    method: 'get',
-    params: query
-  })
+    return request({
+        url: '${baseURL}/page',
+        method: 'get',
+        params: query
+    })
 }
 
 // 导出${table.classComment} Excel
 export function export${simpleClassName}Excel(query) {
-  return request({
-    url: '${baseURL}/export-excel',
-    method: 'get',
-    params: query,
-    responseType: 'blob'
-  })
+    return request({
+        url: '${baseURL}/export-excel',
+        method: 'get',
+        params: query,
+        responseType: 'blob'
+    })
 }

+ 412 - 386
iot-admin-server/src/main/resources/codegen/vue/views/index.vue.vm

@@ -1,403 +1,429 @@
 <template>
-  <div class="app-container">
+    <div class="app-container">
 
-    <!-- 搜索工作栏 -->
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-#foreach($column in $columns)
-#if ($column.listOperation)
-    #set ($dictType=$column.dictType)
-    #set ($javaField = $column.javaField)
-    #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-    #set ($comment=$column.columnComment)
-#if ($column.htmlType == "input")
-      <el-form-item label="${comment}" prop="${javaField}">
-        <el-input v-model="queryParams.${javaField}" placeholder="请输入${comment}" clearable size="small" @keyup.enter.native="handleQuery"/>
-      </el-form-item>
-#elseif ($column.htmlType == "select" || $column.htmlType == "radio")
-      <el-form-item label="${comment}" prop="${javaField}">
-        <el-select v-model="queryParams.${javaField}" placeholder="请选择${comment}" clearable size="small">
-    #if ("" != $dictType)## 设置了 dictType 数据字典的情况
-          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
-                       :key="dict.value" :label="dict.label" :value="dict.value"/>
-    #else## 未设置 dictType 数据字典的情况
-          <el-option label="请选择字典生成" value="" />
-    #end
-        </el-select>
-      </el-form-item>
-#elseif($column.htmlType == "datetime")
-    #if ($column.listOperationCondition != "BETWEEN")## 非范围
-      <el-form-item label="${comment}" prop="${javaField}">
-        <el-date-picker clearable size="small" v-model="queryParams.${javaField}" type="date" value-format="yyyy-MM-dd" placeholder="选择${comment}" />
-      </el-form-item>
-    #else## 范围
-      <el-form-item label="${comment}">
-        <el-date-picker v-model="dateRange${AttrName}" size="small" style="width: 240px" value-format="yyyy-MM-dd"
-                        type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
-      </el-form-item>
-    #end
-#end
-#end
-#end
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
+        <!-- 搜索工作栏 -->
+        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+            #foreach($column in $columns)
+                #if ($column.listOperation)
+                    #set ($dictType=$column.dictType)
+                    #set ($javaField = $column.javaField)
+                    #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
+                    #set ($comment=$column.columnComment)
+                    #if ($column.htmlType == "input")
+                        <el-form-item label="${comment}" prop="${javaField}">
+                            <el-input v-model="queryParams.${javaField}" placeholder="请输入${comment}" clearable
+                                      size="small" @keyup.enter.native="handleQuery"/>
+                        </el-form-item>
+                    #elseif ($column.htmlType == "select" || $column.htmlType == "radio")
+                        <el-form-item label="${comment}" prop="${javaField}">
+                            <el-select v-model="queryParams.${javaField}" placeholder="请选择${comment}" clearable
+                                       size="small">
+                                #if ("" != $dictType)## 设置了 dictType 数据字典的情况
+                                    <el-option v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
+                                               :key="dict.value" :label="dict.label" :value="dict.value"/>
+                                #else## 未设置 dictType 数据字典的情况
+                                    <el-option label="请选择字典生成" value=""/>
+                                #end
+                            </el-select>
+                        </el-form-item>
+                    #elseif($column.htmlType == "datetime")
+                        #if ($column.listOperationCondition != "BETWEEN")## 非范围
+                            <el-form-item label="${comment}" prop="${javaField}">
+                                <el-date-picker clearable size="small" v-model="queryParams.${javaField}" type="date"
+                                                value-format="yyyy-MM-dd" placeholder="选择${comment}"/>
+                            </el-form-item>
+                        #else## 范围
+                            <el-form-item label="${comment}">
+                                <el-date-picker v-model="dateRange${AttrName}" size="small" style="width: 240px"
+                                                value-format="yyyy-MM-dd"
+                                                type="daterange" range-separator="-" start-placeholder="开始日期"
+                                                end-placeholder="结束日期"/>
+                            </el-form-item>
+                        #end
+                    #end
+                #end
+            #end
+            <el-form-item>
+                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+            </el-form-item>
+        </el-form>
 
-    <!-- 操作工具栏 -->
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-                   v-hasPermi="['${permissionPrefix}:create']">新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-                   v-hasPermi="['${permissionPrefix}:export']">导出</el-button>
-      </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
+        <!-- 操作工具栏 -->
+        <el-row :gutter="10" class="mb8">
+            <el-col :span="1.5">
+                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+                           v-hasPermi="['${permissionPrefix}:create']">新增
+                </el-button>
+            </el-col>
+            <el-col :span="1.5">
+                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+                           v-hasPermi="['${permissionPrefix}:export']">导出
+                </el-button>
+            </el-col>
+            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
 
-    <!-- 列表 -->
-    <el-table v-loading="loading" :data="list">
-#foreach($column in $columns)
-#if ($column.listOperationResult)
-    #set ($dictType=$column.dictType)
-    #set ($javaField = $column.javaField)
-    #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-    #set ($comment=$column.columnComment)
-#if ($column.javaType == "Date")## 时间类型
-      <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.${javaField}) }}</span>
-        </template>
-      </el-table-column>
-#elseif("" != $column.dictType)## 数据字典
-      <el-table-column label="${comment}" align="center" prop="${javaField}">
-        <template slot-scope="scope">
-          <span>{{ getDictDataLabel(DICT_TYPE.$dictType.toUpperCase(), scope.row.${column.javaField}) }}</span>
-        </template>
-      </el-table-column>
-#else
-      <el-table-column label="${comment}" align="center" prop="${javaField}" />
-#end
-#end
-#end
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-                     v-hasPermi="['${permissionPrefix}:update']">修改</el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-                     v-hasPermi="['${permissionPrefix}:delete']">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <!-- 分页组件 -->
-    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
-                @pagination="getList"/>
+        <!-- 列表 -->
+        <el-table v-loading="loading" :data="list">
+            #foreach($column in $columns)
+                #if ($column.listOperationResult)
+                    #set ($dictType=$column.dictType)
+                    #set ($javaField = $column.javaField)
+                    #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
+                    #set ($comment=$column.columnComment)
+                    #if ($column.javaType == "Date")## 时间类型
+                        <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
+                            <template slot-scope="scope">
+                                <span>{{ parseTime(scope.row.${javaField}) }}</span>
+                            </template>
+                        </el-table-column>
+                    #elseif("" != $column.dictType)## 数据字典
+                        <el-table-column label="${comment}" align="center" prop="${javaField}">
+                            <template slot-scope="scope">
+                                <span>{{ getDictDataLabel(DICT_TYPE.$dictType.toUpperCase(), scope.row.${column.javaField}) }}</span>
+                            </template>
+                        </el-table-column>
+                    #else
+                        <el-table-column label="${comment}" align="center" prop="${javaField}"/>
+                    #end
+                #end
+            #end
+            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+                <template slot-scope="scope">
+                    <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+                               v-hasPermi="['${permissionPrefix}:update']">修改
+                    </el-button>
+                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+                               v-hasPermi="['${permissionPrefix}:delete']">删除
+                    </el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <!-- 分页组件 -->
+        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
+                    @pagination="getList"/>
 
-    <!-- 对话框(添加 / 修改) -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-#foreach($column in $columns)
-#if ($column.createOperation || $column.updateOperation)
-    #set ($dictType = $column.dictType)
-    #set ($javaField = $column.javaField)
-    #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-    #set ($comment = $column.columnComment)
-#if ($column.htmlType == "input")
-  #if (!$column.primaryKey)## 忽略主键,不用在表单里
-        <el-form-item label="${comment}" prop="${javaField}">
-          <el-input v-model="form.${javaField}" placeholder="请输入${comment}" />
-        </el-form-item>
-  #end
-#elseif($column.htmlType == "imageUpload")## 图片上传
-        #set ($hasImageUploadColumn = true)
-        <el-form-item label="${comment}">
-          <imageUpload v-model="form.${javaField}"/>
-        </el-form-item>
-#elseif($column.htmlType == "fileUpload")## 文件上传
-        #set ($hasFileUploadColumn = true)
-        <el-form-item label="${comment}">
-          <fileUpload v-model="form.${javaField}"/>
-        </el-form-item>
-#elseif($column.htmlType == "editor")## 文本编辑器
-        #set ($hasEditorColumn = true)
-        <el-form-item label="${comment}">
-          <editor v-model="form.${javaField}" :min-height="192"/>
-        </el-form-item>
-#elseif($column.htmlType == "select")## 下拉框
-        <el-form-item label="${comment}" prop="${javaField}">
-          <el-select v-model="form.${javaField}" placeholder="请选择${comment}">
-    #if ("" != $dictType)## 有数据字典
-            <el-option v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
-                       :key="dict.value" :label="dict.label" #if ($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end />
-    #else##没数据字典
-            <el-option label="请选择字典生成" value="" />
-    #end
-          </el-select>
-        </el-form-item>
-#elseif($column.htmlType == "checkbox")## 多选框
-        <el-form-item label="${comment}" prop="${javaField}">
-          <el-checkbox-group v-model="form.${javaField}">
-    #if ("" != $dictType)## 有数据字典
-            <el-checkbox v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
-                         :key="dict.value" #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end>{{dict.label}}</el-checkbox>
-    #else##没数据字典
-            <el-checkbox>请选择字典生成</el-checkbox>
-    #end
-          </el-checkbox-group>
-        </el-form-item>
-#elseif($column.htmlType == "radio")## 单选框
-        <el-form-item label="${comment}" prop="${javaField}">
-          <el-radio-group v-model="form.${javaField}">
-    #if ("" != $dictType)## 有数据字典
-            <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
-                      :key="dict.value" #if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end>{{dict.label}}</el-radio>
-    #else##没数据字典
-            <el-radio label="1">请选择字典生成</el-radio>
-    #end
-          </el-radio-group>
-        </el-form-item>
-#elseif($column.htmlType == "datetime")## 时间框
-        <el-form-item label="${comment}" prop="${javaField}">
-          <el-date-picker clearable size="small" v-model="form.${javaField}" type="date" value-format="yyyy-MM-dd" placeholder="选择${comment}" />
-        </el-form-item>
-#elseif($column.htmlType == "textarea")## 文本框
-        <el-form-item label="${comment}" prop="${javaField}">
-          <el-input v-model="form.${javaField}" type="textarea" placeholder="请输入内容" />
-        </el-form-item>
-#end
-#end
-#end
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
-  </div>
+        <!-- 对话框(添加 / 修改) -->
+        <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+            <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+                #foreach($column in $columns)
+                    #if ($column.createOperation || $column.updateOperation)
+                        #set ($dictType = $column.dictType)
+                        #set ($javaField = $column.javaField)
+                        #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
+                        #set ($comment = $column.columnComment)
+                        #if ($column.htmlType == "input")
+                            #if (!$column.primaryKey)## 忽略主键,不用在表单里
+                                <el-form-item label="${comment}" prop="${javaField}">
+                                    <el-input v-model="form.${javaField}" placeholder="请输入${comment}"/>
+                                </el-form-item>
+                            #end
+                        #elseif($column.htmlType == "imageUpload")## 图片上传
+                            #set ($hasImageUploadColumn = true)
+                            <el-form-item label="${comment}">
+                                <imageUpload v-model="form.${javaField}"/>
+                            </el-form-item>
+                        #elseif($column.htmlType == "fileUpload")## 文件上传
+                            #set ($hasFileUploadColumn = true)
+                            <el-form-item label="${comment}">
+                                <fileUpload v-model="form.${javaField}"/>
+                            </el-form-item>
+                        #elseif($column.htmlType == "editor")## 文本编辑器
+                            #set ($hasEditorColumn = true)
+                            <el-form-item label="${comment}">
+                                <editor v-model="form.${javaField}" :min-height="192"/>
+                            </el-form-item>
+                        #elseif($column.htmlType == "select")## 下拉框
+                            <el-form-item label="${comment}" prop="${javaField}">
+                                <el-select v-model="form.${javaField}" placeholder="请选择${comment}">
+                                    #if ("" != $dictType)## 有数据字典
+                                        <el-option v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
+                                                   :key="dict.value" :label="dict.label"
+                                                   #if ($column.javaType == "Integer" || $column.javaType ==
+                                                       "Long"):value="parseInt(dict.value)"
+                                                   #else:value="dict.value"#end />
+                                    #else##没数据字典
+                                        <el-option label="请选择字典生成" value=""/>
+                                    #end
+                                </el-select>
+                            </el-form-item>
+                        #elseif($column.htmlType == "checkbox")## 多选框
+                            <el-form-item label="${comment}" prop="${javaField}">
+                                <el-checkbox-group v-model="form.${javaField}">
+                                    #if ("" != $dictType)## 有数据字典
+                                        <el-checkbox
+                                                v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
+                                                :key="dict.value"
+                                                #if($column.javaType == "Integer" || $column.javaType ==
+                                                    "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end>
+                                            {{dict.label}}
+                                        </el-checkbox>
+                                    #else##没数据字典
+                                        <el-checkbox>请选择字典生成</el-checkbox>
+                                    #end
+                                </el-checkbox-group>
+                            </el-form-item>
+                        #elseif($column.htmlType == "radio")## 单选框
+                            <el-form-item label="${comment}" prop="${javaField}">
+                                <el-radio-group v-model="form.${javaField}">
+                                    #if ("" != $dictType)## 有数据字典
+                                        <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.$dictType.toUpperCase())"
+                                                  :key="dict.value"
+                                                  #if($column.javaType == "Integer" || $column.javaType ==
+                                                      "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end>
+                                            {{dict.label}}
+                                        </el-radio>
+                                    #else##没数据字典
+                                        <el-radio label="1">请选择字典生成</el-radio>
+                                    #end
+                                </el-radio-group>
+                            </el-form-item>
+                        #elseif($column.htmlType == "datetime")## 时间框
+                            <el-form-item label="${comment}" prop="${javaField}">
+                                <el-date-picker clearable size="small" v-model="form.${javaField}" type="date"
+                                                value-format="yyyy-MM-dd" placeholder="选择${comment}"/>
+                            </el-form-item>
+                        #elseif($column.htmlType == "textarea")## 文本框
+                            <el-form-item label="${comment}" prop="${javaField}">
+                                <el-input v-model="form.${javaField}" type="textarea" placeholder="请输入内容"/>
+                            </el-form-item>
+                        #end
+                    #end
+                #end
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+                <el-button type="primary" @click="submitForm">确 定</el-button>
+                <el-button @click="cancel">取 消</el-button>
+            </div>
+        </el-dialog>
+    </div>
 </template>
 
 <script>
-import { create${simpleClassName}, update${simpleClassName}, delete${simpleClassName}, get${simpleClassName}, get${simpleClassName}Page, export${simpleClassName}Excel } from "@/api/${table.moduleName}/${classNameVar}";
-#if ($hasImageUploadColumn)
+    import {create${simpleClassName}, delete${simpleClassName}, get${simpleClassName}, update${simpleClassName}} from "@/api/";
 import ImageUpload from '@/components/ImageUpload';
-#end
-#if ($hasFileUploadColumn)
 import FileUpload from '@/components/FileUpload';
-#end
-#if ($hasEditorColumn)
 import Editor from '@/components/Editor';
-#end
-
-export default {
-  name: "${simpleClassName}",
-  components: {
-#if ($hasImageUploadColumn)
-    ImageUpload,
-#end
-#if ($hasFileUploadColumn)
-    FileUpload,
-#end
-#if ($hasEditorColumn)
-    Editor,
-#end
-  },
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // ${table.classComment}列表
-      list: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      #foreach ($column in $columns)## 时间范围
-      #if ($column.listOperation)
-      #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
-      #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-      dateRange${AttrName}: [],
-      #end
-      #end
-      #end
-      // 查询参数
-      queryParams: {
-        pageNo: 1,
-        pageSize: 10,
-        #foreach ($column in $columns)
-        #if ($column.listOperation && $column.listOperationCondition != 'BETWEEN')
-        $column.javaField: null,
-        #end
-        #end
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      #foreach ($column in $columns)
-      #if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
-        #set($comment=$column.columnComment)
-        $column.javaField: [{ required: true, message: "${comment}不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }],
-      #end
-      #end
-      }
-    };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询列表 */
-    getList() {
-      this.loading = true;
-      // 处理查询参数
-      let params = {...this.queryParams};
-      #foreach ($column in $columns)
-      #if ($column.listOperation)
-      #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
-      #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-      this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
-      #end
-      #end
-      #end
-      // 执行查询
-      get${simpleClassName}Page(params).then(response => {
-        this.list = response.data.list;
-        this.total = response.data.total;
-        this.loading = false;
-      });
-    },
-    /** 取消按钮 */
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    /** 表单重置 */
-    reset() {
-      this.form = {
-        #foreach ($column in $columns)
-        #if ($column.createOperation || $column.updateOperation)
-        #if ($column.htmlType == "checkbox")
-        $column.javaField: [],
-        #else
-        $column.javaField: undefined,
-        #end
-        #end
+        #if ($hasImageUploadColumn)
         #end
-      };
-      this.resetForm("form");
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNo = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      #foreach ($column in $columns)
-      #if ($column.listOperation)
-      #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
-      #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-      this.dateRange${AttrName} = [];
-      #end
-      #end
-      #end
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加${table.classComment}";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const ${primaryColumn.javaField} = row.${primaryColumn.javaField};
-      get${simpleClassName}(${primaryColumn.javaField}).then(response => {
-        this.form = response.data;
-        #foreach ($column in $columns)
-        #if($column.htmlType == "checkbox")## checkbox 特殊处理
-        this.form.$column.javaField = this.form.${column.javaField}.split(",");
+        #if ($hasFileUploadColumn)
         #end
+        #if ($hasEditorColumn)
         #end
-        this.open = true;
-        this.title = "修改${table.classComment}";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.#[[$]]#refs["form"].validate(valid => {
-        if (!valid) {
-          return;
-        }
-        #foreach ($column in $columns)
-        #if($column.htmlType == "checkbox")
-        this.form.$column.javaField = this.form.${column.javaField}.join(",");
-        #end
-        #end
-        // 修改的提交
-        if (this.form.${primaryColumn.javaField} != null) {
-          update${simpleClassName}(this.form).then(response => {
-            this.msgSuccess("修改成功");
-            this.open = false;
+
+    export default {
+        name: "${simpleClassName}",
+        components: {
+            #if ($hasImageUploadColumn)
+                ImageUpload,
+            #end
+            #if ($hasFileUploadColumn)
+                FileUpload,
+            #end
+            #if ($hasEditorColumn)
+                Editor,
+            #end
+        },
+        data() {
+            return {
+                // 遮罩层
+                loading: true,
+                // 显示搜索条件
+                showSearch: true,
+                // 总条数
+                total: 0,
+                // ${table.classComment}列表
+                list: [],
+                // 弹出层标题
+                title: "",
+                // 是否显示弹出层
+                open: false,
+                #foreach ($column in $columns)## 时间范围
+                    #if ($column.listOperation)
+                        #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
+                            #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
+                            dateRange${AttrName}: [],
+                        #end
+                    #end
+                #end
+                // 查询参数
+                queryParams: {
+                    pageNo: 1,
+                    pageSize: 10,
+                    #foreach ($column in $columns)
+                        #if ($column.listOperation && $column.listOperationCondition != 'BETWEEN')
+                                $column.javaField: null,
+                        #end
+                    #end
+                },
+                // 表单参数
+                form: {},
+                // 表单校验
+                rules: {
+                    #foreach ($column in $columns)
+                        #if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键
+                            #set($comment=$column.columnComment)
+                                $column.javaField: [{
+                                required: true,
+                                message: "${comment}不能为空", trigger: #if($column.htmlType == "select")"change"
+                                    #else"blur"#end }],
+                        #end
+                    #end
+                }
+            };
+        },
+        created() {
             this.getList();
-          });
-          return;
+        },
+        methods: {
+            /** 查询列表 */
+            getList() {
+                this.loading = true;
+                // 处理查询参数
+                let params = {...this.queryParams};
+                #foreach ($column in $columns)
+                    #if ($column.listOperation)
+                        #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
+                            #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
+                            this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
+                        #end
+                    #end
+                #end
+                // 执行查询
+                get${simpleClassName}Page(params).then(response => {
+                    this.list = response.data.list;
+                    this.total = response.data.total;
+                    this.loading = false;
+                });
+            },
+            /** 取消按钮 */
+            cancel() {
+                this.open = false;
+                this.reset();
+            },
+            /** 表单重置 */
+            reset() {
+                this.form = {
+                    #foreach ($column in $columns)
+                        #if ($column.createOperation || $column.updateOperation)
+                            #if ($column.htmlType == "checkbox")
+                                    $column.javaField: [],
+                            #else
+                                    $column.javaField: undefined,
+                            #end
+                        #end
+                    #end
+                };
+                this.resetForm("form");
+            },
+            /** 搜索按钮操作 */
+            handleQuery() {
+                this.queryParams.pageNo = 1;
+                this.getList();
+            },
+            /** 重置按钮操作 */
+            resetQuery() {
+                #foreach ($column in $columns)
+                    #if ($column.listOperation)
+                        #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
+                            #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
+                            this.dateRange${AttrName} = [];
+                        #end
+                    #end
+                #end
+                this.resetForm("queryForm");
+                this.handleQuery();
+            },
+            /** 新增按钮操作 */
+            handleAdd() {
+                this.reset();
+                this.open = true;
+                this.title = "添加${table.classComment}";
+            },
+            /** 修改按钮操作 */
+            handleUpdate(row) {
+                this.reset();
+                const ${primaryColumn.javaField} = row.${primaryColumn.javaField};
+                get${simpleClassName}(${primaryColumn.javaField}).then(response => {
+                    this.form = response.data;
+                    #foreach ($column in $columns)
+                        #if($column.htmlType == "checkbox")## checkbox 特殊处理
+                            this.form.$column.javaField = this.form.${column.javaField}.split(",");
+                        #end
+                    #end
+                    this.open = true;
+                    this.title = "修改${table.classComment}";
+                });
+            },
+            /** 提交按钮 */
+            submitForm() {
+                this.#[[$]]
+                #refs["form"].validate(valid => {
+                    if (!valid) {
+                        return;
+                    }
+                    #foreach ($column in $columns)
+                        #if($column.htmlType == "checkbox")
+                            this.form.$column.javaField = this.form.${column.javaField}.join(",");
+                        #end
+                    #end
+                    // 修改的提交
+                    if (this.form.${primaryColumn.javaField} != null) {
+                        update${simpleClassName}(this.form).then(response => {
+                            this.msgSuccess("修改成功");
+                            this.open = false;
+                            this.getList();
+                        });
+                        return;
+                    }
+                    // 添加的提交
+                    create${simpleClassName}(this.form).then(response => {
+                        this.msgSuccess("新增成功");
+                        this.open = false;
+                        this.getList();
+                    });
+                });
+            },
+            /** 删除按钮操作 */
+            handleDelete(row) {
+                const ${primaryColumn.javaField} = row.${primaryColumn.javaField};
+                this.$confirm('是否确认删除${table.classComment}编号为"' + ${primaryColumn.javaField} + '"的数据项?', "警告", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning"
+                }).then(function () {
+                    return delete${simpleClassName}(${primaryColumn.javaField});
+                }).then(() => {
+                    this.getList();
+                    this.msgSuccess("删除成功");
+                })
+            },
+            /** 导出按钮操作 */
+            handleExport() {
+                // 处理查询参数
+                let params = {...this.queryParams};
+                params.pageNo = undefined;
+                params.pageSize = undefined;
+                #foreach ($column in $columns)
+                    #if ($column.listOperation)
+                        #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
+                            #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
+                            this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
+                        #end
+                    #end
+                #end
+                // 执行导出
+                this.$confirm('是否确认导出所有${table.classComment}数据项?', "警告", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning"
+                }).then(function () {
+                    return export${simpleClassName}Excel(params);
+                }).then(response => {
+                    this.downloadExcel(response, '${table.classComment}.xls');
+                })
+            }
         }
-        // 添加的提交
-        create${simpleClassName}(this.form).then(response => {
-          this.msgSuccess("新增成功");
-          this.open = false;
-          this.getList();
-        });
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ${primaryColumn.javaField} = row.${primaryColumn.javaField};
-      this.$confirm('是否确认删除${table.classComment}编号为"' + ${primaryColumn.javaField} + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delete${simpleClassName}(${primaryColumn.javaField});
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      // 处理查询参数
-      let params = {...this.queryParams};
-      params.pageNo = undefined;
-      params.pageSize = undefined;
-      #foreach ($column in $columns)
-      #if ($column.listOperation)
-      #if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
-      #set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
-      this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
-      #end
-      #end
-      #end
-      // 执行导出
-      this.$confirm('是否确认导出所有${table.classComment}数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return export${simpleClassName}Excel(params);
-        }).then(response => {
-          this.downloadExcel(response, '${table.classComment}.xls');
-        })
-    }
-  }
-};
+    };
 </script>

+ 8 - 6
iot-admin-server/src/main/resources/rebel.xml

@@ -4,13 +4,15 @@
   This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
   Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
 -->
-<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
+<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated-by="intellij"
+             xmlns="http://www.zeroturnaround.com"
+             xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
 
-	<id>iot-admin-server</id>
+    <id>iot-admin-server</id>
 
-	<classpath>
-		<dir name="D:/workspace/iot/iot-admin-server/target/classes">
-		</dir>
-	</classpath>
+    <classpath>
+        <dir name="D:/workspace/iot/iot-admin-server/target/classes">
+        </dir>
+    </classpath>
 
 </application>

+ 9 - 5
iot-common/pom.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <groupId>com.persagy</groupId>
@@ -11,10 +11,10 @@
     <artifactId>iot-common</artifactId>
     <packaging>jar</packaging>
 
-    <name>  ${project.artifactId}</name>
+    <name>${project.artifactId}</name>
     <description>定义基础 pojo 类、枚举、工具类等等</description>
     <properties>
-<!--        <revision>1.0.0</revision>-->
+        <!--        <revision>1.0.0</revision>-->
         <!-- Maven 相关 -->
         <java.version>1.8</java.version>
         <maven.compiler.source>${java.version}</maven.compiler.source>
@@ -122,7 +122,11 @@
             <artifactId>jackson-core</artifactId>
             <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 -->
         </dependency>
-
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <scope>provided</scope><!-- 设置为 provided,只有工具类需要使用到 -->
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>

+ 1 - 1
iot-common/src/main/java/com.persagy/framework/common/core/IntArrayValuable.java

@@ -3,7 +3,7 @@ package com.persagy.framework.common.core;
 /**
  * 可生成 Int 数组的接口
  *
- * @author  
+ * @author
  */
 public interface IntArrayValuable {
 

+ 1 - 1
iot-common/src/main/java/com.persagy/framework/common/core/KeyValue.java

@@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
 /**
  * Key Value 的键值对
  *
- * @author  
+ * @author
  */
 @Data
 @NoArgsConstructor

+ 2 - 2
iot-common/src/main/java/com.persagy/framework/common/exception/ErrorCode.java

@@ -6,10 +6,10 @@ import lombok.Data;
 
 /**
  * 错误码对象
- *
+ * <p>
  * 全局错误码,占用 [0, 999], 参见 {@link GlobalErrorCodeConstants}
  * 业务异常错误码,占用 [1 000 000 000, +∞),参见 {@link ServiceErrorCodeRange}
- *
+ * <p>
  * TODO 错误码设计成对象的原因,为未来的 i18 国际化做准备
  */
 @Data

+ 6 - 6
iot-common/src/main/java/com.persagy/framework/common/exception/enums/GlobalErrorCodeConstants.java

@@ -5,12 +5,12 @@ import com.persagy.framework.common.exception.ErrorCode;
 /**
  * 全局错误码枚举
  * 0-999 系统异常编码保留
- *
+ * <p>
  * 一般情况下,使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status
  * 虽然说,HTTP 响应状态码作为业务使用表达能力偏弱,但是使用在系统层面还是非常不错的
  * 比较特殊的是,因为之前一直使用 0 作为成功,就不使用 200 啦。
  *
- * @author  
+ * @author
  */
 public interface GlobalErrorCodeConstants {
 
@@ -36,9 +36,9 @@ public interface GlobalErrorCodeConstants {
 
     ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");
 
-   static boolean isMatch(Integer code) {
-       return code != null
-               && code >= SUCCESS.getCode() && code <= UNKNOWN.getCode();
-   }
+    static boolean isMatch(Integer code) {
+        return code != null
+                && code >= SUCCESS.getCode() && code <= UNKNOWN.getCode();
+    }
 
 }

+ 18 - 18
iot-common/src/main/java/com.persagy/framework/common/exception/enums/ServiceErrorCodeRange.java

@@ -2,30 +2,30 @@ package com.persagy.framework.common.exception.enums;
 
 /**
  * 业务异常的错误码区间,解决:解决各模块错误码定义,避免重复,在此只声明不做实际使用
- *
+ * <p>
  * 一共 10 位,分成四段
- *
+ * <p>
  * 第一段,1 位,类型
- *      1 - 业务级别异常
- *      x - 预留
+ * 1 - 业务级别异常
+ * x - 预留
  * 第二段,3 位,系统类型
- *      001 - 用户系统
- *      002 - 商品系统
- *      003 - 订单系统
- *      004 - 支付系统
- *      005 - 优惠劵系统
- *      ... - ...
+ * 001 - 用户系统
+ * 002 - 商品系统
+ * 003 - 订单系统
+ * 004 - 支付系统
+ * 005 - 优惠劵系统
+ * ... - ...
  * 第三段,3 位,模块
- *      不限制规则。
- *      一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子:
- *          001 - OAuth2 模块
- *          002 - User 模块
- *          003 - MobileCode 模块
+ * 不限制规则。
+ * 一般建议,每个系统里面,可能有多个模块,可以再去做分段。以用户系统为例子:
+ * 001 - OAuth2 模块
+ * 002 - User 模块
+ * 003 - MobileCode 模块
  * 第四段,3 位,错误码
- *       不限制规则。
- *       一般建议,每个模块自增。
+ * 不限制规则。
+ * 一般建议,每个模块自增。
  *
- * @author  
+ * @author
  */
 public class ServiceErrorCodeRange {
 

+ 5 - 5
iot-common/src/main/java/com.persagy/framework/common/exception/util/ServiceExceptionUtil.java

@@ -1,8 +1,8 @@
 package com.persagy.framework.common.exception.util;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.persagy.framework.common.exception.ErrorCode;
 import com.persagy.framework.common.exception.ServiceException;
-import com.google.common.annotations.VisibleForTesting;
 import lombok.extern.slf4j.Slf4j;
 
 import java.util.Map;
@@ -11,12 +11,12 @@ import java.util.concurrent.ConcurrentMap;
 
 /**
  * {@link ServiceException} 工具类
- *
+ * <p>
  * 目的在于,格式化异常信息提示。
  * 考虑到 String.format 在参数不正确时会报错,因此使用 {} 作为占位符,并使用 {@link #doFormat(int, String, Object...)} 方法来格式化
- *
+ * <p>
  * 因为 {@link #MESSAGES} 里面默认是没有异常信息提示的模板的,所以需要使用方自己初始化进去。目前想到的有几种方式:
- *
+ * <p>
  * 1. 异常提示信息,写在枚举类中,例如说,cn.iocoder.oceans.user.api.constants.ErrorCodeEnum 类 + ServiceExceptionConfiguration
  * 2. 异常提示信息,写在 .properties 等等配置文件
  * 3. 异常提示信息,写在 Apollo 等等配置中心中,从而实现可动态刷新
@@ -67,7 +67,7 @@ public class ServiceExceptionUtil {
     /**
      * 创建指定编号的 ServiceException 的异常
      *
-     * @param code 编号
+     * @param code   编号
      * @param params 消息提示的占位符对应的参数
      * @return 异常
      */

+ 9 - 9
iot-common/src/main/java/com.persagy/framework/common/pojo/CommonResult.java

@@ -1,9 +1,9 @@
 package com.persagy.framework.common.pojo;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.persagy.framework.common.exception.ErrorCode;
 import com.persagy.framework.common.exception.ServiceException;
 import com.persagy.framework.common.exception.enums.GlobalErrorCodeConstants;
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Data;
 import org.springframework.util.Assert;
 
@@ -37,11 +37,11 @@ public class CommonResult<T> implements Serializable {
 
     /**
      * 将传入的 result 对象,转换成另外一个泛型结果的对象
-     *
+     * <p>
      * 因为 A 方法返回的 CommonResult 对象,不满足调用其的 B 方法的返回,所以需要进行转换。
      *
      * @param result 传入的 result 对象
-     * @param <T> 返回的泛型
+     * @param <T>    返回的泛型
      * @return 新的 CommonResult 对象
      */
     public static <T> CommonResult<T> error(CommonResult<?> result) {
@@ -72,18 +72,22 @@ public class CommonResult<T> implements Serializable {
         return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode());
     }
 
+    public static <T> CommonResult<T> error(ServiceException serviceException) {
+        return error(serviceException.getCode(), serviceException.getMessage());
+    }
+
     @JsonIgnore // 避免 jackson 序列化
     public boolean isSuccess() {
         return isSuccess(code);
     }
 
+    // ========= 和 Exception 异常体系集成 =========
+
     @JsonIgnore // 避免 jackson 序列化
     public boolean isError() {
         return !isSuccess();
     }
 
-    // ========= 和 Exception 异常体系集成 =========
-
     /**
      * 判断是否有异常。如果有,则抛出 {@link ServiceException} 异常
      */
@@ -95,8 +99,4 @@ public class CommonResult<T> implements Serializable {
         throw new ServiceException(code, msg);
     }
 
-    public static <T> CommonResult<T> error(ServiceException serviceException) {
-        return error(serviceException.getCode(), serviceException.getMessage());
-    }
-
 }

+ 2 - 2
iot-common/src/main/java/com.persagy/framework/common/pojo/PageParam.java

@@ -4,8 +4,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import javax.validation.constraints.Min;
 import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 
@@ -16,7 +16,7 @@ public class PageParam implements Serializable {
     private static final Integer PAGE_NO = 1;
     private static final Integer PAGE_SIZE = 10;
 
-    @ApiModelProperty(value = "页码,从 1 开始", required = true,example = "1")
+    @ApiModelProperty(value = "页码,从 1 开始", required = true, example = "1")
     @NotNull(message = "页码不能为空")
     @Min(value = 1, message = "页码最小值为 1")
     private Integer pageNo = PAGE_NO;

+ 1 - 1
iot-common/src/main/java/com.persagy/framework/common/pojo/SortingField.java

@@ -4,7 +4,7 @@ import java.io.Serializable;
 
 /**
  * 排序字段 DTO
- *
+ * <p>
  * 类名加了 ing 的原因是,避免和 ES SortField 重名。
  */
 public class SortingField implements Serializable {

+ 2 - 2
iot-common/src/main/java/com.persagy/framework/common/test/WebFilterOrderEnum.java

@@ -2,10 +2,10 @@ package com.persagy.framework.common.enums;
 
 /**
  * Web 过滤器顺序的枚举类,保证过滤器按照符合我们的预期
- *
+ * <p>
  * 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 util 包下
  *
- * @author  
+ * @author
  */
 public interface WebFilterOrderEnum {
 

+ 3 - 3
iot-common/src/main/java/com.persagy/framework/common/util/collection/ArrayUtils.java

@@ -7,16 +7,16 @@ import java.util.function.Consumer;
 /**
  * Array 工具类
  *
- * @author  
+ * @author
  */
 public class ArrayUtils {
 
     /**
      * 将 object 和 newElements 合并成一个数组
      *
-     * @param object 对象
+     * @param object      对象
      * @param newElements 数组
-     * @param <T> 泛型
+     * @param <T>         泛型
      * @return 结果数组
      */
     @SafeVarargs

+ 2 - 2
iot-common/src/main/java/com.persagy/framework/common/util/collection/CollectionUtils.java

@@ -13,7 +13,7 @@ import java.util.stream.Collectors;
 /**
  * Collection 工具类
  *
- * @author  
+ * @author
  */
 public class CollectionUtils {
 
@@ -114,7 +114,7 @@ public class CollectionUtils {
             return new HashMap<>();
         }
         return from.stream()
-                   .collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toList())));
+                .collect(Collectors.groupingBy(keyFunc, Collectors.mapping(valueFunc, Collectors.toList())));
     }
 
     // 暂时没想好名字,先以 2 结尾噶

+ 5 - 5
iot-common/src/main/java/com.persagy/framework/common/util/collection/MapUtils.java

@@ -2,9 +2,9 @@ package com.persagy.framework.common.util.collection;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
-import com.persagy.framework.common.core.KeyValue;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
+import com.persagy.framework.common.core.KeyValue;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -15,7 +15,7 @@ import java.util.function.Consumer;
 /**
  * Map 工具类
  *
- * @author  
+ * @author
  */
 public class MapUtils {
 
@@ -23,7 +23,7 @@ public class MapUtils {
      * 从哈希表表中,获得 keys 对应的所有 value 数组
      *
      * @param multimap 哈希表
-     * @param keys keys
+     * @param keys     keys
      * @return value 数组
      */
     public static <K, V> List<V> getList(Multimap<K, V> multimap, Collection<K> keys) {
@@ -42,8 +42,8 @@ public class MapUtils {
      * 从哈希表查找到 key 对应的 value,然后进一步处理
      * 注意,如果查找到的 value 为 null 时,不进行处理
      *
-     * @param map 哈希表
-     * @param key key
+     * @param map      哈希表
+     * @param key      key
      * @param consumer 进一步处理的逻辑
      */
     public static <K, V> void findAndThen(Map<K, V> map, K key, Consumer<V> consumer) {

+ 1 - 1
iot-common/src/main/java/com.persagy/framework/common/util/collection/SetUtils.java

@@ -7,7 +7,7 @@ import java.util.Set;
 /**
  * Set 工具类
  *
- * @author  
+ * @author
  */
 public class SetUtils {
 

+ 277 - 49
iot-common/src/main/java/com.persagy/framework/common/util/date/DateUtils.java

@@ -1,77 +1,305 @@
 package com.persagy.framework.common.util.date;
 
-import java.time.Duration;
-import java.util.Calendar;
+import cn.hutool.core.date.DateUtil;
+import lombok.extern.slf4j.Slf4j;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalUnit;
 import java.util.Date;
 
 /**
- * 时间工具类
+ * Description: 基于Java8的时间工具类 Company: Persagy
+ * 配合hutool的DateUtil工具类实现各种时间转换需求
+ * @author luoguangyi
+ * @version 1.0
+ * @since: 2019年8月5日: 下午4:44:21 Update By luoguangyi 2019年8月5日: 下午4:44:21
  */
+@Slf4j
 public class DateUtils {
 
+    public static final String SDF_DAY = "yyyyMMdd";
+    public static final String SDF_MONTH = "yyyyMM";
+    public static final String SDF_TIME = "yyyyMMddHHmmss";
+    public static final String SDF_TIME_NOT_DATE = "HHmmss";
+    public static final String SDF_HOUR = "yyyyMMddHH";
+    public static final String SDF_MINUTE = "yyyyMMddHHmm";
+    // 时间格式-显示
+    public final static String DATE_TIME_FORMAT_SHOW = "yyyy-MM-dd HH:mm:ss";
+    public final static String DATE_TIME_FORMAT_SHOW_MINUTE = "yyyy-MM-dd HH:mm";
+    private final static DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
     /**
-     * 时区 - 默认
+     * 东八区时区偏移量
      */
-    public static final String TIME_ZONE_DEFAULT = "GMT+8";
+    private final static int ASIA_SHANGHAI = 8;
 
-    public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss";
+    public static long diff(Date endTime, Date startTime) {
+        return endTime.getTime() - startTime.getTime();
+    }
 
-    public static Date addTime(Duration duration) {
-        return new Date(System.currentTimeMillis() + duration.toMillis());
+    /**
+     * LocalDate类型转为Date
+     *
+     * @param localDate LocalDate object
+     * @return Date object
+     */
+    public static Date localDate2Date(LocalDate localDate) {
+        ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
+        return Date.from(zonedDateTime.toInstant());
     }
 
-    public static boolean isExpired(Date time) {
-        return System.currentTimeMillis() > time.getTime();
+    /**
+     * LocalDateTime类型转为Date
+     *
+     * @param localDateTime LocalDateTime object
+     * @return Date object
+     */
+    public static Date localDateTime2Date(LocalDateTime localDateTime) {
+        return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
     }
 
-    public static long diff(Date endTime, Date startTime) {
-        return endTime.getTime() - startTime.getTime();
+    /**
+     * Description: Date转换为LocalDateTime
+     *
+     * @param date
+     * @return LocalDateTime
+     * @author luoguangyi
+     * @since 2019年8月5日: 下午5:25:27 Update By luoguangyi 2019年8月5日: 下午5:25:27
+     */
+    public static LocalDateTime date2LocalDateTime(Date date) {
+        return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
+    }
+
+    // 获取指定日期的毫秒
+    public static Long getMilliByLocalDateTime(LocalDateTime time) {
+        return time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+    }
+
+    /**
+     * 获取时间戳
+     *
+     * @param dateTime
+     * @return
+     */
+    public static Long getMilliByLocalDateTime(String dateTime) {
+        return parse(dateTime).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
+    }
+
+    // 获取指定日期的秒
+    public static Long getSecondsByLocalDateTime(LocalDateTime time) {
+        return time.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
+    }
+
+    /**
+     * 格式化LocalDateTime为指定格式 字符串
+     *
+     * @param pattern 格式
+     * @return 日期字符串
+     */
+    public static String format(LocalDateTime time, String pattern) {
+        return time.format(DateTimeFormatter.ofPattern(pattern));
+    }
+
+    public static String format(LocalDateTime time, DateTimeFormatter pattern) {
+        return time.format(pattern);
+    }
+
+    public static String format(LocalDateTime time) {
+        return time.format(FORMATTER);
+    }
+
+    public static String formatDate(Date date) {
+        return format(date2LocalDateTime(date));
+    }
+
+    /**
+     * 解析字符串日期为Date
+     *
+     * @param dateStr 日期字符串
+     * @param pattern 格式
+     * @return Date
+     */
+    public static LocalDateTime parse(String dateStr, String pattern) {
+        return LocalDateTime.parse(dateStr, DateTimeFormatter.ofPattern(pattern));
+    }
+
+    public static LocalDateTime parse(String dateStr, DateTimeFormatter pattern) {
+        return LocalDateTime.parse(dateStr, pattern);
+    }
+
+    public static LocalDateTime parse(String dateStr) {
+        return LocalDateTime.parse(dateStr, FORMATTER);
+    }
+
+    public static Date parseDate(String dateStr) {
+        return localDateTime2Date(LocalDateTime.parse(dateStr, FORMATTER));
+    }
+
+    // 获取当前时间的指定格式
+    public static String formatNow(String pattern) {
+        return format(LocalDateTime.now(), pattern);
+    }
+
+    // 日期加上一个数,根据field不同加不同值,field为ChronoUnit.*
+    public static LocalDateTime plus(LocalDateTime time, long number, TemporalUnit field) {
+        return time.plus(number, field);
+    }
+
+    // 日期减去一个数,根据field不同减不同值,field参数为ChronoUnit.*
+    public static LocalDateTime minus(LocalDateTime time, long number, TemporalUnit field) {
+        return time.minus(number, field);
+    }
+
+    /**
+     * 获取两个日期的差 field参数为ChronoUnit.* 默认累加的方式 重要说明: 计算月份差 计算的是否满月,年份同理,
+     * 区别1:Period只考虑到日期,ChronoUnit.between()计算到具体时分秒
+     * 区别2:Period只计算月份差,不考虑年份是否一样,ChronoUnit.between()计算考虑年份
+     * :Period只考虑到日期,field.between(startTime, endTime)会计算到具体时间 period.getMonths();
+     * field.between 比如:6月6号8点到8月6号7点: 2 1 比如:6月6号8点到8月6号9点: 2 2 比如:6月5号到8月6号: 2 2
+     * 比如:6月7号到8月6号: 1 1
+     *
+     * @param startTime
+     * @param endTime
+     * @param field     单位(年月日时分秒)
+     * @return
+     */
+    public static long betweenTwoTime(LocalDateTime startTime, LocalDateTime endTime, ChronoUnit field) {
+
+        // Period period = Period.between(LocalDate.from(startTime),
+        // LocalDate.from(endTime));
+        // startTime : 1993-10-19
+        // endTime : 2019-08-06
+        // 年龄 : 25 年 9 月 18 日
+        // period.getYears(); period.getMonths(); period.getDays();
+        // 25 年 9 月 18 日
+        // field.between(startTime, endTime);
+        // 25 年 25*12+9 ( 25*12+9)个月+18 日
+
+        return field.between(startTime, endTime);
+    }
+
+    /**
+     * 获取间隔时间
+     *
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    public static long betweenTwoTime(String startTime, String endTime, ChronoUnit field) {
+        return betweenTwoTime(parse(startTime), parse(endTime), field);
     }
 
     /**
-     * 创建指定时间
+     * 获取间隔秒数
      *
-     * @param year        年
-     * @param mouth       月
-     * @param day         日
-     * @return 指定时间
+     * @param startTime
+     * @param endTime
+     * @return
      */
-    public static Date buildTime(int year, int mouth, int day) {
-        return buildTime(year, mouth, day, 0, 0, 0);
+    public static long betweenTwoTimeSecond(String startTime, String endTime) {
+        return betweenTwoTime(startTime, endTime, ChronoUnit.SECONDS);
     }
 
     /**
-     * 创建指定时间
+     * Description:获得当前时间的字符串.
      *
-     * @param year        年
-     * @param mouth       月
-     * @param day         日
-     * @param hour        小时
-     * @param minute      分钟
-     * @param second      秒
-     * @return 指定时间
-     */
-    public static Date buildTime(int year, int mouth, int day,
-                                 int hour, int minute, int second) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.set(Calendar.YEAR, year);
-        calendar.set(Calendar.MONTH, mouth - 1);
-        calendar.set(Calendar.DAY_OF_MONTH, day);
-        calendar.set(Calendar.HOUR_OF_DAY, hour);
-        calendar.set(Calendar.MINUTE, minute);
-        calendar.set(Calendar.SECOND, second);
-        calendar.set(Calendar.MILLISECOND, 0); // 一般情况下,都是 0 毫秒
-        return calendar.getTime();
-    }
-
-    public static Date max(Date a, Date b) {
-        if (a == null) {
-            return b;
-        }
-        if (b == null) {
-            return a;
-        }
-        return a.compareTo(b) > 0 ? a : b;
+     * @return String 当前时间的字符串格式.格式是yyyyMMddHHmmss
+     * @author lijie
+     */
+    public static String getNowTimeStr() {
+        return LocalDateTime.now().format(FORMATTER);
+    }
+
+    public static String getTimeStr(LocalDateTime date) {
+        return date.format(FORMATTER);
     }
 
+    public static String getMinusHour(String dateTime, long hour) {
+        LocalDateTime parse = parse(dateTime).minusHours(hour);
+        return format(parse);
+    }
+
+    public static String getSdfTimeNotDate(String dateTime) {
+        return dateTime.substring(8, 14);
+    }
+
+    public static String getPlusHour(String dateTime, long hour) {
+        LocalDateTime parse = parse(dateTime).plusHours(hour);
+        return format(parse);
+    }
+
+    public static String getPlusDay(String dateTime, long days) {
+        LocalDateTime parse = parse(dateTime).plusDays(days);
+        return format(parse);
+    }
+
+    public static String getPlusHourNow(long hour) {
+        LocalDateTime parse = LocalDateTime.now().plusHours(hour);
+        return format(parse);
+    }
+
+    /**
+     * 获取年
+     *
+     * @return 年
+     */
+    public static int getYear(LocalDateTime ldt) {
+        return ldt.getYear();
+    }
+
+    /**
+     * 获取月份
+     */
+    public static int getMonth(LocalDateTime ldt) {
+        return ldt.getMonthValue();
+    }
+
+    /**
+     * 获取月份差 不算满月的月份差(比如7月31号到8月1号仍然算一个月份差)
+     */
+    public static int getBetweenMonth(LocalDateTime startLdt, LocalDateTime endLdt) {
+        int minusMonth = (endLdt.getYear() - startLdt.getYear()) * 12 - endLdt.getMonthValue()
+                - startLdt.getMonthValue();
+        return minusMonth;
+    }
+
+    /**
+     * 获取月份最大天数
+     */
+    public static int getDaylengthOfMonth() {
+        LocalDateTime localTime = LocalDateTime.now();
+        return localTime.toLocalDate().lengthOfMonth();
+    }
+
+    /**
+     * 获取年份最大天数
+     */
+    public static int getDaylengthOfYear() {
+        LocalDateTime localTime = LocalDateTime.now();
+        return localTime.toLocalDate().lengthOfYear();
+    }
+
+    /**
+     * Description: 日期格式转换
+     *
+     * @param srcDateStr      源日期字符串
+     * @param srcDatePattern  源日期字符串格式
+     * @param destDatePattern 目标日期字符串格式
+     * @return String
+     * @author luoguangyi
+     * @since 2019年10月9日: 下午2:29:23 Update By luoguangyi 2019年10月9日: 下午2:29:23
+     */
+    public static String transferDateFormat(String srcDateStr, String srcDatePattern, String destDatePattern) {
+        DateTimeFormatter srcFommater = DateTimeFormatter.ofPattern(srcDatePattern);
+        DateTimeFormatter destFommater = DateTimeFormatter.ofPattern(destDatePattern);
+        return LocalDateTime.parse(srcDateStr, srcFommater).format(destFommater);
+    }
+
+
+
+
 }

+ 73 - 0
iot-common/src/main/java/com.persagy/framework/common/util/json/FastJsonUtil.java

@@ -0,0 +1,73 @@
+//package com.persagy.framework.common.util.json;
+//
+//
+//import cn.hutool.core.util.StrUtil;
+//import lombok.extern.slf4j.Slf4j;
+//
+//import java.util.ArrayList;
+//import java.util.List;
+//
+///**
+// * @description: fastJson工具类
+// * @author: luoguangyi
+// * @company: Persagy Technology Co.,Ltd
+// * @since: 2020/7/9 14:48
+// * @version: V1.0
+// **/
+//@Slf4j
+//public class FastJsonUtil {
+//    /**
+//     * @param content:
+//     * @param t:
+//     * @description:将json数据转换成pojo对象list
+//     * @exception:
+//     * @author: LuoGuangyi
+//     * @company: Persagy Technology Co.,Ltd
+//     * @return: java.util.List<T>
+//     * @since: 2020/10/31 21:24
+//     * @version: V1.0
+//     */
+//    public static <T> List<T> jsonToList(String content, Class<T> t) {
+//        if (StrUtil.isNotBlank(content)) {
+//            // 把字符串转成json对象
+//            return JSONArray.parseArray(content, t);
+//        }
+//        return new ArrayList<T>();
+//    }
+//
+//    /**
+//     * 将json字符串反序列号成对象
+//     *
+//     * @param <T>
+//     * @param json
+//     * @param clazz
+//     * @return
+//     */
+//    public static <T> T readValue(String json, Class<T> clazz) throws Exception {
+//        if (StringUtils.isNotBlank(json)) {
+//            return JSONObject.parseObject(json, clazz);
+//        }
+//        return clazz.newInstance();
+//    }
+//
+//    /**
+//     * @param json
+//     * @param type
+//     * @return
+//     * @Title: readValue
+//     * @return: T
+//     */
+//    public static <T> T parseObject(String json, TypeReference<T> type) {
+//        return JSONObject.parseObject(json, type);
+//    }
+//
+//    /**
+//     * 将对象序列号json字符串
+//     *
+//     * @param obj
+//     * @return
+//     */
+//    public static String writeValue(Object obj) {
+//        return JSONObject.toJSONString(obj);
+//    }
+//}

+ 1 - 1
iot-common/src/main/java/com.persagy/framework/common/util/json/JsonUtils.java

@@ -14,7 +14,7 @@ import java.util.List;
 /**
  * JSON 工具类
  *
- * @author  
+ * @author
  */
 public class JsonUtils {
 

+ 2 - 2
iot-common/src/main/java/com.persagy/framework/common/util/monitor/TracerUtils.java

@@ -4,10 +4,10 @@ import org.apache.skywalking.apm.toolkit.trace.TraceContext;
 
 /**
  * 链路追踪工具类
- *
+ * <p>
  * 考虑到每个 starter 都需要用到该工具类,所以放到 common 模块下的 util 包下
  *
- * @author  
+ * @author
  */
 public class TracerUtils {
 

+ 3 - 3
iot-common/src/main/java/com.persagy/framework/common/util/servlet/ServletUtils.java

@@ -18,7 +18,7 @@ import java.net.URLEncoder;
 /**
  * 客户端工具类
  *
- * @author  
+ * @author
  */
 public class ServletUtils {
 
@@ -26,7 +26,7 @@ public class ServletUtils {
      * 返回 JSON 字符串
      *
      * @param response 响应
-     * @param object 对象,会序列化成 JSON 字符串
+     * @param object   对象,会序列化成 JSON 字符串
      */
     @SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码
     public static void writeJSON(HttpServletResponse response, Object object) {
@@ -39,7 +39,7 @@ public class ServletUtils {
      *
      * @param response 响应
      * @param filename 文件名
-     * @param content 附件内容
+     * @param content  附件内容
      * @throws IOException
      */
     public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {

+ 1 - 1
iot-common/src/main/java/com.persagy/framework/common/util/sping/SpringAopUtils.java

@@ -7,7 +7,7 @@ import org.springframework.aop.support.AopUtils;
 
 /**
  * Spring AOP 工具类
- *
+ * <p>
  * 参考波克尔 http://www.bubuko.com/infodetail-3471885.html 实现
  */
 public class SpringAopUtils {

+ 3 - 3
iot-common/src/main/java/com.persagy/framework/common/util/sping/SpringExpressionUtils.java

@@ -20,7 +20,7 @@ import java.util.Map;
 /**
  * Spring EL 表达式的工具类
  *
- * @author   
+ * @author
  */
 public class SpringExpressionUtils {
 
@@ -33,7 +33,7 @@ public class SpringExpressionUtils {
     /**
      * 从切面中,单个解析 EL 表达式的结果
      *
-     * @param joinPoint  切面点
+     * @param joinPoint        切面点
      * @param expressionString EL 表达式数组
      * @return 执行界面
      */
@@ -45,7 +45,7 @@ public class SpringExpressionUtils {
     /**
      * 从切面中,批量解析 EL 表达式的结果
      *
-     * @param joinPoint   切面点
+     * @param joinPoint         切面点
      * @param expressionStrings EL 表达式数组
      * @return 结果,key 为表达式,value 为对应值
      */

+ 2 - 1
iot-common/src/main/java/com.persagy/framework/common/util/string/StrUtils.java

@@ -8,7 +8,7 @@ import java.util.Map;
 /**
  * 字符串工具类
  *
- * @author  
+ * @author
  */
 public class StrUtils {
 
@@ -18,6 +18,7 @@ public class StrUtils {
 
     /**
      * 指定字符串的
+     *
      * @param str
      * @param replaceMap
      * @return

+ 8 - 6
iot-common/src/main/resources/rebel.xml

@@ -4,13 +4,15 @@
   This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
   Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
 -->
-<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
+<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated-by="intellij"
+             xmlns="http://www.zeroturnaround.com"
+             xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
 
-	<id>iot-common</id>
+    <id>iot-common</id>
 
-	<classpath>
-		<dir name="D:/workspace/iot/iot-common/target/classes">
-		</dir>
-	</classpath>
+    <classpath>
+        <dir name="D:/workspace/iot/iot-common/target/classes">
+        </dir>
+    </classpath>
 
 </application>

+ 16 - 19
iot-dependencies/pom.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
@@ -9,11 +9,11 @@
     <version>${revision}</version>
     <packaging>pom</packaging>
 
-    <name>  ${project.artifactId}</name>
+    <name>${project.artifactId}</name>
     <description>基础 bom 文件,管理整个项目的依赖版本</description>
 
     <properties>
-<!--        <revision>1.0.0</revision>-->
+        <revision>1.0.0</revision>
         <!-- 统一依赖管理 -->
         <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
         <spring-cloud-alibaba.version>2.2.2.RELEASE</spring-cloud-alibaba.version>
@@ -43,6 +43,7 @@
         <lombok.version>1.18.12</lombok.version>
         <mapstruct.version>1.4.1.Final</mapstruct.version>
         <hutool.version>5.6.1</hutool.version>
+        <fastjson.version>1.2.76</fastjson.version>
         <easyexcel.verion>2.2.11</easyexcel.verion>
         <velocity.version>2.2</velocity.version>
         <screw.version>1.0.5</screw.version>
@@ -91,7 +92,11 @@
                 <artifactId>iot-spring-boot-starter-test</artifactId>
                 <version>${revision}</version>
             </dependency>
-
+            <dependency>
+                <groupId>com.persagy</groupId>
+                <artifactId>iot-spring-boot-starter-redis</artifactId>
+                <version>${revision}</version>
+            </dependency>
             <!-- Web 相关 -->
             <dependency>
                 <groupId>com.persagy</groupId>
@@ -123,7 +128,6 @@
                 <artifactId>swagger-annotations</artifactId>
                 <version>${swagger-annotations.version}</version>
             </dependency>
-
             <!-- DB 相关 -->
             <dependency>
                 <groupId>com.persagy</groupId>
@@ -153,12 +157,6 @@
             </dependency>
 
             <dependency>
-                <groupId>com.persagy</groupId>
-                <artifactId>iot-spring-boot-starter-redis</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
-            <dependency>
                 <groupId>org.redisson</groupId>
                 <artifactId>redisson-spring-boot-starter</artifactId>
                 <version>${redisson.version}</version>
@@ -187,13 +185,6 @@
                 <version>${resilience4j.version}</version>
             </dependency>
 
-            <!-- 监控相关 -->
-            <dependency>
-                <groupId>com.persagy</groupId>
-                <artifactId>iot-spring-boot-starter-monitor</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
             <dependency>
                 <groupId>org.apache.skywalking</groupId>
                 <artifactId>apm-toolkit-trace</artifactId>
@@ -293,6 +284,12 @@
 
             <dependency>
                 <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>${fastjson.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.alibaba</groupId>
                 <artifactId>easyexcel</artifactId>
                 <version>${easyexcel.verion}</version>
             </dependency>

+ 3 - 3
iot-spring-boot-starter-excel/pom.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <groupId>com.persagy</groupId>
@@ -11,7 +11,7 @@
     <artifactId>iot-spring-boot-starter-excel</artifactId>
     <packaging>jar</packaging>
 
-    <name>  ${project.artifactId}</name>
+    <name>${project.artifactId}</name>
     <description>Excel 拓展</description>
     <dependencies>
         <dependency>

+ 4 - 6
iot-spring-boot-starter-excel/src/main/java/com.persagy.framework.excel.core.convert/JsonConvert.java

@@ -1,20 +1,18 @@
 package com.persagy.framework.excel.core.convert;
 
-import com.persagy.framework.common.util.json.JsonUtils;
 import com.alibaba.excel.converters.Converter;
 import com.alibaba.excel.enums.CellDataTypeEnum;
 import com.alibaba.excel.metadata.CellData;
 import com.alibaba.excel.metadata.GlobalConfiguration;
 import com.alibaba.excel.metadata.property.ExcelContentProperty;
+import com.persagy.framework.common.util.json.JsonUtils;
 
 /**
  * Excel Json 转换器
  *
- * @author
- * 使用说明:
- *    @ExcelProperty(value = "短信参数", converter = JsonConvert.class)
- *     private Map<String, Object> templateParams;
- *
+ * @author 使用说明:
+ * @ExcelProperty(value = "短信参数", converter = JsonConvert.class)
+ * private Map<String, Object> templateParams;
  */
 public class JsonConvert implements Converter<Object> {
 

+ 1 - 2
iot-spring-boot-starter-excel/src/main/java/com.persagy.framework.excel.core.util/ExcelListener.java

@@ -9,8 +9,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * @description:
- * 解析监听器,
+ * @description: 解析监听器,
  * 每解析一行会回调invoke()方法。
  * 整个excel解析结束会执行doAfterAllAnalysed()方法
  * @author:lgy

+ 1 - 1
iot-spring-boot-starter-excel/src/main/java/com.persagy.framework.excel.core.util/ExcelUtils.java

@@ -74,7 +74,7 @@ public class ExcelUtils {
         try (InputStream fileStream = new FileInputStream(filePath);) {
             ExcelListener<Object> excelListener = new ExcelListener<Object>();
             //异步
-            EasyExcel.read(fileStream,head,excelListener).sheet(1).doRead();
+            EasyExcel.read(fileStream, head, excelListener).sheet(1).doRead();
             //同步
             // return EasyExcel.read(fileStream).sheet(1).doReadSync();
             return excelListener.getDatas();

+ 8 - 6
iot-spring-boot-starter-excel/src/main/resources/rebel.xml

@@ -4,13 +4,15 @@
   This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
   Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
 -->
-<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
+<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" generated-by="intellij"
+             xmlns="http://www.zeroturnaround.com"
+             xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
 
-	<id>iot-spring-boot-starter-excel</id>
+    <id>iot-spring-boot-starter-excel</id>
 
-	<classpath>
-		<dir name="D:/workspace/iot/iot-spring-boot-starter-excel/target/classes">
-		</dir>
-	</classpath>
+    <classpath>
+        <dir name="D:/workspace/iot/iot-spring-boot-starter-excel/target/classes">
+        </dir>
+    </classpath>
 
 </application>

+ 2 - 2
iot-spring-boot-starter-extension/pom.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <groupId>com.persagy</groupId>

+ 5 - 1
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/config/ExtensionAutoConfiguration.java

@@ -11,8 +11,8 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
 /**
- * @description 扩展点组件自动装配
  * @version 1.0.0
+ * @description 扩展点组件自动装配
  * @date 2021-08-28 21:50
  * @class com.persagy.framework.extension.config.YudaoExtensionAutoConfiguration.java
  */
@@ -21,6 +21,7 @@ public class ExtensionAutoConfiguration {
 
     /**
      * 组件初始化
+     *
      * @return
      */
     @Bean(initMethod = "init")
@@ -31,6 +32,7 @@ public class ExtensionAutoConfiguration {
 
     /**
      * 扩展点工厂
+     *
      * @return
      */
     @Bean
@@ -41,6 +43,7 @@ public class ExtensionAutoConfiguration {
 
     /**
      * 扩展组件上下文对象
+     *
      * @return
      */
     @Bean
@@ -51,6 +54,7 @@ public class ExtensionAutoConfiguration {
 
     /**
      * 扩展组件执行器
+     *
      * @return
      */
     @Bean

+ 31 - 27
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/BusinessScenario.java

@@ -5,9 +5,9 @@ import java.io.Serializable;
 import java.util.StringJoiner;
 
 /**
- * @description 业务场景 = businessId + useCase + scenario, 用来标识系统中唯一的一个场景<br/>
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 业务场景 = businessId + useCase + scenario, 用来标识系统中唯一的一个场景<br/>
  * @date 2021-08-28 22:19
  * @class com.persagy.framework.extension.core.BusinessScenario.java
  */
@@ -69,32 +69,9 @@ public class BusinessScenario implements Serializable {
         this(DEFAULT_BUSINESS_ID, useCase, scenario);
     }
 
-    public String getBusinessId() {
-        return businessId;
-    }
-
-    public void setBusinessId(String businessId) {
-        this.businessId = businessId;
-    }
-
-    public String getUseCase() {
-        return useCase;
-    }
-
-    public void setUseCase(String useCase) {
-        this.useCase = useCase;
-    }
-
-    public String getScenario() {
-        return scenario;
-    }
-
-    public void setScenario(String scenario) {
-        this.scenario = scenario;
-    }
-
     /**
      * 构建业务场景
+     *
      * @param businessId
      * @param useCase
      * @param scenario
@@ -106,6 +83,7 @@ public class BusinessScenario implements Serializable {
 
     /**
      * 构建业务场景
+     *
      * @param useCase
      * @param scenario
      * @return
@@ -116,6 +94,7 @@ public class BusinessScenario implements Serializable {
 
     /**
      * 构建业务场景
+     *
      * @param scenario
      * @return
      */
@@ -123,11 +102,36 @@ public class BusinessScenario implements Serializable {
         return new BusinessScenario(scenario);
     }
 
+    public String getBusinessId() {
+        return businessId;
+    }
+
+    public void setBusinessId(String businessId) {
+        this.businessId = businessId;
+    }
+
+    public String getUseCase() {
+        return useCase;
+    }
+
+    public void setUseCase(String useCase) {
+        this.useCase = useCase;
+    }
+
+    public String getScenario() {
+        return scenario;
+    }
+
+    public void setScenario(String scenario) {
+        this.scenario = scenario;
+    }
+
     /**
      * 业务场景唯一标识
+     *
      * @return
      */
-    public String getUniqueIdentity(){
+    public String getUniqueIdentity() {
         return new StringJoiner(DOT_SEPARATOR).add(businessId).add(useCase).add(scenario).toString();
     }
 

+ 2 - 2
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/ExtensionBootstrap.java

@@ -9,9 +9,9 @@ import org.springframework.context.ApplicationContextAware;
 import javax.annotation.PostConstruct;
 
 /**
- * @description 
- * @author 
+ * @author
  * @version 1.0.0
+ * @description
  * @date 2021-08-29 00:18
  * @class com.persagy.framework.extension.core.ExtensionBootstrap.java
  */

+ 14 - 5
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/AbstractComponentExecutor.java

@@ -7,9 +7,9 @@ import java.util.function.Consumer;
 import java.util.function.Function;
 
 /**
- * @description 执行器通用方法
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 执行器通用方法
  * @date 2021-08-29 00:38
  * @class com.persagy.framework.extension.core.context.AbstractComponentExecutor.java
  */
@@ -17,6 +17,7 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * ("业务" + "用例" + "场景")执行扩展组件,并返回执行结果
+     *
      * @param targetClazz
      * @param businessId
      * @param useCase
@@ -33,6 +34,7 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * ("用例" + "场景")执行扩展组件,并返回执行结果
+     *
      * @param targetClazz
      * @param useCase
      * @param scenario
@@ -47,6 +49,7 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * ("场景")执行扩展组件,并返回执行结果
+     *
      * @param targetClazz
      * @param scenario
      * @param function
@@ -60,11 +63,12 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * 执行扩展组件,并返回执行结果
+     *
      * @param targetClazz
      * @param businessScenario
      * @param function
-     * @param <R> Response Type
-     * @param <T> Parameter Type
+     * @param <R>              Response Type
+     * @param <T>              Parameter Type
      * @return
      */
     public <R, T extends ExtensionPoint> R execute(Class<T> targetClazz, BusinessScenario businessScenario, Function<T, R> function) {
@@ -74,6 +78,7 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * ("业务" + "用例" + "场景")执行扩展组件,适用于无返回值的业务
+     *
      * @param targetClazz
      * @param businessId
      * @param useCase
@@ -87,6 +92,7 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * ("场景")执行扩展组件,适用于无返回值的业务
+     *
      * @param targetClazz
      * @param useCase
      * @param scenario
@@ -99,6 +105,7 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * ("场景")执行扩展组件,适用于无返回值的业务
+     *
      * @param targetClazz
      * @param scenario
      * @param consumer
@@ -110,10 +117,11 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * 执行扩展组件,适用于无返回值的业务
+     *
      * @param targetClazz
      * @param businessScenario
      * @param consumer
-     * @param <T> Parameter Type
+     * @param <T>              Parameter Type
      */
     public <T extends ExtensionPoint> void accept(Class<T> targetClazz, BusinessScenario businessScenario, Consumer<T> consumer) {
         T component = locateComponent(targetClazz, businessScenario);
@@ -122,6 +130,7 @@ public abstract class AbstractComponentExecutor {
 
     /**
      * 获取/定位扩展点组件
+     *
      * @param targetClazz
      * @param businessScenario
      * @param <C>

+ 8 - 4
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/ExtensionContext.java

@@ -4,9 +4,9 @@ import com.persagy.framework.extension.core.BusinessScenario;
 import com.persagy.framework.extension.core.point.ExtensionPoint;
 
 /**
- * @description 上下文,包含各个扩展点的相关操作
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 上下文,包含各个扩展点的相关操作
  * @date 2021-08-28 22:15
  * @class com.persagy.framework.extension.core.context.ExtensionContext.java
  */
@@ -14,6 +14,7 @@ public interface ExtensionContext {
 
     /**
      * 根据业务场景唯一标识获取扩展点组件实现类
+     *
      * @param businessId
      * @param useCase
      * @param scenario
@@ -25,6 +26,7 @@ public interface ExtensionContext {
 
     /**
      * 根据("实例" + "场景")获取扩展点组件实现类,其中:业务id(businessId)= {@linkplain BusinessScenario.DEFAULT_BUSINESS_ID}
+     *
      * @param useCase
      * @param scenario
      * @param clazz
@@ -36,8 +38,9 @@ public interface ExtensionContext {
     /**
      * 根据("场景")获取扩展点组件实现类 <br/>
      * 其中:
-     *    业务id(businessId)= {@linkplain BusinessScenario.DEFAULT_BUSINESS_ID}
-     *    实例(useCase)= {@linkplain BusinessScenario.DEFAULT_USECASE}
+     * 业务id(businessId)= {@linkplain BusinessScenario.DEFAULT_BUSINESS_ID}
+     * 实例(useCase)= {@linkplain BusinessScenario.DEFAULT_USECASE}
+     *
      * @param scenario
      * @param clazz
      * @param <T>
@@ -47,6 +50,7 @@ public interface ExtensionContext {
 
     /**
      * 根据业务场景唯一标识获取扩展点组件实现类
+     *
      * @param businessScenario
      * @param clazz
      * @param <T>

+ 3 - 3
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/ExtensionContextHolder.java

@@ -10,15 +10,15 @@ import org.springframework.stereotype.Component;
 import javax.validation.constraints.NotNull;
 
 /**
- * @description 上下文及扩展点组件工厂的持有类
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 上下文及扩展点组件工厂的持有类
  * @date 2021-08-29 00:29
  * @class com.persagy.framework.extension.core.context.ExtensionContextHolder.java
  */
 @Component
 @Slf4j
-public class ExtensionContextHolder implements ExtensionContext{
+public class ExtensionContextHolder implements ExtensionContext {
 
     @Autowired
     private ExtensionFactory factory;

+ 3 - 3
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/context/ExtensionExecutor.java

@@ -7,15 +7,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
- * @description 扩展组件执行器
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 扩展组件执行器
  * @date 2021-08-29 00:32
  * @class com.persagy.framework.extension.core.context.ExtensionExecutor.java
  */
 @Component
 @Slf4j
-public class ExtensionExecutor extends AbstractComponentExecutor{
+public class ExtensionExecutor extends AbstractComponentExecutor {
 
     @Autowired
     private ExtensionContextHolder contextHolder;

+ 3 - 2
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/factory/ExtensionDefinition.java

@@ -10,9 +10,9 @@ import java.io.Serializable;
 import java.util.Objects;
 
 /**
- * @description 扩展定义(扩展坐标),标识唯一一个业务场景实现
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 扩展定义(扩展坐标),标识唯一一个业务场景实现
  * @date 2021-08-28 23:14
  * @class com.persagy.framework.extension.core.factory.ExtensionDefinition.java
  */
@@ -57,6 +57,7 @@ public class ExtensionDefinition implements Serializable {
 
     /**
      * 构建definition
+     *
      * @param businessScenario
      * @param point
      * @return

+ 4 - 2
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/factory/ExtensionFactory.java

@@ -4,9 +4,9 @@ import com.persagy.framework.extension.core.BusinessScenario;
 import com.persagy.framework.extension.core.point.ExtensionPoint;
 
 /**
- * @description 扩展点工厂
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 扩展点工厂
  * @date 2021-08-28 23:04
  * @class com.persagy.framework.extension.core.factory.ExtensionFactory.java
  */
@@ -14,12 +14,14 @@ public interface ExtensionFactory {
 
     /**
      * 注册所有扩展点实现类
+     *
      * @param basePackage
      */
     void register(String basePackage);
 
     /**
      * 根据业务场景获取指定类型的扩展点
+     *
      * @param businessScenario
      * @param clazz
      * @param <T>

+ 7 - 6
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/factory/ExtensionRegisterFactory.java

@@ -15,9 +15,9 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
- * @description 注册工厂
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 注册工厂
  * @date 2021-08-28 23:07
  * @class com.persagy.framework.extension.core.factory.ExtensionRegisterFactory.java
  */
@@ -38,7 +38,7 @@ public class ExtensionRegisterFactory implements ExtensionFactory {
     @Override
     public void register(String basePackage) {
         final Map<String, Object> beans = applicationContext.getBeansWithAnnotation(Extension.class);
-        if(beans == null || beans.isEmpty()) {
+        if (beans == null || beans.isEmpty()) {
             return;
         }
 
@@ -50,7 +50,7 @@ public class ExtensionRegisterFactory implements ExtensionFactory {
     public <T extends ExtensionPoint> T get(BusinessScenario businessScenario, Class<T> clazz) {
 
         final ExtensionDefinition definition = registerExtensionBeans.get(businessScenario.getUniqueIdentity());
-        if(definition == null) {
+        if (definition == null) {
             log.error("获取业务场景扩展点实现失败,失败原因:尚未定义该业务场景相关扩展点。{}", businessScenario);
             throw new RuntimeException("尚未定义该业务场景相关扩展点 [" + businessScenario + "]");
         }
@@ -60,10 +60,11 @@ public class ExtensionRegisterFactory implements ExtensionFactory {
 
     /**
      * 注册扩展点
+     *
      * @param point
      */
     private void doRegister(@NotNull ExtensionPoint point) {
-        Class<?>  extensionClazz = point.getClass();
+        Class<?> extensionClazz = point.getClass();
 
         if (AopUtils.isAopProxy(point)) {
             extensionClazz = ClassUtils.getUserClass(point);
@@ -73,7 +74,7 @@ public class ExtensionRegisterFactory implements ExtensionFactory {
         final BusinessScenario businessScenario = BusinessScenario.valueOf(extension.businessId(), extension.useCase(), extension.scenario());
         final ExtensionDefinition definition = ExtensionDefinition.valueOf(businessScenario, point);
         final ExtensionDefinition exist = registerExtensionBeans.get(businessScenario.getUniqueIdentity());
-        if(exist != null && !exist.equals(definition)) {
+        if (exist != null && !exist.equals(definition)) {
             throw new RuntimeException("相同的业务场景重复注册了不同类型的扩展点实现 :【" + definition + "】【" + exist + "】");
         }
 

+ 1 - 1
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/package-info.java

@@ -1,6 +1,6 @@
 /**
  * @description core 核心
- * @author 
+ * @author
  * @version 1.0.0
  * @date 2021-08-28 21:54
  * @class com.persagy.framework.extension.core.package-info.java

+ 2 - 2
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/point/ExtensionPoint.java

@@ -3,10 +3,10 @@ package com.persagy.framework.extension.core.point;
 import com.persagy.framework.extension.core.stereotype.Extension;
 
 /**
+ * @author
+ * @version 1.0.0
  * @description 扩展点 <br/>
  * 表示一块逻辑在不同的业务有不同的实现,使用扩展点做接口申明,然后用{@linkplain Extension}(扩展)去实现扩展点。
- * @author 
- * @version 1.0.0
  * @date 2021-08-28 22:06
  * @class com.persagy.framework.extension.core.point.ExtensionPoint.java
  */

+ 5 - 2
iot-spring-boot-starter-extension/src/main/java/com/persagy/framework/extension/core/stereotype/Extension.java

@@ -6,9 +6,9 @@ import org.springframework.stereotype.Component;
 import java.lang.annotation.*;
 
 /**
- * @description 表示带注释的类是“扩展组件”
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 表示带注释的类是“扩展组件”
  * @date 2021-08-28 21:59
  * @class com.persagy.framework.extension.core.stereotype.Extension.java
  */
@@ -21,6 +21,7 @@ public @interface Extension {
     /**
      * 业务 <br/>
      * 一个自负盈亏的财务主体,比如tmall、淘宝和零售通就是三个不同的业务
+     *
      * @return
      */
     String businessId() default BusinessScenario.DEFAULT_BUSINESS_ID;
@@ -28,6 +29,7 @@ public @interface Extension {
     /**
      * 用例 <br/>
      * 描述了用户和系统之间的互动,每个用例提供了一个或多个场景。比如,支付订单就是一个典型的用例。
+     *
      * @return
      */
     String useCase() default BusinessScenario.DEFAULT_USECASE;
@@ -35,6 +37,7 @@ public @interface Extension {
     /**
      * 场景 <br/>
      * 场景也被称为用例的实例(Instance),包括用例所有的可能情况(正常的和异常的)。比如对于"订单支付"这个用例,就有“支付宝支付”、“银行卡支付”、"微信支付"等多个场景
+     *
      * @return
      */
     String scenario() default BusinessScenario.DEFAULT_SCENARIO;

+ 2 - 2
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/Application.java

@@ -4,9 +4,9 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
 /**
- * @description Application
- * @author 
+ * @author
  * @version 1.0.0
+ * @description Application
  * @date 2021-08-30 10:32
  * @class com.persagy.framework.extension.Application.java
  */

+ 2 - 2
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/ExtensionTest.java

@@ -18,9 +18,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import java.math.BigDecimal;
 
 /**
- * @description 
- * @author 
+ * @author
  * @version 1.0.0
+ * @description
  * @date 2021-08-30 10:30
  * @class com.persagy.framework.extension.ExtensionTest.java
  */

+ 1 - 1
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/package-info.java

@@ -1,6 +1,6 @@
 /**
  * @description
- * @author 
+ * @author
  * @version 1.0.0
  * @date 2021-08-30 10:25
  * @class com.persagy.framework.extension.package-info.java

+ 3 - 2
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/PayExtensionPoint.java

@@ -5,9 +5,9 @@ import com.persagy.framework.extension.pay.command.TransactionsCommand;
 import com.persagy.framework.extension.pay.domain.TransactionsResult;
 
 /**
- * @description 支付操作接口
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 支付操作接口
  * @date 2021-08-30 10:35
  * @class com.persagy.framework.extension.pay.PayExtensionPoint.java
  */
@@ -15,6 +15,7 @@ public interface PayExtensionPoint extends ExtensionPoint {
 
     /**
      * 统一下单:获取"预支付交易会话标识"
+     *
      * @param command
      * @return
      */

+ 2 - 2
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/command/TransactionsCommand.java

@@ -8,9 +8,9 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 
 /**
- * @description 下单请求
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 下单请求
  * @date 2021-08-30 10:48
  * @class com.persagy.framework.extension.pay.command.TransactionsCommand.java
  */

+ 4 - 3
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/domain/TransactionsResult.java

@@ -1,13 +1,14 @@
 package com.persagy.framework.extension.pay.domain;
 
-import lombok.*;
+import lombok.AllArgsConstructor;
+import lombok.Data;
 
 import java.io.Serializable;
 
 /**
- * @description 下单: 预支付交易单返回结果
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 下单: 预支付交易单返回结果
  * @date 2021-08-30 10:43
  * @class com.persagy.framework.extension.pay.domain.TransactionsResult.java
  */

+ 2 - 2
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/impl/AlipayService.java

@@ -9,9 +9,9 @@ import com.persagy.framework.extension.pay.domain.TransactionsResult;
 import lombok.extern.slf4j.Slf4j;
 
 /**
- * @description 微信 JSAPI 支付
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 微信 JSAPI 支付
  * @date 2021-08-30 10:38
  * @class com.persagy.framework.extension.pay.impl.AlipayService.java
  */

+ 2 - 2
iot-spring-boot-starter-extension/src/test/java/com/persagy/framework/extension/pay/impl/WechatPayService.java

@@ -9,9 +9,9 @@ import com.persagy.framework.extension.pay.domain.TransactionsResult;
 import lombok.extern.slf4j.Slf4j;
 
 /**
- * @description 微信 JSAPI 支付
- * @author 
+ * @author
  * @version 1.0.0
+ * @description 微信 JSAPI 支付
  * @date 2021-08-30 10:37
  * @class com.persagy.framework.extension.pay.impl.WechatPayService.java
  */

+ 3 - 3
iot-spring-boot-starter-mybatis/pom.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <parent>
         <groupId>com.persagy</groupId>
@@ -11,7 +11,7 @@
     <artifactId>iot-spring-boot-starter-mybatis</artifactId>
     <packaging>jar</packaging>
 
-    <name>  ${project.artifactId}</name>
+    <name>${project.artifactId}</name>
     <description>数据库连接池、多数据源、事务、MyBatis 拓展</description>
 
     <properties>

+ 2 - 2
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/datasource/config/DataSourceAutoConfiguration.java

@@ -1,7 +1,7 @@
 package com.persagy.framework.datasource.config;
 
-import com.persagy.framework.datasource.core.filter.DruidAdRemoveFilter;
 import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
+import com.persagy.framework.datasource.core.filter.DruidAdRemoveFilter;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.boot.web.servlet.FilterRegistrationBean;
@@ -12,7 +12,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 /**
  * 数据库配置类
  *
- * @author  
+ * @author
  */
 @Configuration
 @EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理

+ 2 - 2
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/datasource/core/enums/DataSourceEnum.java

@@ -2,10 +2,10 @@ package com.persagy.framework.datasource.core.enums;
 
 /**
  * 对应于多数据源中不同数据源配置
- *
+ * <p>
  * 通过在方法上,使用 {@link com.baomidou.dynamic.datasource.annotation.DS} 注解,设置使用的数据源。
  * 注意,默认是 {@link #MASTER} 数据源
- *
+ * <p>
  * 对应官方文档为 http://dynamic-datasource.com/guide/customize/Annotation.html
  */
 public interface DataSourceEnum {

+ 1 - 1
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/datasource/core/filter/DruidAdRemoveFilter.java

@@ -12,7 +12,7 @@ import java.io.IOException;
 /**
  * Druid 底部广告过滤器
  *
- * @author  
+ * @author
  */
 public class DruidAdRemoveFilter extends OncePerRequestFilter {
 

+ 4 - 4
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/config/MybatisAutoConfiguration.java

@@ -1,9 +1,9 @@
 package com.persagy.framework.mybatis.config;
 
-import com.persagy.framework.mybatis.core.handler.DefaultDBFieldHandler;
 import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
 import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
 import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import com.persagy.framework.mybatis.core.handler.DefaultDBFieldHandler;
 import org.apache.ibatis.annotations.Mapper;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.context.annotation.Bean;
@@ -12,10 +12,10 @@ import org.springframework.context.annotation.Configuration;
 /**
  * MyBaits 配置类
  *
- * @author  
+ * @author
  */
 @Configuration
-@MapperScan(basePackages = { "com.persagy" },annotationClass = Mapper.class)
+@MapperScan(basePackages = {"com.persagy"}, annotationClass = Mapper.class)
 public class MybatisAutoConfiguration {
 
     @Bean
@@ -26,7 +26,7 @@ public class MybatisAutoConfiguration {
     }
 
     @Bean
-    public MetaObjectHandler defaultMetaObjectHandler(){
+    public MetaObjectHandler defaultMetaObjectHandler() {
         return new DefaultDBFieldHandler(); // 自动填充参数类
     }
 

+ 2 - 2
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/dataobject/BaseDO.java

@@ -26,14 +26,14 @@ public class BaseDO implements Serializable {
     private Date updateTime;
     /**
      * 创建者,目前使用 SysUser 的 id 编号
-     *
+     * <p>
      * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。
      */
     @TableField(fill = FieldFill.INSERT)
     private String creator;
     /**
      * 更新者,目前使用 SysUser 的 id 编号
-     *
+     * <p>
      * 使用 String 类型的原因是,未来可能会存在非数值的情况,留好拓展性。
      */
     @TableField(fill = FieldFill.INSERT_UPDATE)

+ 2 - 2
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/handler/DefaultDBFieldHandler.java

@@ -1,8 +1,8 @@
 package com.persagy.framework.mybatis.core.handler;
 
+import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
 import com.persagy.framework.mybatis.core.dataobject.BaseDO;
 import com.persagy.framework.web.core.util.WebFrameworkUtils;
-import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
 import org.apache.ibatis.reflection.MetaObject;
 
 import java.util.Date;
@@ -10,7 +10,7 @@ import java.util.Objects;
 
 /**
  * 通用参数填充实现类
- *
+ * <p>
  * 如果没有显式的对通用参数进行赋值,这里会对通用参数进行填充、赋值
  *
  * @author hexiaowu

+ 3 - 3
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/mapper/BaseMapperX.java

@@ -1,12 +1,12 @@
 package com.persagy.framework.mybatis.core.mapper;
 
-import com.persagy.framework.common.pojo.PageParam;
-import com.persagy.framework.common.pojo.PageResult;
-import com.persagy.framework.mybatis.core.util.MyBatisUtils;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.persagy.framework.common.pojo.PageParam;
+import com.persagy.framework.common.pojo.PageResult;
+import com.persagy.framework.mybatis.core.util.MyBatisUtils;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;

+ 1 - 1
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/query/QueryWrapperX.java

@@ -9,7 +9,7 @@ import java.util.Collection;
 
 /**
  * 拓展 MyBatis Plus QueryWrapper 类,主要增加如下功能:
- *
+ * <p>
  * 1. 拼接条件的方法,增加 xxxIfPresent 方法,用于判断值不存在的时候,不要拼接到条件中。
  *
  * @param <T> 数据类型

+ 0 - 0
iot-spring-boot-starter-mybatis/src/main/java/com.persagy.framework/mybatis/core/type/JsonLongSetTypeHandler.java


Some files were not shown because too many files changed in this diff