InvAccountIncoiceMapper.xml 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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="payoutMoney" column="payout_money" jdbcType="VARCHAR"/>
  18. <result property="notPayoutMoney" column="not_payout_money" jdbcType="VARCHAR"/>
  19. <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
  20. <result property="revBankCardNum" column="rev_bank_card_num" jdbcType="VARCHAR"/>
  21. <result property="outBankCardNum" column="out_bank_card_num" jdbcType="VARCHAR"/>
  22. <result property="clearFlag" column="clear_flag" jdbcType="VARCHAR"/>
  23. <result property="outProfit" column="out_profit" javaType="com.alibaba.fastjson.JSONObject"
  24. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  25. <result property="entProfit" column="ent_profit" javaType="com.alibaba.fastjson.JSONObject"
  26. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  27. <result property="fundFen" column="fund_fen" jdbcType="VARCHAR"/>
  28. <result property="remark" column="remark" jdbcType="VARCHAR"/>
  29. </resultMap>
  30. <!-- 批量插入 -->
  31. <insert id="insertBatch" keyProperty="invoiceId" useGeneratedKeys="true">
  32. insert into zgdd.inv_account_incoice(billerinvoice_subjectsinvoice_byother_unitinvoice_numinvoice_timeno_has_taxratetaxinvoice_moneyinvoice_typepayout_timepayout_moneynot_payout_moneydel_flag)
  33. values
  34. <foreach collection="entities" item="entity" separator=",">
  35. (#{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})
  36. </foreach>
  37. </insert>
  38. <!-- 批量插入或按主键更新 -->
  39. <insert id="insertOrUpdateBatch" keyProperty="invoiceId" useGeneratedKeys="true">
  40. insert into zgdd.inv_account_incoice(billerinvoice_subjectsinvoice_byother_unitinvoice_numinvoice_timeno_has_taxratetaxinvoice_moneyinvoice_typepayout_timepayout_moneynot_payout_moneydel_flag)
  41. values
  42. <foreach collection="entities" item="entity" separator=",">
  43. (#{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})
  44. </foreach>
  45. on duplicate key update
  46. 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>
  47. <select id="selectAccountIncoice" resultType="com.ydtech.modules.inv.model.InvAccountIncoiceResult">
  48. SELECT
  49. sum(round(invoice_money,2)) as invoice_money_sum,
  50. sum( round(tax, 2) ) as tax_sum,
  51. sum( round(no_has_tax, 2) ) as no_has_tax_sum,
  52. sum( round(payout_money, 2) ) as payoutMoneySum,
  53. sum( round(not_payout_money, 2) ) as notPayoutMoneySum,
  54. sum( round(invoice_num, 2) ) as invoiceNumSum
  55. FROM inv_account_incoice WHERE del_flag = '0'
  56. <if test="invoiceTimeStart != null">
  57. and invoice_time &gt;= #{invoiceTimeStart}
  58. </if>
  59. <if test="invoiceTimeEnd != null">
  60. and invoice_time &lt;= #{invoiceTimeEnd}
  61. </if>
  62. <if test="biller != null and biller != ''">
  63. and biller like concat('%',#{biller},'%')
  64. </if>
  65. <if test="invoiceBy != null and invoiceBy != '' ">
  66. and invoice_by like concat('%',#{invoiceBy},'%')
  67. </if>
  68. <if test="otherUnit != null and otherUnit != '' ">
  69. and other_unit like concat('%',#{otherUnit},'%')
  70. </if>
  71. <if test="invoiceType != null and invoiceType != '' ">
  72. and invoice_type = #{invoiceType}
  73. </if>
  74. <if test="clearFlag != null and clearFlag != '' ">
  75. and clear_flag = #{clearFlag}
  76. </if>
  77. </select>
  78. </mapper>