<?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.SupvFileMapper">

    <select id="selectPlanFile" resultType="com.njcn.process.pojo.po.SupvFile">
        select
            sp.work_plan_name busiName,
            sf.*
        from
            supv_file sf
        INNER JOIN supv_plan sp on sp.plan_Id= sf.busi_Id
        <where>
            <if test="param!=null and param.ids != null and param.ids.size > 0">
                AND busi_Id IN
                <foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
            <if test="param!=null and param.type != null ">
                AND sf.type = #{param.type}
            </if>
            <if test="param!=null and param.attachmentType != null and param.attachmentType != ''">
                AND sf.attachment_Type = #{param.attachmentType}
            </if>
        </where>
    </select>

    <select id="selecProblemtFile" resultType="com.njcn.process.pojo.po.SupvFile">
        select
            sp.simple_Problem_Desc busiName,
            sf.*
        from
            supv_file sf
        INNER JOIN supv_problem sp on sp.problem_Id= sf.busi_Id
        <where>
            <if test="param!=null and param.ids != null and param.ids.size > 0">
                AND busi_Id IN
                <foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
                    #{item}
                </foreach>
            </if>
            <if test="param!=null and param.type != null ">
                AND sf.type = #{param.type}
            </if>
            <if test="param!=null and param.attachmentType != null and param.attachmentType != ''">
                AND sf.attachment_Type = #{param.attachmentType}
            </if>
        </where>
    </select>
</mapper>
