管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-02-05 bfc1c1abd1d1deab45740806ce984b6774a319bd
修改目录编码过滤功能
已修改3个文件
47 ■■■■■ 文件已修改
src/main/java/com/lf/server/controller/show/DataLibController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/show/DataLibService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/all/BaseQueryMapper.xml 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/show/DataLibController.java
@@ -101,7 +101,6 @@
            // 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);
src/main/java/com/lf/server/service/show/DataLibService.java
@@ -287,12 +287,19 @@
            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, "|") + "'";
    }
    /**
@@ -370,13 +377,13 @@
    }
    /**
     * 设置 右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));
@@ -393,7 +400,7 @@
        }
        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;
            }
src/main/resources/mapper/all/BaseQueryMapper.xml
@@ -87,22 +87,23 @@
    </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">