ShippingPlanMapper.xml 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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="cn.iocoder.yudao.module.order.dal.mysql.ShippingPlanMapper">
  4. <!-- 根据ID查询出货计划(忽略租户) -->
  5. <select id="selectByRecId" resultType="cn.iocoder.yudao.module.order.dal.dataobject.ShippingPlanDO">
  6. SELECT
  7. RecID as recId,
  8. Domain as domain,
  9. LotSerial as lotSerial,
  10. Remark as remark,
  11. ShippingSite as shippingSite,
  12. Status as status,
  13. CreateUser as createUser,
  14. UpdateUser as updateUser,
  15. CreateTime as createTime,
  16. UpdateTime as updateTime,
  17. IsActive as isActive,
  18. IsConfirm as isConfirm,
  19. Priority as priority,
  20. ShippingDate as shippingDate,
  21. ShippingAddress as shippingAddress,
  22. Consignee as consignee,
  23. Telephone as telephone
  24. FROM ShippingPlan
  25. WHERE RecID = #{id}
  26. </select>
  27. <!-- 出货计划列表查询 - 根据需求文档提供的SQL -->
  28. <select id="selectShippingPlanList" resultType="cn.iocoder.yudao.module.order.controller.admin.delivery.vo.ShippingPlanListItemVO">
  29. SELECT
  30. a.ShippingSite,
  31. a.lotserial,
  32. a.ShippingDate,
  33. a.ShippingAddress,
  34. a.Consignee,
  35. a.Telephone,
  36. a.recid as id,
  37. b.OrdNbr,
  38. b.bill_no,
  39. b.OrdDate,
  40. b.Country,
  41. b.CustomNo,
  42. b.CustomName,
  43. b.ItemNum,
  44. b.ItemName,
  45. b.Specification,
  46. b.Qty,
  47. b.Packaging,
  48. c.RecID,
  49. b.RecID as sid,
  50. b.Volume,
  51. b.Weight
  52. FROM ShippingPlan a
  53. LEFT JOIN ShippingPlanDetail b ON a.recid = b.plan_id
  54. LEFT JOIN ASNBOLShipperDetail c ON b.itemnum = c.ContainerItem
  55. AND b.bill_no = c.ordnbr
  56. AND c.shtype = 'SH'
  57. AND c.Typed &lt;&gt; 'S'
  58. AND c.IsActive = 1
  59. WHERE 1=1
  60. <if test="req.lotSerial != null and req.lotSerial != ''">
  61. AND a.LotSerial LIKE CONCAT('%', #{req.lotSerial}, '%')
  62. </if>
  63. <if test="req.status != null and req.status != ''">
  64. AND a.Status = #{req.status}
  65. </if>
  66. <if test="req.consignee != null and req.consignee != ''">
  67. AND a.Consignee LIKE CONCAT('%', #{req.consignee}, '%')
  68. </if>
  69. <if test="req.ordNbr != null and req.ordNbr != ''">
  70. AND b.OrdNbr LIKE CONCAT('%', #{req.ordNbr}, '%')
  71. </if>
  72. <if test="req.billNo != null and req.billNo != ''">
  73. AND b.bill_no LIKE CONCAT('%', #{req.billNo}, '%')
  74. </if>
  75. <if test="req.country != null and req.country != ''">
  76. AND b.Country = #{req.country}
  77. </if>
  78. <if test="req.shippingDate != null and req.shippingDate != ''">
  79. AND DATE(a.ShippingDate) = #{req.shippingDate}
  80. </if>
  81. <if test="req.customNo != null and req.customNo != ''">
  82. AND b.CustomNo LIKE CONCAT('%', #{req.customNo}, '%')
  83. </if>
  84. <if test="req.itemNum != null and req.itemNum != ''">
  85. AND b.ItemNum LIKE CONCAT('%', #{req.itemNum}, '%')
  86. </if>
  87. ORDER BY a.CreateTime DESC
  88. </select>
  89. </mapper>