SbModelSpareBomMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.platform.dao.mapper.sb.SbModelSpareBomMapper">
  4. <sql id="Left_Column">
  5. bom.id, bom.period, bom.period_type, bom.num, bom.model_id, bom.sb_id, bom.sb_part_id,
  6. bom.check_date,
  7. bom.next_check_date,
  8. bom.change_num,
  9. bom.next_change_num,
  10. bom.spare_id, sbInfo.name, sbInfo.model, sbInfo.no, sbInfo.zbh, sbInfo.name_model, part.name as sbPartName
  11. </sql>
  12. <select id="selectExportList" parameterType="com.platform.dao.dto.sb.SbModelSpareBomDTO"
  13. resultType="com.platform.dao.vo.sb.SbModelSpareBomVO">
  14. select
  15. bom.id,
  16. bom.check_date,
  17. bom.next_check_date,
  18. bom.change_num,
  19. bom.next_change_num,bom.model_id, bom.sb_id, bom.sb_part_id, bom.spare_id,sbInfo.name,sbInfo.model, sbInfo.no, sbInfo.zbh, part.name as sbPartName
  20. from t_sb_model_spare_bom bom
  21. LEFT JOIN t_sb_info sbInfo ON bom.sb_id = sbInfo.id
  22. LEFT JOIN t_part_info part on bom.sb_part_id = part.id
  23. where
  24. bom.sb_id = sbInfo.id
  25. GROUP BY bom.spare_id
  26. </select>
  27. <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbModelSpareBomDTO"
  28. resultType="com.platform.dao.vo.sb.SbModelSpareBomVO">
  29. select
  30. partInfo.name as spareName,
  31. <include refid="Left_Column"/>
  32. from t_sb_model_spare_bom bom
  33. LEFT JOIN t_sb_info sbInfo ON bom.sb_id = sbInfo.id
  34. LEFT JOIN t_part_info part on bom.sb_part_id = part.id
  35. left join t_spare_part_info partInfo on bom.spare_id = partInfo.id
  36. <where>
  37. <if test="spareId != null">
  38. and bom.spare_id = #{spareId}
  39. </if>
  40. <if test="sbId != null">
  41. and bom.sb_id = #{sbId}
  42. </if>
  43. <if test="isSpecial != null">
  44. and partInfo.is_special = #{isSpecial}
  45. </if>
  46. <if test="keyword != null and keyword != ''">
  47. and (
  48. sbInfo.no like concat('%',#{keyword},'%')
  49. or sbInfo.name like concat('%',#{keyword},'%')
  50. or sbInfo.model like concat('%',#{keyword},'%')
  51. or sbInfo.zbh like concat('%',#{keyword},'%')
  52. )
  53. </if>
  54. </where>
  55. </select>
  56. <select id="selectLongYanVOList" parameterType="com.platform.dao.dto.store.SpareStoreDTO"
  57. resultType="com.platform.dao.vo.query.store.SpareStoreVO">
  58. select bom.id,
  59. bom.spare_name as spareName,bom.no as no,bom.ggxh as ggxh from t_sb_model_spare_bom bom
  60. <where>
  61. <if test="spareId != null">
  62. and bom.spare_id = #{spareId}
  63. </if>
  64. <if test="sbId != null">
  65. and bom.sb_id = #{sbId}
  66. </if>
  67. </where>
  68. </select>
  69. <update id="updateBatch" parameterType="java.util.List">
  70. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  71. update t_sb_model_spare_bom
  72. <set>
  73. spare_id = #{item.spareId}
  74. </set>
  75. where id = #{item.id}
  76. </foreach>
  77. </update>
  78. <update id="updateBatchAll" parameterType="java.util.List">
  79. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  80. update t_sb_model_spare_bom
  81. <set>
  82. period = #{item.period},
  83. period_type = #{item.periodType},
  84. num = #{item.num}
  85. </set>
  86. where id = #{item.id}
  87. </foreach>
  88. </update>
  89. <select id="selectVOList1" parameterType="com.platform.dao.dto.sb.SbModelSpareBomDTO"
  90. resultType="com.platform.dao.vo.sb.SbModelSpareBomVO">
  91. select
  92. partInfo.name as spareName,used.change_date,used.real_change_date,
  93. <include refid="Left_Column"/>
  94. from t_sb_model_spare_bom bom
  95. LEFT JOIN t_sb_info sbInfo ON bom.sb_id = sbInfo.id
  96. LEFT JOIN t_part_info part on bom.sb_part_id = part.id
  97. left join t_spare_part_info partInfo on bom.spare_id = partInfo.id
  98. left join t_spare_part_used used on used.spare_id=bom.spare_id
  99. <where>
  100. <if test="spareId != null">
  101. and bom.spare_id = #{spareId}
  102. </if>
  103. <if test="sbId != null">
  104. and bom.sb_id = #{sbId}
  105. </if>
  106. <if test="isSpecial != null">
  107. and partInfo.is_special = #{isSpecial}
  108. </if>
  109. <if test="keyword != null and keyword != ''">
  110. and (
  111. sbInfo.no like concat('%',#{keyword},'%')
  112. or sbInfo.name like concat('%',#{keyword},'%')
  113. or sbInfo.model like concat('%',#{keyword},'%')
  114. or sbInfo.zbh like concat('%',#{keyword},'%')
  115. )
  116. </if>
  117. </where>
  118. </select>
  119. </mapper>