TmstrainTotalResultMapper.xml 16 KB

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