WeatherMonitorDao.xml 10 KB

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