初始化 spring cloud 项目的 system 和 infra 模块

This commit is contained in:
YunaiV
2022-06-01 23:59:01 +08:00
parent fcc5180ebf
commit 12e2ce99e1
1138 changed files with 65636 additions and 134 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.DictFrameworkUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class YudaoDictAutoConfiguration {
@Bean
@SuppressWarnings("InstantiationOfUtilityClass")
public DictFrameworkUtils dictUtils(DictDataFrameworkService service) {
DictFrameworkUtils.init(service);
return new DictFrameworkUtils();
}
}

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 DictFrameworkUtils {
private static DictDataFrameworkService service;
public static void init(DictDataFrameworkService service) {
DictFrameworkUtils.service = service;
log.info("[init][初始化 DictFrameworkUtils 成功]");
}
public static DictDataRespDTO getDictDataFromCache(String type, String value) {
return service.getDictDataFromCache(type, value);
}
public static DictDataRespDTO parseDictDataFromCache(String type, String label) {
return service.parseDictDataFromCache(type, label);
}
}

View File

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

View File

@@ -0,0 +1,2 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.iocoder.yudao.framework.dict.config.YudaoDictAutoConfiguration