| | |
| | | // dirs = DataLibService.copeCodes(dirs, "dircode") |
| | | dirs = dataLibService.getDirsByTypes(types, dirs, "dircode"); |
| | | |
| | | |
| | | int count = metaService.selectMetasForCount(depcode, dirs, name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | |
| | | return null; |
| | | } |
| | | |
| | | List<String> list = Arrays.asList(codes.split(",")); |
| | | //List<String> list = Arrays.asList(codes.split(",")); |
| | | //List<String> list = codesAsList(codes); |
| | | //list = copeDirCodes(list); |
| | | setRightLike(list, field); |
| | | //setRightLike(list, field); |
| | | |
| | | return "(" + StringHelper.join(list, " or ") + ")"; |
| | | //return "(" + StringHelper.join(list, " or ") + ")"; |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | for (String dir : codes.split(",")) { |
| | | list.add("^" + dir); |
| | | } |
| | | |
| | | return field + " ~ '" + StringHelper.join(list, "|") + "'"; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置 右like |
| | | * 设置 右like * |
| | | */ |
| | | private static void setRightLike(List<String> list, String field) { |
| | | /*if (list.isEmpty()) { |
| | | if (list.isEmpty()) { |
| | | list.add("1 = 2"); |
| | | return; |
| | | }*/ |
| | | } |
| | | |
| | | for (int i = 0, c = list.size(); i < c; i++) { |
| | | String str = String.format("%s like '%s%%'", field, list.get(i)); |
| | |
| | | } |
| | | |
| | | if (!StringUtils.isEmpty(types)) { |
| | | List<KeyValueEntity> list = baseQueryService.selectDirsByTypes(types.split(","), dirs); |
| | | List<KeyValueEntity> list = baseQueryService.selectDirsByTypes(types.split(","), copeCodes(dirs, "code")); |
| | | if (null == list || list.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="selectDirsByTypes" resultType="com.lf.server.entity.ctrl.KeyValueEntity"> |
| | | select name "key", (select string_agg(code, ',') from lf.sys_dir where name = a.name) "value" |
| | | from lf.sys_dir a |
| | | <where> |
| | | 1 = 1 |
| | | <if test="types != null"> |
| | | and name in |
| | | with rs as ( |
| | | select name, code |
| | | from lf.sys_dir |
| | | <where> |
| | | name in |
| | | <foreach item="type" collection="types" open="(" separator="," close=")"> |
| | | #{type} |
| | | </foreach> |
| | | </if> |
| | | <if test="dirs != null"> |
| | | and ${dirs} |
| | | </if> |
| | | </where> |
| | | <if test="dirs != null"> |
| | | and ${dirs} |
| | | </if> |
| | | </where> |
| | | ) |
| | | select name "key", (select string_agg(code, ',') from rs where name = a.name) "value" |
| | | from rs a |
| | | group by name |
| | | order by key |
| | | order by value; |
| | | </select> |
| | | |
| | | <select id="selectAnnexByTab" resultType="com.lf.server.entity.sys.AttachEntity"> |