功能管理、操作管理、获取ID列表
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.cczsa.xinghe.codegen.controller;
|
||||
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funItem.FunItemQueryRes;
|
||||
@@ -16,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 功能管理 控制层。
|
||||
*
|
||||
@@ -33,24 +36,23 @@ public class FunItemController {
|
||||
|
||||
@Operation(summary = "获取功能列表", description = "获取功能列表")
|
||||
@PostMapping("/query")
|
||||
public XResult<FunItemQueryRes> query(@RequestBody @Valid FunItemQueryReq req ) {
|
||||
public XResult<List<FunItemQueryRes>> query(@RequestBody @Valid FunItemQueryReq req) {
|
||||
return funitemService.query(req);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "创建/修改功能", description = "创建/修改功能")
|
||||
@PostMapping("/save/update")
|
||||
public XResult<Void> saveUpdate(@RequestBody @Valid FunItemSaveUpdateReq req ) {
|
||||
public XResult<Void> saveUpdate(@RequestBody @Valid FunItemSaveUpdateReq req) {
|
||||
return funitemService.saveUpdate(req);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "删除功能", description = "删除功能")
|
||||
@DeleteMapping("/delete")
|
||||
public XResult<Void> delete() {
|
||||
return funitemService.delete();
|
||||
public XResult<Void> delete(@RequestBody @Valid FunItemDeleteReq req) {
|
||||
return funitemService.delete(req);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ package com.cczsa.xinghe.codegen.controller;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.GetIdListReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funModule.FunModuleQueryRes;
|
||||
import com.cczsa.xinghe.codegen.service.FunModuleService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
@@ -51,5 +52,11 @@ public class FunModuleController {
|
||||
return funmoduleService.delete(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取ID列表", description = "获取ID列表")
|
||||
@PostMapping("/getIdList")
|
||||
public XResult<List<Long>> getIdList(@RequestBody @Valid GetIdListReq req) {
|
||||
return funmoduleService.getIdList(req);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.cczsa.xinghe.codegen.controller;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funOperation.FunOperationQueryRes;
|
||||
@@ -15,6 +16,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作管理 控制层。
|
||||
*
|
||||
@@ -31,22 +34,21 @@ public class FunOperationController {
|
||||
|
||||
@Operation(summary = "获取操作列表", description = "获取操作列表")
|
||||
@PostMapping("/query")
|
||||
public XResult<FunOperationQueryRes> query(@RequestBody @Valid FunOperationQueryReq req ) {
|
||||
public XResult<List<FunOperationQueryRes>> query(@RequestBody @Valid FunOperationQueryReq req) {
|
||||
return funoperationService.query(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "创建/修改操作", description = "创建/修改操作")
|
||||
@PostMapping("/save/update")
|
||||
public XResult<Void> saveUpdate(@RequestBody @Valid FunOperationSaveUpdateReq req ) {
|
||||
public XResult<Void> saveUpdate(@RequestBody @Valid FunOperationSaveUpdateReq req) {
|
||||
return funoperationService.saveUpdate(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除操作", description = "删除操作")
|
||||
@DeleteMapping("/delete")
|
||||
public XResult<Void> delete() {
|
||||
return funoperationService.delete();
|
||||
public XResult<Void> delete(@RequestBody @Valid FunOperationDeleteReq req) {
|
||||
return funoperationService.delete(req);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.cczsa.xinghe.codegen.entity;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.enums.FunTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.RequestTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.UsableConfigEnum;
|
||||
import com.cczsa.xinghe.codegen.handler.PostgreSQLJsonTypeHandler;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
@@ -79,7 +80,7 @@ public class FunOperationEntity extends BaseEntity implements Serializable {
|
||||
* 可配置数据类型json[]
|
||||
*/
|
||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||
private List<Integer> usableConfig;
|
||||
private List<UsableConfigEnum> usableConfig;
|
||||
|
||||
/**
|
||||
* 可配置字段
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.cczsa.xinghe.codegen.entity.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.mybatisflex.annotation.EnumValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* ID类型枚举
|
||||
*
|
||||
* @author My
|
||||
*/
|
||||
@Schema(description = "ID类型",
|
||||
example = "0",
|
||||
allowableValues = {"0: 模块ID", "1: 功能ID", "2: 操作ID"})
|
||||
@Getter
|
||||
public enum IdTypeEnum {
|
||||
// 0: 模块ID 1: 功能ID 2: 操作ID
|
||||
MODULE_ID(0, "模块ID"),
|
||||
ITEM_ID(1, "功能ID"),
|
||||
OPERATION_ID(2, "操作ID");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
IdTypeEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
@EnumValue
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.cczsa.xinghe.codegen.entity.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.mybatisflex.annotation.EnumValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 可配置数据类型
|
||||
*
|
||||
* @author My
|
||||
*/
|
||||
@Schema(description = "可配置数据类型",
|
||||
example = "0",
|
||||
allowableValues = {"0: 无需处理", "1: 所有", "2: 本人", "3: 本部门",
|
||||
"4: 本部门及子部门", "5: 指定部门", "6: 指定人员"
|
||||
})
|
||||
@Getter
|
||||
public enum UsableConfigEnum {
|
||||
|
||||
NO_PROCESSING(0, "无需处理"),
|
||||
ALL(1, "所有"),
|
||||
SELF(2, "本人"),
|
||||
DEPARTMENT(3, "本部门"),
|
||||
DEPARTMENT_AND_SUB(4, "本部门及子部门"),
|
||||
SPECIFIED_DEPARTMENT(5, "指定部门"),
|
||||
SPECIFIED_USER(6, "指定人员");
|
||||
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
UsableConfigEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
@EnumValue
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funItem;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 删除功能 请求参数
|
||||
*
|
||||
* @author my
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "删除功能-参数")
|
||||
public class FunItemDeleteReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "功能id列表不能为空")
|
||||
@Schema(description = "功能id列表")
|
||||
private List<Long> idList;
|
||||
|
||||
@NotBlank(message = "操作密码不能为空")
|
||||
@Schema(description = "操作密码")
|
||||
private String operationPassword;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funItem;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
@@ -19,4 +20,14 @@ public class FunItemQueryReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "模块ID不能为空")
|
||||
@Schema(description = "模块ID")
|
||||
private Long moduleId;
|
||||
|
||||
@Schema(description = "功能名称")
|
||||
private String itemName;
|
||||
|
||||
@Schema(description = "功能编码")
|
||||
private String itemCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funItem;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建/修改功能 请求参数
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@@ -19,4 +26,39 @@ public class FunItemSaveUpdateReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id(修改必填)")
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "模块ID不能为空")
|
||||
@Schema(description = "模块ID")
|
||||
@Min(value = 10, message = "模块ID必须大于等于10小于等于99")
|
||||
@Max(value = 99, message = "模块ID必须大于等于10小于等于99")
|
||||
private Long moduleId;
|
||||
|
||||
|
||||
@NotBlank(message = "功能名称不能为空")
|
||||
@Schema(description = "功能名称")
|
||||
private String itemName;
|
||||
|
||||
@NotBlank(message = "功能编码不能为空")
|
||||
@Pattern(regexp = "^[a-z]+$", message = "功能编码只能包含英文小写字母")
|
||||
@Schema(description = "功能编码")
|
||||
private String itemCode;
|
||||
|
||||
@NotNull(message = "是否租户不能为空")
|
||||
@Schema(description = "是否租户")
|
||||
private Boolean isTenant;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String describe;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sortOrder;
|
||||
|
||||
@NotNull(message = "功能ID不能为空")
|
||||
@Schema(description = "功能ID")
|
||||
@Min(value = 10, message = "功能ID必须大于等于10小于等于99")
|
||||
@Max(value = 99, message = "功能ID必须大于等于10小于等于99")
|
||||
private Long itemId;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -17,12 +19,14 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "删除模块-参数")
|
||||
public class FunModuleDeleteReq {
|
||||
public class FunModuleDeleteReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "模块id列表不能为空")
|
||||
@Schema(description = "模块id列表")
|
||||
private List<Long> moduleIdList;
|
||||
private List<Long> idList;
|
||||
|
||||
@NotBlank(message = "操作密码不能为空")
|
||||
@Schema(description = "操作密码")
|
||||
|
||||
@@ -26,8 +26,8 @@ public class FunModuleSaveUpdateReq implements Serializable {
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
@Schema(description = "id")
|
||||
@Min(value = 10, message = "id必须大于等于10")
|
||||
@Max(value = 99, message = "id必须小于等于99")
|
||||
@Min(value = 10, message = "id必须大于等于10小于等于99")
|
||||
@Max(value = 99, message = "id必须大于等于10小于等于99")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "模块名称不能为空")
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funModule;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.enums.IdTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取ID列表 请求参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "获取ID列表-参数")
|
||||
public class GetIdListReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "Id类型不能为空")
|
||||
@Schema(description = "Id类型(0: 模块ID 1: 功能ID 2: 操作ID)")
|
||||
private IdTypeEnum idType;
|
||||
|
||||
@Schema(description = "模块ID(表主键ID)")
|
||||
private Long moduleId;
|
||||
|
||||
@Schema(description = "功能ID(表主键ID)")
|
||||
private Long itemId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 删除操作 请求参数
|
||||
*
|
||||
* @author my
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "删除操作-参数")
|
||||
public class FunOperationDeleteReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "操作id列表不能为空")
|
||||
@Schema(description = "操作id列表")
|
||||
private List<Long> idList;
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
@@ -19,4 +20,13 @@ public class FunOperationQueryReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "功能ID(表主键ID)")
|
||||
private Long itemId;
|
||||
|
||||
@Schema(description = "操作名称")
|
||||
private String funName;
|
||||
|
||||
@Schema(description = "操作编码")
|
||||
private String operationCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funOperation;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.enums.FunTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.RequestTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.UsableConfigEnum;
|
||||
import com.cczsa.xinghe.codegen.handler.PostgreSQLJsonTypeHandler;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 创建/修改操作 请求参数
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@@ -19,4 +32,59 @@ public class FunOperationSaveUpdateReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id(修改必填)")
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "模块ID不能为空")
|
||||
@Schema(description = "模块ID")
|
||||
@Min(value = 10, message = "模块ID必须大于等于10小于等于99")
|
||||
@Max(value = 99, message = "模块ID必须大于等于10小于等于99")
|
||||
private Long moduleId;
|
||||
|
||||
@NotNull(message = "功能ID不能为空")
|
||||
@Schema(description = "功能ID(表主键ID)")
|
||||
private Long itemId;
|
||||
|
||||
@NotNull(message = "是否直接放行不能为空")
|
||||
@Schema(description = "是否直接放行")
|
||||
private Boolean isGreenLight;
|
||||
|
||||
@NotBlank(message = "操作名称不能为空")
|
||||
@Schema(description = "操作名称")
|
||||
private String funName;
|
||||
|
||||
@NotBlank(message = "操作编码不能为空")
|
||||
@Pattern(regexp = "^[a-z]+(?:-[a-z]+)*$", message = "操作编码只能包含英文小写字母和连字符(-),且连字符不能在开头或结尾")
|
||||
@Schema(description = "操作编码")
|
||||
private String operationCode;
|
||||
|
||||
@NotNull(message = "操作类型不能为空")
|
||||
@Schema(description = "操作类型")
|
||||
private FunTypeEnum funType;
|
||||
|
||||
@NotNull(message = "请求类型不能为空")
|
||||
@Schema(description = "请求类型")
|
||||
private RequestTypeEnum requestType;
|
||||
|
||||
@NotNull(message = "可配置数据类型不能为空")
|
||||
@Schema(description = "可配置数据类型")
|
||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||
private List<UsableConfigEnum> usableConfig;
|
||||
|
||||
@Schema(description = "可配置字段")
|
||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||
private List<String> fieldCofnig;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Schema(description = "说明")
|
||||
private String describe;
|
||||
|
||||
@NotNull(message = "操作ID不能为空")
|
||||
@Schema(description = "操作ID")
|
||||
@Min(value = 10, message = "操作ID必须大于等于10小于等于99")
|
||||
@Max(value = 99, message = "操作ID必须大于等于10小于等于99")
|
||||
private Integer operationId;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.cczsa.xinghe.codegen.entity.res.funItem;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取功能列表 响应参数
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@@ -19,4 +21,28 @@ public class FunItemQueryRes implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模块ID")
|
||||
private Long moduleId;
|
||||
|
||||
@Schema(description = "功能名称")
|
||||
private String itemName;
|
||||
|
||||
@Schema(description = "功能编码")
|
||||
private String itemCode;
|
||||
|
||||
@Schema(description = "是否租户")
|
||||
private Boolean isTenant;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String describe;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Schema(description = "功能ID")
|
||||
private Long itemId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
package com.cczsa.xinghe.codegen.entity.res.funOperation;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.enums.FunTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.RequestTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.UsableConfigEnum;
|
||||
import com.cczsa.xinghe.codegen.handler.PostgreSQLJsonTypeHandler;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取操作列表 响应参数
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@@ -19,4 +32,45 @@ public class FunOperationQueryRes implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id(修改必填)")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模块ID(表主键ID)")
|
||||
private Long moduleId;
|
||||
|
||||
@Schema(description = "功能ID(表主键ID)")
|
||||
private Long itemId;
|
||||
|
||||
@Schema(description = "是否直接放行")
|
||||
private Boolean isGreenLight;
|
||||
|
||||
@Schema(description = "操作名称")
|
||||
private String funName;
|
||||
|
||||
@Schema(description = "操作编码")
|
||||
private String operationCode;
|
||||
|
||||
@Schema(description = "操作类型")
|
||||
private FunTypeEnum funType;
|
||||
|
||||
@Schema(description = "请求类型")
|
||||
private RequestTypeEnum requestType;
|
||||
|
||||
@Schema(description = "可配置数据类型")
|
||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||
private List<UsableConfigEnum> usableConfig;
|
||||
|
||||
@Schema(description = "可配置字段")
|
||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||
private List<String> fieldCofnig;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Schema(description = "说明")
|
||||
private String describe;
|
||||
|
||||
@Schema(description = "操作ID")
|
||||
private Integer operationId;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.cczsa.xinghe.codegen.service;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funItem.FunItemQueryRes;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 功能管理 服务层接口。
|
||||
*
|
||||
@@ -16,7 +19,7 @@ public interface FunItemService {
|
||||
/**
|
||||
* 获取功能列表
|
||||
*/
|
||||
XResult<FunItemQueryRes> query(FunItemQueryReq req);
|
||||
XResult<List<FunItemQueryRes>> query(FunItemQueryReq req);
|
||||
|
||||
/**
|
||||
* 创建/修改功能
|
||||
@@ -26,7 +29,7 @@ public interface FunItemService {
|
||||
/**
|
||||
* 删除功能
|
||||
*/
|
||||
XResult<Void> delete();
|
||||
XResult<Void> delete(FunItemDeleteReq req);
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.cczsa.xinghe.codegen.service;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.GetIdListReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funModule.FunModuleQueryRes;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
|
||||
@@ -32,4 +33,9 @@ public interface FunModuleService {
|
||||
XResult<Void> delete(FunModuleDeleteReq req);
|
||||
|
||||
|
||||
/**
|
||||
* 获取ID列表
|
||||
*/
|
||||
XResult<List<Long>> getIdList(GetIdListReq req);
|
||||
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.cczsa.xinghe.codegen.service;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funOperation.FunOperationQueryRes;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作管理 服务层接口。
|
||||
*
|
||||
@@ -16,7 +19,7 @@ public interface FunOperationService {
|
||||
/**
|
||||
* 获取操作列表
|
||||
*/
|
||||
XResult<FunOperationQueryRes> query(FunOperationQueryReq req);
|
||||
XResult<List<FunOperationQueryRes>> query(FunOperationQueryReq req);
|
||||
|
||||
/**
|
||||
* 创建/修改操作
|
||||
@@ -26,7 +29,7 @@ public interface FunOperationService {
|
||||
/**
|
||||
* 删除操作
|
||||
*/
|
||||
XResult<Void> delete();
|
||||
XResult<Void> delete(FunOperationDeleteReq req);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,49 +1,114 @@
|
||||
package com.cczsa.xinghe.codegen.service.impl;
|
||||
|
||||
import com.cczsa.xinghe.codegen.constant.CodegenConstant;
|
||||
import com.cczsa.xinghe.codegen.entity.FunItemEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.FunModuleEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.FunOperationEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funItem.FunItemQueryRes;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunItemMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunModuleMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunOperationMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.def.FunItemDef;
|
||||
import com.cczsa.xinghe.codegen.service.FunItemService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 功能管理 服务层实现。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
* 功能管理 服务层实现。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FunItemServiceImpl implements FunItemService {
|
||||
|
||||
private final FunItemMapper funItemMapper;
|
||||
private final FunOperationMapper funOperationMapper;
|
||||
private final FunModuleMapper funModuleMapper;
|
||||
|
||||
/**
|
||||
* 获取功能列表
|
||||
*/
|
||||
@Override
|
||||
public XResult<FunItemQueryRes> query(FunItemQueryReq req) {
|
||||
// TODO 实现 获取功能列表 业务逻辑
|
||||
return null;
|
||||
public XResult<List<FunItemQueryRes>> query(FunItemQueryReq req) {
|
||||
FunItemDef funItemDef = FunItemDef.FUN_ITEM_ENTITY;
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.select(funItemDef.ALL_COLUMNS)
|
||||
.from(funItemDef)
|
||||
.eq(FunItemEntity::getModuleId, req.getModuleId())
|
||||
.like(FunItemEntity::getItemName, req.getItemName(), StrUtil.isNotBlank(req.getItemName()))
|
||||
.like(FunItemEntity::getItemCode, req.getItemCode(), StrUtil.isNotBlank(req.getItemCode()))
|
||||
.orderBy(FunItemEntity::getSortOrder, true);
|
||||
List<FunItemQueryRes> funItemQueryRes = funItemMapper.selectListByQueryAs(queryWrapper, FunItemQueryRes.class);
|
||||
return XResult.ok(funItemQueryRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建/修改功能
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public XResult<Void> saveUpdate(FunItemSaveUpdateReq req) {
|
||||
// TODO 实现 创建/修改功能 业务逻辑
|
||||
return null;
|
||||
Long id = req.getId();
|
||||
if (id != null) {
|
||||
// 删除原数据
|
||||
QueryWrapper deleteItem = new QueryWrapper();
|
||||
deleteItem.eq(FunItemEntity::getId, id);
|
||||
funItemMapper.deleteByQuery(deleteItem);
|
||||
}
|
||||
id = Long.valueOf(req.getModuleId().toString() + req.getItemId().toString());
|
||||
// 模块是否存在
|
||||
QueryWrapper queryModule = new QueryWrapper();
|
||||
queryModule.eq(FunModuleEntity::getId, req.getModuleId());
|
||||
if (funModuleMapper.selectCountByQuery(queryModule) <= 0) {
|
||||
return XResult.failed("模块不存在");
|
||||
}
|
||||
// 同一个模块是否存在相同功能ID
|
||||
QueryWrapper queryItem = new QueryWrapper();
|
||||
queryItem.eq(FunItemEntity::getModuleId, req.getModuleId());
|
||||
queryItem.eq(FunItemEntity::getItemId, req.getItemId());
|
||||
if (req.getId() != null) {
|
||||
queryItem.ne(FunItemEntity::getId, req.getId());
|
||||
}
|
||||
if (funItemMapper.selectCountByQuery(queryItem) > 0) {
|
||||
return XResult.failed("功能ID已存在");
|
||||
}
|
||||
FunItemEntity funItemEntity = new FunItemEntity();
|
||||
BeanUtils.copyProperties(req, funItemEntity);
|
||||
funItemEntity.setId(id);
|
||||
funItemMapper.insertSelective(funItemEntity);
|
||||
return XResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除功能
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> delete() {
|
||||
// TODO 实现 删除功能 业务逻辑
|
||||
return null;
|
||||
public XResult<Void> delete(FunItemDeleteReq req) {
|
||||
// 校验密码
|
||||
if (!req.getOperationPassword().equals(CodegenConstant.OPERATION_PASSWORD)) {
|
||||
return XResult.failed("操作密码错误");
|
||||
}
|
||||
// 删除功能
|
||||
QueryWrapper deleteItem = new QueryWrapper();
|
||||
deleteItem.in(FunItemEntity::getId, req.getIdList());
|
||||
funItemMapper.deleteByQuery(deleteItem);
|
||||
// 删除操作
|
||||
QueryWrapper deleteOperation = new QueryWrapper();
|
||||
deleteOperation.in(FunOperationEntity::getItemId, req.getIdList());
|
||||
funOperationMapper.deleteByQuery(deleteOperation);
|
||||
return XResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,14 +4,18 @@ import com.cczsa.xinghe.codegen.constant.CodegenConstant;
|
||||
import com.cczsa.xinghe.codegen.entity.FunItemEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.FunModuleEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.FunOperationEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.IdTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.GetIdListReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funModule.FunModuleQueryRes;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunItemMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunModuleMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunOperationMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.def.FunItemDef;
|
||||
import com.cczsa.xinghe.codegen.mapper.def.FunModuleDef;
|
||||
import com.cczsa.xinghe.codegen.mapper.def.FunOperationDef;
|
||||
import com.cczsa.xinghe.codegen.service.FunModuleService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||
@@ -22,6 +26,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.LongStream;
|
||||
|
||||
/**
|
||||
* 模块管理 服务层实现。
|
||||
@@ -43,8 +48,10 @@ public class FunModuleServiceImpl implements FunModuleService {
|
||||
*/
|
||||
@Override
|
||||
public XResult<List<FunModuleQueryRes>> query(FunModuleQueryReq req) {
|
||||
FunModuleDef funModuleDef = FunModuleDef.FUN_MODULE_ENTITY;
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.select(FunModuleDef.FUN_MODULE_ENTITY.ALL_COLUMNS)
|
||||
queryWrapper.select(funModuleDef.ALL_COLUMNS)
|
||||
.from(funModuleDef)
|
||||
.like(FunModuleEntity::getModuleName, req.getModuleName(), StrUtil.isNotBlank(req.getModuleName()))
|
||||
.like(FunModuleEntity::getModuleCode, req.getModuleCode(), StrUtil.isNotBlank(req.getModuleCode()))
|
||||
.orderBy(FunModuleEntity::getSortOrder, true);
|
||||
@@ -55,6 +62,7 @@ public class FunModuleServiceImpl implements FunModuleService {
|
||||
/**
|
||||
* 创建/修改模块
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public XResult<Void> saveUpdate(FunModuleSaveUpdateReq req) {
|
||||
// 模块编码不能重复
|
||||
@@ -68,7 +76,7 @@ public class FunModuleServiceImpl implements FunModuleService {
|
||||
BeanUtils.copyProperties(req, funModuleEntity);
|
||||
int update = funModuleMapper.update(funModuleEntity);
|
||||
if (update <= 0) {
|
||||
funModuleMapper.insert(funModuleEntity);
|
||||
funModuleMapper.insertSelective(funModuleEntity);
|
||||
}
|
||||
return XResult.ok();
|
||||
}
|
||||
@@ -79,7 +87,7 @@ public class FunModuleServiceImpl implements FunModuleService {
|
||||
@Transactional
|
||||
@Override
|
||||
public XResult<Void> delete(FunModuleDeleteReq req) {
|
||||
List<Long> ids = req.getModuleIdList();
|
||||
List<Long> ids = req.getIdList();
|
||||
if (!req.getOperationPassword().equals(CodegenConstant.OPERATION_PASSWORD)) {
|
||||
return XResult.failed("操作密码错误");
|
||||
}
|
||||
@@ -98,4 +106,57 @@ public class FunModuleServiceImpl implements FunModuleService {
|
||||
return XResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ID列表
|
||||
*/
|
||||
@Override
|
||||
public XResult<List<Long>> getIdList(GetIdListReq req) {
|
||||
if (req.getIdType() == IdTypeEnum.ITEM_ID && req.getModuleId() == null) {
|
||||
return XResult.failed("模块ID必填");
|
||||
}
|
||||
if (req.getIdType() == IdTypeEnum.OPERATION_ID && req.getItemId() == null) {
|
||||
return XResult.failed("功能ID必填");
|
||||
}
|
||||
// 获取10-99的ID
|
||||
List<Long> idList = LongStream.rangeClosed(10, 99)
|
||||
.boxed()
|
||||
.toList();
|
||||
List<Long> filteredIdList = null;
|
||||
switch (req.getIdType()) {
|
||||
case MODULE_ID:
|
||||
FunModuleDef funModuleDef = FunModuleDef.FUN_MODULE_ENTITY;
|
||||
QueryWrapper queryModuleId = new QueryWrapper();
|
||||
queryModuleId.select(funModuleDef.ID)
|
||||
.from(funModuleDef);
|
||||
List<Long> moduleExistIdList = funModuleMapper.selectListByQueryAs(queryModuleId, Long.class);
|
||||
filteredIdList = idList.stream()
|
||||
.filter(id -> !moduleExistIdList.contains(id))
|
||||
.toList();
|
||||
break;
|
||||
case ITEM_ID:
|
||||
FunItemDef funItemDef = FunItemDef.FUN_ITEM_ENTITY;
|
||||
QueryWrapper queryFunctionId = new QueryWrapper();
|
||||
queryFunctionId.select(funItemDef.ITEM_ID)
|
||||
.from(funItemDef)
|
||||
.eq(FunItemEntity::getModuleId, req.getModuleId());
|
||||
List<Long> functionExistIdList = funItemMapper.selectListByQueryAs(queryFunctionId, Long.class);
|
||||
filteredIdList = idList.stream()
|
||||
.filter(id -> !functionExistIdList.contains(id))
|
||||
.toList();
|
||||
break;
|
||||
case OPERATION_ID:
|
||||
FunOperationDef funOperationDef = FunOperationDef.FUN_OPERATION_ENTITY;
|
||||
QueryWrapper queryOperationId = new QueryWrapper();
|
||||
queryOperationId.select(funOperationDef.OPERATION_ID)
|
||||
.from(funOperationDef)
|
||||
.eq(FunOperationEntity::getItemId, req.getItemId());
|
||||
List<Long> operationExistIdList = funOperationMapper.selectListByQueryAs(queryOperationId, Long.class);
|
||||
filteredIdList = idList.stream()
|
||||
.filter(id -> !operationExistIdList.contains(id))
|
||||
.toList();
|
||||
break;
|
||||
}
|
||||
return XResult.ok(filteredIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +1,111 @@
|
||||
package com.cczsa.xinghe.codegen.service.impl;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.FunItemEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.FunModuleEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.FunOperationEntity;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationDeleteReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funOperation.FunOperationQueryRes;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunItemMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunModuleMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.FunOperationMapper;
|
||||
import com.cczsa.xinghe.codegen.mapper.def.FunOperationDef;
|
||||
import com.cczsa.xinghe.codegen.service.FunOperationService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作管理 服务层实现。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
* 操作管理 服务层实现。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FunOperationServiceImpl implements FunOperationService {
|
||||
|
||||
private final FunItemMapper funItemMapper;
|
||||
private final FunOperationMapper funOperationMapper;
|
||||
private final FunModuleMapper funModuleMapper;
|
||||
|
||||
/**
|
||||
* 获取操作列表
|
||||
*/
|
||||
@Override
|
||||
public XResult<FunOperationQueryRes> query(FunOperationQueryReq req) {
|
||||
// TODO 实现 获取操作列表 业务逻辑
|
||||
return null;
|
||||
public XResult<List<FunOperationQueryRes>> query(FunOperationQueryReq req) {
|
||||
FunOperationDef funOperationDef = FunOperationDef.FUN_OPERATION_ENTITY;
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.select(funOperationDef.ALL_COLUMNS)
|
||||
.from(funOperationDef)
|
||||
.eq(FunOperationEntity::getItemId, req.getItemId())
|
||||
.like(FunOperationEntity::getOperationCode, req.getOperationCode(), StrUtil.isNotBlank(req.getOperationCode()))
|
||||
.like(FunOperationEntity::getFunName, req.getFunName(), StrUtil.isNotBlank(req.getFunName()))
|
||||
.orderBy(FunOperationEntity::getSortOrder, true);
|
||||
List<FunOperationQueryRes> funOperationQueryRes = funOperationMapper.selectListByQueryAs(queryWrapper, FunOperationQueryRes.class);
|
||||
return XResult.ok(funOperationQueryRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建/修改操作
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public XResult<Void> saveUpdate(FunOperationSaveUpdateReq req) {
|
||||
// TODO 实现 创建/修改操作 业务逻辑
|
||||
return null;
|
||||
Long id = req.getId();
|
||||
if (req.getId() != null) {
|
||||
// 删除原数据
|
||||
QueryWrapper deleteOperation = new QueryWrapper();
|
||||
deleteOperation.eq(FunOperationEntity::getId, id);
|
||||
funOperationMapper.deleteByQuery(deleteOperation);
|
||||
}
|
||||
id = Long.valueOf(req.getItemId().toString() + req.getOperationId().toString());
|
||||
// 模块是否存在
|
||||
QueryWrapper queryModule = new QueryWrapper();
|
||||
queryModule.eq(FunModuleEntity::getId, req.getModuleId());
|
||||
if (funModuleMapper.selectCountByQuery(queryModule) <= 0) {
|
||||
return XResult.failed("模块不存在");
|
||||
}
|
||||
// 功能是否存在
|
||||
QueryWrapper queryItem = new QueryWrapper();
|
||||
queryItem.eq(FunItemEntity::getId, req.getItemId());
|
||||
if (funItemMapper.selectCountByQuery(queryItem) <= 0) {
|
||||
return XResult.failed("功能不存在");
|
||||
}
|
||||
// 同一个功能是否存在相同操作ID
|
||||
QueryWrapper queryOperation = new QueryWrapper();
|
||||
queryOperation.eq(FunOperationEntity::getModuleId, req.getModuleId());
|
||||
queryOperation.eq(FunOperationEntity::getItemId, req.getItemId());
|
||||
queryOperation.eq(FunOperationEntity::getOperationId, req.getOperationId());
|
||||
if (req.getId() != null) {
|
||||
queryOperation.ne(FunOperationEntity::getId, req.getId());
|
||||
}
|
||||
if (funOperationMapper.selectCountByQuery(queryOperation) > 0) {
|
||||
return XResult.failed("操作ID已存在");
|
||||
}
|
||||
FunOperationEntity funOperationEntity = new FunOperationEntity();
|
||||
BeanUtils.copyProperties(req, funOperationEntity);
|
||||
funOperationEntity.setId(id);
|
||||
funOperationMapper.insertSelective(funOperationEntity);
|
||||
return XResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除操作
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> delete() {
|
||||
// TODO 实现 删除操作 业务逻辑
|
||||
return null;
|
||||
public XResult<Void> delete(FunOperationDeleteReq req) {
|
||||
QueryWrapper deleteWrapper = new QueryWrapper();
|
||||
deleteWrapper.in(FunOperationEntity::getId, req.getIdList());
|
||||
funOperationMapper.deleteByQuery(deleteWrapper);
|
||||
return XResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ server:
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:postgresql://192.168.1.40:5432/xinghe-codegen
|
||||
url: jdbc:postgresql://192.168.1.26:5432/xinghe-codegen
|
||||
username: postgres
|
||||
password: root
|
||||
driver-class-name: org.postgresql.Driver
|
||||
|
||||
Reference in New Issue
Block a user