1、新增字典表的查询 2、修改source_system的查询到查询字典表,防止初始没有数据
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.realtime.protection.configuration.entity.dict;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class SysDictData {
|
||||
@JsonProperty("dict_label")
|
||||
@Schema(description = "字典标签")
|
||||
private String dictLabel;
|
||||
|
||||
@JsonProperty("dict_value")
|
||||
@Schema(description = "字典值")
|
||||
private String dictValue;
|
||||
|
||||
@JsonProperty("dict_type")
|
||||
@Schema(description = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
@JsonProperty("dict_remark")
|
||||
@Schema(description = "字典备注")
|
||||
private String dictRemark;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.realtime.protection.server.dictionary;
|
||||
|
||||
import com.realtime.protection.configuration.response.ResponseResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dict")
|
||||
public class DictController {
|
||||
|
||||
private final DictService dictService;
|
||||
|
||||
public DictController(DictService dictService) {
|
||||
this.dictService = dictService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public ResponseResult dictType(@PathVariable String dictType) {
|
||||
return ResponseResult.ok()
|
||||
.setData("dictData", dictService.selectDictDataByType(dictType));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.realtime.protection.server.dictionary;
|
||||
|
||||
import com.realtime.protection.configuration.entity.dict.SysDictData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DictMapper {
|
||||
List<SysDictData> selectDictDataByType(String dictType);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.realtime.protection.server.dictionary;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.realtime.protection.configuration.entity.dict.SysDictData;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@DS("mysql")
|
||||
public class DictService {
|
||||
private final DictMapper dictMapper;
|
||||
|
||||
public DictService(DictMapper dictMapper) {
|
||||
this.dictMapper = dictMapper;
|
||||
}
|
||||
|
||||
public List<SysDictData> selectDictDataByType(String dictType) {
|
||||
return dictMapper.selectDictDataByType(dictType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user