吉安感知网项目-后端
linwei
2026-06-09 938d8b3758252931c42368152bcbc60cb27d123c
```
fix(attach): 修复附件查询中resultType参数处理逻辑

- 将resultType参数类型从List<List<String>>改为String
- 实现逗号分隔字符串转换为带引号格式的查询逻辑
- 移除原有的数字类型强制转换和固定值过滤条件
- 保留按创建时间倒序排列的功能
```
2 files modified
17 ■■■■■ changed files
drone-ops/drone-resource/src/main/java/org/sxkj/resource/mapper/AttachMapper.xml 15 ●●●●● patch | view | raw | blame | history
drone-ops/drone-resource/src/main/java/org/sxkj/resource/param/AttachPageParam.java 2 ●●● patch | view | raw | blame | history
drone-ops/drone-resource/src/main/java/org/sxkj/resource/mapper/AttachMapper.xml
@@ -37,9 +37,14 @@
        <if test="attach.nickName!=null and attach.nickName!=''">
            and ba.nick_name like concat('%',#{attach.nickName},'%')
        </if>
        <if test="attach.resultType!=null">
            /* 修改点2:如果 resultType 是字符串传入,也需加权转 */
            and ba.result_type::text = #{attach.resultType}::text
        <if test="attach.resultType!=null and attach.resultType!='' ">
            /* 将逗号分隔的字符串转换为带引号的格式,如 "road,road1" 转为 "\"road\",\"road1\"" */
            and ba.result_type like concat('%',
            (
            select string_agg(concat('"', trim(arr_val), '"'), ',')
            from unnest(string_to_array(#{attach.resultType}, ',')) as arr_val
            ),
            '%')
        </if>
        <if test="attach.deptList != null and attach.deptList.size > 0">
            and ba.create_dept::text in
@@ -47,9 +52,7 @@
                #{deptId}::text
            </foreach>
        </if>
        /* 修改点3:result_type 如果是字符型字段,数字必须加单引号 */
        and ba.result_type::text in ('1','2','3','4','5')
        order by ba.create_time desc, ba.id desc
          order by ba.create_time desc, ba.id desc
    </select>
    <select id="findAiAttachImages" resultType="org.sxkj.resource.vo.AttachVO">
drone-ops/drone-resource/src/main/java/org/sxkj/resource/param/AttachPageParam.java
@@ -12,7 +12,7 @@
    private Long id;
    @ApiModelProperty(value = "附件类型: 1=巡查类文档,2=巡检类文档,3=安保类文档,4=文旅类文档,5=采集数据类文档")
    private List<List<String>> resultType;
    private String resultType;
    /**
     * 附件原名
     */