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