EsmTrainMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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.ydtech.modules.esm.dao.EsmTrainMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.esm.model.EsmTrain">
  5. <id column="trainid" jdbcType="VARCHAR" property="trainid"/>
  6. <result column="title" jdbcType="VARCHAR" property="title"/>
  7. <result column="t_describe" jdbcType="VARCHAR" property="tDescribe"/>
  8. <result column="status" jdbcType="VARCHAR" property="status"/>
  9. <result column="comcode" jdbcType="VARCHAR" property="comcode"/>
  10. <result column="fileid" jdbcType="VARCHAR" property="fileid"/>
  11. <result column="dirid" jdbcType="VARCHAR" property="dirid"/>
  12. <result column="userscope" jdbcType="VARCHAR" property="userscope"/>
  13. <result column="byzd_1" jdbcType="VARCHAR" property="byzd1"/>
  14. <result column="byzd_2" jdbcType="VARCHAR" property="byzd2"/>
  15. <result column="byzd_3" jdbcType="VARCHAR" property="byzd3"/>
  16. <result column="byzd_4" jdbcType="VARCHAR" property="byzd4"/>
  17. <result column="byzd_5" jdbcType="VARCHAR" property="byzd5"/>
  18. <result column="operatorcode" jdbcType="VARCHAR" property="operatorcode"/>
  19. <result column="operatime" jdbcType="DATE" property="operatime"/>
  20. </resultMap>
  21. <sql id="Example_Where_Clause">
  22. <where>
  23. <foreach collection="oredCriteria" item="criteria" separator="or">
  24. <if test="criteria.valid">
  25. <trim prefix="(" prefixOverrides="and" suffix=")">
  26. <foreach collection="criteria.criteria" item="criterion">
  27. <choose>
  28. <when test="criterion.noValue">
  29. and ${criterion.condition}
  30. </when>
  31. <when test="criterion.singleValue">
  32. and ${criterion.condition} #{criterion.value}
  33. </when>
  34. <when test="criterion.betweenValue">
  35. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  36. </when>
  37. <when test="criterion.listValue">
  38. and ${criterion.condition}
  39. <foreach close=")" collection="criterion.value" item="listItem" open="("
  40. separator=",">
  41. #{listItem}
  42. </foreach>
  43. </when>
  44. </choose>
  45. </foreach>
  46. </trim>
  47. </if>
  48. </foreach>
  49. </where>
  50. </sql>
  51. <sql id="Update_By_Example_Where_Clause">
  52. <where>
  53. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  54. <if test="criteria.valid">
  55. <trim prefix="(" prefixOverrides="and" suffix=")">
  56. <foreach collection="criteria.criteria" item="criterion">
  57. <choose>
  58. <when test="criterion.noValue">
  59. and ${criterion.condition}
  60. </when>
  61. <when test="criterion.singleValue">
  62. and ${criterion.condition} #{criterion.value}
  63. </when>
  64. <when test="criterion.betweenValue">
  65. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  66. </when>
  67. <when test="criterion.listValue">
  68. and ${criterion.condition}
  69. <foreach close=")" collection="criterion.value" item="listItem" open="("
  70. separator=",">
  71. #{listItem}
  72. </foreach>
  73. </when>
  74. </choose>
  75. </foreach>
  76. </trim>
  77. </if>
  78. </foreach>
  79. </where>
  80. </sql>
  81. <sql id="Base_Column_List">
  82. trainid, title, t_describe, status, comcode, fileid, dirid, userscope, byzd_1, byzd_2,
  83. byzd_3, byzd_4, byzd_5, operatorcode, operatime
  84. </sql>
  85. <select id="selectByExample" parameterType="com.ydtech.modules.esm.model.EsmTrainExample" resultMap="BaseResultMap">
  86. select
  87. <if test="distinct">
  88. distinct
  89. </if>
  90. 'true' as QUERYID,
  91. <include refid="Base_Column_List"/>
  92. from esm_train
  93. <if test="_parameter != null">
  94. <include refid="Example_Where_Clause"/>
  95. </if>
  96. <if test="orderByClause != null">
  97. order by ${orderByClause}
  98. </if>
  99. </select>
  100. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  101. select
  102. <include refid="Base_Column_List"/>
  103. from esm_train
  104. where trainid = #{trainid,jdbcType=VARCHAR}
  105. </select>
  106. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  107. delete
  108. from esm_train
  109. where trainid = #{trainid,jdbcType=VARCHAR}
  110. </delete>
  111. <delete id="deleteByExample" parameterType="com.ydtech.modules.esm.model.EsmTrainExample">
  112. delete from esm_train
  113. <if test="_parameter != null">
  114. <include refid="Example_Where_Clause"/>
  115. </if>
  116. </delete>
  117. <insert id="insert" parameterType="com.ydtech.modules.esm.model.EsmTrain">
  118. insert into esm_train (trainid, title, t_describe,
  119. status, comcode, fileid,
  120. dirid, userscope, byzd_1,
  121. byzd_2, byzd_3, byzd_4,
  122. byzd_5, operatorcode, operatime)
  123. values (#{trainid,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{tDescribe,jdbcType=VARCHAR},
  124. #{status,jdbcType=VARCHAR}, #{comcode,jdbcType=VARCHAR}, #{fileid,jdbcType=VARCHAR},
  125. #{dirid,jdbcType=VARCHAR}, #{userscope,jdbcType=VARCHAR}, #{byzd1,jdbcType=VARCHAR},
  126. #{byzd2,jdbcType=VARCHAR}, #{byzd3,jdbcType=VARCHAR}, #{byzd4,jdbcType=VARCHAR},
  127. #{byzd5,jdbcType=VARCHAR}, #{operatorcode,jdbcType=VARCHAR}, #{operatime,jdbcType=DATE})
  128. </insert>
  129. <insert id="insertSelective" parameterType="com.ydtech.modules.esm.model.EsmTrain">
  130. insert into esm_train
  131. <trim prefix="(" suffix=")" suffixOverrides=",">
  132. <if test="trainid != null">
  133. trainid,
  134. </if>
  135. <if test="title != null">
  136. title,
  137. </if>
  138. <if test="tDescribe != null">
  139. t_describe,
  140. </if>
  141. <if test="status != null">
  142. status,
  143. </if>
  144. <if test="comcode != null">
  145. comcode,
  146. </if>
  147. <if test="fileid != null">
  148. fileid,
  149. </if>
  150. <if test="dirid != null">
  151. dirid,
  152. </if>
  153. <if test="userscope != null">
  154. userscope,
  155. </if>
  156. <if test="byzd1 != null">
  157. byzd_1,
  158. </if>
  159. <if test="byzd2 != null">
  160. byzd_2,
  161. </if>
  162. <if test="byzd3 != null">
  163. byzd_3,
  164. </if>
  165. <if test="byzd4 != null">
  166. byzd_4,
  167. </if>
  168. <if test="byzd5 != null">
  169. byzd_5,
  170. </if>
  171. <if test="operatorcode != null">
  172. operatorcode,
  173. </if>
  174. <if test="operatime != null">
  175. operatime,
  176. </if>
  177. </trim>
  178. <trim prefix="values (" suffix=")" suffixOverrides=",">
  179. <if test="trainid != null">
  180. #{trainid,jdbcType=VARCHAR},
  181. </if>
  182. <if test="title != null">
  183. #{title,jdbcType=VARCHAR},
  184. </if>
  185. <if test="tDescribe != null">
  186. #{tDescribe,jdbcType=VARCHAR},
  187. </if>
  188. <if test="status != null">
  189. #{status,jdbcType=VARCHAR},
  190. </if>
  191. <if test="comcode != null">
  192. #{comcode,jdbcType=VARCHAR},
  193. </if>
  194. <if test="fileid != null">
  195. #{fileid,jdbcType=VARCHAR},
  196. </if>
  197. <if test="dirid != null">
  198. #{dirid,jdbcType=VARCHAR},
  199. </if>
  200. <if test="userscope != null">
  201. #{userscope,jdbcType=VARCHAR},
  202. </if>
  203. <if test="byzd1 != null">
  204. #{byzd1,jdbcType=VARCHAR},
  205. </if>
  206. <if test="byzd2 != null">
  207. #{byzd2,jdbcType=VARCHAR},
  208. </if>
  209. <if test="byzd3 != null">
  210. #{byzd3,jdbcType=VARCHAR},
  211. </if>
  212. <if test="byzd4 != null">
  213. #{byzd4,jdbcType=VARCHAR},
  214. </if>
  215. <if test="byzd5 != null">
  216. #{byzd5,jdbcType=VARCHAR},
  217. </if>
  218. <if test="operatorcode != null">
  219. #{operatorcode,jdbcType=VARCHAR},
  220. </if>
  221. <if test="operatime != null">
  222. #{operatime,jdbcType=DATE},
  223. </if>
  224. </trim>
  225. </insert>
  226. <select id="countByExample" parameterType="com.ydtech.modules.esm.model.EsmTrainExample"
  227. resultType="java.lang.Long">
  228. select count(*) from esm_train
  229. <if test="_parameter != null">
  230. <include refid="Example_Where_Clause"/>
  231. </if>
  232. </select>
  233. <update id="updateByExampleSelective" parameterType="map">
  234. update esm_train
  235. <set>
  236. <if test="record.trainid != null">
  237. trainid = #{record.trainid,jdbcType=VARCHAR},
  238. </if>
  239. <if test="record.title != null">
  240. title = #{record.title,jdbcType=VARCHAR},
  241. </if>
  242. <if test="record.tDescribe != null">
  243. t_describe = #{record.tDescribe,jdbcType=VARCHAR},
  244. </if>
  245. <if test="record.status != null">
  246. status = #{record.status,jdbcType=VARCHAR},
  247. </if>
  248. <if test="record.comcode != null">
  249. comcode = #{record.comcode,jdbcType=VARCHAR},
  250. </if>
  251. <if test="record.fileid != null">
  252. fileid = #{record.fileid,jdbcType=VARCHAR},
  253. </if>
  254. <if test="record.dirid != null">
  255. dirid = #{record.dirid,jdbcType=VARCHAR},
  256. </if>
  257. <if test="record.userscope != null">
  258. userscope = #{record.userscope,jdbcType=VARCHAR},
  259. </if>
  260. <if test="record.byzd1 != null">
  261. byzd_1 = #{record.byzd1,jdbcType=VARCHAR},
  262. </if>
  263. <if test="record.byzd2 != null">
  264. byzd_2 = #{record.byzd2,jdbcType=VARCHAR},
  265. </if>
  266. <if test="record.byzd3 != null">
  267. byzd_3 = #{record.byzd3,jdbcType=VARCHAR},
  268. </if>
  269. <if test="record.byzd4 != null">
  270. byzd_4 = #{record.byzd4,jdbcType=VARCHAR},
  271. </if>
  272. <if test="record.byzd5 != null">
  273. byzd_5 = #{record.byzd5,jdbcType=VARCHAR},
  274. </if>
  275. <if test="record.operatorcode != null">
  276. operatorcode = #{record.operatorcode,jdbcType=VARCHAR},
  277. </if>
  278. <if test="record.operatime != null">
  279. operatime = #{record.operatime,jdbcType=DATE},
  280. </if>
  281. </set>
  282. <if test="_parameter != null">
  283. <include refid="Update_By_Example_Where_Clause"/>
  284. </if>
  285. </update>
  286. <update id="updateByExample" parameterType="map">
  287. update esm_train
  288. set trainid = #{record.trainid,jdbcType=VARCHAR},
  289. title = #{record.title,jdbcType=VARCHAR},
  290. t_describe = #{record.tDescribe,jdbcType=VARCHAR},
  291. status = #{record.status,jdbcType=VARCHAR},
  292. comcode = #{record.comcode,jdbcType=VARCHAR},
  293. fileid = #{record.fileid,jdbcType=VARCHAR},
  294. dirid = #{record.dirid,jdbcType=VARCHAR},
  295. userscope = #{record.userscope,jdbcType=VARCHAR},
  296. byzd_1 = #{record.byzd1,jdbcType=VARCHAR},
  297. byzd_2 = #{record.byzd2,jdbcType=VARCHAR},
  298. byzd_3 = #{record.byzd3,jdbcType=VARCHAR},
  299. byzd_4 = #{record.byzd4,jdbcType=VARCHAR},
  300. byzd_5 = #{record.byzd5,jdbcType=VARCHAR},
  301. operatorcode = #{record.operatorcode,jdbcType=VARCHAR},
  302. operatime = #{record.operatime,jdbcType=DATE}
  303. <if test="_parameter != null">
  304. <include refid="Update_By_Example_Where_Clause"/>
  305. </if>
  306. </update>
  307. <update id="updateByPrimaryKeySelective" parameterType="com.ydtech.modules.esm.model.EsmTrain">
  308. update esm_train
  309. <set>
  310. <if test="title != null">
  311. title = #{title,jdbcType=VARCHAR},
  312. </if>
  313. <if test="tDescribe != null">
  314. t_describe = #{tDescribe,jdbcType=VARCHAR},
  315. </if>
  316. <if test="status != null">
  317. status = #{status,jdbcType=VARCHAR},
  318. </if>
  319. <if test="comcode != null">
  320. comcode = #{comcode,jdbcType=VARCHAR},
  321. </if>
  322. <if test="fileid != null">
  323. fileid = #{fileid,jdbcType=VARCHAR},
  324. </if>
  325. <if test="dirid != null">
  326. dirid = #{dirid,jdbcType=VARCHAR},
  327. </if>
  328. <if test="userscope != null">
  329. userscope = #{userscope,jdbcType=VARCHAR},
  330. </if>
  331. <if test="byzd1 != null">
  332. byzd_1 = #{byzd1,jdbcType=VARCHAR},
  333. </if>
  334. <if test="byzd2 != null">
  335. byzd_2 = #{byzd2,jdbcType=VARCHAR},
  336. </if>
  337. <if test="byzd3 != null">
  338. byzd_3 = #{byzd3,jdbcType=VARCHAR},
  339. </if>
  340. <if test="byzd4 != null">
  341. byzd_4 = #{byzd4,jdbcType=VARCHAR},
  342. </if>
  343. <if test="byzd5 != null">
  344. byzd_5 = #{byzd5,jdbcType=VARCHAR},
  345. </if>
  346. <if test="operatorcode != null">
  347. operatorcode = #{operatorcode,jdbcType=VARCHAR},
  348. </if>
  349. <if test="operatime != null">
  350. operatime = #{operatime,jdbcType=DATE},
  351. </if>
  352. </set>
  353. where trainid = #{trainid,jdbcType=VARCHAR}
  354. </update>
  355. <update id="updateByPrimaryKey" parameterType="com.ydtech.modules.esm.model.EsmTrain">
  356. update esm_train
  357. set title = #{title,jdbcType=VARCHAR},
  358. t_describe = #{tDescribe,jdbcType=VARCHAR},
  359. status = #{status,jdbcType=VARCHAR},
  360. comcode = #{comcode,jdbcType=VARCHAR},
  361. fileid = #{fileid,jdbcType=VARCHAR},
  362. dirid = #{dirid,jdbcType=VARCHAR},
  363. userscope = #{userscope,jdbcType=VARCHAR},
  364. byzd_1 = #{byzd1,jdbcType=VARCHAR},
  365. byzd_2 = #{byzd2,jdbcType=VARCHAR},
  366. byzd_3 = #{byzd3,jdbcType=VARCHAR},
  367. byzd_4 = #{byzd4,jdbcType=VARCHAR},
  368. byzd_5 = #{byzd5,jdbcType=VARCHAR},
  369. operatorcode = #{operatorcode,jdbcType=VARCHAR},
  370. operatime = #{operatime,jdbcType=DATE}
  371. where trainid = #{trainid,jdbcType=VARCHAR}
  372. </update>
  373. <update id="updateCount">
  374. update esm_train
  375. set byzd_3 = (IFNULL(#{byzd3,jdbcType=VARCHAR}, 0) + 1)
  376. where trainid = #{trainid,jdbcType=VARCHAR}
  377. </update>
  378. <!-- 如果传进来OPERATORCODE,那么只查询该发布人发布的培训信息 -->
  379. <select id="queryTrainByCode" parameterType="com.ydtech.modules.esm.model.EsmTrain" resultMap="BaseResultMap">
  380. SELECT
  381. <include refid="Base_Column_List"/>
  382. FROM esm_train
  383. <trim prefix="WHERE" prefixOverrides="AND">
  384. <if test="title != null and title != ''">
  385. AND TITLE LIKE CONCAT(CONCAT('%',#{title}),'%')
  386. </if>
  387. <if test="trainid != null and trainid != ''">
  388. AND TRAINID = #{trainid,jdbcType=VARCHAR}
  389. </if>
  390. <if test="operatorcode != null and operatorcode != ''">
  391. AND OPERATORCODE = #{operatorcode,jdbcType=VARCHAR}
  392. </if>
  393. <if test="status != null and status != ''">
  394. AND STATUS = #{status,jdbcType=VARCHAR}
  395. </if>
  396. <if test="comcode != null and comcode != ''">
  397. AND COMCODE LIKE CONCAT(CONCAT('%',#{comcode}),'%')
  398. </if>
  399. <if test="fileid != null and fileid != ''">
  400. AND FILEID = #{fileid,jdbcType=VARCHAR}
  401. </if>
  402. <if test="dirid != null and dirid != ''">
  403. AND DIRID = #{dirid,jdbcType=VARCHAR}
  404. </if>
  405. <if test="userscope != null and userscope != ''">
  406. AND (USERSCOPE = #{userscope,jdbcType=VARCHAR} or USERSCOPE = 'ALL')
  407. </if>
  408. <if test="byzd1 != null and byzd1 != ''">
  409. AND BYZD_1 = #{byzd1,jdbcType=VARCHAR}
  410. </if>
  411. </trim>
  412. </select>
  413. </mapper>