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.

148 lines
5.7 KiB

1 year ago
3 years ago
3 years ago
1 year ago
3 years 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.ResourceSpareMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.xujie.sys.modules.pms.entity.ResourceSpareEntity" id="resourceSpareMap">
  6. <result property="id" column="id"/>
  7. <result property="resourceId" column="resource_id"/>
  8. <result property="partNo" column="part_no"/>
  9. <result property="qtyUsable" column="qty_usable"/>
  10. <result property="delflag" column="delflag"/>
  11. <result property="version" column="version"/>
  12. <result property="site" column="site"/>
  13. </resultMap>
  14. <select id="queryPage" resultType="com.xujie.sys.modules.pms.entity.ResourceSpareVoData">
  15. select
  16. A.id,
  17. A.site,
  18. A.bu_no,
  19. dbo.get_bu_desc(A.site, A.bu_no) buDesc,
  20. A.resource_id,
  21. B.ObjectDesc as resource_desc,
  22. A.part_no,
  23. C.part_description,
  24. A.qty_usable
  25. from resource_spare A
  26. left join eam_object B on A.site = B.site and A.bu_no = b.bu_no and A.resource_id = B.ObjectID
  27. left join part_spare C on A.site = C.site and A.bu_no = c.bu_no and A.part_no = C.part_no
  28. <where>
  29. A.site in (select site from eam_access_site where username = #{query.username})
  30. and (A.site + '-' + A.bu_no) in (select * from dbo.query_bu(#{query.username}))
  31. <if test="query.buDesc != null and query.buDesc != ''">
  32. AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
  33. </if>
  34. <if test="query.partNo != null and query.partNo != ''">
  35. and A.part_no like '%' + #{query.partNo} + '%'
  36. </if>
  37. <if test="query.partDescription != null and query.partDescription != ''">
  38. and C.part_description like '%' + #{query.partDescription} + '%'
  39. </if>
  40. <if test="query.resourceId != null and query.resourceId != ''">
  41. and A.resource_id like '%' + #{query.resourceId} +'%'
  42. </if>
  43. <if test="query.resourceDesc != null and query.resourceDesc != ''">
  44. and B.ObjectDesc like '%' + #{query.resourceDesc} + '%'
  45. </if>
  46. </where>
  47. GROUP BY A.site, A.resource_id, B.ObjectDesc, A.part_no, A.qty_usable, A.id, C.part_description, A.bu_no
  48. </select>
  49. <!--按照设备编码查询设备的备件列表信息-->
  50. <select id="getResourceSpareListByResourceId" resultType="com.xujie.sys.modules.pms.entity.vo.ResourceSpareVo">
  51. SELECT
  52. rs.id,
  53. rs.resource_id,
  54. rs.part_no,
  55. ps.part_description,
  56. rs.qty_usable,
  57. rs.delflag,
  58. rs.version,
  59. rs.site,
  60. ps.spec,
  61. ps.umid,
  62. ps.remark,
  63. rs.bu_no,
  64. ps.coreFlag,
  65. case when ps.coreFlag = 'Y' then '是' when ps.coreFlag = 'N' then '否' else '' end as coreFlagDesc
  66. FROM resource_spare rs
  67. LEFT JOIN part_spare ps ON rs.site = ps.site AND rs.part_no = ps.part_no and rs.bu_no = ps.bu_no
  68. <where>
  69. rs.site = #{site} AND rs.resource_id = #{objectID}
  70. <if test="buNo != null and buNo != ''">
  71. and rs.bu_no = #{buNo}
  72. </if>
  73. </where>
  74. </select>
  75. <!--按照设备编码查询设备的备件列表信息-->
  76. <select id="getDeviceCorePartList" resultType="com.xujie.sys.modules.pms.entity.vo.ResourceSpareVo">
  77. SELECT
  78. rs.id,
  79. rs.site,
  80. rs.bu_no,
  81. rs.resource_id,
  82. rs.part_no,
  83. ps.part_description,
  84. rs.qty_usable,
  85. rs.delflag,
  86. rs.version,
  87. ps.spec,
  88. ps.umid,
  89. ps.remark,
  90. ewc.oldSerialNo,
  91. ewc.newSerialNo
  92. FROM eam_workOrder_coreComponents ewc,resource_spare rs
  93. LEFT JOIN part_spare ps ON rs.site = ps.site and rs.bu_no = ps.bu_no AND rs.part_no = ps.part_no
  94. where rs.site = ewc.site and rs.bu_no = ewc.bu_no and rs.part_no = ewc.partNo and ewc.OrderNo = #{orderNo}
  95. and rs.site = #{site}
  96. and rs.bu_no = #{buNo}
  97. AND rs.resource_id = #{objectID}
  98. and ps.coreFlag = 'Y'
  99. </select>
  100. <!--按照设备编码查询设备的备件列表信息-->
  101. <select id="getDeviceCorePartListAll" resultType="com.xujie.sys.modules.pms.entity.vo.ResourceSpareVo">
  102. SELECT
  103. rs.id,
  104. rs.site,
  105. rs.bu_no,
  106. rs.resource_id,
  107. rs.part_no,
  108. ps.part_description,
  109. rs.qty_usable,
  110. rs.delflag,
  111. rs.version,
  112. ps.spec,
  113. ps.umid,
  114. ps.remark
  115. FROM resource_spare rs
  116. LEFT JOIN part_spare ps ON rs.site = ps.site and rs.bu_no = ps.bu_no AND rs.part_no = ps.part_no
  117. where rs.site = #{site}
  118. and rs.bu_no = #{buNo}
  119. AND rs.resource_id = #{objectID}
  120. and ps.coreFlag = 'Y'
  121. </select>
  122. <select id="getResourceSpareInfo" resultType="com.xujie.sys.modules.pms.entity.vo.ResourceSpareVo">
  123. select
  124. A.site,
  125. A.resource_id,
  126. A.part_no,
  127. A.qty_usable,
  128. A.id,
  129. B.ObjectDesc as resource_desc,
  130. C.part_description
  131. from resource_spare A
  132. left join eam_object B on A.site = B.site and A.resource_id = B.ObjectID
  133. left join part_spare C on A.site = C.site and A.part_no = C.part_no
  134. <where>
  135. A.site = #{site}
  136. and A.part_no = #{partNo}
  137. and A.resource_id = #{resourceId}
  138. </where>
  139. </select>
  140. </mapper>