文档库--数据字典内容中英文切换
This commit is contained in:
+13
@@ -183,6 +183,19 @@ public class SysDictController {
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部字典数据(中英文切换)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "字典控制器-获取全部字典数据", notes = "字典控制器-获取全部字典数据")
|
||||
@RequestMapping(value = "/queryAllDictItemsByCut", method = RequestMethod.GET)
|
||||
public Result<?> queryAllDictItemsByCut(HttpServletRequest request,String cut) {
|
||||
Map<String, List<DictModel>> res = new HashMap<String, List<DictModel>>();
|
||||
res = sysDictService.queryAllDictItemsByCut(cut);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典数据
|
||||
* @param dictCode
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ public interface ISysDictService extends IService<SysDict> {
|
||||
public List<DictModel> queryDictItemsByCode(String code);
|
||||
|
||||
public Map<String,List<DictModel>> queryAllDictItems();
|
||||
public Map<String,List<DictModel>> queryAllDictItemsByCut(String cut);
|
||||
|
||||
@Deprecated
|
||||
List<DictModel> queryTableDictItemsByCode(String table, String text, String code);
|
||||
|
||||
+26
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.CacheConstant;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.vo.DictModel;
|
||||
import com.jero.common.system.vo.DictQuery;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
@@ -88,6 +89,31 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<DictModel>> queryAllDictItemsByCut(String cut) {
|
||||
Map<String, List<DictModel>> res = new HashMap<String, List<DictModel>>();
|
||||
List<SysDict> ls = sysDictMapper.selectList(null);
|
||||
LambdaQueryWrapper<SysDictItem> queryWrapper = new LambdaQueryWrapper<SysDictItem>();
|
||||
queryWrapper.eq(SysDictItem::getStatus, 1);
|
||||
queryWrapper.orderByAsc(SysDictItem::getSortOrder);
|
||||
List<SysDictItem> sysDictItemList = sysDictItemMapper.selectList(queryWrapper);
|
||||
for (SysDict d : ls) {
|
||||
List<DictModel> dictModelList = sysDictItemList.stream().filter(s -> d.getId().equals(s.getDictId())).map(item -> {
|
||||
DictModel dictModel = new DictModel();
|
||||
if(CutEnum.CN.getValue().equals(cut)){
|
||||
dictModel.setText(item.getItemText());
|
||||
}else{
|
||||
dictModel.setText(item.getEnName());
|
||||
}
|
||||
dictModel.setValue(item.getItemValue());
|
||||
return dictModel;
|
||||
}).collect(Collectors.toList());
|
||||
res.put(d.getDictCode(), dictModelList);
|
||||
}
|
||||
log.debug("-------登录加载系统字典-----" + res.toString());
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过查询指定code 获取字典值text
|
||||
* @param code
|
||||
|
||||
Reference in New Issue
Block a user