RmsCargodepMapper.xml 14 KB

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