山东众工仓储管理系统后台程序
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.

DistributionMapper.xml 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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.th.demo.mapping.ware.DistributionMapper" >
  4. <resultMap id="BaseResultMap" type="com.th.demo.model.ware.Distribution" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="truck_no" property="truckNo" jdbcType="VARCHAR" />
  7. <result column="driver_name" property="driverName" jdbcType="VARCHAR" />
  8. <result column="driver_phone" property="driverPhone" jdbcType="VARCHAR" />
  9. <result column="sum_weight" property="sumWeight" jdbcType="DOUBLE" />
  10. <result column="sum_count" property="sumCount" jdbcType="DOUBLE" />
  11. <result column="suttle" property="suttle" jdbcType="DOUBLE" />
  12. <result column="out_flag" property="outFlag" jdbcType="VARCHAR" />
  13. <result column="add_id" property="addId" jdbcType="VARCHAR" />
  14. <result column="add_time" property="addTime" jdbcType="TIMESTAMP" />
  15. <result column="modify_id" property="modifyId" jdbcType="VARCHAR" />
  16. <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
  17. <result column="cancel_id" property="cancelId" jdbcType="VARCHAR" />
  18. <result column="cancel_time" property="cancelTime" jdbcType="TIMESTAMP" />
  19. <result column="cancel_flag" property="cancelFlag" jdbcType="VARCHAR" />
  20. <result column="belong_id" property="belongId" jdbcType="VARCHAR" />
  21. <result column="delivery_company" property="deliveryCompany" jdbcType="VARCHAR" />
  22. <result column="distribution_no" property="distributionNo" jdbcType="VARCHAR" />
  23. <result column="tally_people" property="tallyPeople" jdbcType="VARCHAR" />
  24. <collection property="listDetail" column="ID" ofType="com.th.demo.model.ware.DistributionDetail"
  25. select="com.th.demo.mapping.ware.DistributionDetailMapper.selectByFidDist" />
  26. </resultMap>
  27. <sql id="Base_Column_List" >
  28. id, truck_no, driver_name, driver_phone, sum_weight, sum_count, suttle, out_flag,
  29. add_id, add_time, modify_id, modify_time, cancel_id, cancel_time, cancel_flag, belong_id,delivery_company
  30. </sql>
  31. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  32. select
  33. <include refid="Base_Column_List" />
  34. from t_ware_distribution
  35. where id = #{id,jdbcType=INTEGER}
  36. </select>
  37. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  38. delete from t_ware_distribution
  39. where id = #{id,jdbcType=INTEGER}
  40. </delete>
  41. <insert id="insert" parameterType="com.th.demo.model.ware.Distribution" >
  42. <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
  43. SELECT REPLACE(UUID(),'-','') as id from dual
  44. </selectKey>
  45. insert into t_ware_distribution (id, truck_no, driver_name,
  46. driver_phone, sum_weight, sum_count,
  47. suttle, out_flag, add_id,
  48. add_time, modify_id, modify_time,
  49. cancel_id, cancel_time, cancel_flag,
  50. belong_id ,delivery_company)
  51. values (#{id,jdbcType=VARCHAR}, #{truckNo,jdbcType=VARCHAR}, #{driverName,jdbcType=VARCHAR},
  52. #{driverPhone,jdbcType=VARCHAR}, #{sumWeight,jdbcType=DOUBLE}, #{sumCount,jdbcType=DOUBLE},
  53. 0, #{outFlag,jdbcType=VARCHAR}, #{addId,jdbcType=VARCHAR},
  54. #{addTime,jdbcType=TIMESTAMP}, #{modifyId,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
  55. #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR},
  56. #{belongId,jdbcType=VARCHAR},#{deliveryCompany,jdbcType=VARCHAR})
  57. </insert>
  58. <insert id="insertSelective" parameterType="com.th.demo.model.ware.Distribution" >
  59. insert into t_ware_distribution
  60. <trim prefix="(" suffix=")" suffixOverrides="," >
  61. <if test="id != null" >
  62. id,
  63. </if>
  64. <if test="truckNo != null" >
  65. truck_no,
  66. </if>
  67. <if test="driverName != null" >
  68. driver_name,
  69. </if>
  70. <if test="driverPhone != null" >
  71. driver_phone,
  72. </if>
  73. <if test="sumWeight != null" >
  74. sum_weight,
  75. </if>
  76. <if test="sumCount != null" >
  77. sum_count,
  78. </if>
  79. <if test="suttle != null" >
  80. suttle,
  81. </if>
  82. <if test="outFlag != null" >
  83. out_flag,
  84. </if>
  85. <if test="addId != null" >
  86. add_id,
  87. </if>
  88. <if test="addTime != null" >
  89. add_time,
  90. </if>
  91. <if test="modifyId != null" >
  92. modify_id,
  93. </if>
  94. <if test="modifyTime != null" >
  95. modify_time,
  96. </if>
  97. <if test="cancelId != null" >
  98. cancel_id,
  99. </if>
  100. <if test="cancelTime != null" >
  101. cancel_time,
  102. </if>
  103. <if test="cancelFlag != null" >
  104. cancel_flag,
  105. </if>
  106. <if test="belongId != null" >
  107. belong_id,
  108. </if>
  109. </trim>
  110. <trim prefix="values (" suffix=")" suffixOverrides="," >
  111. <if test="id != null" >
  112. #{id,jdbcType=INTEGER},
  113. </if>
  114. <if test="truckNo != null" >
  115. #{truckNo,jdbcType=INTEGER},
  116. </if>
  117. <if test="driverName != null" >
  118. #{driverName,jdbcType=VARCHAR},
  119. </if>
  120. <if test="driverPhone != null" >
  121. #{driverPhone,jdbcType=VARCHAR},
  122. </if>
  123. <if test="sumWeight != null" >
  124. #{sumWeight,jdbcType=DOUBLE},
  125. </if>
  126. <if test="sumCount != null" >
  127. #{sumCount,jdbcType=DOUBLE},
  128. </if>
  129. <if test="suttle != null" >
  130. #{suttle,jdbcType=DOUBLE},
  131. </if>
  132. <if test="outFlag != null" >
  133. #{outFlag,jdbcType=VARCHAR},
  134. </if>
  135. <if test="addId != null" >
  136. #{addId,jdbcType=VARCHAR},
  137. </if>
  138. <if test="addTime != null" >
  139. #{addTime,jdbcType=TIMESTAMP},
  140. </if>
  141. <if test="modifyId != null" >
  142. #{modifyId,jdbcType=VARCHAR},
  143. </if>
  144. <if test="modifyTime != null" >
  145. #{modifyTime,jdbcType=TIMESTAMP},
  146. </if>
  147. <if test="cancelId != null" >
  148. #{cancelId,jdbcType=VARCHAR},
  149. </if>
  150. <if test="cancelTime != null" >
  151. #{cancelTime,jdbcType=TIMESTAMP},
  152. </if>
  153. <if test="cancelFlag != null" >
  154. #{cancelFlag,jdbcType=VARCHAR},
  155. </if>
  156. <if test="belongId != null" >
  157. #{belongId,jdbcType=VARCHAR},
  158. </if>
  159. </trim>
  160. </insert>
  161. <update id="updateByPrimaryKeySelective" parameterType="com.th.demo.model.ware.Distribution" >
  162. update t_ware_distribution
  163. <set >
  164. <if test="truckNo != null" >
  165. truck_no = #{truckNo,jdbcType=INTEGER},
  166. </if>
  167. <if test="driverName != null" >
  168. driver_name = #{driverName,jdbcType=VARCHAR},
  169. </if>
  170. <if test="driverPhone != null" >
  171. driver_phone = #{driverPhone,jdbcType=VARCHAR},
  172. </if>
  173. <if test="sumWeight != null" >
  174. sum_weight = #{sumWeight,jdbcType=DOUBLE},
  175. </if>
  176. <if test="sumCount != null" >
  177. sum_count = #{sumCount,jdbcType=DOUBLE},
  178. </if>
  179. <if test="suttle != null" >
  180. suttle = #{suttle,jdbcType=DOUBLE},
  181. </if>
  182. <if test="outFlag != null" >
  183. out_flag = #{outFlag,jdbcType=VARCHAR},
  184. </if>
  185. <if test="addId != null" >
  186. add_id = #{addId,jdbcType=VARCHAR},
  187. </if>
  188. <if test="addTime != null" >
  189. add_time = #{addTime,jdbcType=TIMESTAMP},
  190. </if>
  191. <if test="modifyId != null" >
  192. modify_id = #{modifyId,jdbcType=VARCHAR},
  193. </if>
  194. <if test="modifyTime != null" >
  195. modify_time = #{modifyTime,jdbcType=TIMESTAMP},
  196. </if>
  197. <if test="cancelId != null" >
  198. cancel_id = #{cancelId,jdbcType=VARCHAR},
  199. </if>
  200. <if test="cancelTime != null" >
  201. cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
  202. </if>
  203. <if test="cancelFlag != null" >
  204. cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
  205. </if>
  206. <if test="belongId != null" >
  207. belong_id = #{belongId,jdbcType=VARCHAR},
  208. </if>
  209. </set>
  210. where id = #{id,jdbcType=INTEGER}
  211. </update>
  212. <update id="updateByPrimaryKey" parameterType="com.th.demo.model.ware.Distribution" >
  213. update t_ware_distribution
  214. set truck_no = #{truckNo,jdbcType=VARCHAR},
  215. driver_name = #{driverName,jdbcType=VARCHAR},
  216. driver_phone = #{driverPhone,jdbcType=VARCHAR},
  217. sum_weight = #{sumWeight,jdbcType=DOUBLE},
  218. sum_count = #{sumCount,jdbcType=DOUBLE},
  219. suttle = #{suttle,jdbcType=DOUBLE},
  220. out_flag = #{outFlag,jdbcType=VARCHAR},
  221. add_id = #{addId,jdbcType=VARCHAR},
  222. add_time = #{addTime,jdbcType=TIMESTAMP},
  223. modify_id = #{modifyId,jdbcType=VARCHAR},
  224. modify_time = #{modifyTime,jdbcType=TIMESTAMP},
  225. cancel_id = #{cancelId,jdbcType=VARCHAR},
  226. cancel_time = #{cancelTime,jdbcType=TIMESTAMP},
  227. cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
  228. belong_id = #{belongId,jdbcType=VARCHAR},
  229. delivery_company = #{deliveryCompany,jdbcType=VARCHAR},
  230. distribution_no =ifnull(distribution_no,(select dis_no from (select concat('ZG',DATE_FORMAT(NOW(), '%Y%m%d'),IFNULL(lpad(max(substring(t.distribution_no,11,3)+1),3,'0'),'001')) as dis_no from t_ware_distribution t
  231. where substring(t.distribution_no,3,8) = DATE_FORMAT(NOW(), '%Y%m%d')) temp))
  232. ,tally_people = #{tallyPeople,jdbcType=VARCHAR}
  233. where id = #{id,jdbcType=VARCHAR}
  234. </update>
  235. <select id="selectWaitTrucks" resultMap="BaseResultMap" >
  236. select t.* from t_ware_distribution t
  237. where ifnull(t.out_flag,'0') = '0'
  238. and t.belong_id=#{param2,jdbcType=VARCHAR}
  239. order by t.add_time desc
  240. </select>
  241. <select id="selectByTruckNo" resultMap="BaseResultMap" >
  242. select t.* from t_ware_distribution t
  243. where ifnull(t.out_flag,'0') = '0'
  244. and t.truck_no = #{param1,jdbcType=VARCHAR}
  245. and t.belong_id = #{param2,jdbcType=VARCHAR}
  246. order by t.add_time desc
  247. </select>
  248. <select id="selectByDisNo" resultMap="BaseResultMap" >
  249. select t.* from t_ware_distribution t
  250. where ifnull(t.out_flag,'0') = '0'
  251. and t.distribution_no = #{param1,jdbcType=VARCHAR}
  252. and t.belong_id = #{param2,jdbcType=VARCHAR}
  253. order by t.add_time desc
  254. </select>
  255. </mapper>