OutStoreDetailMapper.xml 9.4 KB

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