<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.device.pms.mapper.majornetwork.RStatTargetDetailMapper">

    <!--获取主网数据质量-稳态指标类数据质量问题查询-->
    <select id="getRStatTargetDetail" resultType="com.njcn.device.pms.pojo.po.RStatTargetDetailPO">
        SELECT
        data_date AS dataDate,
        check_rules AS checkRules,
        measurement_point_id AS measurementPointId,
        target_type AS targetType
        FROM
        r_stat_target_detail
        <where>
            <if test="param!=null and param.checkRules!=null and param.checkRules.size()!=0">
                AND check_rules IN
                <foreach collection="param.checkRules" item="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
            and measurement_point_id IN
            <foreach collection="monitorIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
            <if test="param.startTime != null and param.startTime != ''">
                AND DATE_FORMAT(data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{param.startTime}, '%Y-%m-%d')
            </if>
            <if test="param.endTime != null and param.endTime != ''">
                AND DATE_FORMAT(data_date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{param.endTime}, '%Y-%m-%d')
            </if>
        </where>
    </select>
</mapper>