No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 

376 líneas
20 KiB

  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.iformall.mapper.WxAllBillMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxAllBill">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
  8. <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
  9. <result column="shop_number" jdbcType="VARCHAR" property="shopNumber"/>
  10. <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
  11. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  12. <result column="create_by_name" jdbcType="VARCHAR" property="createByName"/>
  13. <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime"/>
  14. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  15. <result column="update_by_name" jdbcType="VARCHAR" property="updateByName"/>
  16. <result column="price_detail" jdbcType="VARCHAR" property="priceDetail"/>
  17. <result column="need_pay" jdbcType="VARCHAR" property="needPay"/>
  18. <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/>
  19. <result column="pay" jdbcType="VARCHAR" property="pay"/>
  20. <result column="bill_type" jdbcType="INTEGER" property="billType"/>
  21. <result column="pay_way" jdbcType="BIGINT" property="payWay"/>
  22. <result column="pay_date" jdbcType="TIMESTAMP" property="payDate"/>
  23. <result column="set_off" jdbcType="VARCHAR" property="setOff"/>
  24. <result column="use_money" jdbcType="VARCHAR" property="useMoney"/>
  25. <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
  26. <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
  27. <result column="receive_date" jdbcType="TIMESTAMP" property="receiveDate"/>
  28. <result column="period" jdbcType="VARCHAR" property="period"/>
  29. <result column="status" jdbcType="INTEGER" property="status"/>
  30. <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/>
  31. <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/>
  32. <result column="bill_remark" jdbcType="VARCHAR" property="billRemark"/>
  33. <result column="last_owe_call_time" jdbcType="TIMESTAMP" property="lastOweCallTime"/>
  34. <result column="last_owe_call_user" jdbcType="VARCHAR" property="lastOweCallUser"/>
  35. <result column="bussiness_manage_fee_need_pay" jdbcType="VARCHAR" property="bussinessManageFeeNeedPay"/>
  36. <result column="operating_manage_fee_need_pay" jdbcType="VARCHAR" property="operatingManageFeeNeedPay"/>
  37. <result column="is_preview" jdbcType="INTEGER" property="isPreview"/>
  38. <result column="shop_info" jdbcType="VARCHAR" property="shopInfo"/>
  39. <result column="rent_contract_id" jdbcType="BIGINT" property="rentContractId"/>
  40. <result column="rent_contract_agile_fees_type" jdbcType="INTEGER" property="rentContractAgileFeesType"/>
  41. <result column="property_contract_id" jdbcType="BIGINT" property="propertyContractId"/>
  42. <result column="parent_bill_id" jdbcType="BIGINT" property="parentBillId"/>
  43. <result column="energy_reading_calcuteId" jdbcType="BIGINT" property="energyReadingCalcuteId" />
  44. <result column="energy_reading_id" jdbcType="BIGINT" property="energyReadingId" />
  45. <result column="extra_create_from" jdbcType="INTEGER" property="extraCreateFrom" />
  46. <result column="rent_area" jdbcType="VARCHAR" property="rentArea" />
  47. <result column="can_edit" jdbcType="INTEGER" property="canEdit" />
  48. <result column="cus_name" jdbcType="VARCHAR" property="cusName" />
  49. </resultMap>
  50. <sql id="allColumns">
  51. `id`,`tenant_id`,`parent_tenant_id`,`createtime`,`create_by`,`create_by_name`,`updatetime`,`update_by`,`update_by_name`,
  52. `price_detail`,`need_pay`,`receive_pay`,`pay`,`bill_type`,`pay_way`,`pay_date`,`set_off`,`use_money`,`starttime`,`endtime`,`status`,`energy_fees_id`,`return_pay`,
  53. `bill_remark`,`last_owe_call_time`,`last_owe_call_user`,`bussiness_manage_fee_need_pay`,`operating_manage_fee_need_pay`,`shop_id`,`shop_number`,`receive_date`,`period`,
  54. `is_preview`,`shop_info`,`rent_contract_id`,`rent_contract_agile_fees_type`,`property_contract_id`,`parent_bill_id`,`energy_reading_calcuteId`,`energy_reading_id`,`extra_create_from`,`rent_area`,
  55. `can_edit`,`cus_name`
  56. </sql>
  57. <sql id="dynamicWhereConditions">
  58. where `tenant_id` = #{tenantId}
  59. <if test=" null != id ">and `id` = #{id}</if>
  60. <if test=" null != parentTenantId and '' != parentTenantId"> and `parent_tenant_id` = #{parentTenantId}</if>
  61. <if test=" null != createBy ">and `create_by` = #{createBy}</if>
  62. <if test=" null != createByName and '' != createByName"> and `create_by_name` like concat('%',#{createByName},'%')</if>
  63. <if test=" null != billType ">and `bill_type` = #{billType}</if>
  64. <if test=" null != payWay ">and `pay_way` = #{payWay}</if>
  65. <if test=" null != status ">and `status` = #{status}</if>
  66. <if test=" null != energyFeesId ">and `energy_fees_id` = #{energyFeesId}</if>
  67. <if test=" null != rentContractId ">and `rent_contract_id` = #{rentContractId}</if>
  68. <if test=" null != rentContractAgileFeesType ">and `rent_contract_agile_fees_type` = #{rentContractAgileFeesType}</if>
  69. <if test=" null != propertyContractId ">and `property_contract_id` = #{propertyContractId}</if>
  70. <if test=" null != parentBillId ">and `parent_bill_id` = #{parentBillId}</if>
  71. <if test=" null != isPreview ">and `is_preview` = #{isPreview}</if>
  72. <if test=" null != starttime">and `starttime` &gt;= #{starttime}</if>
  73. <if test=" null != endtime">and `endtime` &lt;= #{endtime}</if>
  74. <if test=" null != receiveDate">and `receive_date` &lt;= #{receiveDate}</if>
  75. <if test=" null != starttimeEqual">and `starttime` = #{starttimeEqual}</if>
  76. <if test=" null != endtimeEqual">and `endtime` = #{endtimeEqual}</if>
  77. <if test=" null != extraCreateFrom">and `extra_create_from` = #{extraCreateFrom}</if>
  78. <if test=" null != noExtraCreateFrom">and `extra_create_from` is null</if>
  79. <if test=" null != advanceHasMoney">and bill_type = 6 and IFNULL(`pay`,'0') - IFNULL(`use_money`,'0') &gt; 0</if>
  80. <if test=" null != canEdit">and `can_edit` = #{canEdit}</if>
  81. <if test=" null != shopNumber and '' != shopNumber"> and shop_number like concat('%',#{shopNumber},'%')</if>
  82. <if test=" null != queryShopNumber and '' != queryShopNumber"> and shop_number like concat('%,',#{shopNumber},',%')</if>
  83. <if test=" null != month and '' != month">
  84. and date_format(starttime,'%Y-%m') &lt;= #{month} and date_format(endtime,'%Y-%m') &gt;= #{month}
  85. </if>
  86. <if test=" null == nearBillLastTime and null != oweBillLastTime">
  87. and (
  88. (`receive_date` &lt;= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and bill_type not in (13,21,5,7))
  89. or
  90. (`receive_date` &lt;= #{oweBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') &gt; 0 and bill_type in (13,21,5,7))
  91. )
  92. </if>
  93. <if test=" null != nearBillLastTime and null != oweBillLastTime">
  94. and (
  95. (`receive_date` &gt; #{oweBillLastTime} and `receive_date` &lt;= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and bill_type not in (13,21,5,7))
  96. or
  97. (`receive_date` &gt; #{oweBillLastTime} and `receive_date` &lt;= #{nearBillLastTime} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') &gt; 0 and bill_type in (13,21,5,7))
  98. )
  99. </if>
  100. <if test=" null != needPayStartDay">
  101. and (
  102. (`receive_date` &lt;= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and bill_type not in (13,21,5,7))
  103. or
  104. (`receive_date` &lt;= #{needPayStartDay} and `receive_pay` - `pay` - IFNULL(`set_off`,'0') &gt; 0 and bill_type in (13,21,5,7))
  105. )
  106. </if>
  107. <if test=" null != needPayNoDays">
  108. and (
  109. ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and bill_type not in (13,21,5,7))
  110. or
  111. ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') &gt; 0 and bill_type in (13,21,5,7))
  112. )
  113. </if>
  114. <if test=" null != toPayMerchant">
  115. and (
  116. ( `receive_pay` - `pay` - IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &lt; 0 and bill_type not in (13,21,5,7))
  117. or
  118. ( `pay` - IFNULL(`return_pay`,'0') &gt; 0 and bill_type in (13,21,5,7))
  119. )
  120. </if>
  121. <if test=" 1 == notifyed ">
  122. and (
  123. (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') + IFNULL(`return_pay`,'0') &gt; 0 and bill_type not in (13,21,5,7))
  124. or
  125. (`last_owe_call_time` is not null and `receive_pay` - `pay`- IFNULL(`set_off`,'0') &gt; 0 and bill_type in (13,21,5,7))
  126. )
  127. </if>
  128. <if test=" 1 == hasParentBillId ">and `parent_bill_id` is not null</if>
  129. <if test=" 0 == hasParentBillId ">and `parent_bill_id` is null</if>
  130. <if test=" null != energyReadingCalcuteId ">and `energy_reading_calcuteId` = #{energyReadingCalcuteId}</if>
  131. <if test=" null != energyReadingId ">and `energy_reading_id` = #{energyReadingId}</if>
  132. <if test=" null != energyFeesIds ">
  133. and `energy_fees_id` in
  134. <foreach collection="energyFeesIds" index="index" item="eidItem" open="(" separator="," close=")">
  135. #{eidItem}
  136. </foreach>
  137. </if>
  138. <if test=" null != rentContractIdList ">
  139. and `rent_contract_id` in
  140. <foreach collection="rentContractIdList" index="index" item="ridItem" open="(" separator="," close=")">
  141. #{ridItem}
  142. </foreach>
  143. </if>
  144. <if test=" null != propertyContractIds ">
  145. and property_contract_id in
  146. <foreach collection="propertyContractIds" index="index" item="pidItem" open="(" separator="," close=")">
  147. #{pidItem}
  148. </foreach>
  149. </if>
  150. <if test=" null != statusList ">
  151. and `status` in
  152. <foreach collection="statusList" index="index" item="stItem" open="(" separator="," close=")">
  153. #{stItem}
  154. </foreach>
  155. </if>
  156. <if test=" null != notInIds ">
  157. and id not in
  158. <foreach collection="notInIds" index="index" item="nidItem" open="(" separator="," close=")">
  159. #{nidItem}
  160. </foreach>
  161. </if>
  162. <if test=" null != ids ">
  163. and id in
  164. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  165. #{idItem}
  166. </foreach>
  167. </if>
  168. <if test=" null != sortColumns">order by ${sortColumns}</if>
  169. <if test="null != limitStart and null != limitEnd">
  170. limit #{limitStart},#{limitEnd}
  171. </if>
  172. </sql>
  173. <select id="findList" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap">
  174. select
  175. <include refid="allColumns"/>
  176. from wx_all_bill
  177. <include refid="dynamicWhereConditions"/>
  178. </select>
  179. <select id="getShopIdList" parameterType="com.iformall.domain.po.WxAllBill" resultType="Long">
  180. select distinct shop_id
  181. from wx_all_bill
  182. <include refid="dynamicWhereConditions"/>
  183. </select>
  184. <select id="selectById" parameterType="HashMap" resultMap="BaseResultMap">
  185. select
  186. <include refid="allColumns"/>
  187. from wx_all_bill where id = #{id} and `tenant_id` = #{tenantId}
  188. </select>
  189. <select id="queryBillRentContractIdList" parameterType="com.iformall.domain.po.WxAllBill" resultType="Long">
  190. select distinct rent_contract_id from wx_all_bill
  191. <include refid="dynamicWhereConditions"/>
  192. </select>
  193. <select id="getMerchantAdvanceGroupSumList" parameterType="com.iformall.domain.po.WxAllBill" resultMap="BaseResultMap">
  194. select energy_fees_id, sum(CAST(pay AS DECIMAL(20,2))) pay , sum(CAST(ifnull(use_money,'0') AS DECIMAL(20,2))) use_money
  195. from wx_all_bill
  196. <include refid="dynamicWhereConditions"/>
  197. group by energy_fees_id
  198. </select>
  199. <resultMap id="SumBaseResultMap" type="com.iformall.domain.vo.WxBillSum">
  200. <result column="cut_off_pay" jdbcType="VARCHAR" property="cutOffPay"/>
  201. <result column="receive_pay" jdbcType="VARCHAR" property="needPay"/>
  202. <result column="paid" jdbcType="VARCHAR" property="paid" />
  203. <result column="min_date" jdbcType="TIMESTAMP" property="minDate" />
  204. <result column="max_date" jdbcType="TIMESTAMP" property="maxDate" />
  205. <result column="return_pay" jdbcType="VARCHAR" property="returnPay"/>
  206. <result column="set_off" jdbcType="VARCHAR" property="setOff"/>
  207. <result column="energy_fees_id" jdbcType="BIGINT" property="energyFeesId"/>
  208. </resultMap>
  209. <select id="getBillMonthSum" parameterType="com.iformall.domain.po.WxAllBill" resultMap="SumBaseResultMap">
  210. select
  211. sum(CAST(need_pay AS DECIMAL(20,2))-CAST(receive_pay AS DECIMAL(20,2))) cut_off_pay ,
  212. sum(CAST(receive_pay AS DECIMAL(20,2))) receive_pay ,
  213. sum(CAST(ifnull(pay,'0') AS DECIMAL(20,2))) paid,
  214. min(starttime) min_date,
  215. max(endtime) max_date,
  216. sum(CAST(ifnull(set_off,'0') AS DECIMAL(20,2))) set_off ,
  217. sum(CAST(ifnull(return_pay,'0') AS DECIMAL(20,2))) return_pay
  218. from wx_all_bill
  219. <include refid="dynamicWhereConditions"/>
  220. </select>
  221. <select id="getFeesBillSum" parameterType="com.iformall.domain.po.WxAllBill" resultMap="SumBaseResultMap">
  222. select
  223. energy_fees_id,
  224. sum(CAST(need_pay AS DECIMAL(20,2))-CAST(receive_pay AS DECIMAL(20,2))) cut_off_pay ,
  225. sum(CAST(receive_pay AS DECIMAL(20,2))) receive_pay ,
  226. sum(CAST(ifnull(pay,'0') AS DECIMAL(20,2))) paid,
  227. min(starttime) min_date,
  228. max(endtime) max_date,
  229. sum(CAST(ifnull(set_off,'0') AS DECIMAL(20,2))) set_off ,
  230. sum(CAST(ifnull(return_pay,'0') AS DECIMAL(20,2))) return_pay
  231. from wx_all_bill
  232. <include refid="dynamicWhereConditions"/>
  233. group by energy_fees_id
  234. </select>
  235. <resultMap id="HotNotifyBaseResultMap" type="com.iformall.domain.vo.WxBillHotNotify">
  236. <result column="total_count" jdbcType="INTEGER" property="totalCount"/>
  237. <result column="total_money" jdbcType="VARCHAR" property="totalMoney" />
  238. <result column="min_begin_time" jdbcType="TIMESTAMP" property="minBeginTime"/>
  239. <result column="bill_type" jdbcType="INTEGER" property="billType"/>
  240. </resultMap>
  241. <select id="getBillHotNotify" parameterType="com.iformall.domain.po.WxAllBill" resultMap="HotNotifyBaseResultMap">
  242. select
  243. bill_type,
  244. count(1) total_count ,
  245. case when bill_type in (13,21,5) then sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2)) )
  246. else sum(CAST(`receive_pay` AS DECIMAL(20,2)) - CAST(`pay` AS DECIMAL(20,2)) - CAST(IFNULL(`set_off`,'0') AS DECIMAL(20,2)) + CAST(IFNULL(`return_pay`,'0') AS DECIMAL(20,2)))
  247. end as total_money,
  248. MIN(starttime) min_begin_time from wx_all_bill
  249. <include refid="dynamicWhereConditions"/>
  250. group by bill_type
  251. </select>
  252. <resultMap id="NotifyResultMap" type="com.iformall.domain.vo.WxBillNotify">
  253. <result column="bill_type" jdbcType="INTEGER" property="billType"/>
  254. <result column="bill_id" jdbcType="BIGINT" property="billId" />
  255. <result column="starttime" jdbcType="TIMESTAMP" property="starttime"/>
  256. <result column="endtime" jdbcType="TIMESTAMP" property="endtime"/>
  257. <result column="receive_pay" jdbcType="VARCHAR" property="receivePay"/>
  258. <result column="pay" jdbcType="VARCHAR" property="pay"/>
  259. <result column="shop_id" jdbcType="BIGINT" property="shopId"/>
  260. </resultMap>
  261. <select id="getBillNotifyList" parameterType="com.iformall.domain.po.WxAllBill" resultMap="NotifyResultMap">
  262. select bill_type,br.id as bill_id, br.starttime,br.endtime,br.receive_pay,br.pay,br.shop_id from wx_all_bill br
  263. <include refid="dynamicWhereConditions"/>
  264. </select>
  265. <delete id="deleteBillByContract" parameterType="com.iformall.domain.po.WxRentContract">
  266. delete from wx_all_bill where rent_contract_id = #{id}
  267. </delete>
  268. <delete id="deleteBillByPropertyContract" parameterType="com.iformall.domain.po.WxPropertyContract">
  269. delete from wx_all_bill where property_contract_id = #{id}
  270. </delete>
  271. <delete id="deletePreviewBill" parameterType="com.iformall.domain.po.WxAllBill">
  272. delete from wx_all_bill where is_preview = 1
  273. <if test=" null != rentContractId">
  274. and rent_contract_id = #{rentContractId}
  275. </if>
  276. <if test=" null != propertyContractId">
  277. and property_contract_id = #{propertyContractId}
  278. </if>
  279. <if test=" null != rentContractAgileFeesType">
  280. and rent_contract_agile_fees_type = #{rentContractAgileFeesType}
  281. </if>
  282. <if test=" null != energyFeesId">
  283. and energy_fees_id = #{energyFeesId}
  284. </if>
  285. </delete>
  286. <delete id="deleteNoNeedPayBill" parameterType="com.iformall.domain.po.WxAllBill">
  287. delete from wx_all_bill where starttime &gt;= #{shopEndtime} and IFNULL(`pay`,'0') &lt;= 0 AND IFNULL(`set_off`,'0') &lt;= 0
  288. and IFNULL(`return_pay`,'0') &lt;= 0 and IFNULL(`use_money`,'0') &lt;= 0
  289. <if test=" null != rentContractId">
  290. and rent_contract_id = #{rentContractId}
  291. </if>
  292. <if test=" null != propertyContractId">
  293. and property_contract_id = #{propertyContractId}
  294. </if>
  295. </delete>
  296. <delete id="deleteByRentHuiSuan" parameterType="com.iformall.domain.po.WxAllBill">
  297. delete from wx_all_bill where rent_contract_id = #{rentContractId}
  298. and IFNULL(`pay`,'0') &lt;= 0 AND IFNULL(`set_off`,'0') &lt;= 0 and IFNULL(`return_pay`,'0') &lt;= 0 and IFNULL(`use_money`,'0') &lt;= 0
  299. and extra_create_from = #{extraCreateFrom} and `starttime` = #{starttimeEqual}
  300. </delete>
  301. <select id="countValidBillCountByRentHuiSuan" parameterType="com.iformall.domain.po.WxAllBill" resultType="Integer">
  302. select count(1) from wx_all_bill where rent_contract_id = #{rentContractId}
  303. and (IFNULL(`pay`,'0') &gt; 0 or IFNULL(`set_off`,'0') &gt; 0 or IFNULL(`return_pay`,'0') &gt; 0 or IFNULL(`use_money`,'0') &gt; 0)
  304. and extra_create_from = #{extraCreateFrom} and `starttime` = #{starttimeEqual}
  305. </select>
  306. <delete id="deleteByRentReveneuSales" parameterType="com.iformall.domain.po.WxAllBill">
  307. delete from wx_all_bill where extra_create_from = #{extraCreateFrom}
  308. and IFNULL(`pay`,'0') &lt;= 0 AND IFNULL(`set_off`,'0') &lt;= 0 and IFNULL(`return_pay`,'0') &lt;= 0 and IFNULL(`use_money`,'0') &lt;= 0
  309. and `starttime` = #{starttimeEqual}
  310. <if test=" null != rentContractId">
  311. and rent_contract_id = #{rentContractId}
  312. </if>
  313. <if test=" null != propertyContractId">
  314. and property_contract_id = #{propertyContractId}
  315. </if>
  316. </delete>
  317. <update id="updatePreviewStatus" parameterType="com.iformall.domain.po.WxAllBill">
  318. update wx_all_bill set is_preview = #{isPreview}
  319. <if test=" null != rentContractId">
  320. where rent_contract_id = #{rentContractId}
  321. </if>
  322. <if test=" null != propertyContractId">
  323. where property_contract_id = #{propertyContractId}
  324. </if>
  325. </update>
  326. <insert id="insertBills" parameterType="HashMap">
  327. INSERT INTO wx_all_bill (
  328. <include refid="allColumns"/>
  329. )
  330. VALUES
  331. <foreach collection="list" item="item" index="index" separator=",">
  332. (
  333. #{item.id},#{item.tenantId},#{item.parentTenantId},#{item.createtime},
  334. #{item.createBy},#{item.createByName},#{item.updatetime},#{item.updateBy},#{item.updateByName},#{item.priceDetail},
  335. #{item.needPay},#{item.receivePay},#{item.pay},#{item.billType},#{item.payWay},#{item.payDate},#{item.setOff},#{item.useMoney},
  336. #{item.starttime},#{item.endtime},#{item.status},#{item.energyFeesId},#{item.returnPay},#{item.billRemark},
  337. #{item.lastOweCallTime},#{item.lastOweCallUser},#{item.bussinessManageFeeNeedPay},#{item.operatingManageFeeNeedPay},
  338. #{item.shopId},#{item.shopNumber},#{item.receiveDate},#{item.period},#{item.isPreview},#{item.shopInfo},#{item.rentContractId},#{item.rentContractAgileFeesType},#{item.propertyContractId},
  339. #{item.parentBillId},#{item.energyReadingCalcuteId},#{item.energyReadingId},#{item.extraCreateFrom},#{item.rentArea},#{item.canEdit},#{item.cusName}
  340. )
  341. </foreach>
  342. </insert>
  343. <delete id = "deleteById" parameterType="HashMap">
  344. delete from wx_all_bill where id = #{id} and tenant_id = #{tenantId}
  345. and pay &lt;= 0 and IFNULL(`set_off`,'0') &lt;= 0 and IFNULL(`return_pay`,'0') &lt;= 0 and IFNULL(`use_money`,'0') &lt;= 0
  346. </delete>
  347. <delete id = "deleteEnergyReadingBills" parameterType="HashMap">
  348. delete from wx_all_bill where energy_reading_calcuteId = #{energyReadingCalcuteId} and tenant_id = #{tenantId}
  349. and pay &lt;= 0 and IFNULL(`set_off`,'0') &lt;= 0 and IFNULL(`return_pay`,'0') &lt;= 0 and IFNULL(`use_money`,'0') &lt;= 0
  350. </delete>
  351. </mapper>