RmsUnitOfMeasureMapper.xml 11 KB

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