RmsLinkMapper.xml 12 KB

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