<?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.TBusSalaryConfigMapper">
    <resultMap id="tBusSalaryConfigMap" type="com.yifu.cloud.plus.v1.business.entity.salary.TBusSalaryConfig">
        <id property="id" column="ID"/>
        <result property="cnName" column="CN_NAME"/>
        <result property="dbFiedName" column="DB_FIED_NAME"/>
        <result property="javaFiedName" column="JAVA_FIED_NAME"/>
        <result property="isMustNeed" column="IS_MUST_NEED"/>
        <result property="createUser" column="CREATE_USER"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="orderLine" column="order_line"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.ID,
                  a.CN_NAME,
                  a.DB_FIED_NAME,
                  a.JAVA_FIED_NAME,
                  a.IS_MUST_NEED,
                  a.CREATE_USER,
                  a.CREATE_TIME,
                  a.order_line
         </sql>
    <sql id="tBusSalaryConfig_where">
        <if test="tBusSalaryConfig != null">
            <if test="tBusSalaryConfig.id != null and tBusSalaryConfig.id.trim() != ''">
                AND a.ID = #{tBusSalaryConfig.id}
            </if>
            <if test="tBusSalaryConfig.cnName != null and tBusSalaryConfig.cnName.trim() != ''">
                AND a.CN_NAME = #{tBusSalaryConfig.cnName}
            </if>
            <if test="tBusSalaryConfig.dbFiedName != null and tBusSalaryConfig.dbFiedName.trim() != ''">
                AND a.DB_FIED_NAME = #{tBusSalaryConfig.dbFiedName}
            </if>
            <if test="tBusSalaryConfig.javaFiedName != null and tBusSalaryConfig.javaFiedName.trim() != ''">
                AND a.JAVA_FIED_NAME = #{tBusSalaryConfig.javaFiedName}
            </if>
            <if test="tBusSalaryConfig.isMustNeed != null ">
                AND a.IS_MUST_NEED = #{tBusSalaryConfig.isMustNeed}
            </if>
            <if test="tBusSalaryConfig.createUser != null and tBusSalaryConfig.createUser.trim() != ''">
                AND a.CREATE_USER = #{tBusSalaryConfig.createUser}
            </if>
            <if test="tBusSalaryConfig.createTime != null">
                AND a.CREATE_TIME = #{tBusSalaryConfig.createTime}
            </if>
            <if test="tBusSalaryConfig.orderLine != null">
                AND a.order_line = #{tBusSalaryConfig.orderLine}
            </if>
        </if>
    </sql>
    <!--tBusSalaryConfig简单分页查询-->
    <select id="getTBusSalaryConfigPage" resultMap="tBusSalaryConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_bus_salary_config a
        <where>
            1=1
            <include refid="tBusSalaryConfig_where"/>
        </where>
    </select>
    <!--tBusSalaryConfig简单list-->
    <select id="getConfigList" resultMap="tBusSalaryConfigMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_bus_salary_config a
        where a.order_line != 999
        order by a.order_line asc
    </select>
    <!--tBusSalaryConfig简单分页查询-->
    <select id="getMustList" resultType="String">
        SELECT
            a.DB_FIED_NAME
        FROM t_bus_salary_config a
        where
            a.IS_MUST_NEED in (1,3)
    </select>
</mapper>
