O
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.5 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  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.xujie.sys.modules.pms.mapper.PurchaseOrderMapper">
  4. <select id="queryPurchaseOrder" resultType="com.xujie.sys.modules.pms.entity.PurchaseOrder">
  5. select po.id,
  6. po.site,
  7. po.bu_no,
  8. po.part_no,
  9. po.inventory_stock_id,
  10. po.qty,
  11. po.status,
  12. po.create_by,
  13. po.create_time,
  14. po.purchase_order_no,
  15. po.quantity_of_arrival,
  16. ps.part_description,
  17. ps.umid,
  18. dbo.get_bu_desc(po.site, po.bu_no) as bu_desc
  19. from purchase_order po
  20. left join part_spare ps on po.site = ps.site and po.part_no = ps.part_no and po.bu_no = ps.bu_no
  21. left join accessBu ab on po.site = ab.site and po.bu_no = ab.bu_no and ab.username = #{params.createBy}
  22. <where>
  23. ab.username is not null
  24. <if test="params.site != null and params.site != ''">
  25. and po.site = #{params.site}
  26. </if>
  27. <if test="params.partNo != null and params.partNo != ''">
  28. and po.part_no like '%'+ #{params.partNo} +'%'
  29. </if>
  30. <if test="params.partDescription != null and params.partDescription != ''">
  31. and ps.part_description like '%'+ #{params.partDescription} + '%'
  32. </if>
  33. <if test="params.buNo != null and params.buNo != ''">
  34. and po.bu_no = #{params.buNo}
  35. </if>
  36. <if test="params.status != null and params.status != ''">
  37. and po.status = #{params.status}
  38. </if>
  39. <if test="params.startDate != null">
  40. and po.create_time >= #{params.startDate}
  41. </if>
  42. <if test="params.endDate != null">
  43. and po.create_time <![CDATA[<=]]> #{params.endDate}
  44. </if>
  45. </where>
  46. order by po.id desc
  47. </select>
  48. <select id="queryPurchaseOrderNo" resultType="java.lang.String">
  49. SELECT 'P' + CONVERT(CHAR(8), GETDATE(), 112) +
  50. RIGHT('00000' + CAST(ISNULL(MAX(CAST(SUBSTRING(purchase_order_no, 10, 5) AS INT)), 0) + 1 AS VARCHAR(5)),5)
  51. AS purchase_order_no
  52. FROM dbo.purchase_order
  53. WHERE purchase_order_no LIKE 'P' + CONVERT(CHAR(8), GETDATE(), 112) + '%'
  54. </select>
  55. </mapper>