<?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.ruoyi.project.mapper.VExpertfeeExpertMapper"> 
 | 
  
 | 
    <resultMap type="com.ruoyi.project.domain.VExpertfeeExpert" id="VExpertfeeExpertResult"> 
 | 
        <result property="fundTaxId" column="fund_tax_id"/> 
 | 
        <result property="beneficiarytype" column="BeneficiaryType"/> 
 | 
        <result property="belong" column="Belong"/> 
 | 
        <result property="beneficiaryname" column="BeneficiaryName"/> 
 | 
        <result property="idcardno" column="IDCardNo"/> 
 | 
        <result property="depositbank" column="DepositBank"/> 
 | 
        <result property="bankcardno" column="BankCardNo"/> 
 | 
        <result property="pretaxamount" column="PretaxAmount"/> 
 | 
        <result property="taxamount" column="TaxAmount"/> 
 | 
        <result property="taxedamount" column="TaxedAmount"/> 
 | 
        <result property="donorname" column="DonorName"/> 
 | 
        <result property="unitname" column="UnitName"/> 
 | 
    </resultMap> 
 | 
  
 | 
    <sql id="selectVExpertfeeExpertVo"> 
 | 
        select fund_tax_id, 
 | 
               BeneficiaryType, 
 | 
               Belong, 
 | 
               BeneficiaryName, 
 | 
               IDCardNo, 
 | 
               DepositBank, 
 | 
               BankCardNo, 
 | 
               PretaxAmount, 
 | 
               TaxAmount, 
 | 
               TaxedAmount, 
 | 
               DonorName, 
 | 
               UnitName 
 | 
        from v_expertfee_expert 
 | 
    </sql> 
 | 
  
 | 
    <select id="selectVExpertfeeExpertList" parameterType="com.ruoyi.project.domain.VExpertfeeExpert" 
 | 
            resultMap="VExpertfeeExpertResult"> 
 | 
        <include refid="selectVExpertfeeExpertVo"/> 
 | 
        <where> 
 | 
            <if test="fundTaxId != null ">and fund_tax_id = #{fundTaxId}</if> 
 | 
            <if test="beneficiarytype != null ">and BeneficiaryType = #{beneficiarytype}</if> 
 | 
            <if test="belong != null ">and Belong = #{belong}</if> 
 | 
            <if test="beneficiaryname != null  and beneficiaryname != ''">and BeneficiaryName like concat('%', 
 | 
                #{beneficiaryname}, '%') 
 | 
            </if> 
 | 
            <if test="idcardno != null  and idcardno != ''">and IDCardNo = #{idcardno}</if> 
 | 
            <if test="depositbank != null  and depositbank != ''">and DepositBank = #{depositbank}</if> 
 | 
            <if test="bankcardno != null  and bankcardno != ''">and BankCardNo = #{bankcardno}</if> 
 | 
            <if test="pretaxamount != null ">and PretaxAmount = #{pretaxamount}</if> 
 | 
            <if test="taxamount != null ">and TaxAmount = #{taxamount}</if> 
 | 
            <if test="taxedamount != null ">and TaxedAmount = #{taxedamount}</if> 
 | 
            <if test="donorname != null  and donorname != ''">and DonorName like concat('%', #{donorname}, '%')</if> 
 | 
            <if test="unitname != null  and unitname != ''">and UnitName like concat('%', #{unitname}, '%')</if> 
 | 
        </where> 
 | 
    </select> 
 | 
  
 | 
    <select id="selectVExpertfeeExpertListByFaxId" parameterType="Integer" resultMap="VExpertfeeExpertResult"> 
 | 
        SELECT beneficiarytype, 
 | 
               beneficiaryname, 
 | 
               idcardno, 
 | 
               depositbank, 
 | 
               bankcardno, 
 | 
               pretaxamount, 
 | 
               taxamount, 
 | 
               taxedamount, 
 | 
               donorname, 
 | 
               unitname 
 | 
        FROM v_expertfee_expert 
 | 
        where fund_tax_id = #{taxId} 
 | 
        UNION 
 | 
        SELECT null              as beneficiarytype, 
 | 
               "合计"              as beneficiaryname, 
 | 
               null              as idcardno, 
 | 
               null              as depositbank, 
 | 
               null              as bankcardno, 
 | 
               SUM(pretaxamount) as pretaxamount, 
 | 
               SUM(taxamount)    as taxamount, 
 | 
               SUM(taxedamount)  as taxedamount, 
 | 
               null              as donorname, 
 | 
               null              as unitname 
 | 
        FROM v_expertfee_expert 
 | 
        where fund_tax_id = #{taxId} 
 | 
    </select> 
 | 
  
 | 
</mapper> 
 |