DailyRecordBasicdeviceDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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.daily.DailyRecordBasicdeviceDao">
  4. <resultMap type="cn.ourwill.module.house.entity.daily.DailyRecordBasicdevice" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="name" property="name"/>
  7. <result column="count" property="count"/>
  8. <result column="unit" property="unit"/>
  9. <result column="username" property="username"/>
  10. <result column="remark" property="remark"/>
  11. <result column="change" property="change"/>
  12. <result column="c_time" property="cTime"/>
  13. <result column="c_id" property="cId"/>
  14. <result column="u_time" property="uTime"/>
  15. <result column="u_id" property="uId"/>
  16. <result column="house_id" property="houseId"/>
  17. <result column="get_date" property="getDate"/>
  18. <result column="version" property="version"/>
  19. <result column="uuid" property="uuid"/>
  20. </resultMap>
  21. <sql id="columns">
  22. id ,
  23. `name` ,
  24. `count` ,
  25. unit ,
  26. username ,
  27. remark ,
  28. `change` ,
  29. c_time ,
  30. c_id ,
  31. u_time ,
  32. u_id ,
  33. house_id ,
  34. get_date ,
  35. version
  36. </sql>
  37. <sql id="joinCols">
  38. </sql>
  39. <select id="get" resultMap="baseMap">
  40. SELECT
  41. <include refid="columns"/>
  42. FROM daily_record_basicdevice a
  43. <include refid="joinCols"/>
  44. WHERE a.id = #{id}
  45. </select>
  46. <select id="findList" resultMap="baseMap">
  47. SELECT
  48. <include refid="columns"/>
  49. FROM daily_record_basicdevice a
  50. <include refid="joinCols"/>
  51. <where>
  52. <if test="id !=null">
  53. and id = #{id}
  54. </if>
  55. <if test="name !=null">
  56. and `name` like CONCAT('%',#{name},'%')
  57. </if>
  58. <if test="count !=null">
  59. and `count` = #{count}
  60. </if>
  61. <if test="unit !=null">
  62. and `unit` = #{unit}
  63. </if>
  64. <if test="username !=null">
  65. and username = #{username}
  66. </if>
  67. <if test="remark !=null">
  68. and remark = #{remark}
  69. </if>
  70. <if test="change !=null">
  71. and `change` = #{change}
  72. </if>
  73. <!-- <if test="cTime !=null">-->
  74. <!-- and c_time like CONCAT('%',#{cTime},'%')-->
  75. <!-- </if>-->
  76. <if test="cId !=null">
  77. and c_id = #{cId}
  78. </if>
  79. <if test="uTime !=null">
  80. and u_time = #{uTime}
  81. </if>
  82. <if test="uId !=null">
  83. and u_id = #{uId}
  84. </if>
  85. <if test="houseId !=null">
  86. and house_id = #{houseId}
  87. </if>
  88. <if test="getDate !=null">
  89. and get_date = #{getDate}
  90. </if>
  91. <if test="version !=null">
  92. and version = #{version}
  93. </if>
  94. </where>
  95. <choose>
  96. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  97. ORDER BY ${page.orderBy}
  98. </when>
  99. <otherwise>
  100. </otherwise>
  101. </choose>
  102. </select>
  103. <select id="findAllList" resultMap="baseMap">
  104. SELECT
  105. <include refid="columns"/>
  106. FROM daily_record_basicdevice a
  107. <include refid="joinCols"/>
  108. <where>
  109. <if test="id !=null">
  110. and id = #{id}
  111. </if>
  112. <if test="name !=null">
  113. and `name` like CONCAT('%',#{name},'%')
  114. </if>
  115. <if test="count !=null">
  116. and `count` = #{count}
  117. </if>
  118. <if test="unit !=null">
  119. and unit = #{unit}
  120. </if>
  121. <if test="username !=null">
  122. and username = #{username}
  123. </if>
  124. <if test="remark !=null">
  125. and remark = #{remark}
  126. </if>
  127. <if test="change !=null">
  128. and `change` = #{change}
  129. </if>
  130. <if test="cTime !=null">
  131. and c_time = #{cTime}
  132. </if>
  133. <if test="cId !=null">
  134. and c_id = #{cId}
  135. </if>
  136. <if test="uTime !=null">
  137. and u_time = #{uTime}
  138. </if>
  139. <if test="uId !=null">
  140. and u_id = #{uId}
  141. </if>
  142. <if test="houseId !=null">
  143. and house_id = #{houseId}
  144. </if>
  145. <if test="getDate !=null">
  146. and get_date = #{getDate}
  147. </if>
  148. <if test="version !=null">
  149. and version = #{version}
  150. </if>
  151. </where>
  152. <choose>
  153. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  154. ORDER BY ${page.orderBy}
  155. </when>
  156. <otherwise>
  157. </otherwise>
  158. </choose>
  159. </select>
  160. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  161. parameterType="cn.ourwill.module.house.entity.daily.DailyRecordBasicdevice">
  162. INSERT INTO daily_record_basicdevice
  163. <trim prefix="(" suffix=")" suffixOverrides=",">
  164. <if test=" id != null">
  165. id,
  166. </if>
  167. <if test=" name != null">
  168. `name`,
  169. </if>
  170. <if test=" count != null">
  171. `count`,
  172. </if>
  173. <if test="unit !=null">
  174. unit,
  175. </if>
  176. <if test=" username != null">
  177. username,
  178. </if>
  179. <if test=" remark != null">
  180. remark,
  181. </if>
  182. <if test=" change != null">
  183. `change`,
  184. </if>
  185. <if test=" cTime != null">
  186. c_time,
  187. </if>
  188. <if test=" cId != null">
  189. c_id,
  190. </if>
  191. <if test=" uTime != null">
  192. u_time,
  193. </if>
  194. <if test=" uId != null">
  195. u_id,
  196. </if>
  197. <if test=" houseId != null">
  198. house_id,
  199. </if>
  200. <if test="getDate !=null">
  201. get_date,
  202. </if>
  203. <if test=" version != null">
  204. version
  205. </if>
  206. </trim>
  207. <trim prefix="values (" suffix=")" suffixOverrides=",">
  208. <if test=" id != null">
  209. #{id},
  210. </if>
  211. <if test=" name != null">
  212. #{name},
  213. </if>
  214. <if test=" count != null">
  215. #{count},
  216. </if>
  217. <if test="unit !=null">
  218. #{unit},
  219. </if>
  220. <if test=" username != null">
  221. #{username},
  222. </if>
  223. <if test=" remark != null">
  224. #{remark},
  225. </if>
  226. <if test=" change != null">
  227. #{change},
  228. </if>
  229. <if test=" cTime != null">
  230. #{cTime},
  231. </if>
  232. <if test=" cId != null">
  233. #{cId},
  234. </if>
  235. <if test=" uTime != null">
  236. #{uTime},
  237. </if>
  238. <if test=" uId != null">
  239. #{uId},
  240. </if>
  241. <if test=" houseId != null">
  242. #{houseId},
  243. </if>
  244. <if test="getDate !=null">
  245. #{getDate},
  246. </if>
  247. <if test=" version != null">
  248. #{version}
  249. </if>
  250. </trim>
  251. </insert>
  252. <update id="update" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordBasicdevice">
  253. UPDATE daily_record_basicdevice
  254. <set>
  255. <if test="id != null">
  256. id= #{id} ,
  257. </if>
  258. <if test="name != null">
  259. `name`= #{name} ,
  260. </if>
  261. <if test="count != null">
  262. `count`= #{count} ,
  263. </if>
  264. <if test="unit !=null">
  265. unit = #{unit} ,
  266. </if>
  267. <if test="username != null">
  268. username= #{username} ,
  269. </if>
  270. <if test="remark != null">
  271. remark= #{remark} ,
  272. </if>
  273. <if test="change != null">
  274. `change`= #{change} ,
  275. </if>
  276. <if test="cTime != null">
  277. c_time= #{cTime} ,
  278. </if>
  279. <if test="cId != null">
  280. c_id= #{cId} ,
  281. </if>
  282. <if test="uTime != null">
  283. u_time= #{uTime} ,
  284. </if>
  285. <if test="uId != null">
  286. u_id= #{uId} ,
  287. </if>
  288. <if test="houseId != null">
  289. house_id= #{houseId} ,
  290. </if>
  291. <if test="getDate !=null">
  292. get_date = #{getDate} ,
  293. </if>
  294. <if test="version != null">
  295. version= #{version}
  296. </if>
  297. </set>
  298. WHERE id = #{id}
  299. </update>
  300. <update id="updateByUUID" parameterType="cn.ourwill.module.house.entity.daily.DailyRecordBasicdevice">
  301. UPDATE daily_record_basicdevice
  302. <set>
  303. <if test="id != null">
  304. id= #{id} ,
  305. </if>
  306. <if test="name != null">
  307. `name`= #{name} ,
  308. </if>
  309. <if test="count != null">
  310. `count`= #{count} ,
  311. </if>
  312. <if test="unit !=null">
  313. unit = #{unit} ,
  314. </if>
  315. <if test="username != null">
  316. username= #{username} ,
  317. </if>
  318. <if test="remark != null">
  319. remark= #{remark} ,
  320. </if>
  321. <if test="change != null">
  322. `change`= #{change} ,
  323. </if>
  324. <if test="cTime != null">
  325. c_time= #{cTime} ,
  326. </if>
  327. <if test="cId != null">
  328. c_id= #{cId} ,
  329. </if>
  330. <if test="uTime != null">
  331. u_time= #{uTime} ,
  332. </if>
  333. <if test="uId != null">
  334. u_id= #{uId} ,
  335. </if>
  336. <if test="houseId != null">
  337. house_id= #{houseId} ,
  338. </if>
  339. <if test="getDate !=null">
  340. get_date = #{getDate} ,
  341. </if>
  342. <if test="version != null">
  343. version= #{version}
  344. </if>
  345. </set>
  346. WHERE uuid = #{uuid}
  347. </update>
  348. <delete id="deleteById" parameterType="java.lang.Long">
  349. DELETE FROM daily_record_basicdevice WHERE id = #{id}
  350. </delete>
  351. <delete id="deleteByIds" parameterType="java.util.List">
  352. DELETE FROM daily_record_basicdevice WHERE id IN
  353. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  354. #{item}
  355. </foreach>
  356. </delete>
  357. <select id="getDailyRecordBasicdevice" resultMap="baseMap">
  358. SELECT
  359. <include refid="columns"/>
  360. FROM daily_record_basicdevice a
  361. <include refid="joinCols"/>
  362. <where>
  363. <if test="houseId !=null">
  364. a.house_id = #{houseId}
  365. </if>
  366. <if test="deviceName !=null">
  367. and `name` like CONCAT('%',#{deviceName},'%')
  368. </if>
  369. </where>
  370. </select>
  371. <select id="findByHouseId" resultMap="baseMap">
  372. SELECT *
  373. FROM daily_record_basicdevice a
  374. where house_id=#{houseId}
  375. <if test="cTime != null">
  376. AND c_time <![CDATA[ <= ]]> #{cTime}
  377. </if>
  378. </select>
  379. <select id="getByUuid" resultMap="baseMap">
  380. SELECT *
  381. FROM daily_record_basicdevice a
  382. where uuid=#{uuid}
  383. </select>
  384. </mapper>