feat: 字典配置前端代码.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.orion.ops.module.infra.entity.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 字典配置项额外参数类型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2023/10/20 18:06
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DictKeyExtraSchemaDTO {
|
||||
|
||||
/**
|
||||
* 参数
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数据类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -40,6 +40,7 @@ public class DictKeyCreateRequest implements Serializable {
|
||||
@Schema(description = "额外配置定义")
|
||||
private String extraSchema;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Schema(description = "配置描述")
|
||||
private String description;
|
||||
|
||||
@@ -45,6 +45,7 @@ public class DictKeyUpdateRequest implements Serializable {
|
||||
@Schema(description = "额外配置定义")
|
||||
private String extraSchema;
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 64)
|
||||
@Schema(description = "配置描述")
|
||||
private String description;
|
||||
|
||||
@@ -24,6 +24,10 @@ public class DictValueQueryRequest extends PageRequest {
|
||||
@Schema(description = "配置项id")
|
||||
private Long keyId;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置项名称")
|
||||
private String keyName;
|
||||
|
||||
@Size(max = 32)
|
||||
@Schema(description = "配置名称")
|
||||
private String name;
|
||||
|
||||
@@ -13,11 +13,13 @@ 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.framework.redis.core.utils.RedisStrings;
|
||||
import com.orion.ops.framework.redis.core.utils.RedisUtils;
|
||||
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.dto.DictKeyExtraSchemaDTO;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyQueryRequest;
|
||||
import com.orion.ops.module.infra.entity.request.dict.DictKeyUpdateRequest;
|
||||
@@ -90,7 +92,7 @@ public class DictKeyServiceImpl implements DictKeyService {
|
||||
dictValueService.updateKeyNameByKeyId(id, record.getKeyName(), request.getKeyName());
|
||||
}
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY,
|
||||
RedisUtils.delete(DictCacheKeyDefine.DICT_KEY.getKey(),
|
||||
DictCacheKeyDefine.DICT_SCHEMA.format(record.getKeyName()));
|
||||
log.info("DictKeyService-updateDictKeyById effect: {}", effect);
|
||||
return effect;
|
||||
@@ -147,7 +149,10 @@ public class DictKeyServiceImpl implements DictKeyService {
|
||||
cacheResult.put(Const.VALUE, dictKey.getValueType());
|
||||
String extraSchema = dictKey.getExtraSchema();
|
||||
if (extraSchema != null) {
|
||||
cacheResult.putAll(JSON.parseObject(extraSchema));
|
||||
List<DictKeyExtraSchemaDTO> schemas = JSON.parseArray(extraSchema, DictKeyExtraSchemaDTO.class);
|
||||
for (DictKeyExtraSchemaDTO schema : schemas) {
|
||||
cacheResult.put(schema.getName(), schema.getType());
|
||||
}
|
||||
}
|
||||
// 设置缓存
|
||||
RedisStrings.setJson(cacheKey, DictCacheKeyDefine.DICT_SCHEMA, cacheResult);
|
||||
@@ -173,8 +178,8 @@ public class DictKeyServiceImpl implements DictKeyService {
|
||||
// 删除配置值
|
||||
dictValueService.deleteDictValueByKeyId(id);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, id);
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_SCHEMA.format(record.getKeyName()));
|
||||
RedisUtils.delete(DictCacheKeyDefine.DICT_KEY.getKey(),
|
||||
DictCacheKeyDefine.DICT_SCHEMA.format(record.getKeyName()));
|
||||
log.info("DictKeyService-deleteDictKeyById id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
}
|
||||
@@ -197,7 +202,7 @@ public class DictKeyServiceImpl implements DictKeyService {
|
||||
dictValueService.deleteDictValueByKeyIdList(idList);
|
||||
log.info("DictKeyService-deleteDictKeyByIdList effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, idList);
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY);
|
||||
List<String> schemaKeys = dictKeys.stream()
|
||||
.map(DictKeyDO::getKeyName)
|
||||
.map(DictCacheKeyDefine.DICT_SCHEMA::format)
|
||||
|
||||
@@ -345,6 +345,7 @@ public class DictValueServiceImpl implements DictValueService {
|
||||
private LambdaQueryWrapper<DictValueDO> buildQueryWrapper(DictValueQueryRequest request) {
|
||||
return dictValueDAO.wrapper()
|
||||
.eq(DictValueDO::getKeyId, request.getKeyId())
|
||||
.like(DictValueDO::getKeyName, request.getKeyName())
|
||||
.like(DictValueDO::getName, request.getName())
|
||||
.eq(DictValueDO::getValue, request.getValue())
|
||||
.like(DictValueDO::getLabel, request.getLabel())
|
||||
|
||||
Reference in New Issue
Block a user