<?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.ningdatech.carapi.company.mapper.NdCompanySecurityProductExecuteMapper">

    <select id="securityProductExecuteList"
            resultType="com.ningdatech.carapi.company.entity.dto.ResSecurityProductExecuteDTO">
        SELECT
        ncspe.file_path AS filePath,
        ncspe.file_type AS fileType,
        ncspe.create_on AS createOn,
        ncspe.name AS name
        FROM nd_company_security_product_execute ncspe
        left join nd_company_info c on ncspe.company_id = c.id
        left join nd_region r on ncspe.region_id = r.id
        <where>
            1 = 1
            AND ncspe.file_type = #{po.fileType}
            <if test="po.startTime != null and po.startTime != ''">
                AND ncspe.create_on <![CDATA[ >= ]]> #{po.startTime}
            </if>

            <if test="po.endTime != null and po.endTime != ''">
                AND ncspe.create_on <![CDATA[ <= ]]> #{po.endTime}
            </if>

            <if test="po.name != null and po.name != ''">
                AND ncspe.name LIKE CONCAT(CONCAT('%',
                #{po.name}),'%')
            </if>
        </where>
        ${po.dataScopeSql}
        ORDER BY ncspe.id DESC
    </select>
</mapper>
