<?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="cn.iocoder.yudao.module.inspection.mapper.InspectionFileMapper">



    <select id="selectInspectionFileList"  resultType="cn.iocoder.yudao.module.inspection.entity.InspectionFile">
        select * from inspection_file
        <where>
            and  partner_id = #{vo.partnerId}
            <choose>
                <when test="vo.fatherId != null  and vo.fatherId != ''">
                    and father_id = #{vo.fatherId}
                </when>
                <otherwise>
                    and father_id is null
                </otherwise>
            </choose>
            <if test="vo.type != null  and vo.type != ''"> and type = #{vo.type}</if>
            <if test="vo.fileName != null  and vo.fileName != ''"> and file_name like concat('%', #{vo.fileName}, '%')</if>
            <if test="params.beginWarnTime != null and params.beginWarnTime != '' and params.endWarnTime != null and params.endWarnTime != ''"> and warn_time between #{params.beginWarnTime} and #{params.endWarnTime}</if>
        </where>
        order by `type` ASC,create_time desc
    </select>

    <select id="selectInspectionFileById" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionFile">
         select * from inspection_file
        where id = #{id}
    </select>
</mapper>
