TmstrainTruckTotalResultMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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.TmstrainTruckTotalResultMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstrainTruckTotalResult">
  5. <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
  6. <result column="TMSTRAIN_TOTAL_RESULT_ID" jdbcType="DECIMAL" property="tmstrainTotalResultId" />
  7. <result column="TMSTRUCK_TOTAL_RESULT_ID" jdbcType="DECIMAL" property="tmstruckTotalResultId" />
  8. <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
  9. <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
  10. <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
  11. <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
  12. <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
  13. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  14. <result column="LOAD_STATUS" jdbcType="DECIMAL" property="loadStatus" />
  15. </resultMap>
  16. <sql id="columns">
  17. RESULT_ID, TMSTRAIN_TOTAL_RESULT_ID, TMSTRUCK_TOTAL_RESULT_ID, MATERIAL_ID, INSERT_USERNAME,
  18. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, LOAD_STATUS
  19. </sql>
  20. <sql id="columns_alias">
  21. t.RESULT_ID, t.TMSTRAIN_TOTAL_RESULT_ID, t.TMSTRUCK_TOTAL_RESULT_ID, t.MATERIAL_ID,
  22. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
  23. t.LOAD_STATUS
  24. </sql>
  25. <sql id="select">
  26. SELECT <include refid="columns"/> FROM TMSTRAIN_TRUCK_TOTAL_RESULT
  27. </sql>
  28. <sql id="select_alias">
  29. SELECT <include refid="columns_alias"/> FROM TMSTRAIN_TRUCK_TOTAL_RESULT t
  30. </sql>
  31. <sql id="where">
  32. <where>
  33. <if test="resultId != null">
  34. and RESULT_ID = #{resultId}
  35. </if>
  36. <if test="tmstrainTotalResultId != null">
  37. and TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId}
  38. </if>
  39. <if test="tmstruckTotalResultId != null">
  40. and TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId}
  41. </if>
  42. <if test="materialId != null">
  43. and MATERIAL_ID = #{materialId}
  44. </if>
  45. <if test="insertUsername != null and insertUsername != ''">
  46. and INSERT_USERNAME = #{insertUsername}
  47. </if>
  48. <if test="insertTime != null">
  49. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  50. </if>
  51. <if test="updateUsername != null and updateUsername != ''">
  52. and UPDATE_USERNAME = #{updateUsername}
  53. </if>
  54. <if test="updateTime != null">
  55. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  56. </if>
  57. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  58. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  59. </if>
  60. <if test="loadStatus != null">
  61. and LOAD_STATUS = #{loadStatus}
  62. </if>
  63. </where>
  64. </sql>
  65. <sql id="whereLike">
  66. <where>
  67. <if test="resultId != null">
  68. and RESULT_ID = #{resultId}
  69. </if>
  70. <if test="tmstrainTotalResultId != null">
  71. and TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId}
  72. </if>
  73. <if test="tmstruckTotalResultId != null">
  74. and TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId}
  75. </if>
  76. <if test="materialId != null">
  77. and MATERIAL_ID = #{materialId}
  78. </if>
  79. <if test="insertUsername != null and insertUsername != ''">
  80. and INSERT_USERNAME LIKE '%${insertUsername}%'
  81. </if>
  82. <if test="insertTime != null">
  83. and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
  84. </if>
  85. <if test="updateUsername != null and updateUsername != ''">
  86. and UPDATE_USERNAME LIKE '%${updateUsername}%'
  87. </if>
  88. <if test="updateTime != null">
  89. and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
  90. </if>
  91. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  92. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  93. </if>
  94. <if test="loadStatus != null">
  95. and LOAD_STATUS = #{loadStatus}
  96. </if>
  97. </where>
  98. </sql>
  99. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  100. delete from TMSTRAIN_TRUCK_TOTAL_RESULT
  101. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  102. </delete>
  103. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  104. delete from TMSTRAIN_TRUCK_TOTAL_RESULT
  105. where 1!=1
  106. <if test="tmstrainTotalResultId != null">
  107. or TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId}
  108. </if>
  109. <if test="tmstruckTotalResultId != null">
  110. or TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId}
  111. </if>
  112. <if test="materialId != null">
  113. or MATERIAL_ID = #{materialId}
  114. </if>
  115. <if test="insertUsername != null and insertUsername != ''">
  116. or INSERT_USERNAME = #{insertUsername}
  117. </if>
  118. <if test="insertTime != null">
  119. or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
  120. </if>
  121. <if test="updateUsername != null and updateUsername != ''">
  122. or UPDATE_USERNAME = #{updateUsername}
  123. </if>
  124. <if test="updateTime != null">
  125. or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
  126. </if>
  127. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  128. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  129. </if>
  130. <if test="loadStatus != null">
  131. or LOAD_STATUS = #{loadStatus}
  132. </if>
  133. </delete>
  134. <insert id="insert" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
  135. insert into TMSTRAIN_TRUCK_TOTAL_RESULT (RESULT_ID, TMSTRAIN_TOTAL_RESULT_ID,
  136. TMSTRUCK_TOTAL_RESULT_ID, MATERIAL_ID, INSERT_USERNAME,
  137. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  138. INSERT_UPDATE_REMARK, LOAD_STATUS)
  139. values (#{resultId,jdbcType=DECIMAL}, #{tmstrainTotalResultId,jdbcType=DECIMAL},
  140. #{tmstruckTotalResultId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
  141. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  142. #{insertUpdateRemark,jdbcType=VARCHAR}, #{loadStatus,jdbcType=DECIMAL})
  143. </insert>
  144. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
  145. insert into TMSTRAIN_TRUCK_TOTAL_RESULT
  146. <trim prefix="(" suffix=")" suffixOverrides=",">
  147. <if test="resultId != null">
  148. RESULT_ID,
  149. </if>
  150. <if test="tmstrainTotalResultId != null">
  151. TMSTRAIN_TOTAL_RESULT_ID,
  152. </if>
  153. <if test="tmstruckTotalResultId != null">
  154. TMSTRUCK_TOTAL_RESULT_ID,
  155. </if>
  156. <if test="materialId != null">
  157. MATERIAL_ID,
  158. </if>
  159. <if test="insertUsername != null">
  160. INSERT_USERNAME,
  161. </if>
  162. <if test="insertTime != null">
  163. INSERT_TIME,
  164. </if>
  165. <if test="updateUsername != null">
  166. UPDATE_USERNAME,
  167. </if>
  168. <if test="updateTime != null">
  169. UPDATE_TIME,
  170. </if>
  171. <if test="insertUpdateRemark != null">
  172. INSERT_UPDATE_REMARK,
  173. </if>
  174. <if test="loadStatus != null">
  175. LOAD_STATUS,
  176. </if>
  177. </trim>
  178. <trim prefix="values (" suffix=")" suffixOverrides=",">
  179. <if test="resultId != null">
  180. #{resultId,jdbcType=DECIMAL},
  181. </if>
  182. <if test="tmstrainTotalResultId != null">
  183. #{tmstrainTotalResultId,jdbcType=DECIMAL},
  184. </if>
  185. <if test="tmstruckTotalResultId != null">
  186. #{tmstruckTotalResultId,jdbcType=DECIMAL},
  187. </if>
  188. <if test="materialId != null">
  189. #{materialId,jdbcType=DECIMAL},
  190. </if>
  191. <if test="insertUsername != null">
  192. #{insertUsername,jdbcType=VARCHAR},
  193. </if>
  194. <if test="insertTime != null">
  195. #{insertTime,jdbcType=TIMESTAMP},
  196. </if>
  197. <if test="updateUsername != null">
  198. #{updateUsername,jdbcType=VARCHAR},
  199. </if>
  200. <if test="updateTime != null">
  201. #{updateTime,jdbcType=TIMESTAMP},
  202. </if>
  203. <if test="insertUpdateRemark != null">
  204. #{insertUpdateRemark,jdbcType=VARCHAR},
  205. </if>
  206. <if test="loadStatus != null">
  207. #{loadStatus,jdbcType=DECIMAL},
  208. </if>
  209. </trim>
  210. </insert>
  211. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
  212. update TMSTRAIN_TRUCK_TOTAL_RESULT
  213. set TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId,jdbcType=DECIMAL},
  214. TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId,jdbcType=DECIMAL},
  215. MATERIAL_ID = #{materialId,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. LOAD_STATUS = #{loadStatus,jdbcType=DECIMAL}
  222. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  223. </update>
  224. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstrainTruckTotalResult">
  225. update TMSTRAIN_TRUCK_TOTAL_RESULT
  226. <set>
  227. <if test="tmstrainTotalResultId != null">
  228. TMSTRAIN_TOTAL_RESULT_ID = #{tmstrainTotalResultId,jdbcType=DECIMAL},
  229. </if>
  230. <if test="tmstruckTotalResultId != null">
  231. TMSTRUCK_TOTAL_RESULT_ID = #{tmstruckTotalResultId,jdbcType=DECIMAL},
  232. </if>
  233. <if test="materialId != null">
  234. MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
  235. </if>
  236. <if test="insertUsername != null">
  237. INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
  238. </if>
  239. <if test="insertTime != null">
  240. INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
  241. </if>
  242. <if test="updateUsername != null">
  243. UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
  244. </if>
  245. <if test="updateTime != null">
  246. UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
  247. </if>
  248. <if test="insertUpdateRemark != null">
  249. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  250. </if>
  251. <if test="loadStatus != null">
  252. LOAD_STATUS = #{loadStatus,jdbcType=DECIMAL},
  253. </if>
  254. </set>
  255. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  256. </update>
  257. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  258. <include refid="select"/>
  259. where RESULT_ID = #{resultId,jdbcType=DECIMAL}
  260. </select>
  261. <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  262. <include refid="select"/>
  263. <include refid="where"/>
  264. </select>
  265. <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
  266. <include refid="select"/>
  267. <include refid="whereLike"/>
  268. </select>
  269. <insert id="batchInsert" parameterType="java.util.List">
  270. insert into TMSTRAIN_TRUCK_TOTAL_RESULT
  271. (RESULT_ID,
  272. TMSTRAIN_TOTAL_RESULT_ID, TMSTRUCK_TOTAL_RESULT_ID,
  273. MATERIAL_ID, INSERT_USERNAME, INSERT_TIME,
  274. UPDATE_USERNAME, UPDATE_TIME,
  275. INSERT_UPDATE_REMARK, LOAD_STATUS
  276. )
  277. ( <foreach collection="list" item="item" separator="union all">
  278. select
  279. #{item.resultId,jdbcType=DECIMAL},
  280. #{item.tmstrainTotalResultId,jdbcType=DECIMAL}, #{item.tmstruckTotalResultId,jdbcType=DECIMAL},
  281. #{item.materialId,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
  282. #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
  283. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.loadStatus,jdbcType=DECIMAL}
  284. from dual
  285. </foreach> )
  286. </insert>
  287. <update id="batchUpdate" parameterType="java.util.List">
  288. update TMSTRAIN_TRUCK_TOTAL_RESULT
  289. set
  290. RESULT_ID=
  291. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  292. when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
  293. </foreach>
  294. ,TMSTRAIN_TOTAL_RESULT_ID=
  295. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  296. when #{item.resultId,jdbcType=DECIMAL} then #{item.tmstrainTotalResultId,jdbcType=DECIMAL}
  297. </foreach>
  298. ,TMSTRUCK_TOTAL_RESULT_ID=
  299. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  300. when #{item.resultId,jdbcType=DECIMAL} then #{item.tmstruckTotalResultId,jdbcType=DECIMAL}
  301. </foreach>
  302. ,MATERIAL_ID=
  303. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  304. when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
  305. </foreach>
  306. ,INSERT_USERNAME=
  307. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  308. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  309. </foreach>
  310. ,INSERT_TIME=
  311. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  312. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  313. </foreach>
  314. ,UPDATE_USERNAME=
  315. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  316. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  317. </foreach>
  318. ,UPDATE_TIME=
  319. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  320. when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  321. </foreach>
  322. ,INSERT_UPDATE_REMARK=
  323. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  324. when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  325. </foreach>
  326. ,LOAD_STATUS=
  327. <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
  328. when #{item.resultId,jdbcType=DECIMAL} then #{item.loadStatus,jdbcType=DECIMAL}
  329. </foreach>
  330. where RESULT_ID in
  331. <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  332. #{item.resultId,jdbcType=DECIMAL}
  333. </foreach>
  334. </update>
  335. <delete id="batchDelete" parameterType="java.util.List">
  336. delete from TMSTRAIN_TRUCK_TOTAL_RESULT
  337. where RESULT_ID in
  338. <foreach collection="list" item="id" open="(" close=")" separator=",">
  339. #{id}
  340. </foreach>
  341. </delete>
  342. <!-- 友情提示!!!-->
  343. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  344. <!-- 通过物资ID和物资汽车总实绩ID和火运总实绩ID查找物资中间表ID -->
  345. <select id="getIdByMateAndTruckAndTrainTotalId" resultType="java.lang.Integer">
  346. select
  347. TTTR.RESULT_ID
  348. from TMSTRAIN_TRUCK_TOTAL_RESULT TTTR
  349. where TTTR.TMSTRUCK_TOTAL_RESULT_ID = #{truckTotalId}
  350. and TTTR.TMSTRAIN_TOTAL_RESULT_ID = #{trainTotalId}
  351. and TTTR.LOAD_STATUS = 0
  352. </select>
  353. </mapper>