agentPurchaseOrderMapper.xml 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC
  4. "-//mybatis.org//DTD Mapper 3.0//EN"
  5. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  6. <!-- 命名,每一个映射对象不一样
  7. namespace:必须与对应的接口全类名一致
  8. -->
  9. <mapper namespace="com.iamberry.wechat.service.mapper.AgentPurchaseOrderMapper">
  10. <sql id="agentOrderItem">
  11. item_id itemId,
  12. agent_orderid agentOrderid,
  13. product_id productId,
  14. color_id colorId,
  15. product_type productType,
  16. product_rent_type productRentType,
  17. item_num itemNum,
  18. item_total itemTotal,
  19. item_create_date itemCreateDate,
  20. item_product_name itemProductName,
  21. item_color_name itemColorName,
  22. item_product_discount itemProductDiscount,
  23. item_product_price itemProductPrice,
  24. item_product_pic itemProductPic
  25. </sql>
  26. <insert id="addAgentOrder" parameterType="AgentOrder">
  27. insert into tb_iamberry_agent_order (`agent_orderid` ,`agent_id` ,`agent_yet_amount` ,`agent_amount` ,`agent_create_date`,`agent_status` ,`agent_address_info` ,`agent_address_postnum` ,`agent_address_tel` ,`agent_address_name` ,`agent_admin_remark` )
  28. values (#{agentOrderid},#{agentId},#{agentYetAmount},#{agentAmount},#{agentCreateDate},#{agentStatus},#{agentAddressInfo},#{agentAddressPostnum},#{agentAddressTel},#{agentAddressName},#{agentAdminRemark})
  29. </insert>
  30. <insert id="addAgentOrderItemList" parameterType="AgentOrderItem" useGeneratedKeys="true">
  31. insert into tb_iamberry_agent_order_item (`agent_orderid` ,`product_id` ,`color_id` ,`product_type`
  32. ,`product_rent_type` ,`item_num` ,`item_total` ,`item_product_name` ,`item_color_name` ,`item_product_discount`
  33. ,`item_product_price` ,`item_product_pic` )
  34. values
  35. <foreach collection="list" item="item" index="index" separator="," open="" close="">
  36. (#{item.agentOrderid},#{item.productId},#{item.colorId},#{item.productType},#{item.productRentType},#{item.itemNum},#{item.itemTotal},#{item.itemProductName},#{item.itemColorName},#{item.itemProductDiscount},#{item.itemProductPrice},#{item.itemProductPic})
  37. </foreach>
  38. </insert>
  39. <select id="listAgentOrderItem" parameterType="AgentOrderItem" resultType="AgentOrderItem">
  40. SELECT
  41. <include refid="agentOrderItem"></include>
  42. FROM
  43. tb_iamberry_agent_order_item
  44. WHERE
  45. agent_orderid = #{agentOrderid}
  46. ORDER BY item_id DESC
  47. </select>
  48. <update id="updateAgentPurchaseOrder" parameterType="AgentOrder" >
  49. update
  50. tb_iamberry_agent_order
  51. <set>
  52. <if test="agentPostNum !=null and agentPostNum !=''">
  53. agent_post_num = #{agentPostNum},
  54. </if>
  55. <if test="agentPostFirm !=null and agentPostFirm !=''">
  56. agent_post_firm = #{agentPostFirm},
  57. </if>
  58. <if test="agentStatus !=null and agentStatus !=''">
  59. agent_status = #{agentStatus},
  60. </if>
  61. <if test="agentSendDate !=null and agentSendDate !=''">
  62. agent_send_date = #{agentSendDate},
  63. </if>
  64. <if test="agentAddressInfo !=null and agentAddressInfo !=''">
  65. agent_address_info = #{agentAddressInfo},
  66. </if>
  67. <if test="agentAddressPostnum !=null and agentAddressPostnum !=''">
  68. agent_address_postnum = #{agentAddressPostnum},
  69. </if>
  70. <if test="agentAddressTel !=null and agentAddressTel !=''">
  71. agent_address_tel = #{agentAddressTel},
  72. </if>
  73. <if test="agentAddressName !=null and agentAddressName !=''">
  74. agent_address_name = #{agentAddressName},
  75. </if>
  76. <if test="agentAdminRemark !=null and agentAdminRemark !=''">
  77. agent_admin_remark = #{agentAdminRemark},
  78. </if>
  79. <if test="agentTransactionId !=null and agentTransactionId !=''">
  80. agent_transaction_id = #{agentTransactionId},
  81. </if>
  82. <if test="agentTransactionDate !=null and agentTransactionDate !=''">
  83. agent_transaction_date = #{agentTransactionDate},
  84. </if>
  85. </set>
  86. where
  87. agent_orderid = #{agentOrderid}
  88. </update>
  89. </mapper>