<?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.zcloud.primeport.persistence.mapper.ClosedAreaCarApplyMapper">

    <select id="listPage" resultType="com.zcloud.primeport.persistence.dataobject.ClosedAreaCarApplyDO">
        select c.*,c.create_name  from closed_area_car_apply c
        where c.delete_enum = 'FALSE'
        <if test="params.processOrRecord != null">
            <if test="params.processOrRecord == 1">
                AND c.audit_flag = 1
            </if>
            <if test="params.processOrRecord == 2">
                AND c.audit_flag != 1
            </if>
        </if>
        <if test="params.carBelongType != null">
            <if test="params.carBelongType == 4">
                AND c.car_belong_type = 4
            </if>
            <if test="params.carBelongType == 1">
                AND c.car_belong_type = 1
            </if>
            <if test="params.carBelongType == 2">
                AND c.car_belong_type = 2
            </if>
            <if test="params.carBelongType == 3">
                AND c.car_belong_type = 3
            </if>
            <if test="params.carBelongType == -1">
                AND c.car_belong_type != 4
            </if>
        </if>
        <if test="params.auditFlag != null">
                AND c.audit_flag = #{params.auditFlag}
        </if>
        <if test="params.applyPersonUserName != null and params.applyPersonUserName != ''">
            AND c.apply_person_user_name like CONCAT('%', #{params.applyPersonUserName}, '%')
        </if>
        <if test="params.licenceNo != null and params.licenceNo != ''">
            AND c.licence_no like CONCAT('%', #{params.licenceNo}, '%')
        </if>
        order by c.id desc
    </select>

</mapper>

