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.

165 lines
9.7 KiB

  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.modules.part.dao.PartMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.xujie.modules.part.entity.Part">
  6. <id column="id" property="id" />
  7. <result column="site" property="site" />
  8. <result column="part_no" property="partNo" />
  9. <result column="part_desc" property="partDesc" />
  10. <result column="remark" property="remark" />
  11. <result column="create_by" property="createBy" />
  12. <result column="create_date" property="createDate" />
  13. <result column="update_by" property="updateBy" />
  14. <result column="update_date" property="updateDate" />
  15. <result column="npc" property="npc" />
  16. <result column="part_spec" property="partSpec" />
  17. <result column="buyer_name" property="buyerName" />
  18. <result column="buyer_id" property="buyerId" />
  19. <result column="sourcing_name" property="sourcingName" />
  20. <result column="sourcing_id" property="sourcingId" />
  21. <result column="category" property="category" />
  22. <result column="unit" property="unit" />
  23. <result column="status" property="status" />
  24. <result column="code_no" property="codeNo" />
  25. </resultMap>
  26. <!-- 通用查询结果列 -->
  27. <sql id="BaseColumnList">
  28. site, part_no, part_desc, remark, create_by, create_date, update_by, update_date, npc, part_spec, buyer_name, buyer_id, sourcing_name, sourcing_id, category, unit, status, code_no, id
  29. </sql>
  30. <select id="getListByModel" resultType="com.xujie.modules.part.entity.Part">
  31. select <include refid="BaseColumnList" />
  32. from part
  33. where 1=1
  34. <if test="site != null and site != '' "> and site = #{site}</if>
  35. <if test="partNo != null and partNo != '' "> and part_no = #{partNo}</if>
  36. <if test="partDesc != null and partDesc != '' "> and part_desc = #{partDesc}</if>
  37. <if test="remark != null and remark != '' "> and remark = #{remark}</if>
  38. <if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
  39. <if test="createDate != null and createDate != '' "> and create_date = #{createDate}</if>
  40. <if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
  41. <if test="updateDate != null and updateDate != '' "> and update_date = #{updateDate}</if>
  42. <if test="npc != null and npc != '' "> and npc = #{npc}</if>
  43. <if test="partSpec != null and partSpec != '' "> and part_spec = #{partSpec}</if>
  44. <if test="buyerName != null and buyerName != '' "> and buyer_name = #{buyerName}</if>
  45. <if test="buyerId != null "> and buyer_id = #{buyerId}</if>
  46. <if test="sourcingName != null and sourcingName != '' "> and sourcing_name = #{sourcingName}</if>
  47. <if test="sourcingId != null "> and sourcing_id = #{sourcingId}</if>
  48. <if test="category != null and category != '' "> and category = #{category}</if>
  49. <if test="unit != null and unit != '' "> and unit = #{unit}</if>
  50. <if test="status != null "> and status = #{status}</if>
  51. <if test="codeNo != null and codeNo != '' "> and code_no = #{codeNo}</if>
  52. <if test="id != null "> and id = #{id}</if>
  53. ORDER BY id
  54. </select>
  55. <select id="myPage" resultType="com.xujie.modules.part.vo.PartVo">
  56. select
  57. <include refid="BaseColumnList"/>
  58. from part
  59. where site = '${query.site}'
  60. <if test="query.id != null "> and id = '${query.id}'</if>
  61. <if test="query.partNo != null and query.partNo != '' "> and part_no like '%${query.partNo}%'</if>
  62. <if test="query.partDesc != null and query.partDesc != '' "> and part_desc like '%${query.partDesc}%'</if>
  63. <if test="query.remark != null and query.remark != '' "> and remark like '%${query.remark}%'</if>
  64. <if test="query.createBy != null and query.createBy != '' "> and create_by like '%${query.createBy}%'</if>
  65. <if test="query.createDate != null "> and create_date like '%${query.createDate}%'</if>
  66. <if test="query.updateBy != null and query.updateBy != '' "> and update_by like '%${query.updateBy}%'</if>
  67. <if test="query.updateDate != null "> and update_date like '%${query.updateDate}%'</if>
  68. <if test="query.npc != null and query.npc != '' "> and npc like '%${query.npc}%'</if>
  69. <if test="query.partSpec != null and query.partSpec != '' "> and part_spec like '%${query.partSpec}%'</if>
  70. <if test="query.buyerName != null and query.buyerName != '' "> and buyer_name like '%${query.buyerName}%'</if>
  71. <if test="query.buyerId != null "> and buyer_id = '${query.buyerId}'</if>
  72. <if test="query.sourcingName != null and query.sourcingName != '' "> and sourcing_name like '%${query.sourcingName}%'</if>
  73. <if test="query.sourcingId != null "> and sourcing_id = '${query.sourcingId}'</if>
  74. <if test="query.category != null and query.category != '' "> and category like '%${query.category}%'</if>
  75. <if test="query.unit != null and query.unit != '' "> and unit like '%${query.unit}%'</if>
  76. <if test="query.status != null and query.status != ''"> and status = '${query.status}'</if>
  77. <if test="query.codeNo != null and query.codeNo != '' "> and code_no like '%${query.codeNo}%'</if>
  78. ORDER BY id
  79. </select>
  80. <select id="getAvailableValueList" resultType="com.xujie.modules.base.data.PlmPropertiesItemAvailableData">
  81. select
  82. ItemNo,
  83. ValueNo,
  84. AvailableValue
  85. from plm_properties_item_available
  86. where itemNo = #{propertiesItemNo} and site = #{site} and ItemType = #{recordType}
  87. </select>
  88. <select id="searchPartApproveList" resultType="com.xujie.modules.part.vo.PartVo">
  89. select
  90. ni.apply_no,
  91. ni.node_code,
  92. ni.attempt_no,
  93. ni.site,
  94. ni.order_type,
  95. ni.assignee_user_id,
  96. ni.assignee_name,
  97. ni.special_release,
  98. ni.department_id,
  99. ni.department_name,
  100. i.status as flowStatus,
  101. p.part_stage,
  102. p.part_no,
  103. p.part_desc,
  104. p.remark,
  105. p.create_by,
  106. p.create_date,
  107. p.update_by,
  108. p.update_date,
  109. p.npc,
  110. p.part_spec,
  111. p.buyer_name,
  112. p.buyer_id,
  113. p.sourcing_name,
  114. p.sourcing_id,
  115. p.category,
  116. p.unit,
  117. p.status,
  118. p.code_no,
  119. p.id
  120. from erf_flow_node_instance ni
  121. left join erf_flow_instance i on ni.apply_no = i.apply_no and ni.site = i.site and ni.order_type = i.order_type
  122. left join part p on i.order_ref1 = p.part_no and i.site = p.site
  123. where ni.site = '${query.site}'
  124. and ni.status = 'PENDING'
  125. and ni.order_type = '${query.orderType}'
  126. and p.id is not null
  127. <if test="query.id != null "> and ni.id = '${query.id}'</if>
  128. <if test="query.partNo != null and query.partNo != '' "> and p.part_no like '%${query.partNo}%'</if>
  129. <if test="query.partDesc != null and query.partDesc != '' "> and p.part_desc like '%${query.partDesc}%'</if>
  130. <if test="query.remark != null and query.remark != '' "> and p.remark like '%${query.remark}%'</if>
  131. <if test="query.createBy != null and query.createBy != '' "> and p.create_by like '%${query.createBy}%'</if>
  132. <if test="query.createDate != null "> and p.create_date like '%${query.createDate}%'</if>
  133. <if test="query.updateBy != null and query.updateBy != '' "> and p.update_by like '%${query.updateBy}%'</if>
  134. <if test="query.updateDate != null "> and p.update_date like '%${query.updateDate}%'</if>
  135. <if test="query.npc != null and query.npc != '' "> and p.npc like '%${query.npc}%'</if>
  136. <if test="query.partSpec != null and query.partSpec != '' "> and p.part_spec like '%${query.partSpec}%'</if>
  137. <if test="query.buyerName != null and query.buyerName != '' "> and p.buyer_name like '%${query.buyerName}%'</if>
  138. <if test="query.buyerId != null "> and p.buyer_id = '${query.buyerId}'</if>
  139. <if test="query.sourcingName != null and query.sourcingName != '' "> and p.sourcing_name like '%${query.sourcingName}%'</if>
  140. <if test="query.sourcingId != null "> and p.sourcing_id = '${query.sourcingId}'</if>
  141. <if test="query.category != null and query.category != '' "> and p.category like '%${query.category}%'</if>
  142. <if test="query.unit != null and query.unit != '' "> and p.unit like '%${query.unit}%'</if>
  143. <if test="query.status != null and query.status != ''"> and p.status = '${query.status}'</if>
  144. <if test="query.codeNo != null and query.codeNo != '' "> and p.code_no like '%${query.codeNo}%'</if>
  145. <if test="query.partStage != null and query.partStage != ''"> and p.part_stage = '${query.partStage}'</if>
  146. <if test="query.flowStatus != null and query.flowStatus != ''"> and i.flow_status = '${query.flowStatus}'</if>
  147. <if test="query.applyNo != null and query.applyNo != ''"> and i.apply_no like '%${query.applyNo}%'</if>
  148. <if test="query.nodeCode != null and query.nodeCode != ''"> and ni.node_code = '${query.nodeCode}'</if>
  149. <if test="query.specialRelease != null and query.specialRelease != ''"> and ni.special_release = '${query.specialRelease}'</if>
  150. <!-- 112 样式码表示 yyyyMMdd 格式-->
  151. <if test="query.startDate != null ">
  152. AND CONVERT(varchar(8), ni.receive_time, 112) &gt;= #{query.startDate}
  153. </if>
  154. <if test="query.endDate != null ">
  155. AND CONVERT(varchar(8), ni.receive_time, 112) &lt;= #{query.endDate}
  156. </if>
  157. order by p.id desc
  158. </select>
  159. </mapper>