<?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.engine.salary.mapper.siaccount.SIAccountDetailMapper">
    <resultMap id="BaseResultMap" type="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO">
        <result column="id" property="id" />
        <result column="employee_id" property="employeeId" />
        <result column="bill_month" property="billMonth" />
        <result column="bill_status" property="billStatus" />
        <result column="payment_status" property="paymentStatus" />
        <result column="supplementary_month" property="supplementaryMonth" />
        <result column="supplementary_projects" property="supplementaryProjects" />
        <result column="resource_from" property="resourceFrom" />
        <result column="social_pay_org" property="socialPayOrg" />
        <result column="social_account" property="socialAccount" />
        <result column="social_scheme_id" property="socialSchemeId" />
        <result column="social_payment_base_string" property="socialPaymentBaseString" />
        <result column="fund_pay_org" property="fundPayOrg" />
        <result column="fund_account" property="fundAccount" />
        <result column="supplement_fund_account" property="supplementFundAccount" />
        <result column="fund_scheme_id" property="fundSchemeId" />
        <result column="fund_payment_base_string" property="fundPaymentBaseString" />
        <result column="other_pay_org" property="otherPayOrg" />
        <result column="other_scheme_id" property="otherSchemeId" />
        <result column="other_payment_base_string" property="otherPaymentBaseString" />
        <result column="social_per_json" property="socialPerJson" />
        <result column="social_per_sum" property="socialPerSum" />
        <result column="fund_per_json" property="fundPerJson" />
        <result column="fund_per_sum" property="fundPerSum" />
        <result column="other_per_json" property="otherPerJson" />
        <result column="other_per_sum" property="otherPerSum" />
        <result column="per_sum" property="perSum" />
        <result column="social_com_json" property="socialComJson" />
        <result column="social_com_sum" property="socialComSum" />
        <result column="fund_com_json" property="fundComJson" />
        <result column="fund_com_sum" property="fundComSum" />
        <result column="other_com_json" property="otherComJson" />
        <result column="other_com_sum" property="otherComSum" />
        <result column="com_sum" property="comSum" />
        <result column="social_sum" property="socialSum" />
        <result column="fund_sum" property="fundSum" />
        <result column="other_sum" property="otherSum" />
        <result column="total" property="total" />
        <result column="creator" property="creator" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="delete_type" property="deleteType" />
        <result column="tenant_key" property="tenantKey" />
    </resultMap>

    <!-- 表字段 -->
    <sql id="baseColumns">
        t.id
        , t.employee_id
        , t.bill_month
        , t.bill_status
        , t.payment_status
        , t.supplementary_month
        , t.supplementary_projects
        , t.resource_from
        , t.social_pay_org
        , t.social_account
        , t.social_scheme_id
        , t.social_payment_base_string
        , t.fund_pay_org
        , t.fund_account
        , t.supplement_fund_account
        , t.fund_scheme_id
        , t.fund_payment_base_string
        , t.other_pay_org
        , t.other_scheme_id
        , t.other_payment_base_string
        , t.social_per_json
        , t.social_per_sum
        , t.fund_per_json
        , t.fund_per_sum
        , t.other_per_json
        , t.other_per_sum
        , t.per_sum
        , t.social_com_json
        , t.social_com_sum
        , t.fund_com_json
        , t.fund_com_sum
        , t.other_com_json
        , t.other_com_sum
        , t.com_sum
        , t.social_sum
        , t.fund_sum
        , t.other_sum
        , t.total
        , t.creator
        , t.create_time
        , t.update_time
        , t.delete_type
        , t.tenant_key
    </sql>

    <!-- 条件查询 -->
    <select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.param.QueryAccountDetailParam">
        SELECT
        <include refid="baseColumns" />
        FROM hrsa_bill_detail t
        WHERE delete_type = 0
        <if test="employeeId != null">
            AND employee_id = #{employeeId}
        </if>
        <if test="startMonth != null">
            AND bill_month >= #{startMonth}
        </if>
        <if test="billMonth != null">
            AND bill_month &lt;= #{endMonth}
        </if>
        ORDER BY id DESC
    </select>


</mapper>