PayBaseCustomerandmeterrelaMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  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.bz.smart_city.dao.pay.archives.PayBaseCustomerandmeterrelaMapper">
  4. <sql id="sqlColumns">
  5. </sql>
  6. <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
  7. <!--@mbg.generated-->
  8. <id column="id" property="id" />
  9. <id column="metercode" property="metercode"/>
  10. <result column="remarks" property="remarks" />
  11. <result column="create_by" property="createBy" />
  12. <result column="update_by" property="updateBy" />
  13. <result column="customer_id" property="customerId" />
  14. </resultMap>
  15. <sql id="sqlJoins">
  16. </sql>
  17. <select id="queryDevice" resultMap="BaseResultMap" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
  18. select id as "id",water_meter_no as "metercode" from sc_device LIMIT 1
  19. </select>
  20. <select id="findList" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
  21. select
  22. customer.id as "id",
  23. customer.watermeter_id as "watermeterId",
  24. account.id as "accountId",
  25. account.accountnumber as "accountnumber",
  26. customer.office_id as "officeId",
  27. account.name as "name",
  28. account.telephone as "telephone",
  29. customer.metercode as "metercode",
  30. pro.name as "propertyName",
  31. account.address as "address",
  32. customer.opendate as "opendate",
  33. customer.businessstate as "businessstate",
  34. customer.calculateway as "calculateway"
  35. from pay_base_customerandmeterrela customer
  36. left join pay_base_account account on customer.account_id = account.id
  37. left join pay_base_waterproperty pro on pro.id = customer.waterproperty_id
  38. <where>
  39. <if test="id != null">
  40. and customer.id =#{id}
  41. </if>
  42. <if test="metercode != null">
  43. and customer.metercode =#{metercode}
  44. </if>
  45. <if test="siteId != null">
  46. and customer.site_id = #{siteId}
  47. </if>
  48. <if test="customerId != null">
  49. and customer.customer_id = #{customerId}
  50. </if>
  51. order by customer.create_date desc
  52. </where>
  53. </select>
  54. <select id="getAccountId" resultType="com.bz.smart_city.entity.pay.PayBaseAccount">
  55. select
  56. id as "id"
  57. from pay_base_account
  58. <where>
  59. <if test="siteId != null">
  60. and site_id = #{siteId}
  61. </if>
  62. <if test="customerId != null">
  63. and customer_id = #{customerId}
  64. </if>
  65. <if test="accountnumber">
  66. and accountnumber =#{accountnumber}
  67. </if>
  68. order by create_date desc
  69. </where>
  70. </select>
  71. <select id="getDeviceId" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela" >
  72. select
  73. id as "id"
  74. from sc_device
  75. <where>
  76. <!--<if test="siteId != null">
  77. and site_id = #{siteId}
  78. </if>-->
  79. <if test="customerId != null">
  80. and customer_id = #{customerId}
  81. </if>
  82. <if test="metercode != null">
  83. and metercode =#{metercode}
  84. </if>
  85. </where>
  86. </select>
  87. <select id="getWaterPropertyId" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
  88. select id as "waterPropertyId"
  89. from pay_base_waterproperty
  90. <where>
  91. <if test="siteId != null">
  92. and site_id = #{siteId}
  93. </if>
  94. <if test="customerId != null">
  95. and customer_id = #{customerId}
  96. </if>
  97. <if test="name != null">
  98. and name =#{name}
  99. </if>
  100. order by create_date desc
  101. </where>
  102. </select>
  103. <insert id="insertList">
  104. INSERT INTO pay_base_customerandmeterrela
  105. (
  106. id,
  107. account_id,
  108. watermeter_id,
  109. accountname,
  110. accountnumber,
  111. metercode,
  112. businessstate,
  113. office_id,
  114. housetype,
  115. calculateway,
  116. customercategory,
  117. customergroup,
  118. fixedamount,
  119. vatno,
  120. bankaccount,
  121. invoicetitle,
  122. address,
  123. opendate,
  124. waterproperty_id,
  125. watertype,
  126. canceldate,
  127. create_by,
  128. create_date,
  129. update_by,
  130. update_date,
  131. remarks,
  132. del_flag,
  133. site_id,
  134. customer_id
  135. )
  136. values
  137. <foreach collection="customers" item="customer" index="index" separator=",">
  138. (
  139. #{customer.id,jdbcType=BIGINT},
  140. #{customer.accountId,jdbcType=BIGINT},
  141. #{customer.watermeterId,jdbcType=BIGINT},
  142. #{customer.accountname,jdbcType=VARCHAR},
  143. #{customer.accountnumber,jdbcType=VARCHAR},
  144. #{customer.metercode,jdbcType=VARCHAR},
  145. #{customer.businessstate,jdbcType=INTEGER},
  146. #{customer.officeId,jdbcType=BIGINT},
  147. #{customer.housetype,jdbcType=INTEGER},
  148. #{customer.calculateway,jdbcType=INTEGER},
  149. #{customer.customercategory,jdbcType=INTEGER},
  150. #{customer.customergroup,jdbcType=INTEGER},
  151. #{customer.fixedamount,jdbcType=VARCHAR},
  152. #{customer.vatno,jdbcType=VARCHAR},
  153. #{customer.bankaccount,jdbcType=VARCHAR},
  154. #{customer.invoicetitle,jdbcType=VARCHAR},
  155. #{customer.address,jdbcType=VARCHAR},
  156. #{customer.opendate,jdbcType=TIMESTAMP},
  157. #{customer.waterPropertyId,jdbcType=BIGINT},
  158. #{customer.watertype,jdbcType=INTEGER},
  159. #{customer.canceldate,jdbcType=TIMESTAMP},
  160. #{customer.createBy,jdbcType=VARCHAR},
  161. #{customer.createDate,jdbcType=TIMESTAMP},
  162. #{customer.updateBy,jdbcType=VARCHAR},
  163. #{customer.updateDate,jdbcType=TIMESTAMP},
  164. #{customer.remarks,jdbcType=VARCHAR},
  165. #{customer.delFlag,jdbcType=VARCHAR},
  166. #{customer.siteId,jdbcType=BIGINT},
  167. #{customer.customerId,jdbcType=BIGINT}
  168. )
  169. </foreach>
  170. </insert>
  171. <update id="update">
  172. update pay_base_customerandmeterrela
  173. <set>
  174. <if test="accountId != null">account_id =#{accountId},</if>
  175. <if test="watermeterId != null">watermeter_id =#{watermeterId},</if>
  176. <if test="accountname != null">accountname =#{accountname},</if>
  177. <if test="accountnumber != null">accountnumber =#{accountnumber},</if>
  178. <if test="metercode != null">metercode =#{metercode},</if>
  179. <if test="businessstate != null">businessstate =#{businessstate},</if>
  180. <if test="officeId != null">office_id =#{officeId},</if>
  181. <if test="housetype != null">housetype =#{housetype},</if>
  182. <if test="calculateway != null">calculateway =#{calculateway},</if>
  183. <if test="customercategory != null">customercategory =#{customercategory},</if>
  184. <if test="customergroup != null">customergroup =#{customergroup},</if>
  185. <if test="fixedamount != null">fixedamount =#{fixedamount},</if>
  186. <if test="vatno != null">vatno =#{vatno},</if>
  187. <if test="bankaccount != null">bankaccount =#{bankaccount},</if>
  188. <if test="address != null">address =#{address},</if>
  189. <if test="opendate != null">opendate =#{opendate},</if>
  190. <if test="waterPropertyId != null">waterproperty_id =#{waterPropertyId},</if>
  191. <if test="watertype != null">watertype =#{watertype},</if>
  192. <if test="canceldate != null">canceldate =#{canceldate},</if>
  193. <if test="updateBy != null">update_by =#{updateBy},</if>
  194. <if test="updateDate != null">update_date =#{updateDate},</if>
  195. </set>
  196. <where>
  197. <if test="id != null">id =#{id}</if>
  198. </where>
  199. </update>
  200. <select id="meterAllDebt" resultType="java.lang.Double">
  201. select ifnull(sum(debt),0) debt from pay_pay_receivable r where r.meter_id=#{meterid}
  202. </select>
  203. <select id="findByAccount" resultType="com.bz.smart_city.entity.pay.PayPayRechargeaccount">
  204. select
  205. rech.*
  206. from pay_pay_rechargeaccount rech
  207. <where>
  208. <if test="accountId != null">
  209. and rech.account_id =#{accountId}
  210. </if>
  211. order by rech.create_date desc
  212. </where>
  213. </select>
  214. <update id="updateCustomerState">
  215. update pay_base_customerandmeterrela set businessstate =#{state},update_by=#{updateBy},update_date =#{date},canceldate =#{date}
  216. where site_id =#{siteId} and customer_id =#{customerId} and id =#{id}
  217. </update>
  218. <update id="updateDeviceState">
  219. update sc_device set status =#{state},update_by=#{updateBy},date_update =#{date}
  220. where site_id =#{siteId} and customer_id =#{customerId} and metercode =#{metercode}
  221. </update>
  222. <select id="getAll" resultType="com.bz.smart_city.dto.pay.PayCustomerDto">
  223. select
  224. customer.fixedamount as "fixedamount",
  225. customer.id as "id",
  226. account.accountnumber as "accountnumber",
  227. account.name as "accountname",
  228. account.telephone as "telephone",
  229. customer.metercode as "metercode",
  230. property.id as "waterPropertyId",
  231. property.name as "waterPropertyName",
  232. account.address as "address",
  233. customer.opendate as "opendate",
  234. customer.office_id as "officeId",
  235. customer.businessstate as "businessstate",
  236. (select label from pay_sys_dict where type = '开户状态' and value = customer.businessstate and site_id = #{siteId} and customer_id =#{customerId}) as "businessName",
  237. customer.calculateway as "calculateway",
  238. (select label from pay_sys_dict where type = '结算方式' and value = customer.calculateway and site_id = #{siteId} and customer_id =#{customerId}) as "calculatewayName",
  239. account.idtype as "idtype",
  240. (select label from pay_sys_dict where type = '证件类型' and value = account.idtype and site_id = #{siteId} and customer_id =#{customerId}) as "idtypeName",
  241. account.idcardno as "idcardno",
  242. customer.housetype as "housetype",
  243. (select label from pay_sys_dict where type = '住房类型' and value = customer.housetype and site_id = #{siteId} and customer_id =#{customerId}) as "housetypeName",
  244. customer.customergroup as "customergroup",
  245. (select label from pay_sys_dict where type = '开户分组' and value = customer.customergroup and site_id = #{siteId} and customer_id =#{customerId}) as "customergroupName"
  246. from pay_base_customerandmeterrela customer
  247. left join pay_base_account account on account.id = customer.account_id
  248. left join pay_base_waterproperty property on property.id = customer.waterproperty_id
  249. <where>
  250. <if test="siteId != null">
  251. and customer.site_id = #{siteId}
  252. </if>
  253. <if test="customerId != null">
  254. and customer.customer_id = #{customerId}
  255. </if>
  256. <if test="condition != null">
  257. and
  258. (
  259. account.accountnumber like concat('%',#{condition},'%')
  260. or account.name like concat('%',#{condition},'%')
  261. or customer.metercode like concat('%',#{condition},'%')
  262. or account.address like concat('%',#{condition},'%')
  263. or account.telephone like concat('%',#{condition},'%')
  264. )
  265. </if>
  266. <if test="waterPropertyId != null">
  267. and property.id =#{waterPropertyId}
  268. </if>
  269. <if test="businessstate != null">
  270. and customer.businessstate =#{businessstate}
  271. </if>
  272. <if test="calculateway != null">
  273. and customer.calculateway =#{calculateway}
  274. </if>
  275. <if test="programItems != null and programItems.size() != 0">
  276. and <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
  277. <if test="item.dimensionId == 10">
  278. customer.office_id = #{item.dimensionValue}
  279. </if>
  280. </foreach>
  281. </if>
  282. order by customer.create_date desc
  283. </where>
  284. </select>
  285. <select id="getList" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
  286. select
  287. account.accountnumber as "accountnumber",
  288. account.name as "accountname",
  289. account.telephone as "telephone",
  290. customer.metercode as "metercode",
  291. property.name as "propertyName",
  292. device.loc_desc as "address",
  293. customer.opendate as "opendate",
  294. customer.businessstate as "businessstate",
  295. customer.calculateway as "calculateway"
  296. from pay_base_customerandmeterrela customer
  297. left join pay_base_account account on account.id = customer.account_id
  298. left join pay_base_waterproperty property on property.id = customer.waterproperty_id
  299. inner join sc_device device on device.metercode = customer.metercode
  300. <where>
  301. <if test="siteId != null">
  302. and customer.site_id = #{siteId}
  303. </if>
  304. <if test="customerId != null">
  305. and customer.customer_id = #{customerId}
  306. </if>
  307. <if test="condition != null">
  308. and
  309. (
  310. account.accountnumber like concat('%',#{condition},'%')
  311. or account.name like concat('%',#{condition},'%')
  312. or customer.metercode like concat('%',#{condition},'%')
  313. or account.address like concat('%',#{condition},'%')
  314. or account.telephone like concat('%',#{condition},'%')
  315. )
  316. </if>
  317. <if test="waterPropertyId != null">
  318. and property.id =#{waterPropertyId}
  319. </if>
  320. <if test="businessstate != null">
  321. and customer.businessstate =#{businessstate}
  322. </if>
  323. <if test="calculateway != null">
  324. and customer.calculateway =#{calculateway}
  325. </if>
  326. order by customer.create_date desc
  327. </where>
  328. </select>
  329. <select id="queryNoOpenAccount" resultType="com.bz.smart_city.entity.pay.archives.DeviceListInfo">
  330. select
  331. account.accountnumber as "accountnumber"
  332. from pay_base_account account
  333. <where>
  334. <if test="siteId != null">
  335. and account.site_id = #{siteId}
  336. </if>
  337. <if test="customerId != null">
  338. and account.customer_id = #{customerId}
  339. </if>
  340. order by account.create_date desc
  341. </where>
  342. </select>
  343. <select id="selectAccountInfo" resultType="com.bz.smart_city.entity.pay.archives.MeterListInfo">
  344. select
  345. device.metercode as "metercode",
  346. sil.user_name as accountname,
  347. sil.user_phone as telephone,
  348. sil.id_card as idcardno
  349. from pay_base_account account
  350. inner join sc_device device on account.id = device.account_id
  351. inner join sc_install_list sil on sil.device_id = device.id
  352. <where>
  353. device.metercode not in(select metercode from pay_base_customerandmeterrela where businessstate = '1')
  354. <if test="accountnumber != null">
  355. and account.accountnumber =#{accountnumber}
  356. </if>
  357. <!-- <if test="siteId != null">
  358. and account.site_id = #{siteId}
  359. </if>-->
  360. <if test="customerId != null">
  361. and account.customer_id = #{customerId}
  362. </if>
  363. order by account.create_date desc
  364. </where>
  365. </select>
  366. <select id="selectAccountMeterInfo" resultType="com.bz.smart_city.entity.pay.archives.PayAccountInfo">
  367. select
  368. account.accountnumber as "accountnumber",
  369. account.calculateway as "calculateway",
  370. account.waterproperty_id as "waterPropertyId",
  371. device.metercode as "metercode",
  372. sil.user_name as accountname,
  373. sil.user_phone as telephone,
  374. sil.id_card as idcardno
  375. from pay_base_account account
  376. inner join sc_device device on account.id = device.account_id
  377. inner join sc_install_list sil on sil.device_id = device.id
  378. <where>
  379. device.metercode not in(select metercode from pay_base_customerandmeterrela where businessstate = '1')
  380. <if test="metercode != null">
  381. and device.metercode like concat('%',#{metercode},'%')
  382. </if>
  383. <!--<if test="siteId != null">
  384. and account.site_id = #{siteId}
  385. </if>-->
  386. <if test="customerId != null">
  387. and account.customer_id = #{customerId}
  388. </if>
  389. order by account.create_date desc
  390. </where>
  391. </select>
  392. <select id="selectAccountWater" resultType="com.bz.smart_city.entity.pay.archives.CustomerListInfo">
  393. select
  394. accountnumber as "accountnumber",
  395. calculateway as "calculateway" ,
  396. waterproperty_id as "waterPropertyId"
  397. from pay_base_account account
  398. inner join sc_device device on account.id = device.account_id
  399. <where>
  400. and (account.accountnumber not in (select accountnumber from pay_base_customerandmeterrela where businessstate ='1' ))
  401. <if test="accountnumber != null">
  402. and account.accountnumber like concat('%',#{accountnumber},'%')
  403. </if>
  404. <if test="siteId != null">
  405. and account.site_id = #{siteId}
  406. </if>
  407. <if test="customerId != null">
  408. and account.customer_id = #{customerId}
  409. </if>
  410. order by account.create_date desc
  411. </where>
  412. </select>
  413. <select id="queryMetercode" resultType="com.bz.smart_city.entity.pay.archives.MeterListInfo">
  414. select
  415. metercode from sc_device deivce
  416. <where>
  417. deivce.metercode not in (select metercode from pay_base_customerandmeterrela) and deivce.metercode is not null
  418. <!--<if test="siteId != null">
  419. and site_id = #{siteId}
  420. </if>-->
  421. <if test="customerId != null">
  422. and customer_id = #{customerId}
  423. </if>
  424. order by date_create desc
  425. </where>
  426. </select>
  427. <update id="updateAccountInfo">
  428. update pay_base_account set name=#{accountname},idtype =#{idtype},idcardno=#{idcardno},telephone=#{telephone},update_by=#{updateBy},update_date =#{date}
  429. where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber}
  430. </update>
  431. <update id="updateCustomerInfo">
  432. update pay_base_customerandmeterrela set accountname=#{accountname},housetype =#{housetype} ,office_id =#{officeId},customergroup =#{customergroup},update_by=#{updateBy},update_date =#{date}
  433. where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber} and metercode =#{metercode}
  434. </update>
  435. <update id="updateBaseAccountInfo">
  436. update pay_base_account set address =#{address} ,telephone =#{telephone},idtype =#{idtype},idcardno=#{idcardno}
  437. where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber};
  438. </update>
  439. <select id="queryWaterUserdStateCount" resultType="java.lang.Integer">
  440. select count(1) from pay_amount_waterusedamount t
  441. inner join pay_base_closingaccountinfo c on t.year = c.year and t.month = c.month
  442. where t.state = 1 and c.state = 0 and t.watermeter_id = #{id}
  443. </select>
  444. <select id="get" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
  445. select
  446. a.id,
  447. a.account_id AS "accountId",
  448. a.watermeter_id AS "watermeterId",
  449. a.accountname,
  450. a.accountnumber,
  451. a.metercode,
  452. a.businessstate,
  453. a.office_id AS "officeId",
  454. a.housetype,
  455. a.calculateway,
  456. a.customercategory,
  457. a.customergroup,
  458. a.fixedamount,
  459. a.vatno,
  460. a.bankaccount,
  461. a.invoicetitle,
  462. a.address,
  463. a.opendate,
  464. a.waterproperty_id AS "waterpropertyId",
  465. a.watertype,
  466. a.canceldate,
  467. a.create_by AS "createBy",
  468. a.create_date AS "createDate",
  469. a.update_by AS "updateBy",
  470. a.update_date AS "updateDate",
  471. a.remarks AS "remarks",
  472. a.del_flag AS "delFlag",
  473. a.site_id as "siteId",
  474. a.customer_id as "customerId"
  475. from pay_base_customerandmeterrela a
  476. <where>
  477. a.id =#{id}
  478. </where>
  479. </select>
  480. <update id="updateMeterInstallOpen">
  481. update sc_install_list set is_accepted =#{isAccepted},date_update=#{date},update_by =#{updateBy} where device_id =#{id}
  482. </update>
  483. <select id="getOfficeId" resultType="com.bz.smart_city.entity.Organization">
  484. select id from sc_organization where site_id =#{siteId} and name =#{name}
  485. </select>
  486. <update id="updateRechargeAccountState">
  487. update pay_pay_rechargeaccount set businessstate ='2',update_by=#{updateBy},update_date =#{date}
  488. where site_id =#{siteId} and customer_id =#{customerId} and account_id =#{id}
  489. </update>
  490. <update id="updateAccountState">
  491. update pay_base_account set state =#{state},update_by=#{updateBy},update_date =#{date}
  492. where site_id =#{siteId} and customer_id =#{customerId} and id =#{id}
  493. </update>
  494. <select id="getResetLadderList" resultType="com.bz.smart_city.dto.pay.PayBaseCustomerandmeterrelaDto">
  495. SELECT
  496. a.waterproperty_id as waterpropertyId,
  497. a.account_id as accountId,
  498. pro.laddertype as laddertype
  499. FROM pay_base_customerandmeterrela a
  500. inner join pay_base_account ac on ac.id = a.account_id
  501. left join pay_base_waterproperty pro on pro.id = a.waterproperty_id
  502. WHERE (pro.laddertype=1 or pro.laddertype=2)
  503. and ac.resetaccumulatedtondate &lt;= now()
  504. and a.businessstate=1
  505. and a.site_id = #{siteId}
  506. and a.customer_id = #{customerId}
  507. </select>
  508. <select id="queryCustomerInfo" resultType="java.lang.Integer">
  509. select
  510. count(1)
  511. from pay_base_customerandmeterrela
  512. where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber} and metercode =#{metercode}
  513. </select>
  514. <select id="queryCancelInfo" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
  515. select
  516. a.id,
  517. a.account_id AS "accountId",
  518. a.watermeter_id AS "watermeterId",
  519. a.accountname,
  520. a.accountnumber,
  521. a.metercode,
  522. a.businessstate,
  523. a.office_id AS "officeId",
  524. a.housetype,
  525. a.calculateway,
  526. a.customercategory,
  527. a.customergroup,
  528. a.fixedamount,
  529. a.vatno,
  530. a.bankaccount,
  531. a.invoicetitle,
  532. a.address,
  533. a.opendate,
  534. a.waterproperty_id AS "waterpropertyId",
  535. a.watertype,
  536. a.canceldate,
  537. a.create_by AS "createBy",
  538. a.create_date AS "createDate",
  539. a.update_by AS "updateBy",
  540. a.update_date AS "updateDate",
  541. a.remarks AS "remarks",
  542. a.del_flag AS "delFlag",
  543. a.site_id as "siteId",
  544. a.customer_id as "customerId"
  545. from pay_base_customerandmeterrela a
  546. <where>
  547. <if test="siteId != null">
  548. and a.site_id =#{siteId}
  549. </if>
  550. <if test="customerId != null">
  551. and a.customer_id =#{customerId}
  552. </if>
  553. <if test="accountnumber != null">
  554. and a.accountnumber =#{accountnumber}
  555. </if>
  556. <if test="metercode != null">
  557. and a.metercode =#{metercode}
  558. </if>
  559. </where>
  560. </select>
  561. <select id="queryMeterState" resultType="java.lang.Integer">
  562. select is_accepted as "isAccepted" from sc_install_list where account_id =#{accountId} and customer_id =#{customerId}
  563. </select>
  564. <select id="getParentOfficeId" resultType="com.bz.smart_city.entity.Organization">
  565. select id from sc_organization where site_id =#{siteId} and parent_id =#{id} and name =#{name}
  566. </select>
  567. </mapper>