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.

122 lines
4.4 KiB

1 year ago
1 year ago
1 year ago
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.spring.modules.quote.mapper.QuoteDetailToolMapper">
  4. <select id="queryQuoteDetailTool" resultType="com.spring.modules.quote.entity.QuoteDetailTool">
  5. select qdt.id,
  6. qdt.quote_detail_id,
  7. qdt.quote_id,
  8. qdt.quote_no,
  9. qdt.site,
  10. qdt.bu_no,
  11. qdt.version_no,
  12. qdt.quote_detail_item_no,
  13. qdt.tool_no,
  14. qdt.item_no,
  15. qdt.tool_desc,
  16. qdt.tool_qty,
  17. qdt.tool_spec,
  18. qdt.unit_cost,
  19. qdt.expected_service_life,
  20. qdt.quote_unit_cost,
  21. qdt.remark
  22. from plm_quote_detail_tool qdt
  23. <where>
  24. <if test="quoteDetailId != null">
  25. and qdt.quote_detail_id = #{quoteDetailId}
  26. </if>
  27. <if test="quoteNo != null and quoteNo != ''">
  28. and quote_no = #{quoteNo}
  29. </if>
  30. <if test="site != null and site != ''">
  31. and site = #{site}
  32. </if>
  33. <if test="buNo != null and buNo != ''">
  34. and bu_no = #{buNo}
  35. </if>
  36. <if test="quoteId != null ">
  37. and qdt.quote_id = #{quoteId}
  38. </if>
  39. <if test="versionNo != null and versionNo != ''">
  40. and version_no = #{versionNo}
  41. </if>
  42. <if test="quoteDetailItemNo">
  43. and quote_detail_item_no = #{quoteDetailItemNo}
  44. </if>
  45. </where>
  46. order by qdt.item_no desc
  47. </select>
  48. <select id="queryItemNo" resultType="int">
  49. select isnull(max(item_no),0)+1 from plm_quote_detail_tool where quote_detail_id = #{quoteDetailId}
  50. </select>
  51. <select id="queryToolList" resultType="com.spring.modules.quote.entity.QuoteDetailTool">
  52. select
  53. t.tool_id as toolNo,
  54. t.tool_description as toolDesc,
  55. t.Spec as toolSpec,
  56. t.standard_cost as unitCost
  57. from tool_header t
  58. <where>
  59. site = #{site}
  60. <if test="toolNo != null and toolNo != ''">
  61. and t.tool_id like #{toolNo}
  62. </if>
  63. <if test="toolDesc != null and toolDesc != ''">
  64. and t.tool_description like #{toolDesc}
  65. </if>
  66. </where>
  67. </select>
  68. <insert id="saveToolByRouting">
  69. insert into plm_quote_detail_tool
  70. (quote_detail_id, quote_id, quote_no, site, bu_no, version_no, quote_detail_item_no, tool_no, item_no, tool_desc, tool_qty, tool_spec, unit_cost, expected_service_life, quote_unit_cost, remark, create_by, create_date, update_by, update_date)
  71. select
  72. #{quoteDetailId},
  73. #{quoteId},
  74. #{quoteNo},
  75. #{site},
  76. #{buNo},
  77. #{versionNo},
  78. #{quoteDetailItemNo},
  79. '',
  80. row_number() over (ORDER BY rt.id),
  81. th.tool_description,
  82. rt.tool_qty,
  83. '',
  84. isnull(th.standard_cost,0),
  85. 0,
  86. case when rt.tool_qty = 0 then 0 else th.standard_cost / rt.tool_qty end,
  87. null,
  88. #{createBy},
  89. #{createDate},
  90. null,
  91. null
  92. from routing_tool rt
  93. left join tool_header th on rt.tool_id = th.tool_id and rt.site = th.site
  94. where rt.site = #{site}
  95. and rt.part_no = #{partNo}
  96. and rt.routing_revision = #{routingRevision}
  97. and rt.routing_type = #{routingType}
  98. and rt.alternative_no = #{alternativeNo}
  99. </insert>
  100. <select id="queryToolListByPage" resultType="com.spring.modules.quote.entity.QuoteDetailTool">
  101. select
  102. t.tool_id as toolNo,
  103. t.tool_description as toolDesc,
  104. t.Spec as toolSpec,
  105. t.standard_cost as unitCost
  106. from tool_header t
  107. <where>
  108. site = #{params.site}
  109. <if test="params.toolNo != null and params.toolNo != ''">
  110. and t.tool_id like #{params.toolNo}
  111. </if>
  112. <if test="params.toolDesc != null and params.toolDesc != ''">
  113. and t.tool_description like #{params.toolDesc}
  114. </if>
  115. </where>
  116. </select>
  117. </mapper>