OrderInvoiceMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.caimei.modules.bulkpurchase.dao.OrderInvoiceDao">
  4. <sql id="orderInvoiceColumns">
  5. a.*
  6. </sql>
  7. <select id="get" resultType="OrderInvoice">
  8. SELECT
  9. <include refid="orderInvoiceColumns"/>
  10. FROM bp_order_invoice a
  11. WHERE a.id = #{id}
  12. </select>
  13. <select id="findList" resultType="OrderInvoice">
  14. SELECT
  15. <include refid="orderInvoiceColumns"/>
  16. FROM bp_order_invoice a
  17. <where>
  18. </where>
  19. <choose>
  20. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  21. ORDER BY ${page.orderBy}
  22. </when>
  23. <otherwise>
  24. </otherwise>
  25. </choose>
  26. </select>
  27. <select id="findAllList" resultType="OrderInvoice">
  28. SELECT
  29. <include refid="orderInvoiceColumns"/>
  30. FROM bp_order_invoice a
  31. <where>
  32. </where>
  33. <choose>
  34. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  35. ORDER BY ${page.orderBy}
  36. </when>
  37. <otherwise>
  38. </otherwise>
  39. </choose>
  40. </select>
  41. <insert id="insert" parameterType="OrderInvoice" keyProperty="id" useGeneratedKeys="true">
  42. INSERT INTO bp_order_invoice(orderId,
  43. invoiceTitle,
  44. invoiceType,
  45. type,
  46. invoiceContent,
  47. invoiceTitleType,
  48. registeredAddress,
  49. registeredPhone,
  50. bankAccountNo,
  51. openBank,
  52. corporationTaxNum)
  53. VALUES (#{orderId},
  54. #{invoiceTitle},
  55. #{invoiceType},
  56. #{type},
  57. #{invoiceContent},
  58. #{invoiceTitleType},
  59. #{registeredAddress},
  60. #{registeredPhone},
  61. #{bankAccountNo},
  62. #{openBank},
  63. #{corporationTaxNum})
  64. </insert>
  65. <update id="update">
  66. UPDATE bp_order_invoice SET
  67. <if test="invoiceTitle != null and invoiceTitle != ''">
  68. invoiceTitle = #{invoiceTitle},
  69. </if>
  70. <if test="type != null and type != ''">
  71. type = #{type},
  72. </if>
  73. <if test="invoiceType != null and invoiceType != ''">
  74. invoiceType = #{invoiceType},
  75. </if>
  76. <if test="invoiceContent != null and invoiceContent != ''">
  77. invoiceContent = #{invoiceContent},
  78. </if>
  79. <if test="invoiceTitleType != null and invoiceTitleType != ''">
  80. invoiceTitleType = #{invoiceTitleType},
  81. </if>
  82. <if test="registeredAddress != null and registeredAddress != ''">
  83. registeredAddress = #{registeredAddress},
  84. </if>
  85. <if test="registeredPhone != null and registeredPhone != ''">
  86. registeredPhone = #{registeredPhone},
  87. </if>
  88. <if test="bankAccountNo != null and bankAccountNo != ''">
  89. bankAccountNo = #{bankAccountNo},
  90. </if>
  91. <if test="openBank != null and openBank != ''">
  92. openBank = #{openBank},
  93. </if>
  94. <if test="corporationTaxNum != null and corporationTaxNum != ''">
  95. corporationTaxNum = #{corporationTaxNum},
  96. </if>
  97. orderId = #{orderId}
  98. WHERE id = #{id}
  99. </update>
  100. <select id="getWithorderId" resultType="OrderInvoice">
  101. SELECT *
  102. from bp_order_invoice
  103. where orderId = #{orderId}
  104. </select>
  105. <delete id="delete">
  106. DELETE
  107. FROM bp_order_invoice
  108. WHERE id = #{id}
  109. </delete>
  110. <update id="updateByID">
  111. UPDATE bp_order_invoice
  112. SET invoiceTitle = #{invoiceTitle},
  113. type = #{type},
  114. invoiceType = #{invoiceType},
  115. invoiceContent = #{invoiceContent},
  116. invoiceTitleType = #{invoiceTitleType},
  117. registeredAddress = #{registeredAddress},
  118. registeredPhone = #{registeredPhone},
  119. bankAccountNo = #{bankAccountNo},
  120. openBank = #{openBank},
  121. corporationTaxNum = #{corporationTaxNum},
  122. orderId = #{orderId}
  123. WHERE id = #{id}
  124. </update>
  125. </mapper>