TaInvoiceDetailMapper.xml 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.njyunzhi.invoice.mapper.TaInvoiceDetailMapper">
  4. <insert id="createBatch">
  5. INSERT INTO ta_invoice_detail (
  6. `detail_id`,
  7. `invoice_id`,
  8. `invoice_person_id`,
  9. `person_id`,
  10. `person_name`,
  11. `invoice_org_id`,
  12. `org_id`,
  13. `org_name`,
  14. `tax_no`,
  15. `address`,
  16. `phone`,
  17. `bank_id`,
  18. `bank_name`,
  19. `card_no`,
  20. `invoice_item_tpl_id`,
  21. `item_name`,
  22. `charge`,
  23. `merge_remark`,
  24. `stay_remark`,
  25. `status`,
  26. `create_date`
  27. ) SELECT
  28. UUID_SHORT( ),
  29. t.invoice_id,
  30. t.invoice_person_id,
  31. NULL,
  32. t.`name`,
  33. t.invoice_org_id,
  34. NULL,
  35. t.org_name,
  36. NULL,
  37. NULL,
  38. NULL,
  39. NULL,
  40. NULL,
  41. NULL,
  42. s.invoice_item_tpl_id,
  43. s.`name`,
  44. s.charge,
  45. NULL,
  46. NULL,
  47. 1,
  48. now( )
  49. FROM
  50. ta_invoice_person t
  51. INNER JOIN ta_invoice_item_tpl s ON t.invoice_id = s.invoice_id
  52. WHERE
  53. t.invoice_id = #{invoiceId}
  54. AND t.`status` &gt; -1
  55. AND s.`status` &gt; -1
  56. </insert>
  57. <select id="getByPerson" resultType="com.njyunzhi.invoice.entity.TaInvoiceDetail">
  58. SELECT
  59. *
  60. FROM
  61. ta_invoice_detail t
  62. WHERE
  63. t.invoice_id = #{invoiceId}
  64. AND t.person_id = #{personId}
  65. AND t.`status` &gt; -1
  66. </select>
  67. </mapper>