项目结构调整 x 16 : 将 monitor、sms、dict 等组件拆分出去

This commit is contained in:
YunaiV
2021-05-02 15:41:38 +08:00
parent 20066bc864
commit cf4eeab395
305 changed files with 792 additions and 552 deletions

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.framework.dict.config;
import cn.iocoder.yudao.framework.dict.core.service.DictDataFrameworkService;
import cn.iocoder.yudao.framework.dict.core.util.DictUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class DictConfiguration {
@Bean
@SuppressWarnings("InstantiationOfUtilityClass")
public DictUtils dictUtils(DictDataFrameworkService service) {
DictUtils.init(service);
return new DictUtils();
}
}

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.framework.dict.core.dto;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import lombok.Data;
/**
* 字典数据 Response DTO
*
* @author 芋道源码
*/
@Data
public class DictDataRespDTO {
/**
* 字典标签
*/
private String label;
/**
* 字典值
*/
private String value;
/**
* 字典类型
*/
private String dictType;
/**
* 状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.framework.dict.core.service;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import java.util.List;
public interface DictDataFrameworkService {
/**
* 获得指定的字典数据,从缓存中
*
* @param type 字典类型
* @param value 字典数据值
* @return 字典数据
*/
DictDataRespDTO getDictDataFromCache(String type, String value);
/**
* 解析获得指定的字典数据,从缓存中
*
* @param type 字典类型
* @param label 字典数据标签
* @return 字典数据
*/
DictDataRespDTO parseDictDataFromCache(String type, String label);
/**
* 获得指定类型的字典数据,从缓存中
*
* @param type 字典类型
* @return 字典数据列表
*/
List<DictDataRespDTO> listDictDatasFromCache(String type);
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.framework.dict.core.util;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.dict.core.service.DictDataFrameworkService;
import lombok.extern.slf4j.Slf4j;
/**
* 字典工具类
*/
@Slf4j
public class DictUtils {
private static DictDataFrameworkService service;
public static void init(DictDataFrameworkService service) {
DictUtils.service = service;
log.info("[init][初始化 DictUtils 成功]");
}
public static DictDataRespDTO getDictDataFromCache(String type, String value) {
return service.getDictDataFromCache(type, value);
}
public static DictDataRespDTO parseDictDataFromCache(String type, String label) {
return service.getDictDataFromCache(type, label);
}
}

View File

@ -0,0 +1,6 @@
/**
* 字典数据模块,提供 {@link cn.iocoder.yudao.framework.dict.core.util.DictUtils} 工具类
*
* 通过将字典缓存在内存中,保证性能
*/
package cn.iocoder.yudao.framework.dict;