TmstruckTotalResultMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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.steerinfo.dil.mapper.TmstruckTotalResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckTotalResult">
  5. <id column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
  6. <result column="ORDER_ID" jdbcType="DECIMAL" property="orderId" />
  7. <result column="RESULT_DURATION" jdbcType="DECIMAL" property="resultDuration" />
  8. <result column="STANDARD_DATA_ID" jdbcType="DECIMAL" property="standardDataId" />
  9. <result column="RESULT_OUTLIER" jdbcType="DECIMAL" property="resultOutlier" />
  10. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  11. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  12. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  13. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  14. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  15. </resultMap>
  16. <sql id="columns">
  17. RESULT_TOTAL_ID, ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
  18. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
  19. </sql>
  20. <sql id="columns_alias">
  21. t.RESULT_TOTAL_ID, t.ORDER_ID, t.RESULT_DURATION, t.STANDARD_DATA_ID, t.RESULT_OUTLIER,
  22. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
  23. </sql>
  24. <sql id="select">
  25. SELECT <include refid="columns" /> FROM TMSTRUCK_TOTAL_RESULT
  26. </sql>
  27. <sql id="select_alias">
  28. SELECT <include refid="columns_alias" /> FROM TMSTRUCK_TOTAL_RESULT t
  29. </sql>
  30. <sql id="where">
  31. <where>
  32. <if test="resultTotalId != null">
  33. and RESULT_TOTAL_ID = #{resultTotalId}
  34. </if>
  35. <if test="orderId != null">
  36. and ORDER_ID = #{orderId}
  37. </if>
  38. <if test="resultDuration != null">
  39. and RESULT_DURATION = #{resultDuration}
  40. </if>
  41. <if test="standardDataId != null">
  42. and STANDARD_DATA_ID = #{standardDataId}
  43. </if>
  44. <if test="resultOutlier != null">
  45. and RESULT_OUTLIER = #{resultOutlier}
  46. </if>
  47. <if test="insertUsername != null and insertUsername != ''">
  48. and INSERT_USERNAME = #{insertUsername}
  49. </if>
  50. <if test="insertTime != null">
  51. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  52. </if>
  53. <if test="updateUsername != null and updateUsername != ''">
  54. and UPDATE_USERNAME = #{updateUsername}
  55. </if>
  56. <if test="updateTime != null">
  57. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  58. </if>
  59. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  60. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  61. </if>
  62. </where>
  63. </sql>
  64. <sql id="whereLike">
  65. <where>
  66. <if test="resultTotalId != null">
  67. and RESULT_TOTAL_ID = #{resultTotalId}
  68. </if>
  69. <if test="orderId != null">
  70. and ORDER_ID = #{orderId}
  71. </if>
  72. <if test="resultDuration != null">
  73. and RESULT_DURATION = #{resultDuration}
  74. </if>
  75. <if test="standardDataId != null">
  76. and STANDARD_DATA_ID = #{standardDataId}
  77. </if>
  78. <if test="resultOutlier != null">
  79. and RESULT_OUTLIER = #{resultOutlier}
  80. </if>
  81. <if test="insertUsername != null and insertUsername != ''">
  82. and INSERT_USERNAME LIKE '%${insertUsername}%'
  83. </if>
  84. <if test="insertTime != null">
  85. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  86. </if>
  87. <if test="updateUsername != null and updateUsername != ''">
  88. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  89. </if>
  90. <if test="updateTime != null">
  91. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  92. </if>
  93. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  94. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  95. </if>
  96. </where>
  97. </sql>
  98. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  99. delete from TMSTRUCK_TOTAL_RESULT
  100. where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
  101. </delete>
  102. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  103. delete from TMSTRUCK_TOTAL_RESULT
  104. where 1!=1
  105. <if test="orderId != null">
  106. or ORDER_ID = #{orderId}
  107. </if>
  108. <if test="resultDuration != null">
  109. or RESULT_DURATION = #{resultDuration}
  110. </if>
  111. <if test="standardDataId != null">
  112. or STANDARD_DATA_ID = #{standardDataId}
  113. </if>
  114. <if test="resultOutlier != null">
  115. or RESULT_OUTLIER = #{resultOutlier}
  116. </if>
  117. <if test="insertUsername != null and insertUsername != ''">
  118. or INSERT_USERNAME = #{insertUsername}
  119. </if>
  120. <if test="insertTime != null">
  121. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  122. </if>
  123. <if test="updateUsername != null and updateUsername != ''">
  124. or UPDATE_USERNAME = #{updateUsername}
  125. </if>
  126. <if test="updateTime != null">
  127. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  128. </if>
  129. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  130. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  131. </if>
  132. </delete>
  133. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
  134. insert into TMSTRUCK_TOTAL_RESULT (RESULT_TOTAL_ID, ORDER_ID, RESULT_DURATION,
  135. STANDARD_DATA_ID, RESULT_OUTLIER, INSERT_USERNAME,
  136. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  137. INSERT_UPDATE_REMARK)
  138. values (#{resultTotalId,jdbcType=DECIMAL}, #{orderId,jdbcType=DECIMAL}, #{resultDuration,jdbcType=DECIMAL},
  139. #{standardDataId,jdbcType=DECIMAL}, #{resultOutlier,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
  140. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  141. #{insertUpdateRemark,jdbcType=VARCHAR})
  142. </insert>
  143. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
  144. insert into TMSTRUCK_TOTAL_RESULT
  145. <trim prefix="(" suffix=")" suffixOverrides=",">
  146. <if test="resultTotalId != null">
  147. RESULT_TOTAL_ID,
  148. </if>
  149. <if test="orderId != null">
  150. ORDER_ID,
  151. </if>
  152. <if test="resultDuration != null">
  153. RESULT_DURATION,
  154. </if>
  155. <if test="standardDataId != null">
  156. STANDARD_DATA_ID,
  157. </if>
  158. <if test="resultOutlier != null">
  159. RESULT_OUTLIER,
  160. </if>
  161. <if test="insertUsername != null">
  162. INSERT_USERNAME,
  163. </if>
  164. <if test="insertTime != null">
  165. INSERT_TIME,
  166. </if>
  167. <if test="updateUsername != null">
  168. UPDATE_USERNAME,
  169. </if>
  170. <if test="updateTime != null">
  171. UPDATE_TIME,
  172. </if>
  173. <if test="insertUpdateRemark != null">
  174. INSERT_UPDATE_REMARK,
  175. </if>
  176. </trim>
  177. <trim prefix="values (" suffix=")" suffixOverrides=",">
  178. <if test="resultTotalId != null">
  179. #{resultTotalId,jdbcType=DECIMAL},
  180. </if>
  181. <if test="orderId != null">
  182. #{orderId,jdbcType=DECIMAL},
  183. </if>
  184. <if test="resultDuration != null">
  185. #{resultDuration,jdbcType=DECIMAL},
  186. </if>
  187. <if test="standardDataId != null">
  188. #{standardDataId,jdbcType=DECIMAL},
  189. </if>
  190. <if test="resultOutlier != null">
  191. #{resultOutlier,jdbcType=DECIMAL},
  192. </if>
  193. <if test="insertUsername != null">
  194. #{insertUsername,jdbcType=VARCHAR},
  195. </if>
  196. <if test="insertTime != null">
  197. #{insertTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="updateUsername != null">
  200. #{updateUsername,jdbcType=VARCHAR},
  201. </if>
  202. <if test="updateTime != null">
  203. #{updateTime,jdbcType=TIMESTAMP},
  204. </if>
  205. <if test="insertUpdateRemark != null">
  206. #{insertUpdateRemark,jdbcType=VARCHAR},
  207. </if>
  208. </trim>
  209. </insert>
  210. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
  211. update TMSTRUCK_TOTAL_RESULT
  212. set ORDER_ID = #{orderId,jdbcType=DECIMAL},
  213. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  214. STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
  215. RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
  216. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  217. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  218. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  219. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  220. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
  221. where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
  222. </update>
  223. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckTotalResult">
  224. update TMSTRUCK_TOTAL_RESULT
  225. <set>
  226. <if test="orderId != null">
  227. ORDER_ID = #{orderId,jdbcType=DECIMAL},
  228. </if>
  229. <if test="resultDuration != null">
  230. RESULT_DURATION = #{resultDuration,jdbcType=DECIMAL},
  231. </if>
  232. <if test="standardDataId != null">
  233. STANDARD_DATA_ID = #{standardDataId,jdbcType=DECIMAL},
  234. </if>
  235. <if test="resultOutlier != null">
  236. RESULT_OUTLIER = #{resultOutlier,jdbcType=DECIMAL},
  237. </if>
  238. <if test="insertUsername != null">
  239. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  240. </if>
  241. <if test="insertTime != null">
  242. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  243. </if>
  244. <if test="updateUsername != null">
  245. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  246. </if>
  247. <if test="updateTime != null">
  248. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  249. </if>
  250. <if test="insertUpdateRemark != null">
  251. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  252. </if>
  253. </set>
  254. where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
  255. </update>
  256. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  257. <include refid="select" />
  258. where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
  259. </select>
  260. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  261. <include refid="select" />
  262. <include refid="where" />
  263. </select>
  264. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  265. <include refid="select" />
  266. <include refid="whereLike" />
  267. </select>
  268. <insert id="batchInsert" parameterType="java.util.List">
  269. insert into TMSTRUCK_TOTAL_RESULT
  270. (RESULT_TOTAL_ID,
  271. ORDER_ID, RESULT_DURATION, STANDARD_DATA_ID,
  272. RESULT_OUTLIER, INSERT_USERNAME,
  273. INSERT_TIME, UPDATE_USERNAME,
  274. UPDATE_TIME, INSERT_UPDATE_REMARK
  275. )
  276. ( <foreach collection="list" item="item" separator="union all">
  277. select
  278. #{item.resultTotalId,jdbcType=DECIMAL},
  279. #{item.orderId,jdbcType=DECIMAL}, #{item.resultDuration,jdbcType=DECIMAL}, #{item.standardDataId,jdbcType=DECIMAL},
  280. #{item.resultOutlier,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR},
  281. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  282. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
  283. from dual
  284. </foreach> )
  285. </insert>
  286. <update id="batchUpdate" parameterType="java.util.List">
  287. update TMSTRUCK_TOTAL_RESULT
  288. set
  289. RESULT_TOTAL_ID=
  290. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  291. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
  292. </foreach>
  293. ,ORDER_ID=
  294. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  295. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.orderId,jdbcType=DECIMAL}
  296. </foreach>
  297. ,RESULT_DURATION=
  298. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  299. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultDuration,jdbcType=DECIMAL}
  300. </foreach>
  301. ,STANDARD_DATA_ID=
  302. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  303. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.standardDataId,jdbcType=DECIMAL}
  304. </foreach>
  305. ,RESULT_OUTLIER=
  306. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  307. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.resultOutlier,jdbcType=DECIMAL}
  308. </foreach>
  309. ,INSERT_USERNAME=
  310. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  311. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  312. </foreach>
  313. ,INSERT_TIME=
  314. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  315. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  316. </foreach>
  317. ,UPDATE_USERNAME=
  318. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  319. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  320. </foreach>
  321. ,UPDATE_TIME=
  322. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  323. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  324. </foreach>
  325. ,INSERT_UPDATE_REMARK=
  326. <foreach close="end" collection="list" index="index" item="item" open="case RESULT_TOTAL_ID" separator=" ">
  327. when #{item.resultTotalId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  328. </foreach>
  329. where RESULT_TOTAL_ID in
  330. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  331. #{item.resultTotalId,jdbcType=DECIMAL}
  332. </foreach>
  333. </update>
  334. <delete id="batchDelete" parameterType="java.util.List">
  335. delete from TMSTRUCK_TOTAL_RESULT
  336. where RESULT_TOTAL_ID in
  337. <foreach close=")" collection="list" item="id" open="(" separator=",">
  338. #{id}
  339. </foreach>
  340. </delete>
  341. <!-- 友情提示!!!-->
  342. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  343. <!-- 查询计数实绩 -->
  344. <select id="selectCountList" resultType="java.util.Map" parameterType="java.lang.String">
  345. SELECT RM.MATERIAL_NAME "materialName",
  346. OO.ORDER_NUMBER "orderNumber",
  347. RC.CAPACITY_NUMBER "capacityNumber",
  348. RW.WAREHOUSE_NAME "warehouseName",
  349. RCD.DRIVER_NAME "driverName",
  350. RCT.CAPACITY_TYPE_NAME "capacityTypeName",
  351. RS.SHIPPER_NAME "shipperName",
  352. AIR.REQUIREMENT_WORK_CONTENT "requirmentWorkContent"
  353. FROM AMSTRUCK_INWARD_REQUIREMENT AIR
  354. LEFT JOIN OMSTRUCK_ORDER OO
  355. ON OO.ORDER_PLAN_ID=AIR.PURCHASE_ORDER_ID
  356. LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
  357. ON OO.ORDER_ID = OOM.ORDER_ID
  358. LEFT JOIN RMS_MATERIAL RM
  359. ON RM.MATERIAL_ID=OOM.MATERIAL_ID
  360. LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
  361. ON TTR.ORDER_ID=OO.ORDER_ID
  362. LEFT JOIN TMSTRUCK_UNLOAD_RESULT TUR
  363. ON TTR.RESULT_TOTAL_ID=TUR.RESULT_TOTAL_ID
  364. LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
  365. ON TLR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
  366. LEFT JOIN RMS_CAPACITY RC
  367. ON OO.CAPACITY_ID = RC.CAPACITY_ID
  368. LEFT JOIN RMS_DRIVER_CAPACITY RDC
  369. ON RC.CAPACITY_ID=RDC.CAPACITY_ID
  370. LEFT JOIN RMS_CAPACITY_TYPE RCT
  371. ON RCT.CAPACITY_TYPE_ID=RC.CAPACITY_TYPE_ID
  372. LEFT JOIN RMS_CAR_DRIVER RCD
  373. ON RDC.DRIVER_ID=RCD.DRIVER_ID
  374. -- LEFT JOIN RMS_PWAREHOUSE_PLATFORM RPP
  375. -- ON TLR.LOADER_ID=RPP.PLATFORM_ID
  376. LEFT JOIN RMS_WAREHOUSE RW
  377. ON RW.WAREHOUSE_ID=TUR.RESULT_UNLOAD_PLACE_ID
  378. LEFT JOIN RMS_WAREHOUSE_TYPE RWT
  379. ON RWT.WAREHOUSE_TYPE_ID=RW.WAREHOUSE_TYPE_ID
  380. LEFT JOIN RMS_SHIPPER RS
  381. ON AIR.REQUIREMENT_SHIPPER_ID=RS.SHIPPER_ID
  382. WHERE AIR.REQUIREMENT_TYPE=2 AND RW.WAREHOUSE_TYPE_ID=3
  383. AND OO.ORDER_STATUS=4
  384. </select>
  385. <!-- 查询所有的包月作业实绩 -->
  386. <select id="getTmstruckMonthResult" parameterType="java.util.Map" resultType="java.util.Map">
  387. select * from tmstruck_total_result ttr
  388. left join omstruck_order oo on ttr.order_id=oo.order_id
  389. left join amstruck_inward_plan aip on oo.order_plan_id=aip.plan_id
  390. left join amstruck_requirement_plan arp on aip.plan_id=arp.plan_id
  391. left join amstruck_inward_requirement air on arp.requirement_plan_id=air.requirement_id
  392. where oo.order_type=4 and air.requirement_type=3
  393. </select>
  394. </mapper>