| | |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("每页页数或分页数小于1", null); |
| | | } |
| | | dirs = DataLibService.copeCodes(dirs, "dircode"); |
| | | // dirs = DataLibService.copeCodes(dirs, "dircode") |
| | | dirs = dataLibService.getDirsByTypes(types, dirs, "dircode"); |
| | | |
| | | |
| | | int count = metaService.selectMetasForCount(depcode, dirs, name); |
| | |
| | | * @param dirs |
| | | * @return |
| | | */ |
| | | public List<KeyValueEntity> selectDirsByTypes(String types, String dirs); |
| | | public List<KeyValueEntity> selectDirsByTypes(String[] types, String dirs); |
| | | |
| | | /** |
| | | * 根据表名查询附件 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<KeyValueEntity> selectDirsByTypes(String types, String dirs) { |
| | | public List<KeyValueEntity> selectDirsByTypes(String[] types, String dirs) { |
| | | return baseQueryMapper.selectDirsByTypes(types, dirs); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if (!StringUtils.isEmpty(types)) { |
| | | List<KeyValueEntity> list = baseQueryService.selectDirsByTypes(types, dirs); |
| | | List<KeyValueEntity> list = baseQueryService.selectDirsByTypes(types.split(","), dirs); |
| | | if (null == list || list.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 处理目录编码 |
| | | * 处理目录编码:dircode ~ '^0A|^0E' |
| | | */ |
| | | public static String copeDirs(List<KeyValueEntity> kvs, String field) { |
| | | List<String> list = new ArrayList<>(); |
| | | for (KeyValueEntity kv : kvs) { |
| | | String[] dirs = kv.getValue().split(","); |
| | | for (String dir : dirs) { |
| | | list.add(String.format("%s like '%s%%'", field, dir)); |
| | | list.add("^" + dir); |
| | | } |
| | | } |
| | | |
| | | return "(" + StringHelper.join(list, " or ") + ")"; |
| | | return field + " ~ '" + StringHelper.join(list, "|") + "'"; |
| | | } |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="selectDirsByTypes" resultType="com.lf.server.entity.ctrl.KeyValueEntity"> |
| | | select (select string_agg(code, ',') from lf.sys_dir where name = a.name) "key", name "value" |
| | | select name "key", (select string_agg(code, ',') from lf.sys_dir where name = a.name) "value" |
| | | from lf.sys_dir a |
| | | <where> |
| | | 1 = 1 |