吉安感知网项目-后端
linwei
2026-06-09 938d8b3758252931c42368152bcbc60cb27d123c
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">