fuliqi
2024-08-20 5985afa7fd58bf6b4efb3c890e41b90864da7831
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -89,12 +89,12 @@
    <select id="selectTMonitorList" resultType="com.ycl.platform.domain.vo.TMonitorVO">
        select m.id, m.serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude,
        camera_capture_area, on_state, civil_code, integrated_device, camera_brand, address, net_working,
        public_security, installed_time, management_unit, mu_contact_info, storage_days
        , monitor_azimuth, scene_photo_addr, model, site_vulgo, camera_type, camera_light_type, encoded_format,
        camera_dept, hybm, lxbm,d.dept_id, d.dept_name from t_monitor m
        left join t_yw_point p on m.serial_number = p.serial_number
        left join sys_dept d on p.dept_id = d.dept_id
        camera_capture_area, on_state, civil_code, d.dept_id, d.dept_name, d.area, p.province_tag,
        IF(COUNT(w.id) OVER() > 0, '是', '否') AS error, u.unit_name from t_monitor m
        left join t_yw_point p on m.serial_number = p.serial_number and p.deleted = 0
        left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0
        left join t_work_order w on m.serial_number = w.serial_number and w.deleted = 0
        left join t_yw_unit u on p.unit_id = u.id and u.deleted = 0
        <where>
            <if test="serialNumber != null  and serialNumber != ''">and m.serial_number = #{serialNumber}</if>
            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
@@ -488,23 +488,29 @@
               tm.camera_dept,
               tm.hybm,
               tm.lxbm,
               dc.prop_name,
               dc.label_value,
               dcv.column_value
               't_monitor' as tableName,
               #{query.keyword} as keyword
        FROM
            t_monitor tm
                LEFT JOIN t_dynamic_column_value dcv ON tm.id = dcv.ref_id
                LEFT JOIN t_dynamic_column dc ON dc.id = dcv.dynamic_column_id AND dc.table_name = #{query.tableName}
        <where>
            <if test="query.keyword != null and query.keyword != ''">
                AND (tm.name like concat('%', #{query.keyword}, '%') OR dcv.column_value like concat('%', #{query.keyword}, '%'))
                AND tm.name like concat('%', #{query.keyword}, '%')
            </if>
        </where>
    </select>
    <delete id="deleteAll">
        delete from t_monitor
    </delete>
    <select id="getDyColumns" resultMap="dynamicColumnMap">
        SELECT
               *
        FROM
             t_dynamic_column_value dcv
                 LEFT JOIN t_dynamic_column dc ON dc.id = dcv.dynamic_column_id AND dc.table_name = #{tableName}
        WHERE
            dcv.ref_id = #{id}
            <if test="keyword != null and keyword != ''">
                and dcv.column_value like concat('%', #{keyword}, '%')
            </if>
    </select>
    <resultMap id="dyMap" type="com.ycl.platform.domain.vo.TMonitorVO">
        <id column="id" property="id"/>
@@ -537,7 +543,7 @@
        <result column="camera_dept" property="cameraDept"/>
        <result column="hybm" property="hybm"/>
        <result column="lxbm" property="lxbm"/>
        <collection property="dynamicColumnList" ofType="com.ycl.platform.domain.vo.DynamicColumnVO" resultMap="dynamicColumnMap"/>
        <collection property="dynamicColumnList" select="getDyColumns" column="{id=id,tableName=tableName,keyword=keyword}" ofType="com.ycl.platform.domain.vo.DynamicColumnVO"/>
    </resultMap>
    <resultMap id="dynamicColumnMap" type="com.ycl.platform.domain.vo.DynamicColumnVO">
@@ -546,4 +552,8 @@
        <result column="column_value" property="columnValue"/>
    </resultMap>
    <delete id="deleteAll">
        delete from t_monitor
    </delete>
</mapper>