yxh
9 天以前 edbfa6b1a3a45e79cb17b06f3798535c3b1ba395
ruoyi-project/src/main/resources/mapper/project/ServiceFundMapper.xml
@@ -33,6 +33,7 @@
        <result property="deptmentname" column="DeptmentName"/>
        <result property="opochecker" column="OPOchecker"/>
        <result property="finvicepresident" column="FinVicePresident"/>
        <result property="financechecher" column="FinanceChecher"/>
        <result property="president" column="president"/>
        <result property="busvicepresident" column="BusVicePresident"/>
        <result property="officedirector" column="OfficeDirector"/>
@@ -50,6 +51,10 @@
        <result property="uploadtime" column="uploadtime"/>
        <result property="flowlevel" column="FlowLevel"/>
        <result property="pretaxcost" column="PretaxCost"/>
        <result property="vatCost" column="vat_cost"/>
        <result property="cityTaxCost" column="city_tax_cost"/>
        <result property="laborPretaxCost" column="labor_pretax_cost"/>
        <result property="taxVersion" column="tax_version"/>
        <result property="taxedcost" column="TaxedCost"/>
        <result property="backflowlevel" column="backFlowLevel"/>
        <result property="zffs" column="zffs"/>
@@ -86,6 +91,10 @@
               UnitNo,
               UnitUserNo,
               PretaxCost,
               vat_cost,
               city_tax_cost,
               labor_pretax_cost,
               tax_version,
               TaxedCost,
               Phone,
               AnnexBankCard,
@@ -141,9 +150,13 @@
        where del_flag = '0'
        <if test="donorno != null  and donorno != ''">and DonorNo = #{donorno}</if>
        <!-- 2026-10-22:报销单列表支持按"捐献者姓名"模糊筛选(仅在传值时生效,不影响其它调用方) -->
        <if test="donorname != null  and donorname != ''">and DonorName like concat('%', #{donorname}, '%')</if>
        <if test="fundTaxId != null ">and fund_tax_id = #{fundTaxId}</if>
        <if test="userno != null  and userno != ''">and UserNo = #{userno}</if>
        <if test="username != null  and username != ''">and UserName like concat('%', #{username}, '%')</if>
        <!-- 2026-11-10:业务组长看本组(申请人所属业务组编号 = 登录人部门ID) -->
        <if test="deptmentno != null  and deptmentno != ''">and DeptmentNo = #{deptmentno}</if>
        <if test="applytype != null  and applytype != ''">and ApplyType = #{applytype}</if>
        <if test="deptmentname != null  and deptmentname != ''">and DeptmentName like concat('%', #{deptmentname},
            '%')
@@ -293,4 +306,49 @@
        </set>
        where id = #{id}
    </update>
    <!--
      专家费汇总单打印:按「与视图 v_expertfee_expert 完全相同的分组」汇总增值税 / 城建税 / 劳务税前。
      视图的 TaxAmount 已含增值税+城建税(2026-11-12 业务方修改),代码里再拆出劳务个税。
      分组键用 CONCAT_WS 生成,必须与 Java 的 expertGroupKey 顺序一致:
      BeneficiaryName | IDCardNo | BankCardNo | DepositBank | UnitName
    -->
    <select id="selectTaxSumByBeneficiary" resultType="com.ruoyi.project.domain.vo.FundTaxAmountSum">
        SELECT CONCAT_WS('|',
                         IFNULL(d.BeneficiaryName, ''),
                         IFNULL(d.IDCardNo, ''),
                         IFNULL(d.BankCardNo, ''),
                         IFNULL(d.DepositBank, ''),
                         IFNULL(d.UnitName, ''))                                AS groupKey,
               SUM(IFNULL(d.vat_amount, 0))                                     AS vatAmount,
               SUM(IFNULL(d.city_tax_amount, 0))                                AS cityTaxAmount,
               SUM(IFNULL(d.labor_pretax_amount, IFNULL(d.Amount, 0)))          AS laborPretaxAmount
        FROM service_funddetail d,
             service_fund f
        WHERE f.ID = d.fundID
          AND f.fund_tax_id = #{fundTaxId}
          AND f.istax = 1
          AND d.del_flag = 0
        GROUP BY groupKey
    </select>
    <!--
      专家费汇总单打印:按「与视图 v_expertfee_donor 完全相同的分组」汇总。
      注意:视图里的 DonorName / InfoID 取自 service_fund(不是明细表),
            分组键 = f.DonorName | f.InfoID,与 Java 的 donorGroupKey 一致
    -->
    <select id="selectTaxSumByDonor" resultType="com.ruoyi.project.domain.vo.FundTaxAmountSum">
        SELECT CONCAT_WS('|', IFNULL(f.DonorName, ''), IFNULL(f.InfoID, ''))    AS groupKey,
               SUM(IFNULL(d.vat_amount, 0))                                     AS vatAmount,
               SUM(IFNULL(d.city_tax_amount, 0))                                AS cityTaxAmount,
               SUM(IFNULL(d.labor_pretax_amount, IFNULL(d.Amount, 0)))          AS laborPretaxAmount
        FROM service_funddetail d,
             service_fund f
        WHERE f.ID = d.fundID
          AND f.fund_tax_id = #{fundTaxId}
          AND f.istax = 1
          AND d.del_flag = 0
        GROUP BY groupKey
    </select>
</mapper>