模版参数
This commit is contained in:
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.DeleteMapping;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -43,7 +42,7 @@ public class TemplateController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "创建模板", description = "创建模板")
|
@Operation(summary = "创建模板", description = "创建模板")
|
||||||
@PutMapping("/add")
|
@PostMapping("/add")
|
||||||
public XResult<Void> add(@RequestBody @Valid TemplateAddReq req) {
|
public XResult<Void> add(@RequestBody @Valid TemplateAddReq req) {
|
||||||
return templateService.add(req);
|
return templateService.add(req);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,13 @@ import java.util.stream.Collectors;
|
|||||||
*
|
*
|
||||||
* @author My
|
* @author My
|
||||||
*/
|
*/
|
||||||
@Schema(description = "模板类型",
|
@Schema(description = "从接口:/templateType 获取列表",
|
||||||
example = "0",
|
example = "0",
|
||||||
allowableValues = {"0: controller", "1: service", "2: mapper"})
|
allowableValues = {"0: controller"})
|
||||||
@Getter
|
@Getter
|
||||||
public enum TemplateTypeEnum {
|
public enum TemplateTypeEnum {
|
||||||
|
|
||||||
CONTROLLER(0, "controller"),
|
CONTROLLER(0, "controller");
|
||||||
SERVICE(1, "service"),
|
|
||||||
MAPPER(2, "mapper");
|
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ public class TemplateAddReq implements Serializable {
|
|||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
@NotNull(message = "模板类型不能为空")
|
@NotNull(message = "模板类型不能为空")
|
||||||
@Schema(description = "模板类型")
|
|
||||||
private TemplateTypeEnum templateType;
|
private TemplateTypeEnum templateType;
|
||||||
|
|
||||||
@NotBlank(message = "正文不能为空")
|
@NotBlank(message = "正文不能为空")
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public class TemplateEditReq implements Serializable {
|
|||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
@NotNull(message = "模板类型不能为空")
|
@NotNull(message = "模板类型不能为空")
|
||||||
@Schema(description = "模板类型")
|
|
||||||
private TemplateTypeEnum templateType;
|
private TemplateTypeEnum templateType;
|
||||||
|
|
||||||
@NotBlank(message = "正文不能为空")
|
@NotBlank(message = "正文不能为空")
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class TemplateQueryReq implements Serializable {
|
|||||||
@Schema(description = "模板名称")
|
@Schema(description = "模板名称")
|
||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
@Schema(description = "模板类型")
|
|
||||||
private TemplateTypeEnum templateType;
|
private TemplateTypeEnum templateType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ package com.cczsa.xinghe.codegen.entity.res.template;
|
|||||||
|
|
||||||
import com.cczsa.xinghe.codegen.entity.enums.TemplateTypeEnum;
|
import com.cczsa.xinghe.codegen.entity.enums.TemplateTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -31,7 +30,6 @@ public class TemplateQueryRes implements Serializable {
|
|||||||
@Schema(description = "模板名称")
|
@Schema(description = "模板名称")
|
||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
@Schema(description = "模板类型")
|
|
||||||
private TemplateTypeEnum templateType;
|
private TemplateTypeEnum templateType;
|
||||||
|
|
||||||
@Schema(description = "正文")
|
@Schema(description = "正文")
|
||||||
|
|||||||
@@ -105,11 +105,15 @@ public class FunOperationServiceImpl implements FunOperationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 同模块 同功能中 操作编码不能重复
|
// 同模块 同功能中 操作编码不能重复
|
||||||
|
FunOperationDef operationDef = FunOperationDef.FUN_OPERATION_ENTITY;
|
||||||
|
FunItemDef itemDef = FunItemDef.FUN_ITEM_ENTITY;
|
||||||
QueryWrapper queryOperationCode = new QueryWrapper();
|
QueryWrapper queryOperationCode = new QueryWrapper();
|
||||||
|
queryOperationCode.from(operationDef);
|
||||||
queryOperationCode.eq(FunOperationEntity::getModuleId, req.getModuleId());
|
queryOperationCode.eq(FunOperationEntity::getModuleId, req.getModuleId());
|
||||||
queryOperationCode.eq(FunOperationEntity::getItemId, req.getItemId());
|
queryOperationCode.eq(FunOperationEntity::getItemId, req.getItemId());
|
||||||
queryOperationCode.eq(FunOperationEntity::getOperationCode, req.getOperationCode());
|
queryOperationCode.eq(FunOperationEntity::getOperationCode, req.getOperationCode());
|
||||||
if (req.getId() != null) {
|
if (req.getId() != null) {
|
||||||
|
queryOperationCode.join(itemDef).on(operationDef.ITEM_ID.eq(itemDef.ID));
|
||||||
queryOperationCode.ne(FunItemEntity::getId, req.getId());
|
queryOperationCode.ne(FunItemEntity::getId, req.getId());
|
||||||
}
|
}
|
||||||
if (funOperationMapper.selectCountByQuery(queryOperationCode) > 0) {
|
if (funOperationMapper.selectCountByQuery(queryOperationCode) > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user