GrainStatusCheckHistoryDao.xml 11 KB

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