<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!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.TStatisticsTaxSalaryRuleMapper">

  <resultMap id="tStatisticsTaxSalaryRuleMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsTaxSalaryRule">
    <id property="id" column="id"/>
    <result property="settleMonth" column="settle_month"/>
    <result property="canRefreshNums" column="can_refresh_nums"/>
    <result property="yearMonthDay" column="year_month_day"/>
	  <result property="createBy" column="CREATE_BY"/>
	  <result property="createName" column="CREATE_NAME"/>
	  <result property="createTime" column="CREATE_TIME"/>
	  <result property="updateBy" column="UPDATE_BY"/>
	  <result property="updateTime" column="UPDATE_TIME"/>
  </resultMap>
    <sql id="Base_Column_List">
                a.id,
                a.settle_month,
                a.can_refresh_nums,
                a.year_month_day,
				a.CREATE_BY,
				a.CREATE_NAME,
				a.CREATE_TIME,
				a.UPDATE_BY,
				a.UPDATE_TIME
    </sql>
    <sql id="tStatisticsTaxSalaryRule_where">
        <if test="tStatisticsTaxSalaryRule != null">
                    <if test="tStatisticsTaxSalaryRule.id != null and tStatisticsTaxSalaryRule.id.trim() != ''">
                        AND a.id = #{tStatisticsTaxSalaryRule.id}
                    </if>
                    <if test="tStatisticsTaxSalaryRule.settleMonth != null and tStatisticsTaxSalaryRule.settleMonth.trim() != ''">
                        AND a.settle_month = #{tStatisticsTaxSalaryRule.settleMonth}
                    </if>
                    <if test="tStatisticsTaxSalaryRule.canRefreshNums != null">
                        AND a.can_refresh_nums = #{tStatisticsTaxSalaryRule.canRefreshNums}
                    </if>
                    <if test="tStatisticsTaxSalaryRule.yearMonthDay != null and tStatisticsTaxSalaryRule.yearMonthDay.trim() != ''">
                        AND a.year_month_day = #{tStatisticsTaxSalaryRule.yearMonthDay}
                    </if>
        </if>
    </sql>
    <!--tStatisticsTaxSalaryRule简单分页查询-->
    <select id="getTStatisticsTaxSalaryRulePage" resultMap="tStatisticsTaxSalaryRuleMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_statistics_tax_salary_rule a
        <where>
            1=1
            <include refid="tStatisticsTaxSalaryRule_where"/>
        </where>
    </select>

	<!--list-->
	<select id="getTStatisticsTaxSalaryRule" resultMap="tStatisticsTaxSalaryRuleMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_statistics_tax_salary_rule a
		where a.year_month_day = #{yearMonthDay}
		limit 1
	</select>

</mapper>