DilVersionMapper.xml 14 KB

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