TTempWetAlarmMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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.tempWarn.mapper.TTempWetAlarmMapper" >
  4. <resultMap id="BaseResultMap" type="com.chinaitop.depot.tempWarn.model.TTempWetAlarm" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="house_id" property="houseId" jdbcType="INTEGER" />
  7. <result column="house_code" property="houseCode" jdbcType="VARCHAR" />
  8. <result column="hwxz" property="hwxz" jdbcType="INTEGER" />
  9. <result column="pz" property="pz" jdbcType="INTEGER" />
  10. <result column="threshold_value" property="thresholdValue" jdbcType="INTEGER" />
  11. <result column="alarm_time" property="alarmTime" jdbcType="TIMESTAMP" />
  12. <result column="restore_time" property="restoreTime" jdbcType="TIMESTAMP" />
  13. <result column="duration_days" property="durationDays" jdbcType="INTEGER" />
  14. <result column="approval_status" property="approvalStatus" jdbcType="VARCHAR" />
  15. <result column="org_id" property="orgId" jdbcType="INTEGER" />
  16. <result column="threshold_type" property="thresholdType" jdbcType="INTEGER" />
  17. <result column="temp_value" property="tempValue" jdbcType="DECIMAL" />
  18. <result column="process_status" property="processStatus" jdbcType="VARCHAR" />
  19. <result column="supervision_status" property="supervisionStatus" jdbcType="VARCHAR" />
  20. <!-- 下面是业务字段 -->
  21. <result column="yjzt" property="yjzt" jdbcType="VARCHAR" />
  22. <result column="clordbzt" property="clordbzt" jdbcType="VARCHAR" />
  23. </resultMap>
  24. <sql id="Example_Where_Clause" >
  25. <where >
  26. <foreach collection="oredCriteria" item="criteria" separator="or" >
  27. <if test="criteria.valid" >
  28. <trim prefix="(" suffix=")" prefixOverrides="and" >
  29. <foreach collection="criteria.criteria" item="criterion" >
  30. <choose >
  31. <when test="criterion.noValue" >
  32. and ${criterion.condition}
  33. </when>
  34. <when test="criterion.singleValue" >
  35. and ${criterion.condition} #{criterion.value}
  36. </when>
  37. <when test="criterion.betweenValue" >
  38. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  39. </when>
  40. <when test="criterion.listValue" >
  41. and ${criterion.condition}
  42. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  43. #{listItem}
  44. </foreach>
  45. </when>
  46. </choose>
  47. </foreach>
  48. </trim>
  49. </if>
  50. </foreach>
  51. </where>
  52. </sql>
  53. <sql id="Update_By_Example_Where_Clause" >
  54. <where >
  55. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  56. <if test="criteria.valid" >
  57. <trim prefix="(" suffix=")" prefixOverrides="and" >
  58. <foreach collection="criteria.criteria" item="criterion" >
  59. <choose >
  60. <when test="criterion.noValue" >
  61. and ${criterion.condition}
  62. </when>
  63. <when test="criterion.singleValue" >
  64. and ${criterion.condition} #{criterion.value}
  65. </when>
  66. <when test="criterion.betweenValue" >
  67. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  68. </when>
  69. <when test="criterion.listValue" >
  70. and ${criterion.condition}
  71. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  72. #{listItem}
  73. </foreach>
  74. </when>
  75. </choose>
  76. </foreach>
  77. </trim>
  78. </if>
  79. </foreach>
  80. </where>
  81. </sql>
  82. <sql id="Base_Column_List" >
  83. id, house_id, house_code, hwxz, pz, threshold_value, alarm_time, restore_time, duration_days,
  84. approval_status, org_id, threshold_type, temp_value, process_status, supervision_status
  85. </sql>
  86. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.tempWarn.model.TTempWetAlarmExample" >
  87. select
  88. <if test="distinct" >
  89. distinct
  90. </if>
  91. <include refid="Base_Column_List" />
  92. from t_temp_wet_alarm
  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" resultMap="BaseResultMap" parameterType="java.lang.String" >
  101. select
  102. <include refid="Base_Column_List" />
  103. from t_temp_wet_alarm
  104. where id = #{id,jdbcType=VARCHAR}
  105. </select>
  106. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  107. delete from t_temp_wet_alarm
  108. where id = #{id,jdbcType=VARCHAR}
  109. </delete>
  110. <delete id="deleteByExample" parameterType="com.chinaitop.depot.tempWarn.model.TTempWetAlarmExample" >
  111. delete from t_temp_wet_alarm
  112. <if test="_parameter != null" >
  113. <include refid="Example_Where_Clause" />
  114. </if>
  115. </delete>
  116. <insert id="insert" parameterType="com.chinaitop.depot.tempWarn.model.TTempWetAlarm" >
  117. insert into t_temp_wet_alarm (id, house_id, house_code,
  118. hwxz, pz, threshold_value,
  119. alarm_time, restore_time, duration_days,
  120. approval_status, org_id, threshold_type,
  121. temp_value, process_status, supervision_status)
  122. values (#{id,jdbcType=VARCHAR}, #{houseId,jdbcType=INTEGER}, #{houseCode,jdbcType=VARCHAR},
  123. #{hwxz,jdbcType=INTEGER}, #{pz,jdbcType=INTEGER}, #{thresholdValue,jdbcType=INTEGER},
  124. #{alarmTime,jdbcType=TIMESTAMP}, #{restoreTime,jdbcType=TIMESTAMP}, #{durationDays,jdbcType=INTEGER},
  125. #{approvalStatus,jdbcType=VARCHAR}, #{orgId,jdbcType=INTEGER}, #{thresholdType,jdbcType=INTEGER},
  126. #{tempValue,jdbcType=DECIMAL}, #{processStatus,jdbcType=VARCHAR}, #{supervisionStatus,jdbcType=VARCHAR})
  127. </insert>
  128. <insert id="insertSelective" parameterType="com.chinaitop.depot.tempWarn.model.TTempWetAlarm" >
  129. insert into t_temp_wet_alarm
  130. <trim prefix="(" suffix=")" suffixOverrides="," >
  131. <if test="id != null" >
  132. id,
  133. </if>
  134. <if test="houseId != null" >
  135. house_id,
  136. </if>
  137. <if test="houseCode != null" >
  138. house_code,
  139. </if>
  140. <if test="hwxz != null" >
  141. hwxz,
  142. </if>
  143. <if test="pz != null" >
  144. pz,
  145. </if>
  146. <if test="thresholdValue != null" >
  147. threshold_value,
  148. </if>
  149. <if test="alarmTime != null" >
  150. alarm_time,
  151. </if>
  152. <if test="restoreTime != null" >
  153. restore_time,
  154. </if>
  155. <if test="durationDays != null" >
  156. duration_days,
  157. </if>
  158. <if test="approvalStatus != null" >
  159. approval_status,
  160. </if>
  161. <if test="orgId != null" >
  162. org_id,
  163. </if>
  164. <if test="thresholdType != null" >
  165. threshold_type,
  166. </if>
  167. <if test="tempValue != null" >
  168. temp_value,
  169. </if>
  170. <if test="tempValue != null" >
  171. process_status,
  172. </if>
  173. <if test="tempValue != null" >
  174. supervision_status,
  175. </if>
  176. </trim>
  177. <trim prefix="values (" suffix=")" suffixOverrides="," >
  178. <if test="id != null" >
  179. #{id,jdbcType=VARCHAR},
  180. </if>
  181. <if test="houseId != null" >
  182. #{houseId,jdbcType=INTEGER},
  183. </if>
  184. <if test="houseCode != null" >
  185. #{houseCode,jdbcType=VARCHAR},
  186. </if>
  187. <if test="hwxz != null" >
  188. #{hwxz,jdbcType=INTEGER},
  189. </if>
  190. <if test="pz != null" >
  191. #{pz,jdbcType=INTEGER},
  192. </if>
  193. <if test="thresholdValue != null" >
  194. #{thresholdValue,jdbcType=INTEGER},
  195. </if>
  196. <if test="alarmTime != null" >
  197. #{alarmTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="restoreTime != null" >
  200. #{restoreTime,jdbcType=TIMESTAMP},
  201. </if>
  202. <if test="durationDays != null" >
  203. #{durationDays,jdbcType=INTEGER},
  204. </if>
  205. <if test="approvalStatus != null" >
  206. #{approvalStatus,jdbcType=VARCHAR},
  207. </if>
  208. <if test="orgId != null" >
  209. #{orgId,jdbcType=INTEGER},
  210. </if>
  211. <if test="thresholdType != null" >
  212. #{thresholdType,jdbcType=INTEGER},
  213. </if>
  214. <if test="tempValue != null" >
  215. #{tempValue,jdbcType=DECIMAL},
  216. </if>
  217. <if test="approvalStatus != null" >
  218. #{processStatus,jdbcType=VARCHAR},
  219. </if>
  220. <if test="approvalStatus != null" >
  221. #{supervisionStatus,jdbcType=VARCHAR},
  222. </if>
  223. </trim>
  224. </insert>
  225. <select id="countByExample" parameterType="com.chinaitop.depot.tempWarn.model.TTempWetAlarmExample" resultType="java.lang.Integer" >
  226. select count(*) from t_temp_wet_alarm
  227. <if test="_parameter != null" >
  228. <include refid="Example_Where_Clause" />
  229. </if>
  230. </select>
  231. <update id="updateByExampleSelective" parameterType="map" >
  232. update t_temp_wet_alarm
  233. <set >
  234. <if test="record.id != null" >
  235. id = #{record.id,jdbcType=VARCHAR},
  236. </if>
  237. <if test="record.houseId != null" >
  238. house_id = #{record.houseId,jdbcType=INTEGER},
  239. </if>
  240. <if test="record.houseCode != null" >
  241. house_code = #{record.houseCode,jdbcType=VARCHAR},
  242. </if>
  243. <if test="record.hwxz != null" >
  244. hwxz = #{record.hwxz,jdbcType=INTEGER},
  245. </if>
  246. <if test="record.pz != null" >
  247. pz = #{record.pz,jdbcType=INTEGER},
  248. </if>
  249. <if test="record.thresholdValue != null" >
  250. threshold_value = #{record.thresholdValue,jdbcType=INTEGER},
  251. </if>
  252. <if test="record.alarmTime != null" >
  253. alarm_time = #{record.alarmTime,jdbcType=TIMESTAMP},
  254. </if>
  255. <if test="record.restoreTime != null" >
  256. restore_time = #{record.restoreTime,jdbcType=TIMESTAMP},
  257. </if>
  258. <if test="record.durationDays != null" >
  259. duration_days = #{record.durationDays,jdbcType=INTEGER},
  260. </if>
  261. <if test="record.approvalStatus != null" >
  262. approval_status = #{record.approvalStatus,jdbcType=VARCHAR},
  263. </if>
  264. <if test="record.orgId != null" >
  265. org_id = #{record.orgId,jdbcType=INTEGER},
  266. </if>
  267. <if test="record.thresholdType != null" >
  268. threshold_type = #{record.thresholdType,jdbcType=INTEGER},
  269. </if>
  270. <if test="record.tempValue != null" >
  271. temp_value = #{record.tempValue,jdbcType=DECIMAL},
  272. </if>
  273. <if test="record.approvalStatus != null" >
  274. process_status = #{record.processStatus,jdbcType=VARCHAR},
  275. </if>
  276. <if test="record.approvalStatus != null" >
  277. supervision_status = #{record.supervisionStatus,jdbcType=VARCHAR},
  278. </if>
  279. </set>
  280. <if test="_parameter != null" >
  281. <include refid="Update_By_Example_Where_Clause" />
  282. </if>
  283. </update>
  284. <update id="updateByExample" parameterType="map" >
  285. update t_temp_wet_alarm
  286. set id = #{record.id,jdbcType=VARCHAR},
  287. house_id = #{record.houseId,jdbcType=INTEGER},
  288. house_code = #{record.houseCode,jdbcType=VARCHAR},
  289. hwxz = #{record.hwxz,jdbcType=INTEGER},
  290. pz = #{record.pz,jdbcType=INTEGER},
  291. threshold_value = #{record.thresholdValue,jdbcType=INTEGER},
  292. alarm_time = #{record.alarmTime,jdbcType=TIMESTAMP},
  293. restore_time = #{record.restoreTime,jdbcType=TIMESTAMP},
  294. duration_days = #{record.durationDays,jdbcType=INTEGER},
  295. approval_status = #{record.approvalStatus,jdbcType=VARCHAR},
  296. org_id = #{record.orgId,jdbcType=INTEGER},
  297. threshold_type = #{record.thresholdType,jdbcType=INTEGER},
  298. temp_value = #{record.tempValue,jdbcType=DECIMAL},
  299. process_status = #{record.processStatus,jdbcType=VARCHAR},
  300. supervision_status = #{record.supervisionStatus,jdbcType=VARCHAR}
  301. <if test="_parameter != null" >
  302. <include refid="Update_By_Example_Where_Clause" />
  303. </if>
  304. </update>
  305. <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.tempWarn.model.TTempWetAlarm" >
  306. update t_temp_wet_alarm
  307. <set >
  308. <if test="houseId != null" >
  309. house_id = #{houseId,jdbcType=INTEGER},
  310. </if>
  311. <if test="houseCode != null" >
  312. house_code = #{houseCode,jdbcType=VARCHAR},
  313. </if>
  314. <if test="hwxz != null" >
  315. hwxz = #{hwxz,jdbcType=INTEGER},
  316. </if>
  317. <if test="pz != null" >
  318. pz = #{pz,jdbcType=INTEGER},
  319. </if>
  320. <if test="thresholdValue != null" >
  321. threshold_value = #{thresholdValue,jdbcType=INTEGER},
  322. </if>
  323. <if test="alarmTime != null" >
  324. alarm_time = #{alarmTime,jdbcType=TIMESTAMP},
  325. </if>
  326. <if test="restoreTime != null" >
  327. restore_time = #{restoreTime,jdbcType=TIMESTAMP},
  328. </if>
  329. <if test="durationDays != null" >
  330. duration_days = #{durationDays,jdbcType=INTEGER},
  331. </if>
  332. <if test="approvalStatus != null" >
  333. approval_status = #{approvalStatus,jdbcType=VARCHAR},
  334. </if>
  335. <if test="orgId != null" >
  336. org_id = #{orgId,jdbcType=INTEGER},
  337. </if>
  338. <if test="thresholdType != null" >
  339. threshold_type = #{thresholdType,jdbcType=INTEGER},
  340. </if>
  341. <if test="tempValue != null" >
  342. temp_value = #{tempValue,jdbcType=DECIMAL},
  343. </if>
  344. <if test="approvalStatus != null" >
  345. process_status = #{processStatus,jdbcType=VARCHAR},
  346. </if>
  347. <if test="approvalStatus != null" >
  348. supervision_status = #{supervisionStatus,jdbcType=VARCHAR},
  349. </if>
  350. </set>
  351. where id = #{id,jdbcType=VARCHAR}
  352. </update>
  353. <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.tempWarn.model.TTempWetAlarm" >
  354. update t_temp_wet_alarm
  355. set house_id = #{houseId,jdbcType=INTEGER},
  356. house_code = #{houseCode,jdbcType=VARCHAR},
  357. hwxz = #{hwxz,jdbcType=INTEGER},
  358. pz = #{pz,jdbcType=INTEGER},
  359. threshold_value = #{thresholdValue,jdbcType=INTEGER},
  360. alarm_time = #{alarmTime,jdbcType=TIMESTAMP},
  361. restore_time = #{restoreTime,jdbcType=TIMESTAMP},
  362. duration_days = #{durationDays,jdbcType=INTEGER},
  363. approval_status = #{approvalStatus,jdbcType=VARCHAR},
  364. org_id = #{orgId,jdbcType=INTEGER},
  365. threshold_type = #{thresholdType,jdbcType=INTEGER},
  366. temp_value = #{tempValue,jdbcType=DECIMAL},
  367. process_status = #{processStatus,jdbcType=VARCHAR},
  368. supervision_status = #{supervisionStatus,jdbcType=VARCHAR}
  369. where id = #{id,jdbcType=VARCHAR}
  370. </update>
  371. <select id="selectTempDataForToday" parameterType="string" resultType="com.chinaitop.depot.tempWarn.model.TTempWetAlarm">
  372. select
  373. t1.id,
  374. t1.org_id orgId,
  375. t1.storehouse houseCode,
  376. bs.storehouse_id houseId,
  377. kkd.hwxz,
  378. kkd.pz,
  379. t1.inh inH,
  380. t1.t_max tMax
  381. from
  382. t_testdata t1
  383. left join basic_storehouse bs on t1.org_id = bs.org_id and t1.storehouse = bs.storehouse_code
  384. left join lsreport_ts:data_kcgl_kcsw_default kkd on bs.org_id = kkd.unitid and bs.storehouse_id = kkd.ch
  385. where t1.org_id is not null
  386. and t1.ilq_yq = '0'
  387. and t1.t_time > #{now}
  388. </select>
  389. <select id="selectOneObject" parameterType="map" resultType="com.chinaitop.depot.tempWarn.model.TTempWetAlarm">
  390. select
  391. id,
  392. duration_days durationDays
  393. from
  394. t_temp_wet_alarm
  395. where
  396. org_id = #{orgId}
  397. and house_id = #{houseId}
  398. and threshold_type = #{thresholdType}
  399. and alarm_time between #{yesterday} and #{today}
  400. </select>
  401. <select id="selectAllByRestoreTimeIsNull" parameterType="string" resultMap="BaseResultMap">
  402. select
  403. <include refid="Base_Column_List" />
  404. from
  405. t_temp_wet_alarm
  406. where
  407. restore_time is null
  408. and alarm_time &lt; #{yesterday}
  409. </select>
  410. <select id="getModalPageList" parameterType="com.chinaitop.depot.tempWarn.param.TempWetCheckRecordPageParam" resultType="java.util.Map">
  411. select
  412. id,
  413. storehouse,
  414. t_time time,
  415. intemp,
  416. inh,
  417. outtemp,
  418. outh,
  419. t_max max,
  420. t_min min,
  421. t_avg avg
  422. from
  423. t_testdata
  424. where
  425. ilq_yq = #{ilqYq}
  426. and org_id = #{orgId}
  427. and storehouse = #{houseCode}
  428. and t_time between #{startTime} and #{endTime}
  429. </select>
  430. <select id="selectList" parameterType="com.chinaitop.depot.tempWarn.param.TTempWetAlarmPageParam" resultMap="BaseResultMap">
  431. select
  432. *
  433. from (
  434. select
  435. id, house_id, house_code, hwxz, pz, threshold_value, alarm_time,
  436. restore_time, duration_days, approval_status, org_id, threshold_type,
  437. temp_value, process_status, supervision_status,
  438. case approval_status
  439. when '900000' then '待处理'
  440. when '900001' then '处理中'
  441. when '900002' then '待处理 督办中'
  442. when '900003' then '处理中 督办中'
  443. when '900004' then '督办中'
  444. when '900005' then '二次督办中'
  445. when '900006' then '二次督办完成'
  446. when '900007' then '待督办'
  447. when '999999' then '处理完成'
  448. else ''
  449. end clordbzt,
  450. case when (restore_time is not null) and (approval_status = '999999' or approval_status = '900086') then '已解决' else'未解决' end yjzt
  451. from t_temp_wet_alarm
  452. ) a
  453. where 1=1
  454. <if test="orgId != null">
  455. and a.org_id=#{orgId}
  456. </if>
  457. <if test="thresholdType != null">
  458. and a.threshold_type=#{thresholdType}
  459. </if>
  460. <if test="pz != null">
  461. and a.pz=#{pz}
  462. </if>
  463. <if test="hwxz != null">
  464. and a.hwxz=#{hwxz}
  465. </if>
  466. <if test="alarmTime != null">
  467. and a.alarm_time=#{alarmTime}
  468. </if>
  469. <if test="clordbzt != null">
  470. and a.clordbzt=#{clordbzt}
  471. </if>
  472. <if test="yjzt != null">
  473. and a.yjzt=#{yjzt}
  474. </if>
  475. </select>
  476. </mapper>