<?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.yifu.cloud.plus.v1.yifu.archives.mapper.TProveApplyMapper">
    <resultMap id="tProveApplyMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TProveApply">
        <id property="id" column="id"/>
        <result property="employeeInfo" column="employee_info"/>
        <result property="creatUser" column="creat_user"/>
        <result property="creatDate" column="creat_date"/>
        <result property="startMonth" column="start_month"/>
        <result property="endMonth" column="end_month"/>
        <result property="proveSalary" column="prove_salary"/>
        <result property="applyReason" column="apply_reason"/>
        <result property="auditStatus" column="audit_status"/>
        <result property="auditUser" column="audit_user"/>
        <result property="auditDate" column="audit_date"/>
        <result property="sumType" column="sum_type"/>
        <result property="salary" column="salary"/>
        <result property="employeeName" column="EMPLOYEE_NAME"/>
        <result property="employeeIdCard" column="EMPLOYEE_ID_CARD"/>
        <result property="settleDomainName" column="SETTLE_DOMAIN_NAME"/>
        <result property="creatUserName" column="CREAT_USER_NAME"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.id,
             a.employee_info,
             a.creat_user,
             a.creat_date,
             a.start_month,
             a.end_month,
             a.prove_salary,
             a.apply_reason,
             a.audit_status,
             a.audit_user,
             a.audit_date,
             a.sum_type,
             a.salary,
             a.EMPLOYEE_NAME,
             a.EMPLOYEE_ID_CARD,
             a.SETTLE_DOMAIN_NAME,
             a.AUDIT_USER_NAME,
             a.CREAT_USER_NAME
     </sql>
    <sql id="tProveApply_where">
        <if test="tProveApply != null">
            <if test="tProveApply.employeeIdCard != null and tProveApply.employeeIdCard.trim() != ''">
                AND a.EMPLOYEE_ID_CARD like '%${tProveApply.employeeIdCard}%'
            </if>
            <if test="tProveApply.employeeName != null and tProveApply.employeeName.trim() != ''">
                AND a.EMPLOYEE_NAME like '%${tProveApply.employeeName}%'
            </if>
            <if test="tProveApply.employeeInfo != null and tProveApply.employeeInfo.trim() != ''">
                AND a.employee_info = #{tProveApply.employeeInfo}
            </if>
            <if test="tProveApply.creatUser != null">
                AND a.creat_user = #{tProveApply.creatUser}
            </if>
            <if test="tProveApply.creatDate != null">
                AND a.creat_date = #{tProveApply.creatDate}
            </if>
            <if test="tProveApply.startMonth != null and tProveApply.startMonth.trim() != ''">
                AND a.start_month = #{tProveApply.startMonth}
            </if>
            <if test="tProveApply.endMonth != null and tProveApply.endMonth.trim() != ''">
                AND a.end_month = #{tProveApply.endMonth}
            </if>
            <if test="tProveApply.proveSalary != null">
                AND a.prove_salary = #{tProveApply.proveSalary}
            </if>
            <if test="tProveApply.applyReason != null and tProveApply.applyReason.trim() != ''">
                AND a.apply_reason = #{tProveApply.applyReason}
            </if>
            <if test="tProveApply.auditStatus != null">
                AND a.audit_status = #{tProveApply.auditStatus}
            </if>
            <if test="tProveApply.auditUser != null">
                AND a.audit_user = #{tProveApply.auditUser}
            </if>
            <if test="tProveApply.auditDate != null">
                AND a.audit_date = #{tProveApply.auditDate}
            </if>
            <if test="tProveApply.sumType != null">
                AND a.sum_type = #{tProveApply.sumType}
            </if>
            <if test="tProveApply.salary != null">
                AND a.salary = #{tProveApply.salary}
            </if>
        </if>
    </sql>
    <!--tProveApply简单分页查询-->
    <select id="getTProveApplyPage" resultMap="tProveApplyMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_prove_apply a
        <where>
            1=1
            <include refid="tProveApply_where"/>
        </where>
		order by a.creat_date desc
    </select>
</mapper>
