<?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.salary.TBusSalaryItemMapper">
    <resultMap id="tBusSalaryItemMap" type="com.yifu.cloud.plus.v1.business.entity.salary.TBusSalaryItem">
        <id property="id" column="id"/>
        <result property="salaryId" column="SALARY_ID"/>
        <result property="cnName" column="CN_NAME"/>
        <result property="javaFiedName" column="JAVA_FIED_NAME"/>
        <result property="textValue" column="TEXT_VALUE"/>
        <result property="orderLine" column="order_line"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.id,
                  a.SALARY_ID,
                  a.CN_NAME,
                  a.JAVA_FIED_NAME,
                  a.TEXT_VALUE,
                  a.order_line
         </sql>
    <sql id="tBusSalaryItem_where">
        <if test="tBusSalaryItem != null">
            <if test="tBusSalaryItem.id != null and tBusSalaryItem.id.trim() != ''">
                AND a.id = #{tBusSalaryItem.id}
            </if>
            <if test="tBusSalaryItem.salaryId != null and tBusSalaryItem.salaryId.trim() != ''">
                AND a.SALARY_ID = #{tBusSalaryItem.salaryId}
            </if>
            <if test="tBusSalaryItem.cnName != null and tBusSalaryItem.cnName.trim() != ''">
                AND a.CN_NAME = #{tBusSalaryItem.cnName}
            </if>
            <if test="tBusSalaryItem.javaFiedName != null and tBusSalaryItem.javaFiedName.trim() != ''">
                AND a.JAVA_FIED_NAME = #{tBusSalaryItem.javaFiedName}
            </if>
            <if test="tBusSalaryItem.textValue != null and tBusSalaryItem.textValue.trim() != ''">
                AND a.TEXT_VALUE = #{tBusSalaryItem.textValue}
            </if>
            <if test="tBusSalaryConfig.orderLine != null">
                AND a.order_line = #{tBusSalaryConfig.orderLine}
            </if>
        </if>
    </sql>
    <!--tBusSalaryItem简单分页查询-->
    <select id="getTBusSalaryItemPage" resultMap="tBusSalaryItemMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_bus_salary_item a
        <where>
            1=1
            <include refid="tBusSalaryItem_where"/>
        </where>
    </select>

    <!--tBusSalaryItem简单list-->
    <select id="getListBySalaryId" resultMap="tBusSalaryItemMap">
        SELECT
            <include refid="Base_Column_List"/>
        FROM t_bus_salary_item a
        where a.SALARY_ID in
		<foreach item="item" index="index" collection="salaryIdList" open="(" separator="," close=")">
			#{item}
		</foreach>
        order by a.SALARY_ID,a.order_line asc
    </select>

</mapper>
