2021与蓝度共同重构项目,服务端
liuhaonan
2022-04-24 bef458cd14d2e0f2b09d76b609291f47be3cd525
dao/src/main/resources/mapper/MonitorMapper.xml
@@ -56,11 +56,11 @@
        AND t2.device_type = 7
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            <if test="keyword != null and keyword != ''">
                AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.device_serial LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.note LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t3.pole_code LIKE CONCAT(CONCAT('%', #{keyword}), '%')
            <if test="list != null">
                t1.device_serial IN
                <foreach collection="list" open="(" close=")" separator="," item="deviceCode">
                    #{deviceCode}
                </foreach>
            </if>
            <if test="bindingState != 2">
                AND t1.binding_state = #{bindingState}
@@ -68,13 +68,27 @@
            <if test="equipmentState != 2">
                AND t1.equipment_state = #{equipmentState}
            </if>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
        </where>
    </select>
    <select id="listMonitorDeviceSerial" resultType="java.lang.String">
        SELECT device_serial FROM monitor;
        SELECT
        device_serial
        FROM
        monitor t1
        LEFT JOIN pole_binding t2 ON t1.device_serial = t2.device_code
        AND t2.device_type = 7
        LEFT JOIN pole t3 ON t3.id = t2.pole_id
        <where>
            <if test="userid != null">
                AND (t3.user_id = #{userid} OR t3.client_id = #{userid})
            </if>
            <if test="keyword != null and keyword != ''">
                AND ( t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.device_serial LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t1.note LIKE CONCAT(CONCAT('%', #{keyword}), '%')
                OR t3.pole_code LIKE CONCAT(CONCAT('%', #{keyword}), '%'))
            </if>
        </where>
    </select>
</mapper>