OutStoreDetailMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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.OutStoreDetailMapper">
  4. <sql id="Base_Column_List">
  5. outstoredetail.id,
  6. outstoredetail.out_id,
  7. outstoredetail.out_no,
  8. outstoredetail.store_id,
  9. outstoredetail.spare_id,
  10. outstoredetail.no,
  11. outstoredetail.ggxh,
  12. outstoredetail.real_num,
  13. outstoredetail.store_num,
  14. outstoredetail.yy_id,outstoredetail.auto_id,
  15. outstoredetail.out_flag,
  16. outstoredetail.c_batch,
  17. outstoredetail.store_name,
  18. outstoredetail.store_position,
  19. outstoredetail.project_no,
  20. outstoredetail.project_name,
  21. outstoredetail.project_second_no,
  22. outstoredetail.project_second_name,
  23. outstoredetail.spare_name,
  24. outstoredetail.num,
  25. outstoredetail.price,
  26. outstoredetail.total_price,
  27. outstoredetail.created_user_id,
  28. outstoredetail.created_user_name,
  29. outstoredetail.update_user_id,
  30. outstoredetail.update_user_name,
  31. outstoredetail.created_time,
  32. outstoredetail.type,
  33. outstoredetail.update_time
  34. </sql>
  35. <sql id="Ref_Column_List">
  36. outstoredetail.out_id,
  37. outstoredetail.out_no,
  38. outstoredetail.store_id,
  39. outstoredetail.no,
  40. outstoredetail.ggxh,
  41. outstoredetail.type,
  42. outstoredetail.spare_id,
  43. outstoredetail.c_batch,
  44. outstoredetail.real_num,
  45. outstoredetail.store_num,
  46. outstoredetail.yy_id,outstoredetail.auto_id,
  47. outstoredetail.out_flag,
  48. outstoredetail.store_name,
  49. outstoredetail.store_position,
  50. outstoredetail.project_no,
  51. outstoredetail.project_name,
  52. outstoredetail.project_second_no,
  53. outstoredetail.project_second_name,
  54. outstoredetail.spare_name,
  55. outstoredetail.num,
  56. outstoredetail.price,
  57. outstoredetail.total_price
  58. </sql>
  59. <sql id="List_Condition">
  60. <if test="id != null and id != ''">
  61. and outstoredetail.id = #{id}
  62. </if>
  63. <if test="outId != null and outId != ''">
  64. and outstoredetail.out_id = #{outId}
  65. </if>
  66. <if test="yyId != null and yyId != ''">
  67. and outstoredetail.yy_id = #{yyId}
  68. </if>
  69. <if test="autoId != null and autoId != ''">
  70. and outstoredetail.auto_id = #{autoId}
  71. </if>
  72. <if test="outFlag != null and outFlag != ''">
  73. and outstoredetail.out_flag = #{outFlag}
  74. </if>
  75. <if test="type != null and type != ''">
  76. and outstoredetail.type = #{type}
  77. </if>
  78. <if test="outNo != null and outNo != ''">
  79. and outstoredetail.out_no = #{outNo}
  80. </if>
  81. <if test="storeId != null and storeId != ''">
  82. and outstoredetail.store_id = #{storeId}
  83. </if>
  84. <if test="spareId != null and spareId != ''">
  85. and outstoredetail.spare_id = #{spareId}
  86. </if>
  87. <if test="num != null">
  88. and outstoredetail.num = #{num}
  89. </if>
  90. <if test="createdUserId != null and createdUserId != ''">
  91. and outstoredetail.created_user_id = #{createdUserId}
  92. </if>
  93. <if test="createdUserName != null and createdUserName != ''">
  94. and outstoredetail.created_user_name = #{createdUserName}
  95. </if>
  96. <if test="updateUserId != null and updateUserId != ''">
  97. and outstoredetail.update_user_id = #{updateUserId}
  98. </if>
  99. <if test="updateUserName != null and updateUserName != ''">
  100. and outstoredetail.update_user_name = #{updateUserName}
  101. </if>
  102. <if test="createdTimeStart != null">
  103. and outstoredetail.created_time <![CDATA[>=]]>; #{createdTimeStart}
  104. </if>
  105. <if test="createdTimeEnd != null">
  106. and outstoredetail.created_time <![CDATA[<=]]> #{createdTimeEnd}
  107. </if>
  108. <if test="createdTime != null">
  109. and outstoredetail.created_time = #{createdTime}
  110. </if>
  111. <if test="updateTimeStart != null">
  112. and outstoredetail.update_time <![CDATA[>=]]>; #{updateTimeStart}
  113. </if>
  114. <if test="updateTimeEnd != null">
  115. and outstoredetail.update_time <![CDATA[<=]]> #{updateTimeEnd}
  116. </if>
  117. <if test="updateTime != null">
  118. and outstoredetail.update_time = #{updateTime}
  119. </if>
  120. <if test="keyword != null and keyword != ''">
  121. and outstoredetail.id like concat('%',#{keyword},'%')
  122. </if>
  123. <if test="searchStartTime != null">
  124. and outstoredetail.created_time <![CDATA[ >= ]]> #{searchStartTime}
  125. </if>
  126. <if test="searchEndTime != null">
  127. and outstoredetail.created_time <![CDATA[ <= ]]> #{searchEndTime}
  128. </if>
  129. </sql>
  130. <select id="selectList" parameterType="com.platform.dao.dto.store.OutStoreDetailDTO"
  131. resultType="com.platform.dao.vo.query.store.OutStoreDetailVO">
  132. select outstoredetail.*, store.name storeName, spareinfo.name spareName, spareinfo.no spareNo
  133. from t_out_store_detail as outstoredetail
  134. left join t_store store on store.id = outstoredetail.store_id
  135. left join t_spare_part_info spareinfo on spareinfo.id = outstoredetail.spare_id
  136. <where>
  137. <include refid="List_Condition"/>
  138. <if test="useCompany != null and useCompany != ''">
  139. and store.use_company = #{useCompany}
  140. </if>
  141. <if test="useProject != null and useProject != ''">
  142. and store.use_project = #{useProject}
  143. </if>
  144. <if test="userId != null and userId != ''">
  145. and store.user_id = #{userId}
  146. </if>
  147. <if test="spareNo != null and spareNo != ''">
  148. and spareinfo.no = #{spareNo}
  149. </if>
  150. </where>
  151. </select>
  152. <select id="selectReportList" parameterType="com.platform.dao.dto.store.OutStoreDetailDTO"
  153. resultType="com.platform.dao.vo.query.store.OutStoreDetailVO">
  154. select outstoredetail.*,
  155. sum(outstoredetail.real_num) as totalNum
  156. /*spareinfo.name spareName,
  157. spareinfo.id spareId,
  158. spareinfo.no spareNo,
  159. store.name storeName,
  160. store.id storeId,
  161. sparetype.name typeName*/
  162. from t_out_store_detail as outstoredetail
  163. <where>
  164. /*spareinfo.id = outstoredetail.spare_id
  165. and spareinfo.type_id = sparetype.id
  166. and store.id = outstoredetail.store_id*/
  167. <include refid="List_Condition"/>
  168. <!--<if test="useCompany != null and useCompany != ''">
  169. and store.use_company = #{useCompany}
  170. </if>
  171. <if test="useProject != null and useProject != ''">
  172. and store.use_project = #{useProject}
  173. </if>
  174. <if test="userId != null and userId != ''">
  175. and store.user_id = #{userId}
  176. </if>
  177. <if test="spareNo != null and spareNo != ''">
  178. and spareinfo.no = #{spareNo}
  179. </if>-->
  180. </where>
  181. </select>
  182. <update id="updateBatch" parameterType="java.util.List">
  183. <foreach collection="list" item="item" index="index" open="" close="" separator=";">
  184. update t_out_store_detail
  185. <set>
  186. num=#{item.num},
  187. total_price = #{item.totalPrice}
  188. </set>
  189. where id = #{item.id}
  190. </foreach>
  191. </update>
  192. <select id="getCurrentlyList" parameterType="com.platform.dao.dto.store.OutStoreFormDTO"
  193. resultType="com.platform.dao.vo.query.store.OutStoreDetailVO"
  194. >
  195. select * from t_out_store_detail
  196. left join
  197. t_out_store_form
  198. on
  199. t_out_store_form.id = t_out_store_detail.out_id
  200. left join
  201. t_store
  202. on t_out_store_form.store_id=t_store.id
  203. <where>
  204. <if test="userId!=null">
  205. and user_id=#{userId}
  206. </if>
  207. <if test="searchStartTime != null">
  208. and t_out_store_detail.created_time <![CDATA[ > ]]> #{searchStartTime}
  209. </if>
  210. <if test="searchEndTime != null">
  211. and t_out_store_detail.created_time <![CDATA[ < ]]> #{searchEndTime}
  212. </if>
  213. <if test="status != null">
  214. and status = #{status}
  215. </if>
  216. </where>
  217. </select>
  218. </mapper>