org.jeecg.common.system.vo.DictModel Java Examples
The following examples show how to use
org.jeecg.common.system.vo.DictModel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SysDictServiceImpl.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 通过查询指定table的 text code 获取字典,包含text和value * dictTableCache采用redis缓存有效期10分钟 * @param table * @param text * @param code * @param keyArray * @return */ @Override @Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE) public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray) { List<DictModel> dicts = sysDictMapper.queryTableDictByKeys(table, text, code, keyArray); List<String> texts = new ArrayList<>(dicts.size()); // 查询出来的顺序可能是乱的,需要排个序 for (String key : keyArray) { for (DictModel dict : dicts) { if (key.equals(dict.getValue())) { texts.add(dict.getText()); break; } } } return texts; }
Example #2
Source File: SysCategoryController.java From jeecg-cloud with Apache License 2.0 | 6 votes |
/** * [列表页面]加载分类字典数据 用于值的替换 * @param code * @return */ @RequestMapping(value = "/loadAllData", method = RequestMethod.GET) public Result<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) { Result<List<DictModel>> result = new Result<List<DictModel>>(); LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>(); if(oConvertUtils.isNotEmpty(code) && !"0".equals(code)){ query.likeRight(SysCategory::getCode,code); } List<SysCategory> list = this.sysCategoryService.list(query); if(list==null || list.size()==0) { result.setMessage("无数据,参数有误.[code]"); result.setSuccess(false); return result; } List<DictModel> rdList = new ArrayList<DictModel>(); for (SysCategory c : list) { rdList.add(new DictModel(c.getId(),c.getName())); } result.setSuccess(true); result.setResult(rdList); return result; }
Example #3
Source File: AutoPoiDictService.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * 通过字典查询easypoi,所需字典文本 * * @Author:scott * @since:2019-04-09 * @return */ @Override public String[] queryDict(String dicTable, String dicCode, String dicText) { List<String> dictReplaces = new ArrayList<String>(); List<DictModel> dictList = null; // step.1 如果没有字典表则使用系统字典表 if (oConvertUtils.isEmpty(dicTable)) { dictList = sysDictMapper.queryDictItemsByCode(dicCode); } else { try { dicText = oConvertUtils.getString(dicText, dicCode); dictList = sysDictMapper.queryTableDictItemsByCode(dicTable, dicText, dicCode); } catch (Exception e) { log.error(e.getMessage(),e); } } for (DictModel t : dictList) { dictReplaces.add(t.getText() + "_" + t.getValue()); } if (dictReplaces != null && dictReplaces.size() != 0) { log.info("---AutoPoi--Get_DB_Dict------"+ dictReplaces.toString()); return dictReplaces.toArray(new String[dictReplaces.size()]); } return null; }
Example #4
Source File: SysCategoryController.java From jeecg-boot-with-activiti with MIT License | 6 votes |
/** * [列表页面]加载分类字典数据 用于值的替换 * @param code * @return */ @RequestMapping(value = "/loadAllData", method = RequestMethod.GET) public Result<List<DictModel>> loadAllData(@RequestParam(name="code",required = true) String code) { Result<List<DictModel>> result = new Result<List<DictModel>>(); LambdaQueryWrapper<SysCategory> query = new LambdaQueryWrapper<SysCategory>(); if(oConvertUtils.isNotEmpty(code) && !"0".equals(code)){ query.likeRight(SysCategory::getCode,code); } List<SysCategory> list = this.sysCategoryService.list(query); if(list==null || list.size()==0) { result.setMessage("无数据,参数有误.[code]"); result.setSuccess(false); return result; } List<DictModel> rdList = new ArrayList<DictModel>(); for (SysCategory c : list) { rdList.add(new DictModel(c.getId(),c.getName())); } result.setSuccess(true); result.setResult(rdList); return result; }
Example #5
Source File: SysDictServiceImpl.java From teaching with Apache License 2.0 | 6 votes |
/** * 通过查询指定table的 text code 获取字典,包含text和value * dictTableCache采用redis缓存有效期10分钟 * @param table * @param text * @param code * @param keyArray * @return */ @Override @Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE) public List<String> queryTableDictByKeys(String table, String text, String code, String[] keyArray) { List<DictModel> dicts = sysDictMapper.queryTableDictByKeys(table, text, code, keyArray); List<String> texts = new ArrayList<>(dicts.size()); // 查询出来的顺序可能是乱的,需要排个序 for (String key : keyArray) { for (DictModel dict : dicts) { if (key.equals(dict.getValue())) { texts.add(dict.getText()); break; } } } return texts; }
Example #6
Source File: SysDictServiceImpl.java From jeecg-cloud with Apache License 2.0 | 6 votes |
@Override public Map<String, List<DictModel>> queryAllDictItems() { 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(); dictModel.setText(item.getItemText()); dictModel.setValue(item.getItemValue()); return dictModel; }).collect(Collectors.toList()); res.put(d.getDictCode(), dictModelList); } log.debug("-------登录加载系统字典-----" + res.toString()); return res; }
Example #7
Source File: SysDictServiceImpl.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 通过查询指定code 获取字典 * @param code * @return */ @Override @Cacheable(value = CacheConstant.SYS_DICT_CACHE,key = "#code") public List<DictModel> queryDictItemsByCode(String code) { log.info("无缓存dictCache的时候调用这里!"); return sysDictMapper.queryDictItemsByCode(code); }
Example #8
Source File: SysDictController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 【APP接口】根据字典配置查询表字典数据 * @param query * @param pageNo * @param pageSize * @return */ @GetMapping("/queryTableData") public Result<List<DictModel>> queryTableData(DictQuery query, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request){ Result<List<DictModel>> res = new Result<List<DictModel>>(); // SQL注入漏洞 sign签名校验 String dictCode = query.getTable()+","+query.getText()+","+query.getCode(); List<DictModel> ls = this.sysDictService.queryDictTablePageList(query,pageSize,pageNo); res.setResult(ls); res.setSuccess(true); return res; }
Example #9
Source File: StringProperty.java From teaching with Apache License 2.0 | 5 votes |
/** * 列表类型的走这个构造器 * @param key 字段名 * @param title 字段备注 * @param view 展示控件 list-checkbox-radio * @param maxLength 数据库字段最大长度 * @param include 数据字典 */ public StringProperty(String key,String title,String view,Integer maxLength,List<DictModel> include) { this.maxLength = maxLength; this.key = key; this.view = view; this.title = title; this.type = "string"; this.include = include; }
Example #10
Source File: StringProperty.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 列表类型的走这个构造器 * @param key 字段名 * @param title 字段备注 * @param view 展示控件 list-checkbox-radio * @param maxLength 数据库字段最大长度 * @param include 数据字典 */ public StringProperty(String key,String title,String view,Integer maxLength,List<DictModel> include) { this.maxLength = maxLength; this.key = key; this.view = view; this.title = title; this.type = "string"; this.include = include; }
Example #11
Source File: SysDictController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 大数据量的字典表 走异步加载 即前端输入内容过滤数据 * @param dictCode * @return */ @RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET) public Result<List<DictModel>> loadDict(@PathVariable String dictCode,@RequestParam(name="keyword") String keyword, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) { log.info(" 加载字典表数据,加载关键字: "+ keyword); Result<List<DictModel>> result = new Result<List<DictModel>>(); List<DictModel> ls = null; try { if(dictCode.indexOf(",")!=-1) { String[] params = dictCode.split(","); if(params.length!=3) { result.error500("字典Code格式不正确!"); return result; } ls = sysDictService.queryTableDictItems(params[0],params[1],params[2],keyword); result.setSuccess(true); result.setResult(ls); log.info(result.toString()); }else { result.error500("字典Code格式不正确!"); } } catch (Exception e) { log.error(e.getMessage(),e); result.error500("操作失败"); return result; } return result; }
Example #12
Source File: SysDictController.java From teaching with Apache License 2.0 | 5 votes |
/** * 大数据量的字典表 走异步加载 即前端输入内容过滤数据 * @param dictCode * @return */ @RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET) public Result<List<DictModel>> loadDict(@PathVariable String dictCode,@RequestParam(name="keyword") String keyword) { log.info(" 加载字典表数据,加载关键字: "+ keyword); Result<List<DictModel>> result = new Result<List<DictModel>>(); List<DictModel> ls = null; try { if(dictCode.indexOf(",")!=-1) { String[] params = dictCode.split(","); if(params.length!=3) { result.error500("字典Code格式不正确!"); return result; } ls = sysDictService.queryTableDictItems(params[0],params[1],params[2],keyword); result.setSuccess(true); result.setResult(ls); log.info(result.toString()); }else { result.error500("字典Code格式不正确!"); } } catch (Exception e) { log.error(e.getMessage(),e); result.error500("操作失败"); return result; } return result; }
Example #13
Source File: SysDictServiceImpl.java From jeecg-boot-with-activiti with MIT License | 5 votes |
/** * 通过查询指定code 获取字典 * @param code * @return */ @Override @Cacheable(value = CacheConstant.SYS_DICT_CACHE,key = "#code") public List<DictModel> queryDictItemsByCode(String code) { log.info("无缓存dictCache的时候调用这里!"); return sysDictMapper.queryDictItemsByCode(code); }
Example #14
Source File: SysDictServiceImpl.java From teaching with Apache License 2.0 | 5 votes |
/** * 通过查询指定code 获取字典 * @param code * @return */ @Override @Cacheable(value = CacheConstant.SYS_DICT_CACHE,key = "#code") public List<DictModel> queryDictItemsByCode(String code) { log.info("无缓存dictCache的时候调用这里!"); return sysDictMapper.queryDictItemsByCode(code); }
Example #15
Source File: AutoPoiDictService.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 通过字典查询easypoi,所需字典文本 * * @Author:scott * @since:2019-04-09 * @return */ @Override public String[] queryDict(String dicTable, String dicCode, String dicText) { List<String> dictReplaces = new ArrayList<String>(); List<DictModel> dictList = null; // step.1 如果没有字典表则使用系统字典表 if (oConvertUtils.isEmpty(dicTable)) { dictList = sysDictMapper.queryDictItemsByCode(dicCode); } else { try { dicText = oConvertUtils.getString(dicText, dicCode); dictList = sysDictMapper.queryTableDictItemsByCode(dicTable, dicText, dicCode); } catch (Exception e) { log.error(e.getMessage(),e); } } for (DictModel t : dictList) { if(t!=null){ dictReplaces.add(t.getText() + "_" + t.getValue()); } } if (dictReplaces != null && dictReplaces.size() != 0) { log.info("---AutoPoi--Get_DB_Dict------"+ dictReplaces.toString()); return dictReplaces.toArray(new String[dictReplaces.size()]); } return null; }
Example #16
Source File: StringProperty.java From jeecg-boot-with-activiti with MIT License | 5 votes |
/** * 列表类型的走这个构造器 * @param key 字段名 * @param title 字段备注 * @param view 展示控件 list-checkbox-radio * @param maxLength 数据库字段最大长度 * @param include 数据字典 */ public StringProperty(String key,String title,String view,Integer maxLength,List<DictModel> include) { this.maxLength = maxLength; this.key = key; this.view = view; this.title = title; this.type = "string"; this.include = include; }
Example #17
Source File: SysDictController.java From jeecg-cloud with Apache License 2.0 | 5 votes |
/** * 获取全部字典数据 * * @return */ @RequestMapping(value = "/queryAllDictItems", method = RequestMethod.GET) public Result<?> queryAllDictItems(HttpServletRequest request) { Map<String, List<DictModel>> res = new HashMap<String, List<DictModel>>(); res = sysDictService.queryAllDictItems(); return Result.ok(res); }
Example #18
Source File: CommonProperty.java From teaching with Apache License 2.0 | 4 votes |
public void setInclude(List<DictModel> include) { this.include = include; }
Example #19
Source File: SysDictServiceImpl.java From jeecg-boot-with-activiti with MIT License | 4 votes |
@Override public List<DictModel> queryTableDictItems(String table, String text, String code, String keyword) { return baseMapper.queryTableDictItems(table, text, code, "%"+keyword+"%"); }
Example #20
Source File: SysDictServiceImpl.java From teaching with Apache License 2.0 | 4 votes |
@Override public List<DictModel> queryTableDictItems(String table, String text, String code, String keyword) { return baseMapper.queryTableDictItems(table, text, code, "%"+keyword+"%"); }
Example #21
Source File: CommonProperty.java From teaching with Apache License 2.0 | 4 votes |
public List<DictModel> getInclude() { return include; }
Example #22
Source File: SysDictServiceImpl.java From jeecg-boot-with-activiti with MIT License | 4 votes |
@Override public List<DictModel> queryAllUserBackDictModel() { return baseMapper.queryAllUserBackDictModel(); }
Example #23
Source File: SysDictServiceImpl.java From jeecg-boot-with-activiti with MIT License | 4 votes |
@Override public List<DictModel> queryAllDepartBackDictModel() { return baseMapper.queryAllDepartBackDictModel(); }
Example #24
Source File: CommonProperty.java From jeecg-cloud with Apache License 2.0 | 4 votes |
public void setInclude(List<DictModel> include) { this.include = include; }
Example #25
Source File: SysDictController.java From teaching with Apache License 2.0 | 4 votes |
/** * 获取字典数据 * @param dictCode 字典code * @param dictCode 表名,文本字段,code字段 | 举例:sys_user,realname,id * @return */ @RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET) public Result<List<DictModel>> getDictItems(@PathVariable String dictCode) { log.info(" dictCode : "+ dictCode); Result<List<DictModel>> result = new Result<List<DictModel>>(); List<DictModel> ls = null; try { if(dictCode.indexOf(",")!=-1) { //关联表字典(举例:sys_user,realname,id) String[] params = dictCode.split(","); if(params.length<3) { result.error500("字典Code格式不正确!"); return result; } //SQL注入校验(只限制非法串改数据库) final String[] sqlInjCheck = {params[0],params[1],params[2]}; SqlInjectionUtil.filterContent(sqlInjCheck); if(params.length==4) { //SQL注入校验(查询条件SQL 特殊check,此方法仅供此处使用) SqlInjectionUtil.specialFilterContent(params[3]); ls = sysDictService.queryTableDictItemsByCodeAndFilter(params[0],params[1],params[2],params[3]); }else if (params.length==3) { ls = sysDictService.queryTableDictItemsByCode(params[0],params[1],params[2]); }else{ result.error500("字典Code格式不正确!"); return result; } }else { //字典表 ls = sysDictService.queryDictItemsByCode(dictCode); } result.setSuccess(true); result.setResult(ls); log.info(result.toString()); } catch (Exception e) { log.error(e.getMessage(),e); result.error500("操作失败"); return result; } return result; }
Example #26
Source File: SysBaseApiImpl.java From jeecg-boot-with-activiti with MIT License | 4 votes |
@Override public DictModel getParentDepartId(String departId) { SysDepart depart = departMapper.getParentDepartId(departId); DictModel model = new DictModel(depart.getId(),depart.getParentId()); return model; }
Example #27
Source File: SysDictController.java From jeecg-boot-with-activiti with MIT License | 4 votes |
/** * 获取字典数据 * @param dictCode 字典code * @param dictCode 表名,文本字段,code字段 | 举例:sys_user,realname,id * @return */ @RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET) public Result<List<DictModel>> getDictItems(@PathVariable String dictCode) { log.info(" dictCode : "+ dictCode); Result<List<DictModel>> result = new Result<List<DictModel>>(); List<DictModel> ls = null; try { if(dictCode.indexOf(",")!=-1) { //关联表字典(举例:sys_user,realname,id) String[] params = dictCode.split(","); if(params.length<3) { result.error500("字典Code格式不正确!"); return result; } //SQL注入校验(只限制非法串改数据库) final String[] sqlInjCheck = {params[0],params[1],params[2]}; SqlInjectionUtil.filterContent(sqlInjCheck); if(params.length==4) { //SQL注入校验(查询条件SQL 特殊check,此方法仅供此处使用) SqlInjectionUtil.specialFilterContent(params[3]); ls = sysDictService.queryTableDictItemsByCodeAndFilter(params[0],params[1],params[2],params[3]); }else if (params.length==3) { ls = sysDictService.queryTableDictItemsByCode(params[0],params[1],params[2]); }else{ result.error500("字典Code格式不正确!"); return result; } }else { //字典表 ls = sysDictService.queryDictItemsByCode(dictCode); } result.setSuccess(true); result.setResult(ls); log.info(result.toString()); } catch (Exception e) { log.error(e.getMessage(),e); result.error500("操作失败"); return result; } return result; }
Example #28
Source File: CommonProperty.java From jeecg-boot-with-activiti with MIT License | 4 votes |
public void setInclude(List<DictModel> include) { this.include = include; }
Example #29
Source File: CommonProperty.java From jeecg-boot-with-activiti with MIT License | 4 votes |
public List<DictModel> getInclude() { return include; }
Example #30
Source File: ISysBaseAPI.java From jeecg-boot-with-activiti with MIT License | 4 votes |
/** 查询所有的父级字典,按照create_time排序 */ public List<DictModel> queryAllDict();