MeterReadRecordMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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.huaxu.zoniot.dao.MeterReadRecordMapper">
  4. <resultMap id="BaseResultMap" type="com.huaxu.zoniot.entity.MeterReadRecord">
  5. <!--@mbg.generated-->
  6. <!--@Table sc_meter_read_record-->
  7. <id column="id" jdbcType="BIGINT" property="id" />
  8. <result column="read_date" jdbcType="INTEGER" property="readDate" />
  9. <result column="site_id" jdbcType="INTEGER" property="siteId" />
  10. <result column="sys_id" jdbcType="INTEGER" property="sysId" />
  11. <result column="province" jdbcType="INTEGER" property="province" />
  12. <result column="city" jdbcType="INTEGER" property="city" />
  13. <result column="region" jdbcType="INTEGER" property="region" />
  14. <result column="community" jdbcType="INTEGER" property="community" />
  15. <result column="customer_id" jdbcType="INTEGER" property="customerId" />
  16. <result column="concentrator_id" jdbcType="INTEGER" property="concentratorId" />
  17. <result column="collector_id" jdbcType="INTEGER" property="collectorId" />
  18. <result column="building_id" jdbcType="INTEGER" property="buildingId" />
  19. <result column="location" jdbcType="VARCHAR" property="location" />
  20. <result column="device_type_id" jdbcType="INTEGER" property="deviceTypeId" />
  21. <result column="device_id" jdbcType="BIGINT" property="deviceId" />
  22. <result column="device_no" jdbcType="VARCHAR" property="deviceNo" />
  23. <result column="meter_no" jdbcType="VARCHAR" property="meterNo" />
  24. <result column="meter_file_no" jdbcType="VARCHAR" property="meterFileNo" />
  25. <result column="read_time" jdbcType="TIMESTAMP" property="readTime" />
  26. <result column="read_status" jdbcType="VARCHAR" property="readStatus" />
  27. <result column="read_data" jdbcType="VARCHAR" property="readData" />
  28. <result column="last_valid" jdbcType="VARCHAR" property="lastValid" />
  29. <result column="last_cost" jdbcType="DECIMAL" property="lastCost" />
  30. <result column="status" jdbcType="INTEGER" property="status" />
  31. <result column="date_create" jdbcType="TIMESTAMP" property="dateCreate" />
  32. <result column="date_update" jdbcType="TIMESTAMP" property="dateUpdate" />
  33. <result column="create_by" jdbcType="VARCHAR" property="createBy" />
  34. <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
  35. </resultMap>
  36. <sql id="Base_Column_List">
  37. <!--@mbg.generated-->
  38. id, read_date, site_id, sys_id, province, city, region, community, customer_id, concentrator_id,
  39. collector_id, building_id, `location`, device_type_id, device_id, device_no, meter_no,
  40. meter_file_no, read_time, read_status, read_data, last_valid, last_cost, `status`,
  41. date_create, date_update, create_by, update_by
  42. </sql>
  43. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  44. <!--@mbg.generated-->
  45. select
  46. <include refid="Base_Column_List" />
  47. from sc_meter_read_record
  48. where id = #{id,jdbcType=BIGINT}
  49. </select>
  50. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  51. <!--@mbg.generated-->
  52. delete from sc_meter_read_record
  53. where id = #{id,jdbcType=BIGINT}
  54. </delete>
  55. <insert id="insert" parameterType="com.huaxu.zoniot.entity.MeterReadRecord">
  56. <!--@mbg.generated-->
  57. insert into sc_meter_read_record (id, read_date, site_id,
  58. sys_id, province, city,
  59. region, community, customer_id,
  60. concentrator_id, collector_id, building_id,
  61. `location`, device_type_id, device_id,
  62. device_no, meter_no, meter_file_no,
  63. read_time, read_status, read_data,
  64. last_valid, last_cost, `status`,
  65. date_create, date_update, create_by,
  66. update_by)
  67. values (#{id,jdbcType=BIGINT}, #{readDate,jdbcType=INTEGER}, #{siteId,jdbcType=INTEGER},
  68. #{sysId,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{city,jdbcType=INTEGER},
  69. #{region,jdbcType=INTEGER}, #{community,jdbcType=INTEGER}, #{customerId,jdbcType=INTEGER},
  70. #{concentratorId,jdbcType=INTEGER}, #{collectorId,jdbcType=INTEGER}, #{buildingId,jdbcType=INTEGER},
  71. #{location,jdbcType=VARCHAR}, #{deviceTypeId,jdbcType=INTEGER}, #{deviceId,jdbcType=BIGINT},
  72. #{deviceNo,jdbcType=VARCHAR}, #{meterNo,jdbcType=VARCHAR}, #{meterFileNo,jdbcType=VARCHAR},
  73. #{readTime,jdbcType=TIMESTAMP}, #{readStatus,jdbcType=VARCHAR}, #{readData,jdbcType=VARCHAR},
  74. #{lastValid,jdbcType=VARCHAR}, #{lastCost,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER},
  75. #{dateCreate,jdbcType=TIMESTAMP}, #{dateUpdate,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR},
  76. #{updateBy,jdbcType=VARCHAR})
  77. </insert>
  78. <insert id="insertSelective" parameterType="com.huaxu.zoniot.entity.MeterReadRecord">
  79. <!--@mbg.generated-->
  80. insert into sc_meter_read_record
  81. <trim prefix="(" suffix=")" suffixOverrides=",">
  82. <if test="id != null">
  83. id,
  84. </if>
  85. <if test="readDate != null">
  86. read_date,
  87. </if>
  88. <if test="siteId != null">
  89. site_id,
  90. </if>
  91. <if test="sysId != null">
  92. sys_id,
  93. </if>
  94. <if test="province != null">
  95. province,
  96. </if>
  97. <if test="city != null">
  98. city,
  99. </if>
  100. <if test="region != null">
  101. region,
  102. </if>
  103. <if test="community != null">
  104. community,
  105. </if>
  106. <if test="customerId != null">
  107. customer_id,
  108. </if>
  109. <if test="concentratorId != null">
  110. concentrator_id,
  111. </if>
  112. <if test="collectorId != null">
  113. collector_id,
  114. </if>
  115. <if test="buildingId != null">
  116. building_id,
  117. </if>
  118. <if test="location != null">
  119. `location`,
  120. </if>
  121. <if test="deviceTypeId != null">
  122. device_type_id,
  123. </if>
  124. <if test="deviceId != null">
  125. device_id,
  126. </if>
  127. <if test="deviceNo != null">
  128. device_no,
  129. </if>
  130. <if test="meterNo != null">
  131. meter_no,
  132. </if>
  133. <if test="meterFileNo != null">
  134. meter_file_no,
  135. </if>
  136. <if test="readTime != null">
  137. read_time,
  138. </if>
  139. <if test="readStatus != null">
  140. read_status,
  141. </if>
  142. <if test="readData != null">
  143. read_data,
  144. </if>
  145. <if test="lastValid != null">
  146. last_valid,
  147. </if>
  148. <if test="lastCost != null">
  149. last_cost,
  150. </if>
  151. <if test="status != null">
  152. `status`,
  153. </if>
  154. <if test="dateCreate != null">
  155. date_create,
  156. </if>
  157. <if test="dateUpdate != null">
  158. date_update,
  159. </if>
  160. <if test="createBy != null">
  161. create_by,
  162. </if>
  163. <if test="updateBy != null">
  164. update_by,
  165. </if>
  166. </trim>
  167. <trim prefix="values (" suffix=")" suffixOverrides=",">
  168. <if test="id != null">
  169. #{id,jdbcType=BIGINT},
  170. </if>
  171. <if test="readDate != null">
  172. #{readDate,jdbcType=INTEGER},
  173. </if>
  174. <if test="siteId != null">
  175. #{siteId,jdbcType=INTEGER},
  176. </if>
  177. <if test="sysId != null">
  178. #{sysId,jdbcType=INTEGER},
  179. </if>
  180. <if test="province != null">
  181. #{province,jdbcType=INTEGER},
  182. </if>
  183. <if test="city != null">
  184. #{city,jdbcType=INTEGER},
  185. </if>
  186. <if test="region != null">
  187. #{region,jdbcType=INTEGER},
  188. </if>
  189. <if test="community != null">
  190. #{community,jdbcType=INTEGER},
  191. </if>
  192. <if test="customerId != null">
  193. #{customerId,jdbcType=INTEGER},
  194. </if>
  195. <if test="concentratorId != null">
  196. #{concentratorId,jdbcType=INTEGER},
  197. </if>
  198. <if test="collectorId != null">
  199. #{collectorId,jdbcType=INTEGER},
  200. </if>
  201. <if test="buildingId != null">
  202. #{buildingId,jdbcType=INTEGER},
  203. </if>
  204. <if test="location != null">
  205. #{location,jdbcType=VARCHAR},
  206. </if>
  207. <if test="deviceTypeId != null">
  208. #{deviceTypeId,jdbcType=INTEGER},
  209. </if>
  210. <if test="deviceId != null">
  211. #{deviceId,jdbcType=BIGINT},
  212. </if>
  213. <if test="deviceNo != null">
  214. #{deviceNo,jdbcType=VARCHAR},
  215. </if>
  216. <if test="meterNo != null">
  217. #{meterNo,jdbcType=VARCHAR},
  218. </if>
  219. <if test="meterFileNo != null">
  220. #{meterFileNo,jdbcType=VARCHAR},
  221. </if>
  222. <if test="readTime != null">
  223. #{readTime,jdbcType=TIMESTAMP},
  224. </if>
  225. <if test="readStatus != null">
  226. #{readStatus,jdbcType=VARCHAR},
  227. </if>
  228. <if test="readData != null">
  229. #{readData,jdbcType=VARCHAR},
  230. </if>
  231. <if test="lastValid != null">
  232. #{lastValid,jdbcType=VARCHAR},
  233. </if>
  234. <if test="lastCost != null">
  235. #{lastCost,jdbcType=DECIMAL},
  236. </if>
  237. <if test="status != null">
  238. #{status,jdbcType=INTEGER},
  239. </if>
  240. <if test="dateCreate != null">
  241. #{dateCreate,jdbcType=TIMESTAMP},
  242. </if>
  243. <if test="dateUpdate != null">
  244. #{dateUpdate,jdbcType=TIMESTAMP},
  245. </if>
  246. <if test="createBy != null">
  247. #{createBy,jdbcType=VARCHAR},
  248. </if>
  249. <if test="updateBy != null">
  250. #{updateBy,jdbcType=VARCHAR},
  251. </if>
  252. </trim>
  253. </insert>
  254. <update id="updateByPrimaryKeySelective" parameterType="com.huaxu.zoniot.entity.MeterReadRecord">
  255. <!--@mbg.generated-->
  256. update sc_meter_read_record
  257. <set>
  258. <if test="readDate != null">
  259. read_date = #{readDate,jdbcType=INTEGER},
  260. </if>
  261. <if test="siteId != null">
  262. site_id = #{siteId,jdbcType=INTEGER},
  263. </if>
  264. <if test="sysId != null">
  265. sys_id = #{sysId,jdbcType=INTEGER},
  266. </if>
  267. <if test="province != null">
  268. province = #{province,jdbcType=INTEGER},
  269. </if>
  270. <if test="city != null">
  271. city = #{city,jdbcType=INTEGER},
  272. </if>
  273. <if test="region != null">
  274. region = #{region,jdbcType=INTEGER},
  275. </if>
  276. <if test="community != null">
  277. community = #{community,jdbcType=INTEGER},
  278. </if>
  279. <if test="customerId != null">
  280. customer_id = #{customerId,jdbcType=INTEGER},
  281. </if>
  282. <if test="concentratorId != null">
  283. concentrator_id = #{concentratorId,jdbcType=INTEGER},
  284. </if>
  285. <if test="collectorId != null">
  286. collector_id = #{collectorId,jdbcType=INTEGER},
  287. </if>
  288. <if test="buildingId != null">
  289. building_id = #{buildingId,jdbcType=INTEGER},
  290. </if>
  291. <if test="location != null">
  292. `location` = #{location,jdbcType=VARCHAR},
  293. </if>
  294. <if test="deviceTypeId != null">
  295. device_type_id = #{deviceTypeId,jdbcType=INTEGER},
  296. </if>
  297. <if test="deviceId != null">
  298. device_id = #{deviceId,jdbcType=BIGINT},
  299. </if>
  300. <if test="deviceNo != null">
  301. device_no = #{deviceNo,jdbcType=VARCHAR},
  302. </if>
  303. <if test="meterNo != null">
  304. meter_no = #{meterNo,jdbcType=VARCHAR},
  305. </if>
  306. <if test="meterFileNo != null">
  307. meter_file_no = #{meterFileNo,jdbcType=VARCHAR},
  308. </if>
  309. <if test="readTime != null">
  310. read_time = #{readTime,jdbcType=TIMESTAMP},
  311. </if>
  312. <if test="readStatus != null">
  313. read_status = #{readStatus,jdbcType=VARCHAR},
  314. </if>
  315. <if test="readData != null">
  316. read_data = #{readData,jdbcType=VARCHAR},
  317. </if>
  318. <if test="lastValid != null">
  319. last_valid = #{lastValid,jdbcType=VARCHAR},
  320. </if>
  321. <if test="lastCost != null">
  322. last_cost = #{lastCost,jdbcType=DECIMAL},
  323. </if>
  324. <if test="status != null">
  325. `status` = #{status,jdbcType=INTEGER},
  326. </if>
  327. <if test="dateCreate != null">
  328. date_create = #{dateCreate,jdbcType=TIMESTAMP},
  329. </if>
  330. <if test="dateUpdate != null">
  331. date_update = #{dateUpdate,jdbcType=TIMESTAMP},
  332. </if>
  333. <if test="createBy != null">
  334. create_by = #{createBy,jdbcType=VARCHAR},
  335. </if>
  336. <if test="updateBy != null">
  337. update_by = #{updateBy,jdbcType=VARCHAR},
  338. </if>
  339. </set>
  340. where id = #{id,jdbcType=BIGINT}
  341. </update>
  342. <update id="updateByPrimaryKey" parameterType="com.huaxu.zoniot.entity.MeterReadRecord">
  343. <!--@mbg.generated-->
  344. update sc_meter_read_record
  345. set read_date = #{readDate,jdbcType=INTEGER},
  346. site_id = #{siteId,jdbcType=INTEGER},
  347. sys_id = #{sysId,jdbcType=INTEGER},
  348. province = #{province,jdbcType=INTEGER},
  349. city = #{city,jdbcType=INTEGER},
  350. region = #{region,jdbcType=INTEGER},
  351. community = #{community,jdbcType=INTEGER},
  352. customer_id = #{customerId,jdbcType=INTEGER},
  353. concentrator_id = #{concentratorId,jdbcType=INTEGER},
  354. collector_id = #{collectorId,jdbcType=INTEGER},
  355. building_id = #{buildingId,jdbcType=INTEGER},
  356. `location` = #{location,jdbcType=VARCHAR},
  357. device_type_id = #{deviceTypeId,jdbcType=INTEGER},
  358. device_id = #{deviceId,jdbcType=BIGINT},
  359. device_no = #{deviceNo,jdbcType=VARCHAR},
  360. meter_no = #{meterNo,jdbcType=VARCHAR},
  361. meter_file_no = #{meterFileNo,jdbcType=VARCHAR},
  362. read_time = #{readTime,jdbcType=TIMESTAMP},
  363. read_status = #{readStatus,jdbcType=VARCHAR},
  364. read_data = #{readData,jdbcType=VARCHAR},
  365. last_valid = #{lastValid,jdbcType=VARCHAR},
  366. last_cost = #{lastCost,jdbcType=DECIMAL},
  367. `status` = #{status,jdbcType=INTEGER},
  368. date_create = #{dateCreate,jdbcType=TIMESTAMP},
  369. date_update = #{dateUpdate,jdbcType=TIMESTAMP},
  370. create_by = #{createBy,jdbcType=VARCHAR},
  371. update_by = #{updateBy,jdbcType=VARCHAR}
  372. where id = #{id,jdbcType=BIGINT}
  373. </update>
  374. <insert id="batchInsert" parameterType="map">
  375. <!--@mbg.generated-->
  376. replace into sc_meter_read_record
  377. (id, read_date, site_id, sys_id, province, city, region, community, customer_id,
  378. concentrator_id, collector_id, building_id, `location`, device_type_id, device_id,
  379. device_no, meter_no, meter_file_no, read_time, read_status, read_data, last_valid,
  380. last_cost, `status`, date_create, date_update, create_by, update_by)
  381. values
  382. <foreach collection="list" item="item" separator=",">
  383. (#{item.id,jdbcType=BIGINT}, #{item.readDate,jdbcType=INTEGER}, #{item.siteId,jdbcType=INTEGER},
  384. #{item.sysId,jdbcType=INTEGER}, #{item.province,jdbcType=INTEGER}, #{item.city,jdbcType=INTEGER},
  385. #{item.region,jdbcType=INTEGER}, #{item.community,jdbcType=INTEGER}, #{item.customerId,jdbcType=INTEGER},
  386. #{item.concentratorId,jdbcType=INTEGER}, #{item.collectorId,jdbcType=INTEGER},
  387. #{item.buildingId,jdbcType=INTEGER}, #{item.location,jdbcType=VARCHAR}, #{item.deviceTypeId,jdbcType=INTEGER},
  388. #{item.deviceId,jdbcType=BIGINT}, #{item.deviceNo,jdbcType=VARCHAR}, #{item.meterNo,jdbcType=VARCHAR},
  389. #{item.meterFileNo,jdbcType=VARCHAR}, #{item.readTime,jdbcType=TIMESTAMP}, #{item.readStatus,jdbcType=VARCHAR},
  390. #{item.readData,jdbcType=VARCHAR}, #{item.lastValid,jdbcType=VARCHAR}, #{item.lastCost,jdbcType=DECIMAL},
  391. #{item.status,jdbcType=INTEGER}, #{item.dateCreate,jdbcType=TIMESTAMP}, #{item.dateUpdate,jdbcType=TIMESTAMP},
  392. #{item.createBy,jdbcType=VARCHAR}, #{item.updateBy,jdbcType=VARCHAR})
  393. </foreach>
  394. </insert>
  395. <select id="findRecordByReadDayAndDeviceId" resultMap="BaseResultMap">
  396. select
  397. <include refid="Base_Column_List" />
  398. from
  399. sc_meter_read_record
  400. where
  401. status = 1
  402. and read_date = #{readDate,jdbcType=INTEGER}
  403. and device_id = #{deviceId,jdbcType=BIGINT}
  404. </select>
  405. <update id="deleteRecordByReadDayAndDeviceId">
  406. update sc_meter_read_record set status = 0
  407. where
  408. read_date = #{readDate,jdbcType=INTEGER}
  409. and device_id = #{deviceId,jdbcType=BIGINT}
  410. </update>
  411. </mapper>