| | |
| | | package org.jeecg.modules.system.service.impl; |
| | | |
| | | import cn.hutool.core.lang.Validator; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE) |
| | | public String queryTableDictByParams(String table, String text, String codes, String params) { |
| | | log.info("无缓存dictTable queryTableDictByKeys的时候调用这里!"); |
| | | String[] codeArr = codes.split("&&"); |
| | | String[] paramArr = params.split("&&"); |
| | | |
| | | String subSql = ""; |
| | | for (int i = 0; i < codeArr.length; i++) { |
| | | String column = codeArr[i]; |
| | | // 默认参数为空字符串 |
| | | String param = paramArr.length > i ? paramArr[i] : ""; |
| | | if(column == null || ! Validator.isGeneral(column)){ |
| | | log.error("<<<非法字段:" + column); |
| | | return null; |
| | | } |
| | | if(null == param || (!"-1".equals(param) && ! Validator.isGeneralWithChinese(param.replaceAll(" ", "")))){ |
| | | log.error("<<<非法参数:" + param); |
| | | return null; |
| | | } |
| | | |
| | | if(i != 0) subSql += " and "; |
| | | subSql += column+" = '"+param+"'"; |
| | | } |
| | | return sysDictMapper.queryTableDictTextBySubSql(table,text,subSql); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map> queryTableFieldByParams(String queryTable, String[] columns, String paramName, String[] paramValues) { |
| | | String column = ArrayUtil.join(columns, ","); |
| | | return this.baseMapper.queryTableFieldByParams(queryTable, column, paramName, paramValues); |
| | | } |
| | | } |