TJobMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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.chinaitop.depot.intelligent.ventilation.mapper.TJobMapper" >
  4. <resultMap id="BaseResultMap" type="com.chinaitop.depot.intelligent.ventilation.model.TJob" >
  5. <result column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="task_number" property="taskNumber" jdbcType="VARCHAR" />
  7. <result column="task_start_time" property="taskStartTime" jdbcType="TIMESTAMP" />
  8. <result column="task_end_time" property="taskEndTime" jdbcType="TIMESTAMP" />
  9. <result column="task_state" property="taskState" jdbcType="INTEGER" />
  10. <result column="aeration_plan_number" property="aerationPlanNumber" jdbcType="VARCHAR" />
  11. <result column="creator" property="creator" jdbcType="VARCHAR" />
  12. <result column="creation_time" property="creationTime" jdbcType="TIMESTAMP" />
  13. <result column="operator" property="operator" jdbcType="VARCHAR" />
  14. <result column="org_id" property="orgId" jdbcType="INTEGER" />
  15. </resultMap>
  16. <sql id="Example_Where_Clause" >
  17. <where >
  18. <foreach collection="oredCriteria" item="criteria" separator="or" >
  19. <if test="criteria.valid" >
  20. <trim prefix="(" suffix=")" prefixOverrides="and" >
  21. <foreach collection="criteria.criteria" item="criterion" >
  22. <choose >
  23. <when test="criterion.noValue" >
  24. and ${criterion.condition}
  25. </when>
  26. <when test="criterion.singleValue" >
  27. and ${criterion.condition} #{criterion.value}
  28. </when>
  29. <when test="criterion.betweenValue" >
  30. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  31. </when>
  32. <when test="criterion.listValue" >
  33. and ${criterion.condition}
  34. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  35. #{listItem}
  36. </foreach>
  37. </when>
  38. </choose>
  39. </foreach>
  40. </trim>
  41. </if>
  42. </foreach>
  43. </where>
  44. </sql>
  45. <sql id="Update_By_Example_Where_Clause" >
  46. <where >
  47. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  48. <if test="criteria.valid" >
  49. <trim prefix="(" suffix=")" prefixOverrides="and" >
  50. <foreach collection="criteria.criteria" item="criterion" >
  51. <choose >
  52. <when test="criterion.noValue" >
  53. and ${criterion.condition}
  54. </when>
  55. <when test="criterion.singleValue" >
  56. and ${criterion.condition} #{criterion.value}
  57. </when>
  58. <when test="criterion.betweenValue" >
  59. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  60. </when>
  61. <when test="criterion.listValue" >
  62. and ${criterion.condition}
  63. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  64. #{listItem}
  65. </foreach>
  66. </when>
  67. </choose>
  68. </foreach>
  69. </trim>
  70. </if>
  71. </foreach>
  72. </where>
  73. </sql>
  74. <sql id="Base_Column_List" >
  75. id, task_number, task_start_time, task_end_time, task_state, aeration_plan_number,
  76. creator, creation_time, operator, org_id
  77. </sql>
  78. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.intelligent.ventilation.model.TJobExample" >
  79. select
  80. <if test="distinct" >
  81. distinct
  82. </if>
  83. <include refid="Base_Column_List" />
  84. from t_job
  85. <if test="_parameter != null" >
  86. <include refid="Example_Where_Clause" />
  87. </if>
  88. <if test="orderByClause != null" >
  89. order by ${orderByClause}
  90. </if>
  91. </select>
  92. <delete id="deleteByExample" parameterType="com.chinaitop.depot.intelligent.ventilation.model.TJobExample" >
  93. delete from t_job
  94. <if test="_parameter != null" >
  95. <include refid="Example_Where_Clause" />
  96. </if>
  97. </delete>
  98. <insert id="insert" parameterType="com.chinaitop.depot.intelligent.ventilation.model.TJob" >
  99. insert into t_job (id, task_number, task_start_time,
  100. task_end_time, task_state, aeration_plan_number,
  101. creator, creation_time, operator,
  102. org_id)
  103. values (#{id,jdbcType=VARCHAR}, #{taskNumber,jdbcType=VARCHAR}, #{taskStartTime,jdbcType=TIMESTAMP},
  104. #{taskEndTime,jdbcType=TIMESTAMP}, #{taskState,jdbcType=INTEGER}, #{aerationPlanNumber,jdbcType=VARCHAR},
  105. #{creator,jdbcType=VARCHAR}, #{creationTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=VARCHAR},
  106. #{orgId,jdbcType=INTEGER})
  107. </insert>
  108. <insert id="insertSelective" parameterType="com.chinaitop.depot.intelligent.ventilation.model.TJob" >
  109. insert into t_job
  110. <trim prefix="(" suffix=")" suffixOverrides="," >
  111. <if test="id != null" >
  112. id,
  113. </if>
  114. <if test="taskNumber != null" >
  115. task_number,
  116. </if>
  117. <if test="taskStartTime != null" >
  118. task_start_time,
  119. </if>
  120. <if test="taskEndTime != null" >
  121. task_end_time,
  122. </if>
  123. <if test="taskState != null" >
  124. task_state,
  125. </if>
  126. <if test="aerationPlanNumber != null" >
  127. aeration_plan_number,
  128. </if>
  129. <if test="creator != null" >
  130. creator,
  131. </if>
  132. <if test="creationTime != null" >
  133. creation_time,
  134. </if>
  135. <if test="operator != null" >
  136. operator,
  137. </if>
  138. <if test="orgId != null" >
  139. org_id,
  140. </if>
  141. </trim>
  142. <trim prefix="values (" suffix=")" suffixOverrides="," >
  143. <if test="id != null" >
  144. #{id,jdbcType=VARCHAR},
  145. </if>
  146. <if test="taskNumber != null" >
  147. #{taskNumber,jdbcType=VARCHAR},
  148. </if>
  149. <if test="taskStartTime != null" >
  150. #{taskStartTime,jdbcType=TIMESTAMP},
  151. </if>
  152. <if test="taskEndTime != null" >
  153. #{taskEndTime,jdbcType=TIMESTAMP},
  154. </if>
  155. <if test="taskState != null" >
  156. #{taskState,jdbcType=INTEGER},
  157. </if>
  158. <if test="aerationPlanNumber != null" >
  159. #{aerationPlanNumber,jdbcType=VARCHAR},
  160. </if>
  161. <if test="creator != null" >
  162. #{creator,jdbcType=VARCHAR},
  163. </if>
  164. <if test="creationTime != null" >
  165. #{creationTime,jdbcType=TIMESTAMP},
  166. </if>
  167. <if test="operator != null" >
  168. #{operator,jdbcType=VARCHAR},
  169. </if>
  170. <if test="orgId != null" >
  171. #{orgId,jdbcType=INTEGER},
  172. </if>
  173. </trim>
  174. </insert>
  175. <select id="countByExample" parameterType="com.chinaitop.depot.intelligent.ventilation.model.TJobExample" resultType="java.lang.Integer" >
  176. select count(*) from t_job
  177. <if test="_parameter != null" >
  178. <include refid="Example_Where_Clause" />
  179. </if>
  180. </select>
  181. <update id="updateByExampleSelective" parameterType="map" >
  182. update t_job
  183. <set >
  184. <if test="record.id != null" >
  185. id = #{record.id,jdbcType=VARCHAR},
  186. </if>
  187. <if test="record.taskNumber != null" >
  188. task_number = #{record.taskNumber,jdbcType=VARCHAR},
  189. </if>
  190. <if test="record.taskStartTime != null" >
  191. task_start_time = #{record.taskStartTime,jdbcType=TIMESTAMP},
  192. </if>
  193. <if test="record.taskEndTime != null" >
  194. task_end_time = #{record.taskEndTime,jdbcType=TIMESTAMP},
  195. </if>
  196. <if test="record.taskState != null" >
  197. task_state = #{record.taskState,jdbcType=INTEGER},
  198. </if>
  199. <if test="record.aerationPlanNumber != null" >
  200. aeration_plan_number = #{record.aerationPlanNumber,jdbcType=VARCHAR},
  201. </if>
  202. <if test="record.creator != null" >
  203. creator = #{record.creator,jdbcType=VARCHAR},
  204. </if>
  205. <if test="record.creationTime != null" >
  206. creation_time = #{record.creationTime,jdbcType=TIMESTAMP},
  207. </if>
  208. <if test="record.operator != null" >
  209. operator = #{record.operator,jdbcType=VARCHAR},
  210. </if>
  211. <if test="record.orgId != null" >
  212. org_id = #{record.orgId,jdbcType=INTEGER},
  213. </if>
  214. </set>
  215. <if test="_parameter != null" >
  216. <include refid="Update_By_Example_Where_Clause" />
  217. </if>
  218. </update>
  219. <update id="updateByExample" parameterType="map" >
  220. update t_job
  221. set id = #{record.id,jdbcType=VARCHAR},
  222. task_number = #{record.taskNumber,jdbcType=VARCHAR},
  223. task_start_time = #{record.taskStartTime,jdbcType=TIMESTAMP},
  224. task_end_time = #{record.taskEndTime,jdbcType=TIMESTAMP},
  225. task_state = #{record.taskState,jdbcType=INTEGER},
  226. aeration_plan_number = #{record.aerationPlanNumber,jdbcType=VARCHAR},
  227. creator = #{record.creator,jdbcType=VARCHAR},
  228. creation_time = #{record.creationTime,jdbcType=TIMESTAMP},
  229. operator = #{record.operator,jdbcType=VARCHAR},
  230. org_id = #{record.orgId,jdbcType=INTEGER}
  231. <if test="_parameter != null" >
  232. <include refid="Update_By_Example_Where_Clause" />
  233. </if>
  234. </update>
  235. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  236. delete from t_job
  237. where id = #{id,jdbcType=VARCHAR}
  238. </delete>
  239. <update id="updateByKey" parameterType="com.chinaitop.depot.intelligent.ventilation.model.TJob" >
  240. update t_job
  241. <set >
  242. <if test="taskNumber != null" >
  243. task_number = #{taskNumber,jdbcType=VARCHAR},
  244. </if>
  245. <if test="taskStartTime != null" >
  246. task_start_time = #{taskStartTime,jdbcType=TIMESTAMP},
  247. </if>
  248. <if test="taskEndTime != null" >
  249. task_end_time = #{taskEndTime,jdbcType=TIMESTAMP},
  250. </if>
  251. <if test="taskState != null" >
  252. task_state = #{taskState,jdbcType=INTEGER},
  253. </if>
  254. <if test="aerationPlanNumber != null" >
  255. aeration_plan_number = #{aerationPlanNumber,jdbcType=VARCHAR},
  256. </if>
  257. <if test="creator != null" >
  258. creator = #{creator,jdbcType=VARCHAR},
  259. </if>
  260. <if test="creationTime != null" >
  261. creation_time = #{creationTime,jdbcType=TIMESTAMP},
  262. </if>
  263. <if test="operator != null" >
  264. operator = #{operator,jdbcType=VARCHAR}
  265. </if>
  266. </set>
  267. where aeration_plan_number = #{aerationPlanNumber,jdbcType=VARCHAR}
  268. </update>
  269. <select id="getJobTime" parameterType="java.lang.String" resultMap="BaseResultMap">
  270. SELECT
  271. <include refid="Base_Column_List" />
  272. FROM
  273. t_job
  274. WHERE
  275. aeration_plan_number IN(
  276. SELECT
  277. areation_plan_number
  278. FROM
  279. t_job_application
  280. WHERE
  281. v_cf_code = #{vCfCode,jdbcType=VARCHAR}
  282. )
  283. ORDER BY
  284. task_end_time DESC
  285. </select>
  286. <!-- 根据id查询信息 -->
  287. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  288. select
  289. <include refid="Base_Column_List" />
  290. from t_job
  291. where id = #{id,jdbcType=VARCHAR}
  292. </select>
  293. </mapper>