FoldTheValuesMapper.xml 13 KB

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