<?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.business.mapper.settle.TBusSettleMapper">
    <resultMap id="tBusSettleMap" type="com.yifu.cloud.plus.v1.business.entity.settle.TBusSettle">
        <id property="id" column="id"/>
        <result property="accountDeptName" column="account_dept_name"/>
        <result property="settleMonth" column="settle_month"/>
        <result property="createUserId" column="create_user_id"/>
        <result property="createUserName" column="create_user_name"/>
        <result property="createTime" column="create_time"/>
        <result property="deleteFlag" column="delete_flag"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.id,
			  a.account_dept_name,
			  a.settle_month,
			  a.create_user_id,
			  a.create_user_name,
			  a.create_time,
			  a.delete_flag
         </sql>
    <sql id="tBusSettle_where">
        <if test="tBusSettle != null">
            <if test="tBusSettle.id != null and tBusSettle.id.trim() != ''">
                AND a.id = #{tBusSettle.id}
            </if>
            <if test="tBusSettle.accountDeptName != null and tBusSettle.accountDeptName.trim() != ''">
                AND a.account_dept_name like concat('%',#{tBusSettle.accountDeptName},'%')
            </if>
            <if test="tBusSettle.settleMonth != null and tBusSettle.settleMonth.trim() != ''">
                AND a.settle_month = #{tBusSettle.settleMonth}
            </if>
            <if test="tBusSettle.createUserId != null and tBusSettle.createUserId.trim() != ''">
                AND a.create_user_id = #{tBusSettle.createUserId}
            </if>
            <if test="tBusSettle.createUserName != null and tBusSettle.createUserName.trim() != ''">
                AND a.create_user_name = #{tBusSettle.createUserName}
            </if>
            <if test="tBusSettle.createTime != null">
                AND a.create_time = #{tBusSettle.createTime}
            </if>
            <if test="tBusSettle.deleteFlag != null">
                AND a.delete_flag = #{tBusSettle.deleteFlag}
            </if>
        </if>
    </sql>
    <!--tBusSettle简单分页查询-->
    <select id="getTBusSettlePage" resultMap="tBusSettleMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_bus_settle a
        <where>
            a.delete_flag = 0
            <include refid="tBusSettle_where"/>
        </where>
        ORDER BY a.create_time desc
    </select>

    <!--tBusSettle简单查询list-->
    <select id="getTBusSettleList" resultMap="tBusSettleMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_bus_settle a
        <where>
            a.delete_flag = 0
            <include refid="tBusSettle_where"/>
        </where>
        ORDER BY a.create_time desc
    </select>

</mapper>
