liusheng
2024-03-19 2fdb37e47a5e2ed88ea2fa8bd44072883cc76fc3
ruoyi-project/src/main/resources/mapper/project/ServiceFunddetailMapper.xml
@@ -1,80 +1,153 @@
<?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">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.mapper.ServiceFunddetailMapper">
    <resultMap type="ServiceFunddetail" id="ServiceFunddetailResult">
        <result property="id"    column="ID"    />
        <result property="fundid"    column="fundID"    />
        <result property="beneficiaryname"    column="BeneficiaryName"    />
        <result property="beneficiaryno"    column="BeneficiaryNo"    />
        <result property="unitname"    column="UnitName"    />
        <result property="unitno"    column="UnitNo"    />
        <result property="unituserno"    column="UnitUserNo"    />
        <result property="title"    column="Title"    />
        <result property="idcardtype"    column="IDCardType"    />
        <result property="idcardno"    column="IDCardNo"    />
        <result property="sex"    column="Sex"    />
        <result property="familyrelations"    column="FamilyRelations"    />
        <result property="phone"    column="Phone"    />
        <result property="depositbank"    column="DepositBank"    />
        <result property="bankcardno"    column="BankCardNo"    />
        <result property="branchbankname"    column="BranchBankName"    />
        <result property="annexbankcard"    column="AnnexBankCard"    />
        <result property="annexregistform"    column="AnnexRegistForm"    />
        <result property="applytype"    column="ApplyType"    />
        <result property="applytypename"    column="ApplyTypeName"    />
        <result property="itemid"    column="ItemID"    />
        <result property="itemname"    column="ItemName"    />
        <result property="itemtype"    column="ItemType"    />
        <result property="amount"    column="Amount"    />
        <result property="prepaidamount"    column="PrepaidAmount"    />
        <result property="taxamount"    column="TaxAmount"    />
        <result property="invoicecount"    column="InvoiceCount"    />
        <result property="taxedamount"    column="TaxedAmount"    />
        <result property="attachcount"    column="AttachCount"    />
        <result property="remark"    column="Remark"    />
        <result property="recordstatus"    column="RecordStatus"    />
        <result property="price"    column="Price"    />
        <result property="quantity"    column="Quantity"    />
        <result property="del_flag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="uploadflag"    column="uploadflag"    />
        <result property="uploadtime"    column="uploadtime"    />
        <result property="infoid"    column="InfoId"    />
        <result property="donorno"    column="DonorNo"    />
        <result property="donorname"    column="DonorName"    />
        <result property="servicesscope"    column="SERVICESSCOPE"    />
        <result property="servicesscopename"    column="SERVICESSCOPENAME"    />
        <result property="servicetype"    column="SERVICETYPE"    />
        <result property="servicetypename"    column="SERVICETYPENAME"    />
        <result property="orderno"    column="OrderNo"    />
        <result property="itemcode"    column="ItemCode"    />
    <resultMap type="com.ruoyi.project.domain.ServiceFunddetail" id="ServiceFunddetailResult">
        <result property="id" column="ID"/>
        <result property="fundid" column="fundID"/>
        <result property="orderno" column="OrderNo"/>
        <result property="itemid" column="ItemID"/>
        <result property="itemcode" column="ItemCode"/>
        <result property="itemname" column="ItemName"/>
        <result property="itemdescribe" column="ItemDescribe"/>
        <result property="itemtype" column="ItemType"/>
        <result property="applytype" column="ApplyType"/>
        <result property="applytypename" column="ApplyTypeName"/>
        <result property="beneficiaryname" column="BeneficiaryName"/>
        <result property="beneficiaryno" column="BeneficiaryNo"/>
        <result property="unitname" column="UnitName"/>
        <result property="unitno" column="UnitNo"/>
        <result property="unituserno" column="UnitUserNo"/>
        <result property="title" column="Title"/>
        <result property="idcardtype" column="IDCardType"/>
        <result property="idcardno" column="IDCardNo"/>
        <result property="sex" column="Sex"/>
        <result property="familyrelations" column="FamilyRelations"/>
        <result property="phone" column="Phone"/>
        <result property="depositbank" column="DepositBank"/>
        <result property="bankcardno" column="BankCardNo"/>
        <result property="branchbankname" column="BranchBankName"/>
        <result property="annexbankcard" column="AnnexBankCard"/>
        <result property="annexregistform" column="AnnexRegistForm"/>
        <result property="quantity" column="Quantity"/>
        <result property="price" column="Price"/>
        <result property="amount" column="Amount"/>
        <result property="taxamount" column="TaxAmount"/>
        <result property="taxedamount" column="TaxedAmount"/>
        <result property="prepaidamount" column="PrepaidAmount"/>
        <result property="invoicecount" column="InvoiceCount"/>
        <result property="attachcount" column="AttachCount"/>
        <result property="remark" column="Remark"/>
        <result property="infoid" column="InfoId"/>
        <result property="donorno" column="DonorNo"/>
        <result property="donorname" column="DonorName"/>
        <result property="recordstatus" column="RecordStatus"/>
        <result property="del_flag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="uploadflag" column="uploadflag"/>
        <result property="uploadtime" column="uploadtime"/>
        <result property="servicesscope" column="SERVICESSCOPE"/>
        <result property="servicesscopename" column="SERVICESSCOPENAME"/>
        <result property="servicetype" column="SERVICETYPE"/>
        <result property="servicetypename" column="SERVICETYPENAME"/>
        <result property="reimbursementamount" column="REIMBURSEMENTAMOUNT"/>
        <result property="subjecttype" column="subjecttype"/>
        <result property="subjecttypename" column="subjecttypename"/>
        <result property="annexfiles" column="AnnexFiles"/>
        <result property="taxTime" column="tax_time"/>
        <result property="jxrq" column="jxrq"/>
        <result property="invoicefiles" column="InvoiceFiles"/>
        <result property="deptId" column="dept_id"/>
        <result property="deptName" column="dept_name"/>
    </resultMap>
    <sql id="selectServiceFunddetailVo">
        select ID, fundID, InfoId, DonorNo, DonorName, BeneficiaryName, BeneficiaryNo, UnitName, UnitNo, UnitUserNo, Title, OrderNo, ItemCode, IDCardType, IDCardNo, Sex, FamilyRelations, Phone, DepositBank, BankCardNo, BranchBankName, AnnexBankCard, AnnexRegistForm, ApplyType,ApplyTypeName, ItemID, ItemName, ItemType, Amount, PrepaidAmount, TaxAmount, InvoiceCount, TaxedAmount, AttachCount, Quantity, Price, Remark, RecordStatus, del_flag, create_by, create_time, update_by, update_time, uploadflag, uploadtime,SERVICESSCOPE,SERVICESSCOPENAME,SERVICETYPE,SERVICETYPENAME from service_funddetail
        select ID,
               fundID,
               InfoId,
               DonorNo,
               dept_id,
               dept_name,
               DonorName,
               BeneficiaryName,
               BeneficiaryNo,
               UnitName,
               UnitNo,
               UnitUserNo,
               Title,
               OrderNo,
               ItemCode,
               IDCardType,
               IDCardNo,
               Sex,
               FamilyRelations,
               Phone,
               DepositBank,
               BankCardNo,
               BranchBankName,
               AnnexBankCard,
               AnnexRegistForm,
               ApplyType,
               ApplyTypeName,
               ItemID,
               ItemName,
               ItemType,
               Amount,
               PrepaidAmount,
               TaxAmount,
               InvoiceCount,
               TaxedAmount,
               AttachCount,
               Quantity,
               Price,
               Remark,
               RecordStatus,
               del_flag,
               create_by,
               create_time,
               update_by,
               update_time,
               uploadflag,
               uploadtime,
               SERVICESSCOPE,
               SERVICESSCOPENAME,
               SERVICETYPE,
               SERVICETYPENAME,
               subjecttype,
               subjecttypename,
               AnnexFiles,
               InvoiceFiles,
               tax_time,
               jxrq,
               ItemDescribe
        from service_funddetail
    </sql>
    <select id="selectServiceFunddetailList" parameterType="ServiceFunddetail" resultMap="ServiceFunddetailResult">
    <select id="selectServiceFunddetailList" parameterType="com.ruoyi.project.domain.ServiceFunddetail"
            resultMap="ServiceFunddetailResult">
        <include refid="selectServiceFunddetailVo"/>
        <where>
            del_flag = '0'
            <if test="beneficiaryname != null  and beneficiaryname != ''"> and BeneficiaryName like concat('%', #{beneficiaryname}, '%')</if>
            <if test="unitname != null  and unitname != ''"> and UnitName like concat('%', #{unitname}, '%')</if>
            <if test="applytype != null  and applytype != ''"> and ApplyType = #{applytype}</if>
            <if test="itemname != null  and itemname != ''"> and ItemName like concat('%', #{itemname}, '%')</if>
            <if test="itemtype != null  and itemtype != ''"> and ItemType = #{itemtype}</if>
            <if test="recordstatus != null  and recordstatus != ''"> and RecordStatus = #{recordstatus}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="uploadflag != null  and uploadflag != ''"> and uploadflag = #{uploadflag}</if>
            <if test="uploadtime != null "> and uploadtime = #{uploadtime}</if>
            <if test="fundid != null and fundid != '' "> and fundID = #{fundid}</if>
            <if test="beneficiaryname != null  and beneficiaryname != ''">and BeneficiaryName like concat('%',
                #{beneficiaryname}, '%')
            </if>
            <if test="unitname != null  and unitname != ''">and UnitName like concat('%', #{unitname}, '%')</if>
            <if test="applytype != null  and applytype != ''">and ApplyType = #{applytype}</if>
            <if test="itemname != null  and itemname != ''">and ItemName like concat('%', #{itemname}, '%')</if>
            <if test="itemtype != null  and itemtype != ''">and ItemType = #{itemtype}</if>
            <if test="recordstatus != null  and recordstatus != ''">and RecordStatus = #{recordstatus}</if>
            <if test="createBy != null  and createBy != ''">and create_by = #{createBy}</if>
            <if test="createTime != null ">and create_time = #{createTime}</if>
            <if test="uploadflag != null  and uploadflag != ''">and uploadflag = #{uploadflag}</if>
            <if test="uploadtime != null ">and uploadtime = #{uploadtime}</if>
            <if test="fundid != null and fundid != '' ">and fundID = #{fundid}</if>
            <if test="deptId != null  ">and dept_id = #{deptId}</if>
            <if test="deptName != null and deptName != '' ">and dept_name = #{deptName}</if>
        </where>
    </select>
@@ -109,8 +182,125 @@
        where fundID = #{id} and ItemType = "12"
    </select>
    <select id="countItem" resultType="java.lang.Integer">
        select count(*) from service_funddetail
        where ItemID = #{itemid} and fundID = #{fundid} and del_flag = '0'
        select count(*)
        from service_funddetail
        where ItemID = #{itemid}
          and fundID = #{fundid}
          and del_flag = '0'
    </select>
    <select id="getDataBybeneficiaryNo" parameterType="com.ruoyi.project.domain.FunddetailReqVo"
            resultMap="ServiceFunddetailResult">
        select a.ID,
        a.fundID,
        a.InfoId,
        a.DonorNo,
        a.DonorName,
        a.BeneficiaryName,
        a.BeneficiaryNo,
        a.UnitName,
        a.UnitNo,
        a.UnitUserNo,
        a.Title,
        a.OrderNo,
        a.ItemCode,
        a.IDCardType,
        a.IDCardNo,
        a.Sex,
        a.FamilyRelations,
        a.Phone,
        a.DepositBank,
        a.BankCardNo,
        a.BranchBankName,
        a.AnnexBankCard,
        a.AnnexRegistForm,
        a.ApplyType,
        a.ApplyTypeName,
        a.ItemID,
        a.ItemName,
        a.ItemType,
        a.Amount,
        a.PrepaidAmount,
        a.TaxAmount,
        a.InvoiceCount,
        a.TaxedAmount,
        a.AttachCount,
        a.Quantity,
        a.Price,
        a.Remark,
        a.RecordStatus,
        a.del_flag,
        a.create_by,
        a.create_time,
        a.update_by,
        a.update_time,
        a.uploadflag,
        a.uploadtime,
        a.SERVICESSCOPE,
        a.SERVICESSCOPENAME,
        a.SERVICETYPE,
        a.SERVICETYPENAME,
        a.subjecttype,
        a.dept_id,
        a.dept_name,
        a.subjecttypename
        from service_funddetail a,
        service_fund b
        where a.del_flag = '0'
        and a.fundID = b.id
        <if test="idcardno != null  and idcardno != '' ">and a.IDCardNo = #{idcardno}</if>
        and b.create_time >= #{starttime}
        and b.create_time &lt;= #{endtime}
    </select>
    <select id="getTaxBeforeByBeneFiciaryNo" parameterType="com.ruoyi.project.domain.vo.TaxMoneyVO"
            resultMap="ServiceFunddetailResult">
        <include refid="selectServiceFunddetailVo"/>
        where create_time like concat(#{startTime}, '%') and IDCardNo=#{idcardno}
    </select>
    <update id="updateTaxTime" parameterType="com.ruoyi.project.domain.ServiceFunddetail">
        update com.ruoyi.project.domain.
        <set>
            tax_time = #{taxTime},
        </set>
        where fundID = #{fundid}
    </update>
    <select id="getTaxSum" parameterType="com.ruoyi.project.domain.vo.TaxMoneyByItemEO"
            resultType="com.ruoyi.project.domain.vo.TaxMoneySumEO">
        SELECT sum(a.Amount) amounts, sum(a.TaxAmount) taxAmounts, sum(a.TaxedAmount) taxedAmounts
        FROM service_funddetail a,
             service_fund b
        where a.FundID = b.id
          and a.tax_time &lt; #{taxTime}
          and a.tax_time >= #{firstDay}
          and TRIM(a.IDCardNo) = #{IDCard}
          and a.del_flag != 1
          and b.id != #{fundID}
          and b.fundtaxtime
         &lt; #{taxTime}
          and b.fundtaxtime >= #{firstDay}
          and b.del_flag != 1
          and b.ApplyType in (1
            , 2)
    </select>
    <select id="totlaTax" resultType="com.ruoyi.project.domain.ServiceFunddetail">
        <include refid="selectServiceFunddetailVo"/>
        where fundID in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
        and del_flag=0
    </select>
    <select id="getListBySpStatBonus" statementType="CALLABLE"
            resultType="com.ruoyi.project.domain.SpStatBonus">
        call `SP_STAT_BONUS`(#{PABEGTIME,mode=IN,jdbcType=VARCHAR},#{PAENDTIME,mode=IN,jdbcType=VARCHAR},#{PADEPTNO,mode=IN,jdbcType=VARCHAR},#{PAUSERNO,mode=IN,jdbcType=VARCHAR},#{PABONUSTYPE,mode=IN,jdbcType=VARCHAR})
    </select>
</mapper>