Commit 3965e1da by fsn

字典管理表格增加详情一列

parent d7202e51
package com.stylefeng.guns.common.constant.factory; package com.stylefeng.guns.common.constant.factory;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.common.constant.cache.Cache; import com.stylefeng.guns.common.constant.cache.Cache;
import com.stylefeng.guns.common.constant.cache.CacheKey; import com.stylefeng.guns.common.constant.cache.CacheKey;
import com.stylefeng.guns.common.constant.state.ManagerStatus; import com.stylefeng.guns.common.constant.state.ManagerStatus;
...@@ -10,13 +11,17 @@ import com.stylefeng.guns.core.util.Convert; ...@@ -10,13 +11,17 @@ import com.stylefeng.guns.core.util.Convert;
import com.stylefeng.guns.core.util.SpringContextHolder; import com.stylefeng.guns.core.util.SpringContextHolder;
import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.persistence.dao.DeptMapper; import com.stylefeng.guns.persistence.dao.DeptMapper;
import com.stylefeng.guns.persistence.dao.DictMapper;
import com.stylefeng.guns.persistence.dao.RoleMapper; import com.stylefeng.guns.persistence.dao.RoleMapper;
import com.stylefeng.guns.persistence.model.Dept; import com.stylefeng.guns.persistence.model.Dept;
import com.stylefeng.guns.persistence.model.Dict;
import com.stylefeng.guns.persistence.model.Role; import com.stylefeng.guns.persistence.model.Role;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.DependsOn; import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
/** /**
* 常量的生产工厂 * 常量的生产工厂
* *
...@@ -29,6 +34,7 @@ public class ConstantFactory { ...@@ -29,6 +34,7 @@ public class ConstantFactory {
private RoleMapper roleMapper = SpringContextHolder.getBean(RoleMapper.class); private RoleMapper roleMapper = SpringContextHolder.getBean(RoleMapper.class);
private DeptMapper deptMapper = SpringContextHolder.getBean(DeptMapper.class); private DeptMapper deptMapper = SpringContextHolder.getBean(DeptMapper.class);
private DictMapper dictMapper = SpringContextHolder.getBean(DictMapper.class);
public static ConstantFactory me() { public static ConstantFactory me() {
return SpringContextHolder.getBean("constantFactory"); return SpringContextHolder.getBean("constantFactory");
...@@ -113,4 +119,21 @@ public class ConstantFactory { ...@@ -113,4 +119,21 @@ public class ConstantFactory {
return MenuStatus.valueOf(status); return MenuStatus.valueOf(status);
} }
/**
* 查询字典
*/
public List<Dict> findInDict(Integer id){
if(ToolUtil.isEmpty(id)){
return null;
}else{
EntityWrapper<Dict> wrapper = new EntityWrapper<>();
List<Dict> dicts = dictMapper.selectList(wrapper.eq("pid", id));
if(dicts == null || dicts.size() == 0){
return null;
}else{
return dicts;
}
}
}
} }
package com.stylefeng.guns.modular.system.warpper; package com.stylefeng.guns.modular.system.warpper;
import com.stylefeng.guns.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.common.warpper.BaseControllerWarpper; import com.stylefeng.guns.common.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.persistence.model.Dict;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -18,8 +22,15 @@ public class DictWarpper extends BaseControllerWarpper { ...@@ -18,8 +22,15 @@ public class DictWarpper extends BaseControllerWarpper {
@Override @Override
public void warpTheMap(Map<String, Object> map) { public void warpTheMap(Map<String, Object> map) {
StringBuffer detail = new StringBuffer();
Integer id = (Integer) map.get("id");
List<Dict> dicts = ConstantFactory.me().findInDict(id);
if(dicts != null){
for (Dict dict : dicts) {
detail.append(dict.getNum() + ":" +dict.getName() + ",");
}
map.put("detail", ToolUtil.removeSuffix(detail.toString(),","));
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment