DilVersionMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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 <include refid="columns" /> FROM DIL_VERSION
  24. </sql>
  25. <sql id="select_alias">
  26. SELECT <include refid="columns_alias" /> FROM DIL_VERSION t
  27. </sql>
  28. <sql id="where">
  29. <where>
  30. <if test="versionId != null">
  31. and VERSION_ID = #{versionId}
  32. </if>
  33. <if test="versionValue != null and versionValue != ''">
  34. and VERSION_VALUE = #{versionValue}
  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="versionType != null">
  52. and VERSION_TYPE = #{versionType}
  53. </if>
  54. </where>
  55. </sql>
  56. <sql id="whereLike">
  57. <where>
  58. <if test="versionId != null">
  59. and VERSION_ID = #{versionId}
  60. </if>
  61. <if test="versionValue != null and versionValue != ''">
  62. and VERSION_VALUE LIKE '%${versionValue}%'
  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="versionType != null">
  80. and VERSION_TYPE = #{versionType}
  81. </if>
  82. </where>
  83. </sql>
  84. <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
  85. delete from DIL_VERSION
  86. where VERSION_ID = #{versionId,jdbcType=DECIMAL}
  87. </delete>
  88. <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
  89. delete from DIL_VERSION
  90. where 1!=1
  91. <if test="versionValue != null and versionValue != ''">
  92. or VERSION_VALUE = #{versionValue}
  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="versionType != null">
  110. or VERSION_TYPE = #{versionType}
  111. </if>
  112. </delete>
  113. <insert id="insert" parameterType="com.steerinfo.dil.model.DilVersion">
  114. insert into DIL_VERSION (VERSION_ID, VERSION_VALUE, INSERT_USERNAME,
  115. INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
  116. INSERT_UPDATE_REMARK, VERSION_TYPE)
  117. values (#{versionId,jdbcType=DECIMAL}, #{versionValue,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR},
  118. #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
  119. #{insertUpdateRemark,jdbcType=VARCHAR}, #{versionType,jdbcType=DECIMAL})
  120. </insert>
  121. <insert id="insertSelective" parameterType="com.steerinfo.dil.model.DilVersion">
  122. insert into DIL_VERSION
  123. <trim prefix="(" suffix=")" suffixOverrides=",">
  124. <if test="versionId != null">
  125. VERSION_ID,
  126. </if>
  127. <if test="versionValue != null">
  128. VERSION_VALUE,
  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="versionType != null">
  146. VERSION_TYPE,
  147. </if>
  148. </trim>
  149. <trim prefix="values (" suffix=")" suffixOverrides=",">
  150. <if test="versionId != null">
  151. #{versionId,jdbcType=DECIMAL},
  152. </if>
  153. <if test="versionValue != null">
  154. #{versionValue,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="versionType != null">
  172. #{versionType,jdbcType=DECIMAL},
  173. </if>
  174. </trim>
  175. </insert>
  176. <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.DilVersion">
  177. update DIL_VERSION
  178. set VERSION_VALUE = #{versionValue,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. VERSION_TYPE = #{versionType,jdbcType=DECIMAL}
  185. where VERSION_ID = #{versionId,jdbcType=DECIMAL}
  186. </update>
  187. <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.DilVersion">
  188. update DIL_VERSION
  189. <set>
  190. <if test="versionValue != null">
  191. VERSION_VALUE = #{versionValue,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="versionType != null">
  209. VERSION_TYPE = #{versionType,jdbcType=DECIMAL},
  210. </if>
  211. </set>
  212. where VERSION_ID = #{versionId,jdbcType=DECIMAL}
  213. </update>
  214. <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
  215. <include refid="select" />
  216. where VERSION_ID = #{versionId,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 DIL_VERSION
  228. (VERSION_ID,
  229. VERSION_VALUE, INSERT_USERNAME,
  230. INSERT_TIME, UPDATE_USERNAME,
  231. UPDATE_TIME, INSERT_UPDATE_REMARK,
  232. VERSION_TYPE)
  233. ( <foreach collection="list" item="item" separator="union all">
  234. select
  235. #{item.versionId,jdbcType=DECIMAL},
  236. #{item.versionValue,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR},
  237. #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
  238. #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR},
  239. #{item.versionType,jdbcType=DECIMAL} from dual
  240. </foreach> )
  241. </insert>
  242. <update id="batchUpdate" parameterType="java.util.List">
  243. update DIL_VERSION
  244. set
  245. VERSION_ID=
  246. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  247. when #{item.versionId,jdbcType=DECIMAL} then #{item.versionId,jdbcType=DECIMAL}
  248. </foreach>
  249. ,VERSION_VALUE=
  250. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  251. when #{item.versionId,jdbcType=DECIMAL} then #{item.versionValue,jdbcType=VARCHAR}
  252. </foreach>
  253. ,INSERT_USERNAME=
  254. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  255. when #{item.versionId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
  256. </foreach>
  257. ,INSERT_TIME=
  258. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  259. when #{item.versionId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
  260. </foreach>
  261. ,UPDATE_USERNAME=
  262. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  263. when #{item.versionId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
  264. </foreach>
  265. ,UPDATE_TIME=
  266. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  267. when #{item.versionId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
  268. </foreach>
  269. ,INSERT_UPDATE_REMARK=
  270. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  271. when #{item.versionId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
  272. </foreach>
  273. ,VERSION_TYPE=
  274. <foreach close="end" collection="list" index="index" item="item" open="case VERSION_ID" separator=" ">
  275. when #{item.versionId,jdbcType=DECIMAL} then #{item.versionType,jdbcType=DECIMAL}
  276. </foreach>
  277. where VERSION_ID in
  278. <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
  279. #{item.versionId,jdbcType=DECIMAL}
  280. </foreach>
  281. </update>
  282. <delete id="batchDelete" parameterType="java.util.List">
  283. delete from DIL_VERSION
  284. where VERSION_ID in
  285. <foreach close=")" collection="list" item="id" open="(" separator=",">
  286. #{id}
  287. </foreach>
  288. </delete>
  289. <!-- 友情提示!!!-->
  290. <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
  291. <select id="getAppVersion" resultType="string">
  292. select *
  293. from (
  294. select DV.VERSION_VALUE
  295. from DIL_VERSION DV
  296. where DV.VERSION_TYPE = 0
  297. order by DV.VERSION_ID desc
  298. )
  299. where ROWNUM = 1
  300. </select>
  301. <select id="getVersionId" parameterType="string" resultType="java.lang.Integer">
  302. select DV.VERSION_ID from DIL_VERSION DV
  303. where DV.VERSION_VALUE = #{versionValue}
  304. </select>
  305. <select id="getPDAVersion" resultType="java.lang.String">
  306. select *
  307. from (
  308. select DV.VERSION_VALUE
  309. from DIL_VERSION DV
  310. where DV.VERSION_TYPE = 1
  311. order by DV.VERSION_ID desc
  312. )
  313. where ROWNUM = 1
  314. </select>
  315. </mapper>