yxh
8 天以前 edbfa6b1a3a45e79cb17b06f3798535c3b1ba395
ruoyi-project/src/main/resources/mapper/project/ServiceFundMapper.xml
@@ -155,6 +155,8 @@
        <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},
            '%')
@@ -304,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>