feat: 完善sys_enum枚举管理与初始化能力
This commit is contained in:
@@ -4,9 +4,13 @@ import com.bruce.common.entity.SysEnum;
|
||||
import com.bruce.common.service.ISysEnumService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
@@ -33,4 +37,16 @@ public class SysEnumController {
|
||||
public List<SysEnum> queryByCatalogAndType(@RequestParam String catalog, @RequestParam String type) {
|
||||
return sysEnumService.listByCatalogAndType(catalog, type);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增或修改系统枚举")
|
||||
@PostMapping
|
||||
public boolean saveOrUpdate(@RequestBody SysEnum sysEnum) {
|
||||
return sysEnumService.saveOrUpdate(sysEnum);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除系统枚举")
|
||||
@DeleteMapping("/{id}")
|
||||
public boolean deleteById(@PathVariable Long id) {
|
||||
return sysEnumService.removeById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_setting")
|
||||
@TableName("sys_enum")
|
||||
@Schema(description = "系统枚举配置")
|
||||
public class SysEnum extends BaseEntity {
|
||||
|
||||
|
||||
20
src/main/java/com/bruce/common/enums/CommonStatusEnum.java
Normal file
20
src/main/java/com/bruce/common/enums/CommonStatusEnum.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.bruce.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CommonStatusEnum {
|
||||
|
||||
DISABLED(0, "禁用"),
|
||||
ENABLED(1, "启用"),
|
||||
DRAFT(2, "草稿"),
|
||||
PROCESSING(3, "处理中"),
|
||||
COMPLETED(4, "已完成"),
|
||||
FAILED(5, "失败");
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private final String label;
|
||||
}
|
||||
16
src/main/java/com/bruce/common/enums/EnableStatusEnum.java
Normal file
16
src/main/java/com/bruce/common/enums/EnableStatusEnum.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.bruce.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum EnableStatusEnum {
|
||||
|
||||
DISABLED(0, "禁用"),
|
||||
ENABLED(1, "启用");
|
||||
|
||||
private final Integer value;
|
||||
|
||||
private final String label;
|
||||
}
|
||||
Reference in New Issue
Block a user