PurchaseApplyDetailServiceDaoImplMapper.xml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="purchaseApplyDetailServiceDaoImpl">
  6. <!-- 保存订单明细信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessPurchaseApplyDetailInfo" parameterType="Map">
  8. insert into business_purchase_apply_detail
  9. (operate,apply_order_id,b_id,res_id,quantity,remark,status_cd) values
  10. (#{operate},#{applyOrderId},#{bId},#{resId},#{quantity},#{remark},#{statusCd})
  11. </insert>
  12. <!-- 查询订单明细信息(Business) add by wuxw 2018-07-03 -->
  13. <select id="getBusinessPurchaseApplyDetailInfo" parameterType="Map" resultType="Map">
  14. select
  15. t.operate,t.apply_order_id,t.apply_order_id applyOrderId,
  16. t.b_id,t.b_id bId,t.res_id,t.res_id resId
  17. from business_purchase_apply_detail t
  18. where 1 =1
  19. <if test="operate !=null and operate != ''">
  20. and t.operate= #{operate}
  21. </if>
  22. <if test="applyOrderId !=null and applyOrderId != ''">
  23. and t.apply_order_id= #{applyOrderId}
  24. </if>
  25. <if test="bId !=null and bId != ''">
  26. and t.b_id= #{bId}
  27. </if>
  28. <if test="resId !=null and resId != ''">
  29. and t.res_id= #{resId}
  30. </if>
  31. </select>
  32. <!-- 保存订单明细信息至 instance表中 add by wuxw 2018-07-03 -->
  33. <insert id="savePurchaseApplyDetailInfoInstance" parameterType="Map">
  34. insert into purchase_apply_detail(
  35. apply_order_id,status_cd,id,b_id,res_id
  36. ) select t.apply_order_id,'0',t.id,t.b_id,t.res_id from business_purchase_apply_detail t where 1=1
  37. and t.operate= 'ADD'
  38. <if test="applyOrderId !=null and applyOrderId != ''">
  39. and t.apply_order_id= #{applyOrderId}
  40. </if>
  41. <if test="id !=null and id != ''">
  42. and t.id= #{id}
  43. </if>
  44. <if test="bId !=null and bId != ''">
  45. and t.b_id= #{bId}
  46. </if>
  47. <if test="resId !=null and resId != ''">
  48. and t.res_id= #{resId}
  49. </if>
  50. </insert>
  51. <!-- 查询订单明细信息 add by wuxw 2018-07-03 -->
  52. <select id="getPurchaseApplyDetailInfo" parameterType="Map" resultType="Map">
  53. select
  54. t.apply_order_id applyOrderId,
  55. t.status_cd statusCd,
  56. t.b_id bId,
  57. t.res_id resId,
  58. t.remark remark,
  59. t.quantity quantity
  60. from purchase_apply_detail t
  61. where 1 =1
  62. <if test="applyOrderId !=null and applyOrderId != ''">
  63. and t.apply_order_id= #{applyOrderId}
  64. </if>
  65. <if test="statusCd !=null and statusCd != ''">
  66. and t.status_cd= #{statusCd}
  67. </if>
  68. <if test="id !=null and id != ''">
  69. and t.id= #{id}
  70. </if>
  71. <if test="bId !=null and bId != ''">
  72. and t.b_id= #{bId}
  73. </if>
  74. <if test="resId !=null and resId != ''">
  75. and t.res_id= #{resId}
  76. </if>
  77. <if test="page != -1 and page != null ">
  78. limit #{page}, #{row}
  79. </if>
  80. </select>
  81. <!-- 修改订单明细信息 add by wuxw 2018-07-03 -->
  82. <update id="updatePurchaseApplyDetailInfoInstance" parameterType="Map">
  83. update purchase_apply_detail t set t.status_cd = #{statusCd}
  84. <if test="newBId != null and newBId != ''">
  85. ,t.b_id = #{newBId}
  86. </if>
  87. <if test="applyOrderId !=null and applyOrderId != ''">
  88. , t.apply_order_id= #{applyOrderId}
  89. </if>
  90. <if test="resId !=null and resId != ''">
  91. , t.res_id= #{resId}
  92. </if>
  93. where 1=1
  94. <if test="id !=null and id != ''">
  95. and t.id= #{id}
  96. </if>
  97. <if test="bId !=null and bId != ''">
  98. and t.b_id= #{bId}
  99. </if>
  100. </update>
  101. <!-- 查询订单明细数量 add by wuxw 2018-07-03 -->
  102. <select id="queryPurchaseApplyDetailsCount" parameterType="Map" resultType="Map">
  103. select count(1) count
  104. from purchase_apply_detail t
  105. where 1 =1
  106. <if test="applyOrderId !=null and applyOrderId != ''">
  107. and t.apply_order_id= #{applyOrderId}
  108. </if>
  109. <if test="statusCd !=null and statusCd != ''">
  110. and t.status_cd= #{statusCd}
  111. </if>
  112. <if test="id !=null and id != ''">
  113. and t.id= #{id}
  114. </if>
  115. <if test="bId !=null and bId != ''">
  116. and t.b_id= #{bId}
  117. </if>
  118. <if test="resId !=null and resId != ''">
  119. and t.res_id= #{resId}
  120. </if>
  121. </select>
  122. </mapper>