RmsDriverCapacityMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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.RmsDriverCapacityMapper">
  4. <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.RmsDriverCapacity">
  5. <id column="DRIVER_CAPACITY_ID" jdbcType="DECIMAL" property="driverCapacityId" />
  6. <result column="DRIVER_ID" jdbcType="DECIMAL" property="driverId" />
  7. <result column="CAPACITY_ID" jdbcType="DECIMAL" property="capacityId" />
  8. <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId" />
  9. <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
  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="DELETED" jdbcType="DECIMAL" property="deleted" />
  15. </resultMap>
  16. <sql id="columns">
  17. DRIVER_CAPACITY_ID, DRIVER_ID, CAPACITY_ID, CARRIER_ID, INSERT_UPDATE_REMARK, INSERT_USERNAME,
  18. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, DELETED
  19. </sql>
  20. <sql id="columns_alias">
  21. t.DRIVER_CAPACITY_ID, t.DRIVER_ID, t.CAPACITY_ID, t.CARRIER_ID, t.INSERT_UPDATE_REMARK,
  22. t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.DELETED
  23. </sql>
  24. <sql id="select">
  25. SELECT <include refid="columns" /> FROM RMS_DRIVER_CAPACITY
  26. </sql>
  27. <sql id="select_alias">
  28. SELECT <include refid="columns_alias" /> FROM RMS_DRIVER_CAPACITY t
  29. </sql>
  30. <sql id="where">
  31. <where>
  32. <if test="driverCapacityId != null">
  33. and DRIVER_CAPACITY_ID = #{driverCapacityId}
  34. </if>
  35. <if test="driverId != null">
  36. and DRIVER_ID = #{driverId}
  37. </if>
  38. <if test="capacityId != null">
  39. and CAPACITY_ID = #{capacityId}
  40. </if>
  41. <if test="carrierId != null">
  42. and CARRIER_ID = #{carrierId}
  43. </if>
  44. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  45. and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  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="deleted != null">
  60. and DELETED = #{deleted}
  61. </if>
  62. </where>
  63. </sql>
  64. <sql id="whereLike">
  65. <where>
  66. <if test="driverCapacityId != null">
  67. and DRIVER_CAPACITY_ID = #{driverCapacityId}
  68. </if>
  69. <if test="driverId != null">
  70. and DRIVER_ID = #{driverId}
  71. </if>
  72. <if test="capacityId != null">
  73. and CAPACITY_ID = #{capacityId}
  74. </if>
  75. <if test="carrierId != null">
  76. and CARRIER_ID = #{carrierId}
  77. </if>
  78. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  79. and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
  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="deleted != null">
  94. and DELETED = #{deleted}
  95. </if>
  96. </where>
  97. </sql>
  98. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  99. delete from RMS_DRIVER_CAPACITY
  100. where DRIVER_CAPACITY_ID = #{driverCapacityId,jdbcType=DECIMAL}
  101. </delete>
  102. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  103. delete from RMS_DRIVER_CAPACITY
  104. where 1!=1
  105. <if test="driverId != null">
  106. or DRIVER_ID = #{driverId}
  107. </if>
  108. <if test="capacityId != null">
  109. or CAPACITY_ID = #{capacityId}
  110. </if>
  111. <if test="carrierId != null">
  112. or CARRIER_ID = #{carrierId}
  113. </if>
  114. <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
  115. or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
  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="deleted != null">
  130. or DELETED = #{deleted}
  131. </if>
  132. </delete>
  133. <insert id="insert" parameterType="com.steerinfo.dil.model.RmsDriverCapacity">
  134. insert into RMS_DRIVER_CAPACITY (DRIVER_CAPACITY_ID, DRIVER_ID, CAPACITY_ID,
  135. CARRIER_ID, INSERT_UPDATE_REMARK, INSERT_USERNAME,
  136. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  137. DELETED)
  138. values (#{driverCapacityId,jdbcType=DECIMAL}, #{driverId,jdbcType=DECIMAL}, #{capacityId,jdbcType=DECIMAL},
  139. #{carrierId,jdbcType=DECIMAL}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR},
  140. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  141. #{deleted,jdbcType=DECIMAL})
  142. </insert>
  143. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.RmsDriverCapacity">
  144. insert into RMS_DRIVER_CAPACITY
  145. <trim prefix="(" suffix=")" suffixOverrides=",">
  146. <if test="driverCapacityId != null">
  147. DRIVER_CAPACITY_ID,
  148. </if>
  149. <if test="driverId != null">
  150. DRIVER_ID,
  151. </if>
  152. <if test="capacityId != null">
  153. CAPACITY_ID,
  154. </if>
  155. <if test="carrierId != null">
  156. CARRIER_ID,
  157. </if>
  158. <if test="insertUpdateRemark != null">
  159. INSERT_UPDATE_REMARK,
  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="deleted != null">
  174. DELETED,
  175. </if>
  176. </trim>
  177. <trim prefix="values (" suffix=")" suffixOverrides=",">
  178. <if test="driverCapacityId != null">
  179. #{driverCapacityId,jdbcType=DECIMAL},
  180. </if>
  181. <if test="driverId != null">
  182. #{driverId,jdbcType=DECIMAL},
  183. </if>
  184. <if test="capacityId != null">
  185. #{capacityId,jdbcType=DECIMAL},
  186. </if>
  187. <if test="carrierId != null">
  188. #{carrierId,jdbcType=DECIMAL},
  189. </if>
  190. <if test="insertUpdateRemark != null">
  191. #{insertUpdateRemark,jdbcType=VARCHAR},
  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="deleted != null">
  206. #{deleted,jdbcType=DECIMAL},
  207. </if>
  208. </trim>
  209. </insert>
  210. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.RmsDriverCapacity">
  211. update RMS_DRIVER_CAPACITY
  212. set DRIVER_ID = #{driverId,jdbcType=DECIMAL},
  213. CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
  214. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  215. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  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. DELETED = #{deleted,jdbcType=DECIMAL}
  221. where DRIVER_CAPACITY_ID = #{driverCapacityId,jdbcType=DECIMAL}
  222. </update>
  223. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.RmsDriverCapacity">
  224. update RMS_DRIVER_CAPACITY
  225. <set>
  226. <if test="driverId != null">
  227. DRIVER_ID = #{driverId,jdbcType=DECIMAL},
  228. </if>
  229. <if test="capacityId != null">
  230. CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
  231. </if>
  232. <if test="carrierId != null">
  233. CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
  234. </if>
  235. <if test="insertUpdateRemark != null">
  236. INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
  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="deleted != null">
  251. DELETED = #{deleted,jdbcType=DECIMAL},
  252. </if>
  253. </set>
  254. where DRIVER_CAPACITY_ID = #{driverCapacityId,jdbcType=DECIMAL}
  255. </update>
  256. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  257. <include refid="select" />
  258. where DRIVER_CAPACITY_ID = #{driverCapacityId,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 RMS_DRIVER_CAPACITY
  270. (DRIVER_CAPACITY_ID,
  271. DRIVER_ID, CAPACITY_ID, CARRIER_ID,
  272. INSERT_UPDATE_REMARK, INSERT_USERNAME,
  273. INSERT_TIME, UPDATE_USERNAME,
  274. UPDATE_TIME, DELETED)
  275. ( <foreach collection="list" item="item" separator="union all">
  276. select
  277. #{item.driverCapacityId,jdbcType=DECIMAL},
  278. #{item.driverId,jdbcType=DECIMAL}, #{item.capacityId,jdbcType=DECIMAL}, #{item.carrierId,jdbcType=DECIMAL},
  279. #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  280. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  281. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.deleted,jdbcType=DECIMAL} from dual
  282. </foreach> )
  283. </insert>
  284. <update id="batchUpdate" parameterType="java.util.List">
  285. update RMS_DRIVER_CAPACITY
  286. set
  287. DRIVER_CAPACITY_ID=
  288. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  289. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.driverCapacityId,jdbcType=DECIMAL}
  290. </foreach>
  291. ,DRIVER_ID=
  292. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  293. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.driverId,jdbcType=DECIMAL}
  294. </foreach>
  295. ,CAPACITY_ID=
  296. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  297. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.capacityId,jdbcType=DECIMAL}
  298. </foreach>
  299. ,CARRIER_ID=
  300. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  301. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.carrierId,jdbcType=DECIMAL}
  302. </foreach>
  303. ,INSERT_UPDATE_REMARK=
  304. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  305. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  306. </foreach>
  307. ,INSERT_USERNAME=
  308. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  309. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  310. </foreach>
  311. ,INSERT_TIME=
  312. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  313. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  314. </foreach>
  315. ,UPDATE_USERNAME=
  316. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  317. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  318. </foreach>
  319. ,UPDATE_TIME=
  320. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  321. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  322. </foreach>
  323. ,DELETED=
  324. <foreach close="end" collection="list" index="index" item="item" open="case DRIVER_CAPACITY_ID" separator=" ">
  325. when #{item.driverCapacityId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
  326. </foreach>
  327. where DRIVER_CAPACITY_ID in
  328. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  329. #{item.driverCapacityId,jdbcType=DECIMAL}
  330. </foreach>
  331. </update>
  332. <delete id="batchDelete" parameterType="java.util.List">
  333. delete from RMS_DRIVER_CAPACITY
  334. where DRIVER_CAPACITY_ID in
  335. <foreach close=")" collection="list" item="id" open="(" separator=",">
  336. #{id}
  337. </foreach>
  338. </delete>
  339. <!-- 友情提示!!!-->
  340. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  341. <select id="getDriverCapacityList" parameterType="java.util.Map" resultType="java.util.Map">
  342. SELECT * FROM
  343. (
  344. SELECT
  345. RDC.DRIVER_CAPACITY_ID AS "driverCapacityId",
  346. RCD.DRIVER_NAME AS "driverName",
  347. RCT.CAPACITY_TYPE_NAME AS "capacityTypeName",
  348. RC.CARRIER_NAME AS "carrierName"
  349. FROM RMS_DRIVER_CAPACITY RDC
  350. LEFT JOIN RMS_CAR_DRIVER RCD
  351. ON RDC.DRIVER_ID=RCD.DRIVER_ID
  352. LEFT JOIN RMS_CAPACITY RCA
  353. ON RDC.CAPACITY_ID=RCA.CAPACITY_ID
  354. LEFT JOIN RMS_CAPACITY_TYPE RCT
  355. ON RCA.CAPACITY_TYPE_ID=RCT.CAPACITY_TYPE_ID
  356. LEFT JOIN RMS_CARRIER RC
  357. ON RDC.CARRIER_ID=RC.CARRIER_ID
  358. WHERE RDC.DELETED!=1
  359. ORDER BY RDC.INSERT_TIME DESC
  360. )
  361. <where>
  362. <if test="driverCapacityId!= null">
  363. and
  364. <foreach collection="driverCapacityId" item="item" open="(" separator="," close=")">
  365. "driverCapacityId" in #{item}
  366. </foreach>
  367. </if>
  368. <if test="driverName!= null">
  369. and
  370. <foreach collection="driverName" item="item" open="(" separator="," close=")">
  371. "driverName" in #{item}
  372. </foreach>
  373. </if>
  374. <if test="capacityTypeName!= null">
  375. and
  376. <foreach collection="capacityTypeName" item="item" open="(" separator="," close=")">
  377. "capacityTypeName" in #{item}
  378. </foreach>
  379. </if>
  380. <if test="carrierName!= null">
  381. and
  382. <foreach collection="carrierName" item="item" open="(" separator="," close=")">
  383. "carrierName" in #{item}
  384. </foreach>
  385. </if>
  386. </where>
  387. <include refid="orderBy"></include>
  388. </select>
  389. <sql id="orderBy">
  390. <if test="orderField!=null and orderField !=''">
  391. order by "${orderField}"
  392. <if test="orderType !=null and orderType !=''">
  393. ${orderType}
  394. </if>
  395. </if>
  396. </sql>
  397. <select id="getDriverCapacityById" resultType="java.util.LinkedHashMap">
  398. SELECT
  399. RDC.DRIVER_CAPACITY_ID AS "driverCapacityId",
  400. RCD.DRIVER_ID AS "driverId",
  401. RCT.CAPACITY_TYPE_NAME AS "capacityTypeName",
  402. RC.CARRIER_NAME AS "carrierName"
  403. FROM RMS_DRIVER_CAPACITY RDC
  404. LEFT JOIN RMS_CAR_DRIVER RCD
  405. ON RDC.DRIVER_ID=RCD.DRIVER_ID
  406. LEFT JOIN RMS_CAPACITY RCA
  407. ON RDC.CAPACITY_ID=RCA.CAPACITY_ID
  408. LEFT JOIN RMS_CAPACITY_TYPE RCT
  409. ON RCA.CAPACITY_TYPE_ID=RCT.CAPACITY_TYPE_ID
  410. LEFT JOIN RMS_CARRIER RC
  411. ON RDC.CARRIER_ID=RC.CARRIER_ID
  412. WHERE RDC.DRIVER_CAPACITY_ID=#{id}
  413. </select>
  414. <select id="getCarrierId" resultType="java.util.LinkedHashMap">
  415. SELECT
  416. RC.CARRIER_ID AS "id",
  417. RC.CARRIER_ID AS "value",
  418. RC.CARRIER_NAME AS "label"
  419. FROM RMS_CARRIER RC
  420. WHERE RC.DELETED!=1
  421. </select>
  422. <select id="getDriverId" resultType="java.util.LinkedHashMap">
  423. SELECT
  424. RCD.DRIVER_ID AS "id",
  425. RCD.DRIVER_ID AS "value",
  426. RCD.DRIVER_NAME AS "label"
  427. FROM RMS_CAR_DRIVER RCD
  428. WHERE RCD.DELETED!=1
  429. </select>
  430. <select id="getCapacityTypeId" resultType="java.util.LinkedHashMap">
  431. SELECT
  432. RCT.CAPACITY_TYPE_ID AS "id",
  433. RCT.CAPACITY_TYPE_ID AS "value",
  434. RCT.CAPACITY_TYPE_NAME AS "label"
  435. FROM RMS_CAPACITY_TYPE RCT
  436. </select>
  437. </mapper>