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.

290 lines
12 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years 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.quotation.mapper.QuotationInformationMapper">
  4. <!-- 报价信息列表 -->
  5. <select id="quotationInformationSearch" parameterType="com.spring.modules.quotation.vo.QuotationInformationVo" resultType="com.spring.modules.quotation.vo.QuotationInformationVo">
  6. SELECT
  7. site,
  8. quotation_no,
  9. customer_no,
  10. dbo.plm_get_customer_desc(site, customer_no) as customerDesc,
  11. dbo.plm_get_customer_currency(site, customer_no) as customerCurrency,
  12. project_id,
  13. dbo.plm_get_project_name(site, project_id) as projectName,
  14. tracker,
  15. dbo.plm_get_user_display(site, tracker) as trackerName,
  16. quoter,
  17. dbo.plm_get_user_display(site, quoter) as quoterName,
  18. quotation_status,
  19. test_part_no,
  20. dbo.plm_get_test_part_desc(site, test_part_no) as partName,
  21. priority_level,
  22. required_completion_date,
  23. remark,
  24. technical_considerations,
  25. customer_responsible_person,
  26. customer_responsible_person_phone,
  27. create_date,
  28. create_by,
  29. update_date,
  30. update_by,
  31. next_to_do,
  32. actuality_quotation_date,
  33. quotation_result_information,
  34. actuality_submission_date,
  35. submission_method,
  36. submission_remark,
  37. actuality_reply_date,
  38. confirm_results,
  39. confirm_by,
  40. confirm_information,
  41. quotation_result_status,
  42. quotation_batch_no,
  43. quotation_item_no
  44. FROM plm_quotation_information
  45. <where>
  46. site = #{query.site}
  47. <if test="query.quotationNo != null and query.quotationNo != ''">
  48. AND quotation_no = #{query.quotationNo}
  49. </if>
  50. <if test="query.quotationBatchNo != null and query.quotationBatchNo != ''">
  51. AND quotation_batch_no like #{query.quotationBatchNo}
  52. </if>
  53. <if test="query.quotationItemNo != null and query.quotationItemNo != ''">
  54. AND quotation_item_no = #{query.quotationItemNo}
  55. </if>
  56. <if test = "query.customerNo != null and query.customerNo != ''">
  57. AND customer_no like #{query.customerNo}
  58. </if>
  59. <if test = "query.customerDesc != null and query.customerDesc != ''">
  60. AND dbo.plm_get_customer_desc(site, customer_no) like #{query.customerDesc}
  61. </if>
  62. <if test = "query.projectId != null and query.projectId != ''">
  63. AND project_id like #{query.projectId}
  64. </if>
  65. <if test = "query.projectName != null and query.projectName != ''">
  66. AND dbo.plm_get_project_name(site, project_id) like #{query.projectName}
  67. </if>
  68. <if test = "query.trackerName != null and query.trackerName != ''">
  69. AND dbo.plm_get_user_display(site, tracker) like #{query.trackerName}
  70. </if>
  71. <if test = "query.quoterName != null and query.quoterName != ''">
  72. AND dbo.plm_get_user_display(site, quoter) like #{query.quoterName}
  73. </if>
  74. <if test = "query.testPartNo != null and query.testPartNo != ''">
  75. AND test_part_no like #{query.testPartNo}
  76. </if>
  77. <if test = "query.partName != null and query.partName != ''">
  78. AND dbo.plm_get_test_part_desc(site, test_part_no) like #{query.partName}
  79. </if>
  80. <if test = "query.quotationStatus != null and query.quotationStatus != ''">
  81. AND quotation_status = #{query.quotationStatus}
  82. </if>
  83. <if test = "query.priorityLevel != null and query.priorityLevel != ''">
  84. AND priority_level = #{query.priorityLevel}
  85. </if>
  86. <if test="query.startDate != null ">
  87. AND required_completion_date >= #{query.startDate}
  88. </if>
  89. <if test="query.endDate != null ">
  90. AND #{query.endDate} >= required_completion_date
  91. </if>
  92. order by quotation_batch_no desc,quotation_item_no
  93. </where>
  94. </select>
  95. <!--按照orderRef1查询文件文件参数-->
  96. <select id="getFileContentList" resultType="SysOssEntity" parameterType="SysOssEntity">
  97. SELECT
  98. id,
  99. url,
  100. create_date,
  101. file_name,
  102. new_file_name,
  103. create_by,
  104. order_ref1,
  105. order_ref2,
  106. order_ref3,
  107. file_type,
  108. file_suffix,
  109. file_type_code,
  110. file_remark
  111. FROM sys_oss
  112. <where>
  113. <if test="orderRef1 != '' and orderRef1 != null ">
  114. and order_ref1 = #{orderRef1}
  115. </if>
  116. <if test="orderRef2 != '' and orderRef2 != null ">
  117. and order_ref2 = #{orderRef2}
  118. </if>
  119. <!-- <if test="orderRef2 != '' and orderRef2 != null ">-->
  120. <!-- and order_ref2 in-->
  121. <!-- <foreach collection="refArr" item="item" open="(" separator="," close=")">-->
  122. <!-- #{item}-->
  123. <!-- </foreach>-->
  124. <!-- </if>-->
  125. <if test="orderRef3 != '' and orderRef3 != null ">
  126. and order_ref3 = #{orderRef3}
  127. </if>
  128. </where>
  129. </select>
  130. <!-- 获得报价单号 -->
  131. <select id="getQuotationNo" resultType="string" parameterType="QuotationInformationEntity">
  132. SELECT
  133. Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(quotation_batch_no, 3, 10))), 0) + 1), 8)
  134. FROM plm_quotation_information
  135. WHERE site = #{site}
  136. </select>
  137. <!-- 获取产品列表 -->
  138. <select id="getProjectPartList" parameterType="PlmProjectPartData" resultType="PlmProjectPartData">
  139. SELECT
  140. ppp.id,
  141. ppp.site,
  142. ppp.test_part_no,
  143. ppp.part_name,
  144. ppp.part_desc,
  145. ppp.part_type,
  146. ppp.project_id,
  147. ppi.project_name,
  148. ppi.customer_id as customerNo,
  149. dbo.plm_get_customer_desc(ppi.site, ppi.customer_id) as customerDesc
  150. FROM plm_project_part as ppp
  151. LEFT JOIN plm_project_info as ppi on ppp.site = ppi.site and ppp.project_id = ppi.project_id
  152. <where>
  153. ppp.site = #{site}
  154. <if test = "projectId != null and projectId != ''">
  155. AND ppp.project_id = #{projectId}
  156. </if>
  157. <if test = "testPartNo != null and testPartNo != ''">
  158. AND ppp.test_part_no LIKE '%' + #{testPartNo}+'%'
  159. </if>
  160. <if test = "partName != null and partName != ''">
  161. AND ppp.part_name LIKE '%' + #{partName}+'%'
  162. </if>
  163. </where>
  164. </select>
  165. <!-- 获取项目信息 -->
  166. <select id="getProjectInformation" parameterType="PlmProjectInfoData" resultType="PlmProjectInfoData">
  167. SELECT
  168. project_id,
  169. ori_project_id,
  170. project_type_db,
  171. project_name,
  172. status,
  173. project_source,
  174. customer_id,
  175. create_by,
  176. create_date,
  177. update_by,
  178. update_date,
  179. priority,
  180. site,
  181. id,
  182. project_desc,
  183. customer_remark,
  184. remark,
  185. dbo.get_projectTeamName(site, project_id, 'owner') projectOwnerName,
  186. dbo.get_projectTeamName(site, project_id, 'manager') ProjectManagerName,
  187. dbo.plm_get_dictDataLabel('project_info_type_db',project_type_db,site) projectType,
  188. dbo.plm_get_projectBaseDesc(status,'project_status') projectStatusDesc,
  189. dbo.plm_get_dictDataLabel('project_info_source',project_source,site) projectSourceDesc,
  190. dbo.plm_get_customer_desc(site,customer_id) customerName,
  191. dbo.plm_get_dictDataLabel('project_info_priority',priority,site) priorityDesc,
  192. need_date,
  193. dbo.get_projectUserRoleName(site,project_id) userRoleName
  194. FROM plm_project_info
  195. where site = #{site} and project_id = #{projectId}
  196. </select>
  197. <!-- 获取客户信息 -->
  198. <select id="getCustomerInformation" parameterType="com.spring.modules.customer.vo.CustomerInformationVo" resultType="com.spring.modules.customer.vo.CustomerInformationVo">
  199. SELECT
  200. site,
  201. customer_no,
  202. customer_desc,
  203. customer_currency,
  204. turnover_of_year,
  205. potential_revenue_of_year,
  206. important_customer,
  207. customer_status,
  208. customer_description,
  209. customer_industry,
  210. company_name,
  211. job_description,
  212. remark,
  213. create_date,
  214. create_by,
  215. update_date,
  216. update_by,
  217. dbo.plm_get_contactName(site, customer_no, 'Y') as contactName,
  218. dbo.plm_get_contactPhoneNumber(site, customer_no, 'Y') as contactPhoneNumber1,
  219. dbo.plm_get_addressName(site, customer_no, 'Y') as addressName,
  220. dbo.plm_get_position(site, customer_no, 'Y') as position,
  221. dbo.plm_get_addressType(site, customer_no, 'Y') as addressType
  222. FROM plm_customer_information
  223. where site = #{site} and customer_no = #{customerNo}
  224. </select>
  225. <!-- 批量删除文件-->
  226. <delete id="batchDeleteQuotationFile" parameterType="com.spring.modules.quotation.vo.SysOssVo">
  227. DELETE FROM sys_oss
  228. <where>
  229. order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
  230. <if test = "fileName != null and fileName != ''">
  231. AND file_name = #{fileName}
  232. </if>
  233. </where>
  234. </delete>
  235. <select id="searchQuotationByQuotationNo" resultType="com.spring.modules.quotation.vo.QuotationInformationVo">
  236. SELECT
  237. site,
  238. quotation_no,
  239. customer_no,
  240. dbo.plm_get_customer_desc(site, customer_no) as customerDesc,
  241. dbo.plm_get_customer_currency(site, customer_no) as customerCurrency,
  242. project_id,
  243. dbo.plm_get_project_name(site, project_id) as projectName,
  244. tracker,
  245. dbo.plm_get_user_display(site, tracker) as trackerName,
  246. quoter,
  247. dbo.plm_get_user_display(site, quoter) as quoterName,
  248. quotation_status,
  249. test_part_no,
  250. dbo.plm_get_test_part_desc(site, test_part_no) as partName,
  251. priority_level,
  252. required_completion_date,
  253. remark,
  254. technical_considerations,
  255. customer_responsible_person,
  256. customer_responsible_person_phone,
  257. create_date,
  258. create_by,
  259. update_date,
  260. update_by,
  261. next_to_do,
  262. actuality_quotation_date,
  263. quotation_result_information,
  264. actuality_submission_date,
  265. submission_method,
  266. submission_remark,
  267. actuality_reply_date,
  268. confirm_results,
  269. confirm_by,
  270. confirm_information,
  271. quotation_result_status,
  272. quotation_batch_no,
  273. quotation_item_no
  274. FROM plm_quotation_information
  275. <where>
  276. site = #{site}
  277. <if test = "quotationNo != null and quotationNo != ''">
  278. AND quotation_no like #{quotationNo}
  279. </if>
  280. </where>
  281. </select>
  282. </mapper>