吉安感知网项目-后端
linwei
2026-07-08 79c2d5fa54ca680f5fc439b3607d7f0482a2ff32
drone-ops/drone-resource/src/main/java/org/sxkj/resource/mapper/AttachMapper.xml
@@ -18,10 +18,11 @@
        <result column="original_name" property="originalName"/>
        <result column="extension" property="extension"/>
        <result column="attach_size" property="attachSize"/>
        <result column="result_type" property="resultType" typeHandler="org.sxkj.common.handler.GenericListTypeHandler"/>
    </resultMap>
    <!--自定义分页查询-->
    <select id="selectAttachPage" resultType="org.sxkj.resource.vo.AttachVO">
    <select id="selectAttachPage" resultMap="attachResultMap" >
        select
        ba.*,
        bd.dept_name,
@@ -36,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
@@ -46,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">