生成数据字典代码.
This commit is contained in:
@@ -27,6 +27,8 @@ public interface ErrorMessage {
|
||||
|
||||
String CONFIG_ABSENT = "配置不存在";
|
||||
|
||||
String CONFIG_PRESENT = "配置已存在";
|
||||
|
||||
String DATA_PRESENT = "数据已存在";
|
||||
|
||||
String NAME_PRESENT = "名称已存在";
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.generator.config.rules.DateType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
|
||||
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
||||
import com.orion.lang.constant.Const;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.ansi.AnsiAppender;
|
||||
import com.orion.lang.utils.ansi.style.AnsiFont;
|
||||
import com.orion.lang.utils.ansi.style.color.AnsiForeground;
|
||||
@@ -26,6 +25,7 @@ import java.io.File;
|
||||
import java.sql.Types;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -53,13 +53,29 @@ public class CodeGenerator {
|
||||
// .vue("user", "preference")
|
||||
// .enums("type")
|
||||
// .names("APP", "HOST")
|
||||
// .values("label", "应用", "主机")
|
||||
// // 同 .value(1, 2)
|
||||
// .values("value", 1, 2)
|
||||
// // 同 .label("应用", "主机")
|
||||
// .values("label", "应用", "主机")
|
||||
// .color("blue", "green")
|
||||
// .build(),
|
||||
Template.create("operator_log", "操作日志", "operator.log")
|
||||
.disableUnitTest()
|
||||
.build()
|
||||
Template.create("history_value", "历史归档", "history")
|
||||
.enableProviderApi()
|
||||
.vue("meta", "history-value")
|
||||
.build(),
|
||||
Template.create("dict_key", "字典配置项", "dict")
|
||||
.cache("dict:keys", "字典配置项")
|
||||
.expire(1, TimeUnit.HOURS)
|
||||
.vue("system", "dict-key")
|
||||
.enums("value_type")
|
||||
.names("STRING", "NUMBER", "BOOLEAN", "COLOR")
|
||||
.label("字符串", "数值", "布尔值", "颜色")
|
||||
.build(),
|
||||
Template.create("dict_value", "字典配置值", "dict")
|
||||
.cache("dict:value:{}", "字典配置值 ${key}")
|
||||
.expire(1, TimeUnit.HOURS)
|
||||
.vue("system", "dict-value")
|
||||
.build(),
|
||||
};
|
||||
// jdbc 配置 - 使用配置文件
|
||||
File yamlFile = new File("orion-ops-launch/src/main/resources/application-dev.yaml");
|
||||
@@ -124,7 +140,7 @@ public class CodeGenerator {
|
||||
ag.execute(engine);
|
||||
|
||||
// 打印提示信息
|
||||
printTips(module);
|
||||
printTips();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,13 +422,12 @@ public class CodeGenerator {
|
||||
/**
|
||||
* 打印提示信息
|
||||
*/
|
||||
private static void printTips(String module) {
|
||||
private static void printTips() {
|
||||
String line = AnsiAppender.create()
|
||||
.append(AnsiForeground.BRIGHT_GREEN.and(AnsiFont.BOLD), "\n:: 代码生成完毕 ^_^ ::\n")
|
||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 后端代码复制后请先 clean 模块父工程\n")
|
||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 后端代码需要自行修改缓存逻辑\n")
|
||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 后端代码修改完成后请先执行单元测试检测是否正常\n")
|
||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 需要在 " + Strings.firstUpper(module) + "OperatorTypeRunner 添加 xxxOperatorType.init() 来初始化操作日志类型 \n")
|
||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- vue 代码需要注意同一模块的 router 需要自行合并\n")
|
||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- vue 枚举需要自行更改数据类型\n")
|
||||
.append(AnsiForeground.BRIGHT_BLUE.and(AnsiFont.BOLD), "- 菜单 sql 执行完成后 需要在菜单页面刷新缓存\n")
|
||||
|
||||
@@ -200,7 +200,7 @@ public class VelocityTemplateEngine extends AbstractTemplateEngine {
|
||||
// 类型脊柱名称
|
||||
objectMap.put("typeHyphen", mappingHyphen.substring(0, mappingHyphen.length() - 3));
|
||||
// 类型常量
|
||||
objectMap.put("typeConst", VariableStyles.BIG_HUMP.toSpine(entityName).toUpperCase());
|
||||
objectMap.put("typeConst", VariableStyles.BIG_HUMP.toSerpentine(entityName).toUpperCase());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLe
|
||||
* @since ${date}
|
||||
*/
|
||||
@Module("${package.ModuleName}:${typeHyphen}")
|
||||
public class ${type}OperatorType {
|
||||
public class ${type}OperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String CREATE = "${typeHyphen}:create";
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
return ${typeLower}DAO.of(wrapper).list(${type}ProviderConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
#if($cacheMeta.enableCache)
|
||||
@Override
|
||||
public List<${type}DTO> get${type}ListByCache() {
|
||||
return ${typeLower}Service.get${type}ListByCache()
|
||||
@@ -114,6 +115,7 @@ public class ${type}ApiImpl implements ${type}Api {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
#end
|
||||
@Override
|
||||
public Long get${type}Count(${type}QueryDTO dto) {
|
||||
log.info("${type}Api.get${type}Count dto: {}", JSON.toJSONString(dto));
|
||||
|
||||
@@ -64,6 +64,7 @@ public interface ${type}Api {
|
||||
*/
|
||||
List<${type}DTO> get${type}List(${type}QueryDTO dto);
|
||||
|
||||
#if($cacheMeta.enableCache)
|
||||
/**
|
||||
* ${apiComment.queryListByCache}
|
||||
*
|
||||
@@ -71,6 +72,7 @@ public interface ${type}Api {
|
||||
*/
|
||||
List<${type}DTO> get${type}ListByCache();
|
||||
|
||||
#end
|
||||
/**
|
||||
* ${apiComment.queryCount}
|
||||
*
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.orion.ops.module.infra.api;
|
||||
|
||||
import com.orion.ops.module.infra.entity.dto.history.HistoryValueCreateDTO;
|
||||
import com.orion.ops.module.infra.entity.dto.history.HistoryValueDTO;
|
||||
import com.orion.ops.module.infra.enums.HistoryValueTypeEnum;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 历史归档 对外服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 17:33
|
||||
*/
|
||||
public interface HistoryValueApi {
|
||||
|
||||
/**
|
||||
* 创建历史归档
|
||||
*
|
||||
* @param type type
|
||||
* @param dto dto
|
||||
* @return id
|
||||
*/
|
||||
Long createHistoryValue(HistoryValueTypeEnum type, HistoryValueCreateDTO dto);
|
||||
|
||||
/**
|
||||
* 查询历史归档
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
HistoryValueDTO getHistoryValueById(Long id);
|
||||
|
||||
/**
|
||||
* 删除历史归档
|
||||
*
|
||||
* @param type type
|
||||
* @param relId relId
|
||||
* @return rows
|
||||
*/
|
||||
Integer deleteByRelId(HistoryValueTypeEnum type, Long relId);
|
||||
|
||||
/**
|
||||
* 删除历史归档
|
||||
*
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByRelIdList(HistoryValueTypeEnum type, List<Long> relIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.orion.ops.module.infra.entity.dto.history;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 历史归档 创建请求业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 17:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HistoryValueCreateDTO", description = "历史归档 创建请求业务对象")
|
||||
public class HistoryValueCreateDTO implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "引用id")
|
||||
private Long relId;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "修改前")
|
||||
private String beforeValue;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "修改后")
|
||||
private String afterValue;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.orion.ops.module.infra.entity.dto.history;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 历史归档 业务对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 17:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HistoryValueDTO", description = "历史归档 业务对象")
|
||||
public class HistoryValueDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "引用id")
|
||||
private Long relId;
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "修改前")
|
||||
private String beforeValue;
|
||||
|
||||
@Schema(description = "修改后")
|
||||
private String afterValue;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.orion.ops.module.infra.enums;
|
||||
|
||||
/**
|
||||
* 历史值类型 枚举
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/16 17:40
|
||||
*/
|
||||
public enum HistoryValueTypeEnum {
|
||||
|
||||
/**
|
||||
* 字典
|
||||
*/
|
||||
DICT,
|
||||
|
||||
;
|
||||
|
||||
public static HistoryValueTypeEnum of(String type) {
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
for (HistoryValueTypeEnum value : values()) {
|
||||
if (value.name().equals(type)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.orion.ops.module.infra.api.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
import com.orion.ops.module.infra.api.HistoryValueApi;
|
||||
import com.orion.ops.module.infra.convert.HistoryValueProviderConvert;
|
||||
import com.orion.ops.module.infra.entity.domain.HistoryValueDO;
|
||||
import com.orion.ops.module.infra.entity.dto.history.HistoryValueCreateDTO;
|
||||
import com.orion.ops.module.infra.entity.dto.history.HistoryValueDTO;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueCreateRequest;
|
||||
import com.orion.ops.module.infra.enums.HistoryValueTypeEnum;
|
||||
import com.orion.ops.module.infra.service.HistoryValueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 历史归档 对外服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 17:33
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HistoryValueApiImpl implements HistoryValueApi {
|
||||
|
||||
@Resource
|
||||
private HistoryValueService historyValueService;
|
||||
|
||||
@Override
|
||||
public Long createHistoryValue(HistoryValueTypeEnum type, HistoryValueCreateDTO dto) {
|
||||
log.info("HistoryValueApi.createHistoryValue dto: {}", JSON.toJSONString(dto));
|
||||
Valid.notNull(type);
|
||||
Valid.valid(dto);
|
||||
// 转换
|
||||
HistoryValueCreateRequest request = HistoryValueProviderConvert.MAPPER.toRequest(dto);
|
||||
request.setType(type.name());
|
||||
// 创建
|
||||
return historyValueService.createHistoryValue(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoryValueDTO getHistoryValueById(Long id) {
|
||||
log.info("HistoryValueApi.getHistoryValueById id: {}", id);
|
||||
Valid.notNull(id, ErrorMessage.ID_MISSING);
|
||||
// 修改
|
||||
HistoryValueDO record = historyValueService.getHistoryById(id);
|
||||
if (record == null) {
|
||||
return null;
|
||||
}
|
||||
// 转换
|
||||
return HistoryValueProviderConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByRelId(HistoryValueTypeEnum type, Long relId) {
|
||||
return historyValueService.deleteByRelId(type.name(), relId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByRelIdList(HistoryValueTypeEnum type, List<Long> relIdList) {
|
||||
return historyValueService.deleteByRelIdList(type.name(), relIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
### 创建字典配置项
|
||||
POST {{baseUrl}}/infra/dict-key/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"key": "",
|
||||
"valueType": "",
|
||||
"extraSchema": "",
|
||||
"desc": ""
|
||||
}
|
||||
|
||||
|
||||
### 更新字典配置项
|
||||
PUT {{baseUrl}}/infra/dict-key/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"key": "",
|
||||
"valueType": "",
|
||||
"extraSchema": "",
|
||||
"desc": ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
### 查询全部字典配置项
|
||||
POST {{baseUrl}}/infra/dict-key/list
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 删除字典配置项
|
||||
DELETE {{baseUrl}}/infra/dict-key/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 批量删除字典配置项
|
||||
DELETE {{baseUrl}}/infra/dict-key/batch-delete?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
###
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.orion.ops.module.infra.controller;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.define.operator.DictKeyOperatorType;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictKeyVO;
|
||||
import com.orion.ops.module.infra.service.DictKeyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典配置项 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Tag(name = "infra - 字典配置项服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/dict-key")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class DictKeyController {
|
||||
|
||||
@Resource
|
||||
private DictKeyService dictKeyService;
|
||||
|
||||
@OperatorLog(DictKeyOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建字典配置项")
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-key:create')")
|
||||
public Long createDictKey(@Validated @RequestBody DictKeyCreateRequest request) {
|
||||
return dictKeyService.createDictKey(request);
|
||||
}
|
||||
|
||||
@OperatorLog(DictKeyOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新字典配置项")
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-key:update')")
|
||||
public Integer updateDictKey(@Validated @RequestBody DictKeyUpdateRequest request) {
|
||||
return dictKeyService.updateDictKeyById(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "查询全部字典配置项")
|
||||
public List<DictKeyVO> getDictKeyList() {
|
||||
return dictKeyService.getDictKeyList();
|
||||
}
|
||||
|
||||
@OperatorLog(DictKeyOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除字典配置项")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-key:delete')")
|
||||
public Integer deleteDictKey(@RequestParam("id") Long id) {
|
||||
return dictKeyService.deleteDictKeyById(id);
|
||||
}
|
||||
|
||||
@OperatorLog(DictKeyOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除字典配置项")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-key:delete')")
|
||||
public Integer batchDeleteDictKey(@RequestParam("idList") List<Long> idList) {
|
||||
return dictKeyService.batchDeleteDictKeyByIdList(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
### 创建字典配置值
|
||||
POST {{baseUrl}}/infra/dict-value/create
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"keyId": "",
|
||||
"key": "",
|
||||
"label": "",
|
||||
"value": "",
|
||||
"desc": "",
|
||||
"extra": "",
|
||||
"sort": ""
|
||||
}
|
||||
|
||||
|
||||
### 更新字典配置值
|
||||
PUT {{baseUrl}}/infra/dict-value/update
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"keyId": "",
|
||||
"key": "",
|
||||
"label": "",
|
||||
"value": "",
|
||||
"desc": "",
|
||||
"extra": "",
|
||||
"sort": ""
|
||||
}
|
||||
|
||||
|
||||
### 查询字典配置值
|
||||
GET {{baseUrl}}/infra/dict-value/get?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 批量查询字典配置值
|
||||
GET {{baseUrl}}/infra/dict-value/batch-get?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 查询全部字典配置值
|
||||
POST {{baseUrl}}/infra/dict-value/list
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"keyId": "",
|
||||
"key": "",
|
||||
"label": "",
|
||||
"value": "",
|
||||
"desc": "",
|
||||
"extra": "",
|
||||
"sort": ""
|
||||
}
|
||||
|
||||
|
||||
### 分页查询字典配置值
|
||||
POST {{baseUrl}}/infra/dict-value/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"id": "",
|
||||
"keyId": "",
|
||||
"key": "",
|
||||
"label": "",
|
||||
"value": "",
|
||||
"desc": "",
|
||||
"extra": "",
|
||||
"sort": ""
|
||||
}
|
||||
|
||||
|
||||
### 删除字典配置值
|
||||
DELETE {{baseUrl}}/infra/dict-value/delete?id=1
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 批量删除字典配置值
|
||||
DELETE {{baseUrl}}/infra/dict-value/batch-delete?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
|
||||
|
||||
### 导出字典配置值
|
||||
POST {{baseUrl}}/infra/dict-value/export
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"id": "",
|
||||
"keyId": "",
|
||||
"key": "",
|
||||
"label": "",
|
||||
"value": "",
|
||||
"desc": "",
|
||||
"extra": "",
|
||||
"sort": ""
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.orion.ops.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
|
||||
import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.define.operator.DictValueOperatorType;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictValueVO;
|
||||
import com.orion.ops.module.infra.service.DictValueService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典配置值 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Tag(name = "infra - 字典配置值服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/dict-value")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class DictValueController {
|
||||
|
||||
@Resource
|
||||
private DictValueService dictValueService;
|
||||
|
||||
@OperatorLog(DictValueOperatorType.CREATE)
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建字典配置值")
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-value:create')")
|
||||
public Long createDictValue(@Validated @RequestBody DictValueCreateRequest request) {
|
||||
return dictValueService.createDictValue(request);
|
||||
}
|
||||
|
||||
@OperatorLog(DictValueOperatorType.UPDATE)
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新字典配置值")
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-value:update')")
|
||||
public Integer updateDictValue(@Validated @RequestBody DictValueUpdateRequest request) {
|
||||
return dictValueService.updateDictValueById(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "查询字典配置值")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-value:query')")
|
||||
public DictValueVO getDictValue(@RequestParam("id") Long id) {
|
||||
return dictValueService.getDictValueById(id);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "查询全部字典配置值")
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-value:query')")
|
||||
public List<DictValueVO> getDictValueList(@Validated @RequestBody DictValueQueryRequest request) {
|
||||
return dictValueService.getDictValueList(request);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询字典配置值")
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-value:query')")
|
||||
public DataGrid<DictValueVO> getDictValuePage(@Validated(Page.class) @RequestBody DictValueQueryRequest request) {
|
||||
return dictValueService.getDictValuePage(request);
|
||||
}
|
||||
|
||||
@OperatorLog(DictValueOperatorType.DELETE)
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除字典配置值")
|
||||
@Parameter(name = "id", description = "id", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-value:delete')")
|
||||
public Integer deleteDictValue(@RequestParam("id") Long id) {
|
||||
return dictValueService.deleteDictValueById(id);
|
||||
}
|
||||
|
||||
@OperatorLog(DictValueOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除字典配置值")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:dict-value:delete')")
|
||||
public Integer batchDeleteDictValue(@RequestParam("idList") List<Long> idList) {
|
||||
return dictValueService.batchDeleteDictValueByIdList(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
### 分页查询历史归档
|
||||
POST {{baseUrl}}/infra/history-value/query
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
"page": 1,
|
||||
"limit": 10,
|
||||
"relId": "1",
|
||||
"type": ""
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.orion.ops.module.infra.controller;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.HistoryValueVO;
|
||||
import com.orion.ops.module.infra.service.HistoryValueService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 历史归档 api
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Tag(name = "infra - 历史归档服务")
|
||||
@Slf4j
|
||||
@Validated
|
||||
@RestWrapper
|
||||
@RestController
|
||||
@RequestMapping("/infra/history-value")
|
||||
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
|
||||
public class HistoryValueController {
|
||||
|
||||
@Resource
|
||||
private HistoryValueService historyValueService;
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@PostMapping("/query")
|
||||
@Operation(summary = "分页查询历史归档")
|
||||
@PreAuthorize("@ss.hasPermission('infra:history-value:query')")
|
||||
public DataGrid<HistoryValueVO> getHistoryValuePage(@Validated(Page.class) @RequestBody HistoryValueQueryRequest request) {
|
||||
return historyValueService.getHistoryValuePage(request);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.orion.ops.framework.common.validator.group.Page;
|
||||
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.ops.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.ops.module.infra.entity.request.operator.log.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.operator.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.OperatorLogVO;
|
||||
import com.orion.ops.module.infra.service.OperatorLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.DictKeyDO;
|
||||
import com.orion.ops.module.infra.entity.dto.DictKeyCacheDTO;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictKeyVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典配置项 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictKeyConvert {
|
||||
|
||||
DictKeyConvert MAPPER = Mappers.getMapper(DictKeyConvert.class);
|
||||
|
||||
DictKeyDO to(DictKeyCreateRequest request);
|
||||
|
||||
DictKeyDO to(DictKeyUpdateRequest request);
|
||||
|
||||
DictKeyVO to(DictKeyDO domain);
|
||||
|
||||
List<DictKeyVO> to(List<DictKeyDO> list);
|
||||
|
||||
DictKeyVO to(DictKeyCacheDTO cache);
|
||||
|
||||
DictKeyCacheDTO toCache(DictKeyDO domain);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.DictValueDO;
|
||||
import com.orion.ops.module.infra.entity.dto.DictValueCacheDTO;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictValueVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典配置值 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictValueConvert {
|
||||
|
||||
DictValueConvert MAPPER = Mappers.getMapper(DictValueConvert.class);
|
||||
|
||||
DictValueDO to(DictValueCreateRequest request);
|
||||
|
||||
DictValueDO to(DictValueUpdateRequest request);
|
||||
|
||||
DictValueDO to(DictValueQueryRequest request);
|
||||
|
||||
DictValueVO to(DictValueDO domain);
|
||||
|
||||
List<DictValueVO> to(List<DictValueDO> list);
|
||||
|
||||
DictValueVO to(DictValueCacheDTO cache);
|
||||
|
||||
DictValueCacheDTO toCache(DictValueDO domain);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.HistoryValueDO;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.HistoryValueVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 历史归档 内部对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface HistoryValueConvert {
|
||||
|
||||
HistoryValueConvert MAPPER = Mappers.getMapper(HistoryValueConvert.class);
|
||||
|
||||
HistoryValueDO to(HistoryValueCreateRequest request);
|
||||
|
||||
HistoryValueDO to(HistoryValueQueryRequest request);
|
||||
|
||||
HistoryValueVO to(HistoryValueDO domain);
|
||||
|
||||
List<HistoryValueVO> to(List<HistoryValueDO> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.ops.module.infra.convert;
|
||||
|
||||
import com.orion.ops.module.infra.entity.domain.HistoryValueDO;
|
||||
import com.orion.ops.module.infra.entity.dto.history.HistoryValueCreateDTO;
|
||||
import com.orion.ops.module.infra.entity.dto.history.HistoryValueDTO;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueCreateRequest;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 历史归档 对外服务对象转换器
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 17:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface HistoryValueProviderConvert {
|
||||
|
||||
HistoryValueProviderConvert MAPPER = Mappers.getMapper(HistoryValueProviderConvert.class);
|
||||
|
||||
HistoryValueDTO to(HistoryValueDO domain);
|
||||
|
||||
HistoryValueCreateRequest toRequest(HistoryValueCreateDTO request);
|
||||
|
||||
List<HistoryValueDTO> toList(List<HistoryValueDO> list);
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.orion.ops.module.infra.convert;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||
import com.orion.ops.module.infra.entity.domain.OperatorLogDO;
|
||||
import com.orion.ops.module.infra.entity.request.operator.log.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.operator.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.OperatorLogVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.DictKeyDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 字典配置项 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictKeyDAO extends IMapper<DictKeyDO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.DictValueDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 字典配置值 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictValueDAO extends IMapper<DictValueDO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.HistoryValueDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 历史归档 Mapper 接口
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface HistoryValueDAO extends IMapper<HistoryValueDO> {
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
* @param type type
|
||||
* @param relId relId
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByRelId(String type, Long relId) {
|
||||
LambdaQueryWrapper<HistoryValueDO> wrapper = this.lambda()
|
||||
.eq(HistoryValueDO::getType, type)
|
||||
.eq(HistoryValueDO::getRelId, relId);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByRelIdList(String type, List<Long> relIdList) {
|
||||
LambdaQueryWrapper<HistoryValueDO> wrapper = this.lambda()
|
||||
.eq(HistoryValueDO::getType, type)
|
||||
.in(HistoryValueDO::getRelId, relIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.orion.ops.module.infra.define.cache;
|
||||
|
||||
import com.orion.lang.define.cache.CacheKeyBuilder;
|
||||
import com.orion.lang.define.cache.CacheKeyDefine;
|
||||
import com.orion.ops.module.infra.entity.dto.DictKeyCacheDTO;
|
||||
import com.orion.ops.module.infra.entity.dto.DictValueCacheDTO;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 字典配置项缓存 key
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
public interface DictCacheKeyDefine {
|
||||
|
||||
CacheKeyDefine DICT_KEY = new CacheKeyBuilder()
|
||||
.key("dict:keys")
|
||||
.desc("字典配置项")
|
||||
.type(DictKeyCacheDTO.class)
|
||||
.timeout(1, TimeUnit.DAYS)
|
||||
.build();
|
||||
|
||||
CacheKeyDefine DICT_VALUE = new CacheKeyBuilder()
|
||||
.key("dict:value:{}")
|
||||
.desc("字典配置值 ${key}")
|
||||
.type(DictValueCacheDTO.class)
|
||||
.timeout(1, TimeUnit.DAYS)
|
||||
.build();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.infra.define.operator;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.Module;
|
||||
import com.orion.ops.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.*;
|
||||
|
||||
/**
|
||||
* 字典配置项 操作日志类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Module("infra:dict-key")
|
||||
public class DictKeyOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String CREATE = "dict-key:create";
|
||||
|
||||
public static final String UPDATE = "dict-key:update";
|
||||
|
||||
public static final String DELETE = "dict-key:delete";
|
||||
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建字典配置项"),
|
||||
new OperatorType(M, UPDATE, "更新字典配置项"),
|
||||
new OperatorType(H, DELETE, "删除字典配置项"),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.orion.ops.module.infra.define.operator;
|
||||
|
||||
import com.orion.ops.framework.biz.operator.log.core.annotation.Module;
|
||||
import com.orion.ops.framework.biz.operator.log.core.factory.InitializingOperatorTypes;
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorType;
|
||||
|
||||
import static com.orion.ops.framework.biz.operator.log.core.enums.OperatorRiskLevel.*;
|
||||
|
||||
/**
|
||||
* 字典配置值 操作日志类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Module("infra:dict-value")
|
||||
public class DictValueOperatorType extends InitializingOperatorTypes {
|
||||
|
||||
public static final String CREATE = "dict-value:create";
|
||||
|
||||
public static final String UPDATE = "dict-value:update";
|
||||
|
||||
public static final String DELETE = "dict-value:delete";
|
||||
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建字典配置值"),
|
||||
new OperatorType(M, UPDATE, "更新字典配置值"),
|
||||
new OperatorType(H, DELETE, "删除字典配置值"),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.orion.ops.module.infra.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 字典配置项 实体对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "dict_key", autoResultMap = true)
|
||||
@Schema(name = "DictKeyDO", description = "字典配置项 实体对象")
|
||||
public class DictKeyDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置项")
|
||||
@TableField("key")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "配置值定义")
|
||||
@TableField("value_type")
|
||||
private String valueType;
|
||||
|
||||
@Schema(description = "额外配置定义")
|
||||
@TableField("extra_schema")
|
||||
private String extraSchema;
|
||||
|
||||
@Schema(description = "配置描述")
|
||||
@TableField("desc")
|
||||
private String desc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.orion.ops.module.infra.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 字典配置值 实体对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "dict_value", autoResultMap = true)
|
||||
@Schema(name = "DictValueDO", description = "字典配置值 实体对象")
|
||||
public class DictValueDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置项id")
|
||||
@TableField("key_id")
|
||||
private Long keyId;
|
||||
|
||||
@Schema(description = "配置项")
|
||||
@TableField("key")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "配置名称")
|
||||
@TableField("label")
|
||||
private String label;
|
||||
|
||||
@Schema(description = "配置值")
|
||||
@TableField("value")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "配置描述")
|
||||
@TableField("desc")
|
||||
private String desc;
|
||||
|
||||
@Schema(description = "额外参数")
|
||||
@TableField("extra")
|
||||
private String extra;
|
||||
|
||||
@Schema(description = "排序")
|
||||
@TableField("sort")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.orion.ops.module.infra.entity.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.orion.ops.framework.mybatis.core.domain.BaseDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典配置项 实体对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "history_value", autoResultMap = true)
|
||||
@Schema(name = "HistoryValueDO", description = "字典配置项 实体对象")
|
||||
public class HistoryValueDO extends BaseDO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "引用id")
|
||||
@TableField("rel_id")
|
||||
private Long relId;
|
||||
|
||||
@Schema(description = "类型")
|
||||
@TableField("type")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "修改前")
|
||||
@TableField("before_value")
|
||||
private String beforeValue;
|
||||
|
||||
@Schema(description = "修改后")
|
||||
@TableField("after_value")
|
||||
private String afterValue;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
@TableField(exist = false)
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
@TableField(exist = false)
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.orion.ops.module.infra.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典配置项 缓存对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictKeyCacheDTO", description = "字典配置项 缓存对象")
|
||||
public class DictKeyCacheDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置项")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "配置值定义")
|
||||
private String valueType;
|
||||
|
||||
@Schema(description = "额外配置定义")
|
||||
private String extraSchema;
|
||||
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.orion.ops.module.infra.entity.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典配置值 缓存对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictValueCacheDTO", description = "字典配置值 缓存对象")
|
||||
public class DictValueCacheDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置项id")
|
||||
private Long keyId;
|
||||
|
||||
@Schema(description = "配置项")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "配置名称")
|
||||
private String label;
|
||||
|
||||
@Schema(description = "配置值")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
@Schema(description = "额外参数")
|
||||
private String extra;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.orion.ops.module.infra.entity.request.dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字典配置项 创建请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictKeyCreateRequest", description = "字典配置项 创建请求对象")
|
||||
public class DictKeyCreateRequest implements Serializable {
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置项")
|
||||
private String key;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 12)
|
||||
@Schema(description = "配置值定义")
|
||||
private String valueType;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "额外配置定义")
|
||||
private String extraSchema;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.orion.ops.module.infra.entity.request.dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字典配置项 更新请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictKeyUpdateRequest", description = "字典配置项 更新请求对象")
|
||||
public class DictKeyUpdateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置项")
|
||||
private String key;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 12)
|
||||
@Schema(description = "配置值定义")
|
||||
private String valueType;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "额外配置定义")
|
||||
private String extraSchema;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.orion.ops.module.infra.entity.request.dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字典配置值 创建请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictValueCreateRequest", description = "字典配置值 创建请求对象")
|
||||
public class DictValueCreateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "配置项id")
|
||||
private Long keyId;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置名称")
|
||||
private String label;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 512)
|
||||
@Schema(description = "配置值")
|
||||
private String value;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "额外参数")
|
||||
private String extra;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.orion.ops.module.infra.entity.request.dict;
|
||||
|
||||
import com.orion.ops.framework.common.entity.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 字典配置值 查询请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "DictValueQueryRequest", description = "字典配置值 查询请求对象")
|
||||
public class DictValueQueryRequest extends PageRequest {
|
||||
|
||||
@Schema(description = "配置项id")
|
||||
private Long keyId;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置名称")
|
||||
private String label;
|
||||
|
||||
@Size(max = 512)
|
||||
@Schema(description = "配置值")
|
||||
private String value;
|
||||
|
||||
@Size(max = 64)
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.orion.ops.module.infra.entity.request.dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字典配置值 更新请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictValueUpdateRequest", description = "字典配置值 更新请求对象")
|
||||
public class DictValueUpdateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "配置项id")
|
||||
private Long keyId;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置项")
|
||||
private String key;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置名称")
|
||||
private String label;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 512)
|
||||
@Schema(description = "配置值")
|
||||
private String value;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "额外参数")
|
||||
private String extra;
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.orion.ops.module.infra.entity.request.history;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 历史归档 创建请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HistoryValueCreateRequest", description = "历史归档 创建请求对象")
|
||||
public class HistoryValueCreateRequest implements Serializable {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "引用id")
|
||||
private Long relId;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 16)
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "修改前")
|
||||
private String beforeValue;
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "修改后")
|
||||
private String afterValue;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.orion.ops.module.infra.entity.request.history;
|
||||
|
||||
import com.orion.ops.framework.common.entity.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 历史归档 查询请求对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Schema(name = "HistoryValueQueryRequest", description = "历史归档 查询请求对象")
|
||||
public class HistoryValueQueryRequest extends PageRequest {
|
||||
|
||||
@NotNull
|
||||
@Schema(description = "引用id")
|
||||
private Long relId;
|
||||
|
||||
@Size(max = 16)
|
||||
@NotNull
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "搜索")
|
||||
private String searchValue;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.orion.ops.module.infra.entity.request.operator.log;
|
||||
package com.orion.ops.module.infra.entity.request.operator;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.orion.ops.framework.common.entity.PageRequest;
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.orion.ops.module.infra.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典配置项 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictKeyVO", description = "字典配置项 视图响应对象")
|
||||
public class DictKeyVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置项")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "配置值定义")
|
||||
private String valueType;
|
||||
|
||||
@Schema(description = "额外配置定义")
|
||||
private String extraSchema;
|
||||
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.orion.ops.module.infra.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典配置值 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "DictValueVO", description = "字典配置值 视图响应对象")
|
||||
public class DictValueVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置项id")
|
||||
private Long keyId;
|
||||
|
||||
@Schema(description = "配置项")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "配置名称")
|
||||
private String label;
|
||||
|
||||
@Schema(description = "配置值")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "配置描述")
|
||||
private String desc;
|
||||
|
||||
@Schema(description = "额外参数")
|
||||
private String extra;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "修改人")
|
||||
private String updater;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.orion.ops.module.infra.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 字典配置项 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HistoryValueVO", description = "字典配置项 视图响应对象")
|
||||
public class HistoryValueVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "修改前")
|
||||
private String beforeValue;
|
||||
|
||||
@Schema(description = "修改后")
|
||||
private String afterValue;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String creator;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictKeyVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典配置项 服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
public interface DictKeyService {
|
||||
|
||||
/**
|
||||
* 创建字典配置项
|
||||
*
|
||||
* @param request request
|
||||
* @return id
|
||||
*/
|
||||
Long createDictKey(DictKeyCreateRequest request);
|
||||
|
||||
/**
|
||||
* 更新字典配置项
|
||||
*
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer updateDictKeyById(DictKeyUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 查询全部字典配置项
|
||||
*
|
||||
* @return rows
|
||||
*/
|
||||
List<DictKeyVO> getDictKeyList();
|
||||
|
||||
/**
|
||||
* 删除字典配置项
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteDictKeyById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除字典配置项
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDeleteDictKeyByIdList(List<Long> idList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictValueVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典配置值 服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
public interface DictValueService {
|
||||
|
||||
/**
|
||||
* 创建字典配置值
|
||||
*
|
||||
* @param request request
|
||||
* @return id
|
||||
*/
|
||||
Long createDictValue(DictValueCreateRequest request);
|
||||
|
||||
/**
|
||||
* 更新字典配置值
|
||||
*
|
||||
* @param request request
|
||||
* @return effect
|
||||
*/
|
||||
Integer updateDictValueById(DictValueUpdateRequest request);
|
||||
|
||||
/**
|
||||
* 查询字典配置值
|
||||
*
|
||||
* @param id id
|
||||
* @return row
|
||||
*/
|
||||
DictValueVO getDictValueById(Long id);
|
||||
|
||||
/**
|
||||
* 查询全部字典配置值
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
List<DictValueVO> getDictValueList(DictValueQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过缓存查询字典配置值
|
||||
*
|
||||
* @return rows
|
||||
*/
|
||||
List<DictValueVO> getDictValueListByCache();
|
||||
|
||||
/**
|
||||
* 分页查询字典配置值
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
DataGrid<DictValueVO> getDictValuePage(DictValueQueryRequest request);
|
||||
|
||||
/**
|
||||
* 删除字典配置值
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteDictValueById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除字典配置值
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer batchDeleteDictValueByIdList(List<Long> idList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.module.infra.entity.domain.HistoryValueDO;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.HistoryValueVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 历史归档 服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
public interface HistoryValueService {
|
||||
|
||||
/**
|
||||
* 创建历史归档
|
||||
*
|
||||
* @param request request
|
||||
* @return id
|
||||
*/
|
||||
Long createHistoryValue(HistoryValueCreateRequest request);
|
||||
|
||||
/**
|
||||
* 分页查询历史归档
|
||||
*
|
||||
* @param request request
|
||||
* @return rows
|
||||
*/
|
||||
DataGrid<HistoryValueVO> getHistoryValuePage(HistoryValueQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id id
|
||||
* @return value
|
||||
*/
|
||||
HistoryValueDO getHistoryById(Long id);
|
||||
|
||||
/**
|
||||
* 删除历史归档
|
||||
*
|
||||
* @param type type
|
||||
* @param relId relId
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByRelId(String type, Long relId);
|
||||
|
||||
/**
|
||||
* 批量删除历史归档
|
||||
*
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByRelIdList(String type, List<Long> relIdList);
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.orion.ops.module.infra.service;
|
||||
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||
import com.orion.ops.module.infra.entity.request.operator.log.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.operator.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.OperatorLogVO;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.ops.framework.common.constant.Const;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
import com.orion.ops.framework.redis.core.utils.RedisMaps;
|
||||
import com.orion.ops.module.infra.convert.DictKeyConvert;
|
||||
import com.orion.ops.module.infra.dao.DictKeyDAO;
|
||||
import com.orion.ops.module.infra.define.cache.DictCacheKeyDefine;
|
||||
import com.orion.ops.module.infra.entity.domain.DictKeyDO;
|
||||
import com.orion.ops.module.infra.entity.dto.DictKeyCacheDTO;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictKeyVO;
|
||||
import com.orion.ops.module.infra.service.DictKeyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典配置项 服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DictKeyServiceImpl implements DictKeyService {
|
||||
|
||||
@Resource
|
||||
private DictKeyDAO dictKeyDAO;
|
||||
|
||||
@Override
|
||||
public Long createDictKey(DictKeyCreateRequest request) {
|
||||
log.info("DictKeyService-createDictKey request: {}", JSON.toJSONString(request));
|
||||
// 转换
|
||||
DictKeyDO record = DictKeyConvert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.checkDictKeyPresent(record);
|
||||
// 插入
|
||||
int effect = dictKeyDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("DictKeyService-createDictKey id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateDictKeyById(DictKeyUpdateRequest request) {
|
||||
log.info("DictKeyService-updateDictKeyById id: {}, request: {}", request.getId(), JSON.toJSONString(request));
|
||||
// 查询
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
DictKeyDO record = dictKeyDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
DictKeyDO updateRecord = DictKeyConvert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.checkDictKeyPresent(updateRecord);
|
||||
// 更新
|
||||
int effect = dictKeyDAO.updateById(updateRecord);
|
||||
log.info("DictKeyService-updateDictKeyById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY);
|
||||
|
||||
// 修改 value 的 key
|
||||
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictKeyVO> getDictKeyList() {
|
||||
// 查询缓存
|
||||
List<DictKeyCacheDTO> list = RedisMaps.valuesJson(DictCacheKeyDefine.DICT_KEY);
|
||||
if (list.isEmpty()) {
|
||||
// 查询数据库
|
||||
list = dictKeyDAO.of().list(DictKeyConvert.MAPPER::toCache);
|
||||
// 添加默认值 防止穿透
|
||||
if (list.isEmpty()) {
|
||||
list.add(DictKeyCacheDTO.builder()
|
||||
.id(Const.NONE_ID)
|
||||
.build());
|
||||
}
|
||||
// 设置缓存
|
||||
RedisMaps.putAllJson(DictCacheKeyDefine.DICT_KEY.getKey(), s -> s.getId().toString(), list);
|
||||
RedisMaps.setExpire(DictCacheKeyDefine.DICT_KEY);
|
||||
}
|
||||
// 删除默认值
|
||||
return list.stream()
|
||||
.filter(s -> !s.getId().equals(Const.NONE_ID))
|
||||
.map(DictKeyConvert.MAPPER::to)
|
||||
.sorted(Comparator.comparing(DictKeyVO::getId).reversed())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteDictKeyById(Long id) {
|
||||
log.info("DictKeyService-deleteDictKeyById id: {}", id);
|
||||
// 检查数据是否存在
|
||||
DictKeyDO record = dictKeyDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 删除
|
||||
int effect = dictKeyDAO.deleteById(id);
|
||||
log.info("DictKeyService-deleteDictKeyById id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, id);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDeleteDictKeyByIdList(List<Long> idList) {
|
||||
log.info("DictKeyService-batchDeleteDictKeyByIdList idList: {}", idList);
|
||||
int effect = dictKeyDAO.deleteBatchIds(idList);
|
||||
log.info("DictKeyService-batchDeleteDictKeyByIdList effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, idList);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void checkDictKeyPresent(DictKeyDO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<DictKeyDO> wrapper = dictKeyDAO.wrapper()
|
||||
// 更新时忽略当前记录
|
||||
.ne(DictKeyDO::getId, domain.getId())
|
||||
// 用其他字段做重复校验
|
||||
.eq(DictKeyDO::getKey, domain.getKey());
|
||||
// 检查是否存在
|
||||
boolean present = dictKeyDAO.of(wrapper).present();
|
||||
Valid.isFalse(present, ErrorMessage.DATA_PRESENT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.ops.framework.common.constant.Const;
|
||||
import com.orion.ops.framework.common.constant.ErrorMessage;
|
||||
import com.orion.ops.framework.common.utils.Valid;
|
||||
import com.orion.ops.framework.redis.core.utils.RedisMaps;
|
||||
import com.orion.ops.module.infra.convert.DictValueConvert;
|
||||
import com.orion.ops.module.infra.dao.DictKeyDAO;
|
||||
import com.orion.ops.module.infra.dao.DictValueDAO;
|
||||
import com.orion.ops.module.infra.define.cache.DictCacheKeyDefine;
|
||||
import com.orion.ops.module.infra.entity.domain.DictKeyDO;
|
||||
import com.orion.ops.module.infra.entity.domain.DictValueDO;
|
||||
import com.orion.ops.module.infra.entity.dto.DictValueCacheDTO;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictValueUpdateRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.DictValueVO;
|
||||
import com.orion.ops.module.infra.service.DictValueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典配置值 服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DictValueServiceImpl implements DictValueService {
|
||||
|
||||
@Resource
|
||||
private DictKeyDAO dictKeyDAO;
|
||||
|
||||
@Resource
|
||||
private DictValueDAO dictValueDAO;
|
||||
|
||||
@Override
|
||||
public Long createDictValue(DictValueCreateRequest request) {
|
||||
log.info("DictValueService-createDictValue request: {}", JSON.toJSONString(request));
|
||||
// 转换
|
||||
DictValueDO record = DictValueConvert.MAPPER.to(request);
|
||||
// 查询 key 是否存在
|
||||
DictKeyDO key = dictKeyDAO.selectById(request.getKeyId());
|
||||
Valid.notNull(key, ErrorMessage.CONFIG_ABSENT);
|
||||
String keyName = record.getKey();
|
||||
// 查询数据是否冲突
|
||||
this.checkDictValuePresent(record);
|
||||
// 插入
|
||||
int effect = dictValueDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("DictValueService-createDictValue id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_VALUE);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateDictValueById(DictValueUpdateRequest request) {
|
||||
log.info("DictValueService-updateDictValueById id: {}, request: {}", request.getId(), JSON.toJSONString(request));
|
||||
// 查询
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
DictValueDO record = dictValueDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
DictValueDO updateRecord = DictValueConvert.MAPPER.to(request);
|
||||
// 查询数据是否冲突
|
||||
this.checkDictValuePresent(updateRecord);
|
||||
// 更新
|
||||
int effect = dictValueDAO.updateById(updateRecord);
|
||||
log.info("DictValueService-updateDictValueById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_VALUE);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictValueVO getDictValueById(Long id) {
|
||||
// 查询
|
||||
DictValueDO record = dictValueDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 转换
|
||||
return DictValueConvert.MAPPER.to(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictValueVO> getDictValueList(DictValueQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<DictValueDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return dictValueDAO.of(wrapper).list(DictValueConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictValueVO> getDictValueListByCache() {
|
||||
// 查询缓存
|
||||
List<DictValueCacheDTO> list = RedisMaps.valuesJson(DictCacheKeyDefine.DICT_VALUE);
|
||||
if (list.isEmpty()) {
|
||||
// 查询数据库
|
||||
list = dictValueDAO.of().list(DictValueConvert.MAPPER::toCache);
|
||||
// 添加默认值 防止穿透
|
||||
if (list.isEmpty()) {
|
||||
list.add(DictValueCacheDTO.builder()
|
||||
.id(Const.NONE_ID)
|
||||
.build());
|
||||
}
|
||||
// 设置缓存
|
||||
RedisMaps.putAllJson(DictCacheKeyDefine.DICT_VALUE.getKey(), s -> s.getId().toString(), list);
|
||||
RedisMaps.setExpire(DictCacheKeyDefine.DICT_VALUE);
|
||||
}
|
||||
// 删除默认值
|
||||
return list.stream()
|
||||
.filter(s -> !s.getId().equals(Const.NONE_ID))
|
||||
.map(DictValueConvert.MAPPER::to)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<DictValueVO> getDictValuePage(DictValueQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<DictValueDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return dictValueDAO.of(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(DictValueConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteDictValueById(Long id) {
|
||||
log.info("DictValueService-deleteDictValueById id: {}", id);
|
||||
// 检查数据是否存在
|
||||
DictValueDO record = dictValueDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 删除
|
||||
int effect = dictValueDAO.deleteById(id);
|
||||
log.info("DictValueService-deleteDictValueById id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_VALUE, id);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer batchDeleteDictValueByIdList(List<Long> idList) {
|
||||
log.info("DictValueService-batchDeleteDictValueByIdList idList: {}", idList);
|
||||
int effect = dictValueDAO.deleteBatchIds(idList);
|
||||
log.info("DictValueService-batchDeleteDictValueByIdList effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_VALUE, idList);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查对象是否存在
|
||||
*
|
||||
* @param domain domain
|
||||
*/
|
||||
private void checkDictValuePresent(DictValueDO domain) {
|
||||
// 构造条件
|
||||
LambdaQueryWrapper<DictValueDO> wrapper = dictValueDAO.wrapper()
|
||||
// 更新时忽略当前记录
|
||||
.ne(DictValueDO::getId, domain.getId())
|
||||
// 用其他字段做重复校验
|
||||
.eq(DictValueDO::getKeyId, domain.getKeyId())
|
||||
.eq(DictValueDO::getLabel, domain.getLabel());
|
||||
// 检查是否存在
|
||||
boolean present = dictValueDAO.of(wrapper).present();
|
||||
Valid.isFalse(present, ErrorMessage.CONFIG_PRESENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<DictValueDO> buildQueryWrapper(DictValueQueryRequest request) {
|
||||
return dictValueDAO.wrapper()
|
||||
.eq(DictValueDO::getKeyId, request.getKeyId())
|
||||
.eq(DictValueDO::getLabel, request.getLabel())
|
||||
.eq(DictValueDO::getValue, request.getValue())
|
||||
.eq(DictValueDO::getDesc, request.getDesc());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.orion.ops.module.infra.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.ops.module.infra.convert.HistoryValueConvert;
|
||||
import com.orion.ops.module.infra.dao.HistoryValueDAO;
|
||||
import com.orion.ops.module.infra.entity.domain.HistoryValueDO;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.history.HistoryValueQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.HistoryValueVO;
|
||||
import com.orion.ops.module.infra.service.HistoryValueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 历史归档 服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023-10-16 16:33
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HistoryValueServiceImpl implements HistoryValueService {
|
||||
|
||||
@Resource
|
||||
private HistoryValueDAO historyValueDAO;
|
||||
|
||||
@Override
|
||||
public Long createHistoryValue(HistoryValueCreateRequest request) {
|
||||
log.info("HistoryValueService-createHistoryValue request: {}", JSON.toJSONString(request));
|
||||
// 转换
|
||||
HistoryValueDO record = HistoryValueConvert.MAPPER.to(request);
|
||||
// 插入
|
||||
int effect = historyValueDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("HistoryValueService-createHistoryValue id: {}, effect: {}", id, effect);
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGrid<HistoryValueVO> getHistoryValuePage(HistoryValueQueryRequest request) {
|
||||
// 条件
|
||||
LambdaQueryWrapper<HistoryValueDO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
return historyValueDAO.of(wrapper)
|
||||
.page(request)
|
||||
.dataGrid(HistoryValueConvert.MAPPER::to);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoryValueDO getHistoryById(Long id) {
|
||||
return historyValueDAO.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByRelId(String type, Long relId) {
|
||||
log.info("HistoryValueService-deleteByRelId type: {}, relId: {}", type, relId);
|
||||
int effect = historyValueDAO.deleteByRelId(type, relId);
|
||||
log.info("HistoryValueService-deleteByRelId type: {}, effect: {}", type, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByRelIdList(String type, List<Long> relIdList) {
|
||||
log.info("HistoryValueService-deleteByRelIdList type: {}, relIdList: {}", type, relIdList);
|
||||
int effect = historyValueDAO.deleteByRelIdList(type, relIdList);
|
||||
log.info("HistoryValueService-deleteByRelIdList type: {}, effect: {}", type, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询 wrapper
|
||||
*
|
||||
* @param request request
|
||||
* @return wrapper
|
||||
*/
|
||||
private LambdaQueryWrapper<HistoryValueDO> buildQueryWrapper(HistoryValueQueryRequest request) {
|
||||
String searchValue = request.getSearchValue();
|
||||
return historyValueDAO.wrapper()
|
||||
.eq(HistoryValueDO::getRelId, request.getRelId())
|
||||
.eq(HistoryValueDO::getType, request.getType())
|
||||
.and(Strings.isNotEmpty(searchValue), c -> c
|
||||
.eq(HistoryValueDO::getBeforeValue, searchValue).or()
|
||||
.eq(HistoryValueDO::getAfterValue, searchValue)
|
||||
)
|
||||
.orderByDesc(HistoryValueDO::getId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import com.orion.ops.framework.biz.operator.log.core.model.OperatorLogModel;
|
||||
import com.orion.ops.module.infra.convert.OperatorLogConvert;
|
||||
import com.orion.ops.module.infra.dao.OperatorLogDAO;
|
||||
import com.orion.ops.module.infra.entity.domain.OperatorLogDO;
|
||||
import com.orion.ops.module.infra.entity.request.operator.log.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.operator.OperatorLogQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.vo.OperatorLogVO;
|
||||
import com.orion.ops.module.infra.service.OperatorLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orion.ops.module.infra.dao.DictKeyDAO">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.DictKeyDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="key" property="key"/>
|
||||
<result column="value_type" property="valueType"/>
|
||||
<result column="extra_schema" property="extraSchema"/>
|
||||
<result column="desc" property="desc"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, key, value_type, extra_schema, desc, create_time, update_time, creator, updater, deleted
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orion.ops.module.infra.dao.DictValueDAO">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.DictValueDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="key_id" property="keyId"/>
|
||||
<result column="key" property="key"/>
|
||||
<result column="label" property="label"/>
|
||||
<result column="value" property="value"/>
|
||||
<result column="desc" property="desc"/>
|
||||
<result column="extra" property="extra"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="updater" property="updater"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, key_id, key, label, value, desc, extra, sort, create_time, update_time, creator, updater, deleted
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.orion.ops.module.infra.dao.HistoryValueDAO">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.orion.ops.module.infra.entity.domain.HistoryValueDO">
|
||||
<id column="id" property="id"/>
|
||||
<result column="rel_id" property="relId"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="before_value" property="beforeValue"/>
|
||||
<result column="after_value" property="afterValue"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="deleted" property="deleted"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, rel_id, type, before_value, after_value, create_time, creator, deleted
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user