字典表数据获取
This commit is contained in:
@@ -64,7 +64,7 @@ public class DictDetailController {
|
||||
@GetMapping(value = "/map")
|
||||
public ResponseEntity<Object> getDictDetailMaps(@RequestParam String dictName){
|
||||
String[] names = dictName.split("[,,]");
|
||||
Map<String, List<DictDetailDto>> dictMap = new HashMap<>(16);
|
||||
Map<String, List<DictDto>> dictMap = new HashMap<>(16);
|
||||
for (String name : names) {
|
||||
dictMap.put(name, dictDetailService.getDictByName(name));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public interface DictDetailService {
|
||||
* @param name 字典名称
|
||||
* @return /
|
||||
*/
|
||||
List<DictDetailDto> getDictByName(String name);
|
||||
List<DictDto> getDictByName(String name);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
|
||||
@@ -19,6 +19,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -103,8 +104,16 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
|
||||
@Override
|
||||
@Cacheable(key = "'name:' + #p0")
|
||||
public List<DictDetailDto> getDictByName(String name) {
|
||||
return null;
|
||||
public List<DictDto> getDictByName(String name) {
|
||||
List<DictDto> dictDtos = this.findByDictName(name);
|
||||
return dictDtos;
|
||||
}
|
||||
|
||||
private List<DictDto> findByDictName(String name) { // 前端的name就是code
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||
JSONArray jsonArray = wo.query("code = '" + name + "' AND " +
|
||||
"label IS NOT NULL AND label != '' ").getResultJSONArray(0);
|
||||
return jsonArray.toJavaList(DictDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user