<?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.salary.mapper.TConfigSalaryMapper">

	<resultMap id="tConfigSalaryMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TConfigSalary">
		<id property="id" column="ID"/>
		<result property="name" column="NAME"/>
		<result property="departId" column="DEPART_ID"/>
		<result property="departNo" column="DEPART_NO"/>
		<result property="departName" column="DEPART_NAME"/>
		<result property="salaryMonth" column="SALARY_MONTH"/>
		<result property="socialMonth" column="SOCIAL_MONTH"/>
		<result property="fundMonth" column="FUND_MONTH"/>
		<result property="socialPriority" column="SOCIAL_PRIORITY"/>
		<result property="fundPriority" column="FUND_PRIORITY"/>
		<result property="grantType" column="GRANT_TYPE"/>
		<result property="salaryNum" column="SALARY_NUM"/>
	</resultMap>

	<!--tConfigSalary简单分页查询-->
	<select id="getTConfigSalaryPage" resultMap="tConfigSalaryMap">
		SELECT
		ID,
		NAME,
		DEPART_ID,
		DEPART_NO,
		DEPART_NAME,
		SALARY_MONTH,
		SOCIAL_MONTH,
		FUND_MONTH,
		SOCIAL_PRIORITY,
		FUND_PRIORITY,
		GRANT_TYPE,
		SALARY_NUM
		FROM t_config_salary a
		<where>
			1=1
			<if test="tConfigSalary.id != null and tConfigSalary.id.trim() != ''">
				AND ID = #{tConfigSalary.id}
			</if>
			<if test="tConfigSalary.name != null and tConfigSalary.name.trim() != ''">
				AND NAME like concat('%', #{tConfigSalary.name},'%')
			</if>
			<if test="tConfigSalary.departId != null and tConfigSalary.departId.trim() != ''">
				AND DEPART_ID = #{tConfigSalary.departId}
			</if>
			<if test="tConfigSalary.departNo != null and tConfigSalary.departNo.trim() != ''">
				AND DEPART_NO like concat('%', #{tConfigSalary.departNo},'%')
			</if>
			<if test="tConfigSalary.departName != null and tConfigSalary.departName.trim() != ''">
				AND DEPART_NAME like concat('%', #{tConfigSalary.departName},'%')
			</if>
			<if test="tConfigSalary.salaryMonth != null ">
				AND SALARY_MONTH = #{tConfigSalary.salaryMonth}
			</if>
			<if test="tConfigSalary.socialMonth != null ">
				AND SOCIAL_MONTH = #{tConfigSalary.socialMonth}
			</if>
			<if test="tConfigSalary.fundMonth != null ">
				AND FUND_MONTH = #{tConfigSalary.fundMonth}
			</if>
			<if test="tConfigSalary.socialPriority != null ">
				AND SOCIAL_PRIORITY = #{tConfigSalary.socialPriority}
			</if>
			<if test="tConfigSalary.fundPriority != null ">
				AND FUND_PRIORITY = #{tConfigSalary.fundPriority}
			</if>
			<if test="tConfigSalary.grantType != null ">
				AND GRANT_TYPE = #{tConfigSalary.grantType}
			</if>
			<if test="tConfigSalary.salaryNum != null ">
				AND SALARY_NUM = #{tConfigSalary.salaryNum}
			</if>
			<!--数据权限判断-->
			<if test="depatIds != null and depatIds.size() > 0">
				and DEPART_ID in
				<foreach collection="depatIds" item="param" index="index" open="(" close=")" separator=",">
					#{param}
				</foreach>
			</if>
			<if test="tConfigSalary.authSql != null and tConfigSalary.authSql.trim() != ''">
				${tConfigSalary.authSql}
			</if>
		</where>
		order by CREATE_TIME DESC
	</select>


</mapper>