<?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.process.mapper.RStatElectricQualityProblemFlowMapper">

    <select id="getIssues" resultType="com.njcn.process.pojo.vo.IssuesVO">
        SELECT
            *
        FROM
            r_stat_electric_quality_problem_flow
        WHERE
        data_date between #{dateBegin} AND #{dateEnd}
        <if test="deptIds !=null  and deptIds.size() >0">
        AND org_no in
                <foreach collection="deptIds" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>

        </if>
        <if test="param.problemSources !=null  and param.problemSources !=''">
            AND problem_sources = #{param.problemSources}
        </if>
        <if test="param.reportProcess !=null  and param.reportProcess !=''">
            AND report_process = #{param.reportProcess}
        </if>
        <if test="param.reportProcessStatus !=null  and param.reportProcessStatus !=''">
            AND report_process_status = #{param.reportProcessStatus}
        </if>
        <if test="param.problemName !=null  and param.problemName !=''">
            AND problem_name like CONCAT(CONCAT('%', #{param.problemName}), '%')
        </if>
    </select>
</mapper>
