<?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="org.springblade.bank.tellertrunk.mapper.TellerTrunkMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="tellerTrunkResultMap" type="org.springblade.bank.tellertrunk.entity.TellerTrunk">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="bank_no" property="bankNo"/>
        <result column="org_no" property="orgNo"/>
        <result column="org_name" property="orgName"/>
        <result column="check_content" property="checkContent"/>
        <result column="check_time_begin" property="checkTimeBegin"/>
        <result column="check_time_end" property="checkTimeEnd"/>
        <result column="check_unit" property="checkUnit"/>
        <result column="holding_number_unit" property="holdingNumberUnit"/>
        <result column="holding_number_check" property="holdingNumberCheck"/>
        <result column="check_type" property="checkType"/>
        <result column="check_result" property="checkResult"/>
        <result column="check_person_no" property="checkPersonNo"/>
        <result column="check_person_name" property="checkPersonName"/>
        <result column="remark" property="remark"/>
        <result column="filling_date" property="fillingDate"/>
        <result column="filling_person" property="fillingPerson"/>
        <result column="enclosure" property="enclosure"/>
        <result column="enclosure_name" property="enclosureName"/>
    </resultMap>


    <select id="selectTellerTrunkPage" resultMap="tellerTrunkResultMap">
        select * from zh_record_teller_trunk where is_deleted = 0
        <if test="tellerTrunk!=null">
            <if test="tellerTrunk.createUser!=null">
                AND create_user like '%${tellerTrunk.createUser}%'
            </if>
            <if test="tellerTrunk.bankNo!=null">
                AND bank_no = '${tellerTrunk.bankNo}'
            </if>
            <if test="tellerTrunk.checkUnit!=null">
                AND check_unit like '%${tellerTrunk.checkUnit}%'
            </if>
            <if test="tellerTrunk.checkContent!=null">
                AND check_content like '%${tellerTrunk.checkContent}%'
            </if>
            <if test="tellerTrunk.orgNos!=null">
                AND org_no in
                <foreach item="orgNo" collection="tellerTrunk.orgNos" separator="," open="(" close=")" index="">
                    #{orgNo}
                </foreach>
            </if>
            <if test="tellerTrunk.checkTime_begin!=null and tellerTrunk.checkTime_end!=null">
                and (
                check_time_begin BETWEEN '${tellerTrunk.checkTime_begin}' and '${tellerTrunk.checkTime_end}'
                or
                check_time_end BETWEEN '${tellerTrunk.checkTime_begin}' and '${tellerTrunk.checkTime_end}'
                )
            </if>
        </if>
        ORDER BY create_time DESC
    </select>

</mapper>
