diff --git a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/entity/PageRequest.java b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/entity/PageRequest.java
index 0b2e0589..6e910fc9 100644
--- a/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/entity/PageRequest.java
+++ b/orion-ops-framework/orion-ops-common/src/main/java/com/orion/ops/framework/common/entity/PageRequest.java
@@ -15,7 +15,6 @@ import org.hibernate.validator.constraints.Range;
@Data
public class PageRequest implements IPageRequest {
- // TODO TEST
@Range(min = 1, max = 10000)
@Schema(description = "页码")
private int page;
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/config/OrionMybatisAutoConfiguration.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/config/OrionMybatisAutoConfiguration.java
index 16d62ecc..46cf32d7 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/config/OrionMybatisAutoConfiguration.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/config/OrionMybatisAutoConfiguration.java
@@ -15,7 +15,6 @@ import org.springframework.context.annotation.Bean;
/**
* mybatis 配置类
- * TODO 扫描的包
*
* @author Jiahang Li
* @version 1.0.0
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/handler/FieldFillHandler.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/handler/FieldFillHandler.java
index b4a4c14c..eff0b2e3 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/handler/FieldFillHandler.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/handler/FieldFillHandler.java
@@ -21,6 +21,8 @@ public class FieldFillHandler implements MetaObjectHandler {
@Resource
private SecurityHolder securityHolder;
+ // TODO 删除fill baseConst
+
@Override
public void insertFill(MetaObject metaObject) {
if (Objects.nonNull(metaObject) && metaObject.getOriginalObject() instanceof BaseDO) {
@@ -36,7 +38,6 @@ public class FieldFillHandler implements MetaObjectHandler {
baseDO.setUpdateTime(now);
}
- // TODO TEST
Long userId = securityHolder.getLoginUserId();
// 创建人
if (Objects.nonNull(userId) && Objects.isNull(baseDO.getCreator())) {
@@ -60,7 +61,6 @@ public class FieldFillHandler implements MetaObjectHandler {
// 更新人
Object updater = getFieldValByName("updater", metaObject);
- // TODO TEST
Long userId = securityHolder.getLoginUserId();
if (Objects.nonNull(userId) && Objects.isNull(updater)) {
setFieldValByName("updater", userId.toString(), metaObject);
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/ValidateLambdaWrapper.java b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/ValidateLambdaWrapper.java
index 252cf76d..b45dd8a1 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/ValidateLambdaWrapper.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/java/com/orion/ops/framework/mybatis/core/query/ValidateLambdaWrapper.java
@@ -7,8 +7,6 @@ import com.orion.lang.utils.Strings;
import java.util.Collection;
/**
- * TODO TEST
- *
* 有效性验证 wrapper
*
* @author Jiahang Li
@@ -38,22 +36,22 @@ public class ValidateLambdaWrapper extends LambdaQueryWrapper {
for (Object object : objects) {
// 非 null 检测
if (object == null) {
- return false;
+ return true;
}
// 字符串 非空校验
if (object instanceof String) {
if (Strings.isBlank((String) object)) {
- return false;
+ return true;
}
}
// 集合 非空校验
if (object instanceof Collection>) {
if (((Collection>) object).isEmpty()) {
- return false;
+ return true;
}
}
}
- return true;
+ return false;
}
@Override
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-controller.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-controller.java.vm
index 4ed0dca3..200079e9 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-controller.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-controller.java.vm
@@ -3,12 +3,12 @@ package ${package.Controller};
import com.orion.lang.define.wrapper.DataGrid;
import com.orion.ops.framework.common.annotation.RestWrapper;
import ${package.Service}.*;
- #foreach($pkg in ${customFilePackages})
- import ${pkg}.*;
- #end
- #if(${superControllerClassPackage})
- import ${superControllerClassPackage};
- #end
+#foreach($pkg in ${customFilePackages})
+import ${pkg}.*;
+#end
+#if(${superControllerClassPackage})
+import ${superControllerClassPackage};
+#end
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -40,61 +40,61 @@ public class ${table.controllerName} extends ${superControllerClass} {
public class ${table.controllerName} {
#end
-@Resource
-private ${type}Service ${typeLower}Service;
+ @Resource
+ private ${type}Service ${typeLower}Service;
-@PostMapping("/create")
-@Operation(summary = "创建$!{table.comment}")
-@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:create')")
-public Long create${type}(@Validated ${type}CreateRequest request){
+ @PostMapping("/create")
+ @Operation(summary = "创建$!{table.comment}")
+ @PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:create')")
+ public Long create${type}(@Validated @RequestBody ${type}CreateRequest request) {
return ${typeLower}Service.create${type}(request);
- }
+ }
-@PutMapping("/update")
-@Operation(summary = "更新$!{table.comment}")
-@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:update')")
-public Integer update${type}(@Validated ${type}UpdateRequest request){
+ @PutMapping("/update")
+ @Operation(summary = "更新$!{table.comment}")
+ @PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:update')")
+ public Integer update${type}(@Validated @RequestBody ${type}UpdateRequest request) {
return ${typeLower}Service.update${type}(request);
- }
+ }
-@GetMapping("/get")
-@Operation(summary = "通过id查询$!{table.comment}")
-@Parameter(name = "id", description = "id", required = true)
-@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
-public ${type}VO get${type}(@RequestParam("id") Long id){
+ @GetMapping("/get")
+ @Operation(summary = "通过id查询$!{table.comment}")
+ @Parameter(name = "id", description = "id", required = true)
+ @PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
+ public ${type}VO get${type}(@RequestParam("id") Long id) {
return ${typeLower}Service.get${type}(id);
- }
+ }
-@GetMapping("/list")
-@Operation(summary = "通过id批量查询$!{table.comment}")
-@Parameter(name = "idList", description = "idList", required = true)
-@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
-public List<${type}VO> get${type}List(@RequestParam("idList") List idList){
+ @GetMapping("/list")
+ @Operation(summary = "通过id批量查询$!{table.comment}")
+ @Parameter(name = "idList", description = "idList", required = true)
+ @PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
+ public List<${type}VO> get${type}List(@RequestParam("idList") List idList) {
return ${typeLower}Service.get${type}List(idList);
- }
+ }
-@PostMapping("/query")
-@Operation(summary = "分页查询$!{table.comment}")
-@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
-public DataGrid<${type}VO> get${type}Page(@Validated @RequestBody ${type}QueryRequest request){
+ @PostMapping("/query")
+ @Operation(summary = "分页查询$!{table.comment}")
+ @PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:query')")
+ public DataGrid<${type}VO> get${type}Page(@Validated @RequestBody ${type}QueryRequest request) {
return ${typeLower}Service.get${type}Page(request);
- }
+ }
-@PutMapping("/delete")
-@Operation(summary = "删除$!{table.comment}")
-@Parameter(name = "id", description = "id", required = true)
-@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:delete')")
-public Integer delete${type}(@RequestParam("id") Long id){
+ @PutMapping("/delete")
+ @Operation(summary = "删除$!{table.comment}")
+ @Parameter(name = "id", description = "id", required = true)
+ @PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:delete')")
+ public Integer delete${type}(@RequestParam("id") Long id) {
return ${typeLower}Service.delete${type}(id);
- }
+ }
-@PutMapping("/delete-batch")
-@Operation(summary = "批量删除$!{table.comment}")
-@Parameter(name = "idList", description = "idList", required = true)
-@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:delete')")
-public Integer batchDelete${type}(@RequestParam("idList") List idList){
+ @PutMapping("/delete-batch")
+ @Operation(summary = "批量删除$!{table.comment}")
+ @Parameter(name = "idList", description = "idList", required = true)
+ @PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:delete')")
+ public Integer batchDelete${type}(@RequestParam("idList") List idList) {
return ${typeLower}Service.batchDelete${type}(idList);
- }
+ }
- }
+}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert-provider.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert-provider.java.vm
index 92fcc53e..e5c9b3ae 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert-provider.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert-provider.java.vm
@@ -3,9 +3,9 @@ package ${currentPackage};
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import ${package.Entity}.*;
- #foreach($pkg in ${customFilePackages})
- import ${pkg}.*;
- #end
+#foreach($pkg in ${customFilePackages})
+import ${pkg}.*;
+#end
import java.util.List;
/**
@@ -19,11 +19,11 @@ import java.util.List;
@SuppressWarnings("ALL")
public interface ${type}ProviderConvert {
- ${type}ProviderConvert MAPPER = Mappers.getMapper(${type}ProviderConvert.class);
+ ${type}ProviderConvert MAPPER = Mappers.getMapper(${type}ProviderConvert.class);
- ${type}DO to(${type}DTO dto);
+ ${type}DO to(${type}DTO dto);
- ${type}DTO to(${type}DO dto);
+ ${type}DTO to(${type}DO dto);
List<${type}DO> toDO(List<${type}DTO> list);
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert.java.vm
index a8e9cf4e..1565fd58 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-convert.java.vm
@@ -3,9 +3,9 @@ package ${currentPackage};
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import ${package.Entity}.*;
- #foreach($pkg in ${customFilePackages})
- import ${pkg}.*;
- #end
+#foreach($pkg in ${customFilePackages})
+import ${pkg}.*;
+#end
import java.util.List;
/**
@@ -18,16 +18,16 @@ import java.util.List;
@Mapper
@SuppressWarnings("ALL")
public interface ${type}Convert {
+
+ ${type}Convert MAPPER = Mappers.getMapper(${type}Convert.class);
- ${type}Convert MAPPER = Mappers.getMapper(${type}Convert.class);
+ ${type}DO to(${type}CreateRequest request);
- ${type}DO to(${type}CreateRequest request);
+ ${type}DO to(${type}UpdateRequest request);
- ${type}DO to(${type}UpdateRequest request);
+ ${type}DO to(${type}QueryRequest request);
- ${type}DO to(${type}QueryRequest request);
-
- ${type}VO to(${type}DO request);
+ ${type}VO to(${type}DO request);
List<${type}VO> to(List<${type}DO> list);
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-do.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-do.java.vm
index 5baea36c..860496b1 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-do.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-do.java.vm
@@ -26,52 +26,52 @@ import java.util.*;
#if(${superEntityClass})
public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
#elseif(${entitySerialVersionUID})
-public class ${entity} implements Serializable{
+public class ${entity} implements Serializable {
#else
public class ${entity} {
#end
#if(${entitySerialVersionUID})
-private static final long serialVersionUID=1L;
+ private static final long serialVersionUID = 1L;
#end
## ---------- BEGIN 字段循环遍历 ----------
#foreach($field in ${table.fields})
- #if(${field.keyFlag})
- #set($keyPropertyName=${field.propertyName})
- #end
- #if("$!field.comment" != "")
+#if(${field.keyFlag})
+#set($keyPropertyName=${field.propertyName})
+#end
+#if("$!field.comment" != "")
@Schema(description = "${field.comment}")
- #end
- #if(${field.keyFlag})
- ## 主键
- #if(${field.keyIdentityFlag})
- @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
- #elseif(!$null.isNull(${idType}) && "$!idType" != "")
- @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
- #elseif(${field.convert})
- @TableId("${field.annotationColumnName}")
- #end
- ## 普通字段
- #elseif(${field.fill})
- ## ----- 存在字段填充设置 -----
- #if(${field.convert})
- @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
- #else
- @TableField(fill = FieldFill.${field.fill})
- #end
- #elseif(${field.convert})
+#end
+#if(${field.keyFlag})
+## 主键
+ #if(${field.keyIdentityFlag})
+ @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO)
+ #elseif(!$null.isNull(${idType}) && "$!idType" != "")
+ @TableId(value = "${field.annotationColumnName}", type = IdType.${idType})
+ #elseif(${field.convert})
+ @TableId("${field.annotationColumnName}")
+ #end
+## 普通字段
+#elseif(${field.fill})
+## ----- 存在字段填充设置 -----
+ #if(${field.convert})
+ @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill})
+ #else
+ @TableField(fill = FieldFill.${field.fill})
+ #end
+#elseif(${field.convert})
@TableField("${field.annotationColumnName}")
- #end
- ## 乐观锁注解
- #if(${field.versionField})
+#end
+## 乐观锁注解
+#if(${field.versionField})
@Version
- #end
- ## 逻辑删除注解
- #if(${field.logicDeleteField})
+#end
+## 逻辑删除注解
+#if(${field.logicDeleteField})
@TableLogic
- #end
-private ${field.propertyType} ${field.propertyName};
+#end
+ private ${field.propertyType} ${field.propertyName};
#end
}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-dto.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-dto.java.vm
index ee860d27..c551343f 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-dto.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-dto.java.vm
@@ -1,9 +1,7 @@
package ${currentPackage};
import io.swagger.v3.oas.annotations.media.Schema;
-
import java.io.Serializable;
-
import lombok.*;
import java.util.*;
@@ -25,9 +23,9 @@ public class ${type}DTO implements Serializable {
private static final long serialVersionUID = 1L;
#foreach($field in ${table.fields})
- #if("$!field.comment" != "")
- @Schema(description = "${field.comment}")
- #end
+ #if("$!field.comment" != "")
+ @Schema(description = "${field.comment}")
+ #end
private ${field.propertyType} ${field.propertyName};
#end
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-create.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-create.java.vm
index 6ef649b1..15d893e3 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-create.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-create.java.vm
@@ -1,9 +1,7 @@
package ${currentPackage};
import io.swagger.v3.oas.annotations.media.Schema;
-
import java.io.Serializable;
-
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -26,9 +24,9 @@ import java.util.*;
public class ${type}CreateRequest implements Serializable {
#foreach($field in ${table.fields})
- #if("$!field.comment" != "")
- @Schema(description = "${field.comment}")
- #end
+ #if("$!field.comment" != "")
+ @Schema(description = "${field.comment}")
+ #end
private ${field.propertyType} ${field.propertyName};
#end
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-query.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-query.java.vm
index 23727e13..e671289f 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-query.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-query.java.vm
@@ -22,9 +22,9 @@ import java.util.*;
public class ${type}QueryRequest extends PageRequest {
#foreach($field in ${table.fields})
- #if("$!field.comment" != "")
- @Schema(description = "${field.comment}")
- #end
+ #if("$!field.comment" != "")
+ @Schema(description = "${field.comment}")
+ #end
private ${field.propertyType} ${field.propertyName};
#end
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-update.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-update.java.vm
index 91c97992..daa79485 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-update.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-request-update.java.vm
@@ -1,9 +1,7 @@
package ${currentPackage};
import io.swagger.v3.oas.annotations.media.Schema;
-
import java.io.Serializable;
-
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -26,9 +24,9 @@ import java.util.*;
public class ${type}UpdateRequest implements Serializable {
#foreach($field in ${table.fields})
- #if("$!field.comment" != "")
- @Schema(description = "${field.comment}")
- #end
+ #if("$!field.comment" != "")
+ @Schema(description = "${field.comment}")
+ #end
private ${field.propertyType} ${field.propertyName};
#end
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-vo.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-vo.java.vm
index 95c8a6e4..c0faad71 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-vo.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-entity-vo.java.vm
@@ -1,9 +1,7 @@
package ${currentPackage};
import io.swagger.v3.oas.annotations.media.Schema;
-
import java.io.Serializable;
-
import lombok.*;
import java.util.*;
@@ -25,9 +23,9 @@ public class ${type}VO implements Serializable {
private static final long serialVersionUID = 1L;
#foreach($field in ${table.fields})
- #if("$!field.comment" != "")
- @Schema(description = "${field.comment}")
- #end
+ #if("$!field.comment" != "")
+ @Schema(description = "${field.comment}")
+ #end
private ${field.propertyType} ${field.propertyName};
#end
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.java.vm
index 087f7109..1a6e5488 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.java.vm
@@ -18,4 +18,4 @@ import ${mapperAnnotationClass.name};
#end
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
- }
+}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.xml.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.xml.vm
index 50a6daec..38dcbbc3 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.xml.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-mapper.xml.vm
@@ -2,38 +2,38 @@
- #if(${enableCache})
-
-
+#if(${enableCache})
+
+
- #end
- #if(${baseResultMap})
-
-
- #foreach($field in ${table.fields})
- #if(${field.keyFlag})##生成主键排在第一位
-
- #end
- #end
- #foreach($field in ${table.commonFields})##生成公共字段
-
- #end
- #foreach($field in ${table.fields})
- #if(!${field.keyFlag})##生成普通字段
-
- #end
- #end
-
+#end
+#if(${baseResultMap})
+
+
+ #foreach($field in ${table.fields})
+ #if(${field.keyFlag})##生成主键排在第一位
+
+ #end
+ #end
+ #foreach($field in ${table.commonFields})##生成公共字段
+
+ #end
+ #foreach($field in ${table.fields})
+ #if(!${field.keyFlag})##生成普通字段
+
+ #end
+ #end
+
- #end
- #if(${baseColumnList})
-
-
- #foreach($field in ${table.commonFields})
- ${field.columnName},
- #end
- ${table.fieldNames}
-
+#end
+#if(${baseColumnList})
+
+
+ #foreach($field in ${table.commonFields})
+ ${field.columnName},
+ #end
+ ${table.fieldNames}
+
- #end
+#end
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service-impl.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service-impl.java.vm
index 9729f917..f8a050e7 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service-impl.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service-impl.java.vm
@@ -8,9 +8,9 @@ import com.orion.lang.utils.collect.Lists;
import com.orion.ops.framework.common.constant.ErrorCode;
import com.orion.ops.framework.common.constant.ErrorMessage;
import com.orion.ops.framework.mybatis.core.query.Conditions;
- #foreach($pkg in ${customFilePackages})
- import ${pkg}.*;
- #end
+#foreach($pkg in ${customFilePackages})
+import ${pkg}.*;
+#end
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
@@ -31,99 +31,97 @@ import java.util.List;
@Service
public class ${table.serviceImplName} implements ${table.serviceName} {
-// TODO 需要自行实现 page 和 check 方法
+ // TODO 需要自行实现 page 和 check 方法
-@Resource
-private ${type}DAO ${typeLower}DAO;
+ @Resource
+ private ${type}DAO ${typeLower}DAO;
-@Override
-public Long create${type}(${type}CreateRequest request){
+ @Override
+ public Long create${type}(${type}CreateRequest request) {
// 转换
- ${type}DO record= ${type}Convert.MAPPER.to(request);
+ ${type}DO record = ${type}Convert.MAPPER.to(request);
record.setId(null);
// 查询是否存在
- if(this.check${type}Present(record)){
- throw ErrorCode.DATA_PRESENT.exception();
- }
+ this.checkTestTablePresent(record);
// 插入
- int effect= ${typeLower}DAO.insert(record);
- log.info("${type}Service-add${type} effect: {}, domain: {}",effect,JSON.toJSONString(record));
+ int effect = ${typeLower}DAO.insert(record);
+ log.info("${type}Service-add${type} effect: {}, domain: {}", effect, JSON.toJSONString(record));
return record.getId();
- }
+ }
-@Override
-public Integer update${type}(${type}UpdateRequest request){
+ @Override
+ public Integer update${type}(${type}UpdateRequest request) {
// 转换
- ${type}DO record= ${type}Convert.MAPPER.to(request);
- Valid.notNull(request.getId(),ErrorMessage.ID_MISSING);
+ ${type}DO record = ${type}Convert.MAPPER.to(request);
+ Valid.notNull(record.getId(), ErrorMessage.ID_MISSING);
// 查询是否存在
- if(this.check${type}Present(record)){
- throw ErrorCode.DATA_PRESENT.exception();
- }
+ this.checkTestTablePresent(record);
// 更新
- int effect= ${typeLower}DAO.updateById(record);
- log.info("${type}Service-update${type} effect: {}, domain: {}",effect,JSON.toJSONString(record));
+ int effect = ${typeLower}DAO.updateById(record);
+ log.info("${type}Service-update${type} effect: {}, domain: {}", effect, JSON.toJSONString(record));
return effect;
- }
+ }
-@Override
-public ${type}VO get${type}(Long id){
+ @Override
+ public ${type}VO get${type}(Long id) {
// 查询
- ${type}DO record= ${typeLower}DAO.selectById(id);
- if(record==null){
- throw ErrorCode.DATA_ABESENT.exception();
+ ${type}DO record = ${typeLower}DAO.selectById(id);
+ if (record == null) {
+ throw ErrorCode.DATA_ABESENT.exception();
}
// 转换
return ${type}Convert.MAPPER.to(record);
- }
+ }
-@Override
-public List<${type}VO> get${type}List(List idList){
+ @Override
+ public List<${type}VO> get${type}List(List idList) {
// 查询
- List<${type}DO> records= ${typeLower}DAO.selectBatchIds(idList);
- if(records.isEmpty()){
- return Lists.empty();
+ List<${type}DO> records = ${typeLower}DAO.selectBatchIds(idList);
+ if (records.isEmpty()) {
+ return Lists.empty();
}
// 转换
return ${type}Convert.MAPPER.to(records);
- }
+ }
-@Override
-public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request){
+ @Override
+ public DataGrid<${type}VO> get${type}Page(${type}QueryRequest request) {
// 构造条件
- LambdaQueryWrapper<${type}DO> wrapper=Conditions.wrapper(${type}DO.class);
+ LambdaQueryWrapper<${type}DO> wrapper = Conditions.wrapper(${type}DO.class);
// 查询
return ${typeLower}DAO.of()
- .wrapper(wrapper)
- .page(request)
- .dataGrid(${type}Convert.MAPPER::to);
- }
+ .wrapper(wrapper)
+ .page(request)
+ .dataGrid(${type}Convert.MAPPER::to);
+ }
-@Override
-public Integer delete${type}(Long id){
+ @Override
+ public Integer delete${type}(Long id) {
return ${typeLower}DAO.deleteById(id);
- }
+ }
-@Override
-public Integer batchDelete${type}(List idList){
+ @Override
+ public Integer batchDelete${type}(List idList) {
return ${typeLower}DAO.deleteBatchIds(idList);
- }
+ }
-/**
- * 检测对象是否存在
- *
- * @param domain domain
- * @return 是否存在
- */
-private boolean check${type}Present(${type}DO domain){
+ /**
+ * 检测对象是否存在
+ *
+ * @param domain domain
+ */
+ private void check${type}Present(${type}DO domain) {
// 构造条件
- LambdaQueryWrapper<${type}DO> wrapper=Conditions.wrapper(${type}DO.class)
- .eq(${type}DO::getId,domain.getId());
+ LambdaQueryWrapper<${type}DO> wrapper = Conditions.wrapper(${type}DO.class)
+ .eq(${type}DO::getId, domain.getId());
// .eq(XXXDO::getXXX, domain.getXXX());
// 检查是否存在
- return ${typeLower}DAO.of()
- .wrapper(wrapper)
- .present();
+ boolean present = testTableDAO.of()
+ .wrapper(wrapper)
+ .present();
+ if (present) {
+ throw ErrorCode.DATA_PRESENT.exception();
}
+ }
- }
+}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service.java.vm b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service.java.vm
index 11560e6a..fdb00bd5 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service.java.vm
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-mybatis/src/main/resources/templates/orion-service.java.vm
@@ -1,9 +1,9 @@
package ${package.Service};
import com.orion.lang.define.wrapper.DataGrid;
- #foreach($pkg in ${customFilePackages})
- import ${pkg}.*;
- #end
+#foreach($pkg in ${customFilePackages})
+import ${pkg}.*;
+#end
import java.util.List;
@@ -16,60 +16,60 @@ import java.util.List;
*/
public interface ${table.serviceName} {
- /**
- * 插入$!{table.comment}
- *
- * @param request request
- * @return id
- */
- Long create${type}(${type}CreateRequest request);
+ /**
+ * 插入$!{table.comment}
+ *
+ * @param request request
+ * @return id
+ */
+ Long create${type}(${type}CreateRequest request);
- /**
- * 通过 id 更新$!{table.comment}
- *
- * @param request request
- * @return effect
- */
- Integer update${type}(${type}UpdateRequest request);
+ /**
+ * 通过 id 更新$!{table.comment}
+ *
+ * @param request request
+ * @return effect
+ */
+ Integer update${type}(${type}UpdateRequest request);
- /**
- * 通过 id 查询$!{table.comment}
- *
- * @param id id
- * @return row
- */
+ /**
+ * 通过 id 查询$!{table.comment}
+ *
+ * @param id id
+ * @return row
+ */
${type}VO get${type}(Long id);
- /**
- * 通过 id 批量查询$!{table.comment}
- *
- * @param idList idList
- * @return rows
- */
- List<${type}VO> get${type}List(List idList);
+ /**
+ * 通过 id 批量查询$!{table.comment}
+ *
+ * @param idList idList
+ * @return rows
+ */
+ List<${type}VO> get${type}List(List idList);
- /**
- * 分页查询$!{table.comment}
- *
- * @param request request
- * @return rows
- */
- DataGrid<${type}VO> get${type}Page(${type}QueryRequest request);
+ /**
+ * 分页查询$!{table.comment}
+ *
+ * @param request request
+ * @return rows
+ */
+ DataGrid<${type}VO> get${type}Page(${type}QueryRequest request);
- /**
- * 通过 id 删除$!{table.comment}
- *
- * @param id id
- * @return effect
- */
- Integer delete${type}(Long id);
+ /**
+ * 通过 id 删除$!{table.comment}
+ *
+ * @param id id
+ * @return effect
+ */
+ Integer delete${type}(Long id);
- /**
- * 通过 id 批量删除$!{table.comment}
- *
- * @param idList idList
- * @return effect
- */
- Integer batchDelete${type}(List idList);
+ /**
+ * 通过 id 批量删除$!{table.comment}
+ *
+ * @param idList idList
+ * @return effect
+ */
+ Integer batchDelete${type}(List idList);
- }
+}
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-swagger/src/main/java/com/orion/ops/framework/swagger/config/OrionSwaggerAutoConfiguration.java b/orion-ops-framework/orion-ops-spring-boot-starter-swagger/src/main/java/com/orion/ops/framework/swagger/config/OrionSwaggerAutoConfiguration.java
index 67ae4ee1..2c94bf5d 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-swagger/src/main/java/com/orion/ops/framework/swagger/config/OrionSwaggerAutoConfiguration.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-swagger/src/main/java/com/orion/ops/framework/swagger/config/OrionSwaggerAutoConfiguration.java
@@ -55,7 +55,7 @@ public class OrionSwaggerAutoConfiguration {
Map securitySchemas = this.buildSecuritySchemes();
OpenAPI api = new OpenAPI()
// 接口信息
- .info(buildInfo(properties))
+ .info(this.buildInfo(properties))
// 接口安全配置
.components(new Components().securitySchemes(securitySchemas));
securitySchemas.keySet()
@@ -109,13 +109,12 @@ public class OrionSwaggerAutoConfiguration {
propertyResolverUtils, openApiBuilderCustomizers, serverBaseUrlCustomizers, javadocProvider);
}
-
/**
* @return 所有模块的 api 分组
*/
@Bean
public GroupedOpenApi allGroupedOpenApi() {
- return buildGroupedOpenApi("全部", "");
+ return buildGroupedOpenApi("全部", "*");
}
/**
diff --git a/orion-ops-framework/orion-ops-spring-boot-starter-web/src/main/java/com/orion/ops/framework/web/core/handler/GlobalExceptionHandler.java b/orion-ops-framework/orion-ops-spring-boot-starter-web/src/main/java/com/orion/ops/framework/web/core/handler/GlobalExceptionHandler.java
index 7e029630..6c82b955 100644
--- a/orion-ops-framework/orion-ops-spring-boot-starter-web/src/main/java/com/orion/ops/framework/web/core/handler/GlobalExceptionHandler.java
+++ b/orion-ops-framework/orion-ops-spring-boot-starter-web/src/main/java/com/orion/ops/framework/web/core/handler/GlobalExceptionHandler.java
@@ -74,8 +74,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler(value = BindException.class)
public HttpWrapper> paramBindExceptionHandler(BindException ex) {
log.error("paramBindExceptionHandler", ex);
- FieldError error = ex.getFieldError();
- return ErrorCode.BAD_REQUEST.wrapper().msg(Objects.requireNonNull(error).getDefaultMessage());
+ FieldError error = Objects.requireNonNull(ex.getFieldError());
+ return ErrorCode.BAD_REQUEST.wrapper().msg(error.getField() + " " + error.getDefaultMessage());
}
@ExceptionHandler(value = ConstraintViolationException.class)