InvAccountIncoiceMapper.xml 5.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ydtech.modules.inv.dao.InvAccountIncoiceMapper">
  4. <resultMap type="com.ydtech.modules.inv.model.InvAccountIncoice" id="InvAccountIncoiceMap">
  5. <result property="invoiceId" column="invoice_id" jdbcType="INTEGER"/>
  6. <result property="biller" column="biller" jdbcType="VARCHAR"/>
  7. <result property="invoiceSubjects" column="invoice_subjects" jdbcType="VARCHAR"/>
  8. <result property="invoiceBy" column="invoice_by" jdbcType="VARCHAR"/>
  9. <result property="otherUnit" column="other_unit" jdbcType="VARCHAR"/>
  10. <result property="invoiceNum" column="invoice_num" jdbcType="VARCHAR"/>
  11. <result property="invoiceTime" column="invoice_time" jdbcType="TIMESTAMP"/>
  12. <result property="noHasTax" column="no_has_tax" jdbcType="VARCHAR"/>
  13. <result property="rate" column="rate" jdbcType="VARCHAR"/>
  14. <result property="tax" column="tax" jdbcType="VARCHAR"/>
  15. <result property="invoiceMoney" column="invoice_money" jdbcType="VARCHAR"/>
  16. <result property="invoiceType" column="invoice_type" jdbcType="VARCHAR"/>
  17. <result property="payoutTime" column="payout_time" jdbcType="TIMESTAMP"/>
  18. <result property="payoutMoney" column="payout_money" jdbcType="VARCHAR"/>
  19. <result property="notPayoutMoney" column="not_payout_money" jdbcType="VARCHAR"/>
  20. <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
  21. <result property="revBankCardNum" column="rev_bank_card_num" jdbcType="VARCHAR"/>
  22. <result property="outBankCardNum" column="out_bank_card_num" jdbcType="VARCHAR"/>
  23. <result property="clearFlag" column="clear_flag" jdbcType="VARCHAR"/>
  24. <result property="outProfit" column="out_profit" javaType="com.alibaba.fastjson.JSONObject"
  25. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  26. <result property="entProfit" column="ent_profit" javaType="com.alibaba.fastjson.JSONObject"
  27. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  28. <result property="fundFen" column="fund_fen" jdbcType="VARCHAR"/>
  29. <result property="remark" column="remark" jdbcType="VARCHAR"/>
  30. </resultMap>
  31. <!-- 批量插入 -->
  32. <insert id="insertBatch" keyProperty="invoiceId" useGeneratedKeys="true">
  33. insert into zgdd.inv_account_incoice(billerinvoice_subjectsinvoice_byother_unitinvoice_numinvoice_timeno_has_taxratetaxinvoice_moneyinvoice_typepayout_timepayout_moneynot_payout_moneydel_flag)
  34. values
  35. <foreach collection="entities" item="entity" separator=",">
  36. (#{entity.biller}#{entity.invoiceSubjects}#{entity.invoiceBy}#{entity.otherUnit}#{entity.invoiceNum}#{entity.invoiceTime}#{entity.noHasTax}#{entity.rate}#{entity.tax}#{entity.invoiceMoney}#{entity.invoiceType}#{entity.payoutTime}#{entity.payoutMoney}#{entity.notPayoutMoney}#{entity.delFlag})
  37. </foreach>
  38. </insert>
  39. <!-- 批量插入或按主键更新 -->
  40. <insert id="insertOrUpdateBatch" keyProperty="invoiceId" useGeneratedKeys="true">
  41. insert into zgdd.inv_account_incoice(billerinvoice_subjectsinvoice_byother_unitinvoice_numinvoice_timeno_has_taxratetaxinvoice_moneyinvoice_typepayout_timepayout_moneynot_payout_moneydel_flag)
  42. values
  43. <foreach collection="entities" item="entity" separator=",">
  44. (#{entity.biller}#{entity.invoiceSubjects}#{entity.invoiceBy}#{entity.otherUnit}#{entity.invoiceNum}#{entity.invoiceTime}#{entity.noHasTax}#{entity.rate}#{entity.tax}#{entity.invoiceMoney}#{entity.invoiceType}#{entity.payoutTime}#{entity.payoutMoney}#{entity.notPayoutMoney}#{entity.delFlag})
  45. </foreach>
  46. on duplicate key update
  47. biller = values(biller) invoice_subjects = values(invoice_subjects) invoice_by = values(invoice_by) other_unit = values(other_unit) invoice_num = values(invoice_num) invoice_time = values(invoice_time) no_has_tax = values(no_has_tax) rate = values(rate) tax = values(tax) invoice_money = values(invoice_money) invoice_type = values(invoice_type) payout_time = values(payout_time) payout_money = values(payout_money) not_payout_money = values(not_payout_money) del_flag = values(del_flag) </insert>
  48. <select id="selectAccountIncoice" resultType="com.ydtech.modules.inv.model.InvAccountIncoiceResult">
  49. SELECT
  50. sum(round(invoice_money,2)) as invoice_money_sum,
  51. sum( round(tax, 2) ) as tax_sum,
  52. sum( round(no_has_tax, 2) ) as no_has_tax_sum
  53. FROM inv_account_incoice WHERE del_flag = '0'
  54. <if test="invoiceTimeStart != null">
  55. and invoice_time &gt;= #{invoiceTimeStart}
  56. </if>
  57. <if test="invoiceTimeEnd != null">
  58. and invoice_time &lt;= #{invoiceTimeEnd}
  59. </if>
  60. <if test="biller != null and biller != ''">
  61. and biller like concat('%',#{biller},'%')
  62. </if>
  63. <if test="invoiceBy != null and invoiceBy != '' ">
  64. and invoice_by like concat('%',#{invoiceBy},'%')
  65. </if>
  66. <if test="otherUnit != null and otherUnit != '' ">
  67. and other_unit like concat('%',#{otherUnit},'%')
  68. </if>
  69. <if test="invoiceType != null and invoiceType != '' ">
  70. and invoice_type = #{invoiceType}
  71. </if>
  72. <if test="clearFlag != null and clearFlag != '' ">
  73. and clear_flag = #{clearFlag}
  74. </if>
  75. </select>
  76. </mapper>