LogisticsBatchMapper.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.order.dao.LogisticsBatchDao">
  4. <sql id="columns">
  5. a.id AS id,
  6. a.shopOrderID AS shopOrderID,
  7. a.orderID AS orderID,
  8. a.outStoreTimes AS outStoreTimes,
  9. a.mailer AS mailer,
  10. a.shopID AS shopID,
  11. a.updateDate AS updateDate,
  12. a.deliveryTime AS deliveryTime,
  13. a.receiptTime AS receiptTime,
  14. a.remarkImage AS remarkImage,
  15. a.remark AS remark
  16. </sql>
  17. <insert id="insert" parameterType="LogisticsBatch" keyProperty="id" useGeneratedKeys="true">
  18. INSERT INTO cm_logistics_batch (
  19. shopOrderID,
  20. orderID,
  21. outStoreTimes,
  22. mailer,
  23. shopID,
  24. updateDate,
  25. deliveryTime,
  26. receiptTime,
  27. remarkImage,
  28. remark
  29. ) VALUES (
  30. #{shopOrderID},
  31. #{orderID},
  32. #{outStoreTimes},
  33. #{mailer},
  34. #{shopID},
  35. #{updateDate},
  36. #{deliveryTime},
  37. #{receiptTime},
  38. #{remarkImage},
  39. #{remark}
  40. )
  41. </insert>
  42. <select id="findByShopOrderID" resultType="LogisticsBatch">
  43. select <include refid="columns"/>
  44. from cm_logistics_batch a where a.shopOrderID = #{shopOrderID}
  45. order by a.outStoreTimes desc
  46. </select>
  47. <select id="findByShopOrderIDWithTimes" resultType="LogisticsBatch">
  48. select <include refid="columns"/>
  49. from cm_logistics_batch a where a.shopOrderID = #{shopOrderID}
  50. and a.outStoreTimes = #{outStoreTimes}
  51. order by a.outStoreTimes desc
  52. </select>
  53. <select id="get" resultType="LogisticsBatch">
  54. select <include refid="columns"/>
  55. from cm_logistics_batch a where a.id = #{id}
  56. </select>
  57. <select id="findByOrderID" resultType="LogisticsBatch">
  58. select <include refid="columns"/>
  59. from cm_logistics_batch a where a.orderID = #{orderID}
  60. order by a.deliveryTime desc
  61. </select>
  62. <select id="findBatch" resultType="LogisticsBatch">
  63. select <include refid="columns"/>
  64. from cm_logistics_batch a
  65. <where>
  66. 1 = 1
  67. <if test="orderID != null and orderID != ''">
  68. and a.orderID = #{orderID}
  69. </if>
  70. <if test="logisticsBatchID != null and logisticsBatchID != ''">
  71. and a.logisticsBatchID = #{logisticsBatchID}
  72. </if>
  73. </where>
  74. order by a.deliveryTime desc
  75. </select>
  76. </mapper>