2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-01-05 d5c71f3c85e9370100559e86e1081c44b1cc15df
dao/src/main/resources/mapper/MonitorMapper.xml
@@ -46,11 +46,47 @@
           t1.id DESC
    </select>
    <select id="listMonitorId" resultType="java.lang.Long">
        SELECT
        MAX(t1.id) AS air_equipment_id
        FROM
        monitor t1
        <if test="keyword != null and keyword != ''">
            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
        </if>
        <where>
            <if test="keyword != null and keyword != ''">
                AND t3.pole_name LIKE CONCAT(CONCAT('%', #{keyword}), '%')
            </if>
            <if test="clientId != null">
                AND t3.client_id = #{clientId}
            </if>
            <if test="bindingState != 2">
                AND t1.binding_state = #{bindingState}
            </if>
        </where>
        GROUP BY
        t1.device_serial
    </select>
    <select id="listMonitorByIds" resultType="com.sandu.ximon.dao.bo.MonitorBo">
        SELECT
        t1.*, t2.pole_id,
        t3.pole_name
        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>
            t1.id IN
            <foreach collection="airEquipmentIdList" open="(" close=")" item="airId" separator=",">
                #{airId}
            </foreach>
        </where>
    </select>
</mapper>
        <!--        SELECT    * FROM   (SELECT    * FROM    (SELECT    * FROM    monitor AS table1-->
        <!--        WHERE device_serial  LIKE CONCAT(CONCAT('%', #{keyword}), '%')-->
        <!--        OR belong_to  LIKE CONCAT(CONCAT('%', #{keyword}), '%')) AS table2-->
        <!--        WHERE equipment_status = #{equipmentState1}-->
        <!--        OR equipment_status = #{equipmentState2}) AS table3-->
        <!--        WHERE binding_state = #{bindingState1} OR binding_state = #{bindingState2};-->