SparePickDetailMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.store.SparePickDetailMapper">
  4. <sql id="Base_Column_List">
  5. sparepickdetail.id,
  6. sparepickdetail.pick_id,
  7. sparepickdetail.pick_no,
  8. sparepickdetail.spare_id,
  9. sparepickdetail.store_id,
  10. sparepickdetail.num,
  11. sparepickdetail.price,
  12. sparepickdetail.total_price,
  13. sparepickdetail.created_user_id,
  14. sparepickdetail.created_user_name,
  15. sparepickdetail.update_user_id,
  16. sparepickdetail.update_user_name,
  17. sparepickdetail.created_time,
  18. sparepickdetail.update_time
  19. </sql>
  20. <sql id="Ref_Column_List">
  21. sparepickdetail.pick_id,
  22. sparepickdetail.pick_no,
  23. sparepickdetail.store_id,
  24. sparepickdetail.spare_id,
  25. sparepickdetail.num,
  26. sparepickdetail.price,
  27. sparepickdetail.total_price </sql>
  28. <sql id="List_Condition">
  29. <if test="id != null and id != ''">
  30. and sparepickdetail.id = #{id}
  31. </if>
  32. <if test="pickId != null and pickId != ''">
  33. and sparepickdetail.pick_id = #{pickId}
  34. </if>
  35. <if test="storeId != null and storeId != ''">
  36. and sparepickdetail.store_id = #{storeId}
  37. </if>
  38. <if test="pickNo != null and pickNo != ''">
  39. and sparepickdetail.pick_no = #{pickNo}
  40. </if>
  41. <if test="spareId != null and spareId != ''">
  42. and sparepickdetail.spare_id = #{spareId}
  43. </if>
  44. <if test="num != null">
  45. and sparepickdetail.num = #{num}
  46. </if>
  47. <if test="createdUserId != null and createdUserId != ''">
  48. and sparepickdetail.created_user_id = #{createdUserId}
  49. </if>
  50. <if test="createdUserName != null and createdUserName != ''">
  51. and sparepickdetail.created_user_name = #{createdUserName}
  52. </if>
  53. <if test="updateUserId != null and updateUserId != ''">
  54. and sparepickdetail.update_user_id = #{updateUserId}
  55. </if>
  56. <if test="updateUserName != null and updateUserName != ''">
  57. and sparepickdetail.update_user_name = #{updateUserName}
  58. </if>
  59. <if test="createdTimeStart != null">
  60. and sparepickdetail.created_time <![CDATA[>=]]>; #{createdTimeStart}
  61. </if>
  62. <if test="createdTimeEnd != null">
  63. and sparepickdetail.created_time <![CDATA[<=]]> #{createdTimeEnd}
  64. </if>
  65. <if test="createdTime != null">
  66. and sparepickdetail.created_time = #{createdTime}
  67. </if>
  68. <if test="updateTimeStart != null">
  69. and sparepickdetail.update_time <![CDATA[>=]]>; #{updateTimeStart}
  70. </if>
  71. <if test="updateTimeEnd != null">
  72. and sparepickdetail.update_time <![CDATA[<=]]> #{updateTimeEnd}
  73. </if>
  74. <if test="updateTime != null">
  75. and sparepickdetail.update_time = #{updateTime}
  76. </if>
  77. <if test="keyword != null and keyword != ''">
  78. and sparepickdetail.id like concat('%',#{keyword},'%')
  79. </if>
  80. <if test="searchStartTime != null">
  81. and sparepickdetail.created_time <![CDATA[ >= ]]> #{searchStartTime}
  82. </if>
  83. <if test="searchEndTime != null">
  84. and sparepickdetail.created_time <![CDATA[ <= ]]> #{searchEndTime}
  85. </if>
  86. </sql>
  87. <select id="selectList" parameterType="com.platform.dao.dto.store.SparePickDetailDTO"
  88. resultType="com.platform.dao.vo.query.store.SparePickDetailVO">
  89. select sparepickdetail.*, store.name storeName, spareinfo.name spareName
  90. from t_spare_pick_detail as sparepickdetail
  91. left join t_store store on store.id = sparepickdetail.store_id
  92. left join t_spare_part_info spareinfo on spareinfo.id = sparepickdetail.spare_id
  93. <where>
  94. <include refid="List_Condition"/>
  95. <if test="useCompany != null and useCompany != ''">
  96. and store.use_company = #{useCompany}
  97. </if>
  98. <if test="useProject != null and useProject != ''">
  99. and store.use_project = #{useProject}
  100. </if>
  101. <if test="userId != null and userId != ''">
  102. and store.user_id = #{userId}
  103. </if>
  104. </where>
  105. </select>
  106. <select id="selectReportList" parameterType="com.platform.dao.dto.store.SparePickDetailDTO"
  107. resultType="com.platform.dao.vo.query.store.SparePickDetailVO">
  108. select
  109. sum(sparepickdetail.num) as totalNum,
  110. spareinfo.name spareName,
  111. spareinfo.id spareId,
  112. store.name storeName,
  113. store.id storeId,
  114. sparetype.name typeName
  115. from t_spare_pick_detail as sparepickdetail,t_spare_part_info spareinfo ,t_spare_type sparetype,t_store store
  116. <where>
  117. spareinfo.id = sparepickdetail.spare_id
  118. and spareinfo.type_id = sparetype.id
  119. and store.id = sparepickdetail.store_id
  120. <include refid="List_Condition"/>
  121. </where>
  122. </select>
  123. <update id="updateBatch" parameterType="java.util.List">
  124. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  125. update t_spare_pick_detail
  126. <set>
  127. num=#{item.num},
  128. total_price = #{item.totalPrice}
  129. </set>
  130. where id = #{item.id}
  131. </foreach>
  132. </update>
  133. </mapper>