GasCheckHistoryDao.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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="cn.ourwill.module.house.dao.intelcontrol.GasCheckHistoryDao">
  4. <resultMap type="cn.ourwill.module.house.entity.intelcontrol.GasCheckHistoryRecord" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="grain_id" property="grainId"/>
  7. <result column="house_id" property="houseId"/>
  8. <result column="check_date" property="checkDate"/>
  9. <result column="O2" property="O2"/>
  10. <result column="PH3" property="PH3"/>
  11. <result column="CO2" property="CO2"/>
  12. <result column="N2" property="N2"/>
  13. <result column="uuid" property="uuid"/>
  14. <result column="c_id" property="cId"/>
  15. <result column="c_time" property="cTime"/>
  16. <result column="u_id" property="uId"/>
  17. <result column="u_time" property="uTime"/>
  18. <result column="version" property="version"/>
  19. <result column="sync_flag" property="syncFlag"/>
  20. </resultMap>
  21. <sql id="columns">
  22. id,
  23. cityId,
  24. grain_id,
  25. house_id,
  26. check_date,
  27. O2,
  28. PH3,
  29. CO2,
  30. N2,
  31. uuid,
  32. c_id,
  33. c_time,
  34. u_id,
  35. u_time,
  36. version,
  37. sync_flag
  38. </sql>
  39. <!--<sql id="joinCols">
  40. left join sys_user u on sol.c_id=u.id
  41. </sql>-->
  42. <select id="get" resultMap="baseMap">
  43. SELECT
  44. <include refid="columns"/>
  45. FROM gas_check_historyrecord a
  46. <!--<include refid="joinCols"/>-->
  47. WHERE a.id = #{id}
  48. </select>
  49. <select id="findListFive" parameterType="cn.ourwill.module.house.entity.intelcontrol.GasCheckHistoryRecord">
  50. SELECT *
  51. FROM gas_check_historyrecord
  52. order by id desc limit 5
  53. </select>
  54. <select id="findList" resultMap="baseMap">
  55. SELECT
  56. <include refid="columns"/>
  57. FROM gas_check_historyrecord
  58. <!--<include refid="joinCols"/>-->
  59. <!--<where>
  60. <if test="id !=null">
  61. and id = #{id}
  62. </if>
  63. <if test="cityId !=null">
  64. and cityId = #{cityId}
  65. </if>
  66. <if test="grainId !=null">
  67. and grain_id = #{grainId}
  68. </if>
  69. <if test="houseId !=null">
  70. and house_id= #{houseId}
  71. </if>
  72. <if test="checkDate !=null">
  73. and check_date = #{checkDate}
  74. </if>
  75. <if test="O2 !=null">
  76. and O2 = #{O2}
  77. </if>
  78. <if test="PH3 !=null">
  79. and PH3 = #{PH3}
  80. </if>
  81. <if test="CO2 !=null">
  82. and CO2 = #{CO2}
  83. </if>
  84. <if test="N2 !=null">
  85. and N2 = #{N2}
  86. </if>
  87. <if test="uuid !=null">
  88. and uuid = #{uuid}
  89. </if>
  90. <if test="cId !=null">
  91. and c_id = #{cId}
  92. </if>
  93. <if test="cTime !=null">
  94. and c_time = #{cTime}
  95. </if>
  96. <if test="uId !=null">
  97. and u_id = #{uId}
  98. </if>
  99. <if test="uTime !=null">
  100. and u_time = #{uTime}
  101. </if>
  102. <if test="version !=null">
  103. and version = #{version}
  104. </if>
  105. <if test="syncFlag !=null">
  106. and sync_flag = #{syncFlag}
  107. </if>
  108. </where>-->
  109. <choose>
  110. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  111. ORDER BY ${page.orderBy}
  112. </when>
  113. <otherwise>
  114. </otherwise>
  115. </choose>
  116. </select>
  117. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  118. parameterType="cn.ourwill.module.house.entity.intelcontrol.GasCheckHistoryRecord">
  119. INSERT INTO gas_check_historyrecord
  120. <trim prefix="(" suffix=")" suffixOverrides=",">
  121. <if test="id !=null">
  122. id,
  123. </if>
  124. <if test="cityId !=null">
  125. cityId,
  126. </if>
  127. <if test="grainId !=null">
  128. grain_id,
  129. </if>
  130. <if test="houseId !=null">
  131. house_id,
  132. </if>
  133. <if test="checkDate !=null">
  134. check_date,
  135. </if>
  136. <if test="O2 !=null">
  137. O2,
  138. </if>
  139. <if test="PH3 !=null">
  140. PH3,
  141. </if>
  142. <if test="CO2 !=null">
  143. CO2,
  144. </if>
  145. <if test="N2 !=null">
  146. N2,
  147. </if>
  148. <if test="uuid !=null">
  149. uuid,
  150. </if>
  151. <if test="cId !=null">
  152. c_id,
  153. </if>
  154. <if test="cTime !=null">
  155. c_time,
  156. </if>
  157. <if test="uId !=null">
  158. u_id,
  159. </if>
  160. <if test="uTime !=null">
  161. u_time,
  162. </if>
  163. <if test="version !=null">
  164. version,
  165. </if>
  166. <if test="syncFlag !=null">
  167. sync_flag
  168. </if>
  169. </trim>
  170. <trim prefix="values (" suffix=")" suffixOverrides=",">
  171. <if test="id !=null">
  172. #{id},
  173. </if>
  174. <if test="cityId !=null">
  175. #{cityId},
  176. </if>
  177. <if test="grainId !=null">
  178. #{grainId},
  179. </if>
  180. <if test="houseId !=null">
  181. #{houseId},
  182. </if>
  183. <if test="checkDate !=null">
  184. #{checkDate},
  185. </if>
  186. <if test="O2 !=null">
  187. #{O2},
  188. </if>
  189. <if test="PH3 !=null">
  190. #{PH3},
  191. </if>
  192. <if test="CO2 !=null">
  193. #{CO2},
  194. </if>
  195. <if test="N2 !=null">
  196. #{N2},
  197. </if>
  198. <if test="uuid !=null">
  199. #{uuid},
  200. </if>
  201. <if test="cId !=null">
  202. #{cId},
  203. </if>
  204. <if test="cTime !=null">
  205. #{cTime},
  206. </if>
  207. <if test="uId !=null">
  208. #{uId},
  209. </if>
  210. <if test="uTime !=null">
  211. #{uTime},
  212. </if>
  213. <if test="version !=null">
  214. #{version},
  215. </if>
  216. <if test="syncFlag !=null">
  217. #{syncFlag}
  218. </if>
  219. </trim>
  220. </insert>
  221. <update id="update" parameterType="cn.ourwill.module.house.entity.intelcontrol.GasCheckHistoryRecord">
  222. UPDATE gas_check_historyrecord <set>
  223. <if test="id !=null">
  224. id = #{id},
  225. </if>
  226. <if test="cityId !=null">
  227. cityId = #{cityId},
  228. </if>
  229. <if test="grainId !=null">
  230. grain_id = #{grainId},
  231. </if>
  232. <if test="houseId !=null">
  233. house_id= #{houseId},
  234. </if>
  235. <if test="checkDate !=null">
  236. check_date = #{checkDate},
  237. </if>
  238. <if test="O2 !=null">
  239. O2 = #{O2},
  240. </if>
  241. <if test="PH3 !=null">
  242. PH3 = #{PH3},
  243. </if>
  244. <if test="CO2 !=null">
  245. CO2 = #{CO2},
  246. </if>
  247. <if test="N2 !=null">
  248. N2 = #{N2},
  249. </if>
  250. <if test="uuid !=null">
  251. uuid = #{uuid},
  252. </if>
  253. <if test="cId !=null">
  254. c_id = #{cId},
  255. </if>
  256. <if test="cTime !=null">
  257. c_time = #{cTime},
  258. </if>
  259. <if test="uId !=null">
  260. u_id = #{uId},
  261. </if>
  262. <if test="uTime !=null">
  263. u_time = #{uTime},
  264. </if>
  265. <if test="version !=null">
  266. version = #{version},
  267. </if>
  268. <if test="syncFlag !=null">
  269. sync_flag = #{syncFlag}
  270. </if>
  271. </set>
  272. WHERE id = #{id}
  273. </update>
  274. <delete id="deleteById" parameterType="java.lang.Long">
  275. DELETE FROM gas_check_historyrecord WHERE id = #{id}
  276. </delete>
  277. <delete id="deleteByIds" parameterType="java.util.List">
  278. DELETE FROM gas_check_historyrecord WHERE id IN
  279. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  280. #{item}
  281. </foreach>
  282. </delete>
  283. </mapper>