chengf
2026-01-27 b6184e2ddf3db37a94f7efb3b619bbc64642a292
java110-db/src/main/resources/mapper/fee/MeterWaterServiceDaoImplMapper.xml
old mode 100644 new mode 100755
@@ -5,258 +5,719 @@
<mapper namespace="meterWaterServiceDaoImpl">
    <!-- 保存水电费信息 add by wuxw 2018-07-03 -->
       <insert id="saveBusinessMeterWaterInfo" parameterType="Map">
           insert into business_meter_water(
remark,cur_reading_time,water_id,cur_degrees,operate,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,community_id,obj_type
) values (
#{remark},#{curReadingTime},#{waterId},#{curDegrees},#{operate},#{createTime},#{meterType},#{preDegrees},#{objId},#{preReadingTime},#{bId},#{communityId},#{objType}
)
       </insert>
    <insert id="saveBusinessMeterWaterInfo" parameterType="Map">
        insert into business_meter_water(
        remark,cur_reading_time,water_id,cur_degrees,operate,meter_type,pre_degrees,obj_id,pre_reading_time,
        b_id,community_id,obj_type,fee_id,obj_name,price,
        power_supply_bureau,household_name,household_number,electric_meter_id,`handler`,is_transferred,
        company_name_after_transfer,transfer_date,corresponding_household_count,last_payment_date,reading_type,
        multiplying_factor,unit_price,invoice_amount,amount_difference,auto_deduction,remark2
        ) values (
        #{remark},#{curReadingTime},#{waterId},#{curDegrees},#{operate},#{meterType},#{preDegrees},#{objId},
        #{preReadingTime},#{bId},#{communityId},#{objType},#{feeId},#{objName},#{price},
        #{powerSupplyBureau},#{householdName},#{householdNumber},#{electricMeterId},#{handler},#{isTransferred},
        #{companyNameAfterTransfer},#{transferDate},#{correspondingHouseholdCount},#{lastPaymentDate},#{readingType},
        #{multiplyingFactor},#{unitPrice},#{invoiceAmount},#{amountDifference},#{autoDeduction},#{remark2}
        )
    </insert>
       <!-- 查询水电费信息(Business) add by wuxw 2018-07-03 -->
       <select id="getBusinessMeterWaterInfo" parameterType="Map" resultType="Map">
           select  t.remark,t.cur_reading_time,t.cur_reading_time curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.operate,t.create_time,t.create_time createTime,t.meter_type,t.meter_type meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.obj_type,t.obj_type objType
from business_meter_water t
where 1 =1
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="curReadingTime !=null and curReadingTime != ''">
   and t.cur_reading_time= #{curReadingTime}
</if>
<if test="waterId !=null and waterId != ''">
   and t.water_id= #{waterId}
</if>
<if test="curDegrees !=null and curDegrees != ''">
   and t.cur_degrees= #{curDegrees}
</if>
<if test="operate !=null and operate != ''">
   and t.operate= #{operate}
</if>
<if test="createTime !=null and createTime != ''">
   and t.create_time= #{createTime}
</if>
<if test="meterType !=null and meterType != ''">
   and t.meter_type= #{meterType}
</if>
<if test="preDegrees !=null and preDegrees != ''">
   and t.pre_degrees= #{preDegrees}
</if>
<if test="objId !=null and objId != ''">
   and t.obj_id= #{objId}
</if>
<if test="preReadingTime !=null and preReadingTime != ''">
   and t.pre_reading_time= #{preReadingTime}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="communityId !=null and communityId != ''">
   and t.community_id= #{communityId}
</if>
<if test="objType !=null and objType != ''">
   and t.obj_type= #{objType}
</if>
       </select>
    <!-- 查询水电费信息(Business) add by wuxw 2018-07-03 -->
    <select id="getBusinessMeterWaterInfo" parameterType="Map" resultType="Map">
        select t.remark,t.cur_reading_time,t.cur_reading_time curReadingTime,t.water_id,t.water_id
        waterId,t.cur_degrees,t.cur_degrees curDegrees,t.operate,t.meter_type,t.meter_type
        meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id
        objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id
        communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName,t.price,
        t.power_supply_bureau powerSupplyBureau,t.household_name householdName,t.household_number householdNumber,
        t.electric_meter_id electricMeterId,t.`handler` handler,t.is_transferred isTransferred,
        t.company_name_after_transfer companyNameAfterTransfer,t.transfer_date transferDate,
        t.corresponding_household_count correspondingHouseholdCount,t.last_payment_date lastPaymentDate,
        t.reading_type readingType,t.multiplying_factor multiplyingFactor,t.unit_price unitPrice,
        t.invoice_amount invoiceAmount,t.amount_difference amountDifference,t.auto_deduction autoDeduction,
        t.remark2 remark2
        from business_meter_water t
        where 1 =1
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="curReadingTime !=null ">
            and t.cur_reading_time= #{curReadingTime}
        </if>
        <if test="waterId !=null and waterId != ''">
            and t.water_id= #{waterId}
        </if>
        <if test="curDegrees !=null and curDegrees != ''">
            and t.cur_degrees= #{curDegrees}
        </if>
        <if test="operate !=null and operate != ''">
            and t.operate= #{operate}
        </if>
        <if test="createTime !=null and createTime != ''">
            and t.create_time= #{createTime}
        </if>
        <if test="meterType !=null and meterType != ''">
            and t.meter_type= #{meterType}
        </if>
        <if test="preDegrees !=null and preDegrees != ''">
            and t.pre_degrees= #{preDegrees}
        </if>
        <if test="objId !=null and objId != ''">
            and t.obj_id= #{objId}
        </if>
        <if test="preReadingTime !=null ">
            and t.pre_reading_time= #{preReadingTime}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="objType !=null and objType != ''">
            and t.obj_type= #{objType}
        </if>
        <!-- 新增字段查询条件 -->
        <if test="powerSupplyBureau !=null and powerSupplyBureau != ''">
            and t.power_supply_bureau= #{powerSupplyBureau}
        </if>
        <if test="householdName !=null and householdName != ''">
            and t.household_name= #{householdName}
        </if>
        <if test="householdNumber !=null and householdNumber != ''">
            and t.household_number= #{householdNumber}
        </if>
        <if test="electricMeterId !=null and electricMeterId != ''">
            and t.electric_meter_id= #{electricMeterId}
        </if>
        <if test="handler !=null and handler != ''">
            and t.`handler`= #{handler}
        </if>
        <if test="isTransferred !=null and isTransferred != ''">
            and t.is_transferred= #{isTransferred}
        </if>
        <if test="companyNameAfterTransfer !=null and companyNameAfterTransfer != ''">
            and t.company_name_after_transfer= #{companyNameAfterTransfer}
        </if>
        <if test="transferDate !=null and transferDate != ''">
            and t.transfer_date= #{transferDate}
        </if>
        <if test="correspondingHouseholdCount !=null and correspondingHouseholdCount != ''">
            and t.corresponding_household_count= #{correspondingHouseholdCount}
        </if>
        <if test="lastPaymentDate !=null and lastPaymentDate != ''">
            and t.last_payment_date= #{lastPaymentDate}
        </if>
        <if test="readingType !=null and readingType != ''">
            and t.reading_type= #{readingType}
        </if>
        <if test="multiplyingFactor !=null and multiplyingFactor != ''">
            and t.multiplying_factor= #{multiplyingFactor}
        </if>
        <if test="unitPrice !=null and unitPrice != ''">
            and t.unit_price= #{unitPrice}
        </if>
        <if test="invoiceAmount !=null and invoiceAmount != ''">
            and t.invoice_amount= #{invoiceAmount}
        </if>
        <if test="amountDifference !=null and amountDifference != ''">
            and t.amount_difference= #{amountDifference}
        </if>
        <if test="autoDeduction !=null and autoDeduction != ''">
            and t.auto_deduction= #{autoDeduction}
        </if>
        <if test="remark2 !=null and remark2 != ''">
            and t.remark2= #{remark2}
        </if>
    </select>
    <!-- 保存水电费信息至 instance表中 add by wuxw 2018-07-03 -->
    <insert id="saveMeterWaterInfoInstance" parameterType="Map">
        insert into meter_water(
remark,status_cd,cur_reading_time,water_id,cur_degrees,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,community_id,obj_type
) select t.remark,'0',t.cur_reading_time,t.water_id,t.cur_degrees,t.create_time,t.meter_type,t.pre_degrees,t.obj_id,t.pre_reading_time,t.b_id,t.community_id,t.obj_type from business_meter_water t where 1=1
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="curReadingTime !=null and curReadingTime != ''">
   and t.cur_reading_time= #{curReadingTime}
</if>
<if test="waterId !=null and waterId != ''">
   and t.water_id= #{waterId}
</if>
<if test="curDegrees !=null and curDegrees != ''">
   and t.cur_degrees= #{curDegrees}
</if>
   and t.operate= 'ADD'
<if test="createTime !=null and createTime != ''">
   and t.create_time= #{createTime}
</if>
<if test="meterType !=null and meterType != ''">
   and t.meter_type= #{meterType}
</if>
<if test="preDegrees !=null and preDegrees != ''">
   and t.pre_degrees= #{preDegrees}
</if>
<if test="objId !=null and objId != ''">
   and t.obj_id= #{objId}
</if>
<if test="preReadingTime !=null and preReadingTime != ''">
   and t.pre_reading_time= #{preReadingTime}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="communityId !=null and communityId != ''">
   and t.community_id= #{communityId}
</if>
<if test="objType !=null and objType != ''">
   and t.obj_type= #{objType}
</if>
        remark,status_cd,cur_reading_time,water_id,cur_degrees,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,
        community_id,obj_type,fee_id,obj_name,price,
        power_supply_bureau,household_name,household_number,electric_meter_id,`handler`,is_transferred,
        company_name_after_transfer,transfer_date,corresponding_household_count,last_payment_date,reading_type,
        multiplying_factor,unit_price,invoice_amount,amount_difference,auto_deduction,remark2,
        address,write_time,writer,
        check_apply_company_name,check_apply_dept_project,water_fee_payer,account_number,meter_read_book_no,
        water_consumption,sewage_treatment_water,collection_standard,arrears_unpaid,late_payment_fine,
        late_payment_surcharge,fee_payment_status,carry_over_balance,total_payable_amount
        ) select
        t.remark,'0',t.cur_reading_time,t.water_id,t.cur_degrees,t.meter_type,t.pre_degrees,t.obj_id,
        t.pre_reading_time,t.b_id,t.community_id,t.obj_type,t.fee_id,t.obj_name,t.price,
        t.power_supply_bureau,t.household_name,t.household_number,t.electric_meter_id,t.`handler`,t.is_transferred,
        t.company_name_after_transfer,t.transfer_date,t.corresponding_household_count,t.last_payment_date,t.reading_type,
        t.multiplying_factor,t.unit_price,t.invoice_amount,t.amount_difference,t.auto_deduction,t.remark2,
        #{address},#{writeTime},#{writer},
        #{checkApplyCompanyName},#{checkApplyDeptProject},#{waterFeePayer},#{accountNumber},#{meterReadBookNo},
        #{waterConsumption},#{sewageTreatmentWater},#{collectionStandard},#{arrearsUnpaid},#{latePaymentFine},
        #{latePaymentSurcharge},#{feePaymentStatus},#{carryOverBalance},#{totalPayableAmount}
        from business_meter_water t where 1=1
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="curReadingTime !=null ">
            and t.cur_reading_time= #{curReadingTime}
        </if>
        <if test="waterId !=null and waterId != ''">
            and t.water_id= #{waterId}
        </if>
        <if test="curDegrees !=null and curDegrees != ''">
            and t.cur_degrees= #{curDegrees}
        </if>
        and t.operate= 'ADD'
        <if test="createTime !=null and createTime != ''">
            and t.create_time= #{createTime}
        </if>
        <if test="meterType !=null and meterType != ''">
            and t.meter_type= #{meterType}
        </if>
        <if test="preDegrees !=null and preDegrees != ''">
            and t.pre_degrees= #{preDegrees}
        </if>
        <if test="objId !=null and objId != ''">
            and t.obj_id= #{objId}
        </if>
        <if test="preReadingTime !=null ">
            and t.pre_reading_time= #{preReadingTime}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="objType !=null and objType != ''">
            and t.obj_type= #{objType}
        </if>
        <!-- 新增字段筛选条件 -->
        <if test="powerSupplyBureau !=null and powerSupplyBureau != ''">
            and t.power_supply_bureau= #{powerSupplyBureau}
        </if>
        <if test="householdName !=null and householdName != ''">
            and t.household_name= #{householdName}
        </if>
        <if test="householdNumber !=null and householdNumber != ''">
            and t.household_number= #{householdNumber}
        </if>
        <if test="electricMeterId !=null and electricMeterId != ''">
            and t.electric_meter_id= #{electricMeterId}
        </if>
    </insert>
    <!-- 查询水电费信息 add by wuxw 2018-07-03 -->
    <select id="getMeterWaterInfo" parameterType="Map" resultType="Map">
        select  t.remark,t.status_cd,t.status_cd statusCd,t.cur_reading_time,t.cur_reading_time curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.create_time,t.create_time createTime,t.meter_type,t.meter_type meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id communityId,t.obj_type,t.obj_type objType
from meter_water t
where 1 =1
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="curReadingTime !=null and curReadingTime != ''">
   and t.cur_reading_time= #{curReadingTime}
</if>
<if test="waterId !=null and waterId != ''">
   and t.water_id= #{waterId}
</if>
<if test="curDegrees !=null and curDegrees != ''">
   and t.cur_degrees= #{curDegrees}
</if>
<if test="createTime !=null and createTime != ''">
   and t.create_time= #{createTime}
</if>
<if test="meterType !=null and meterType != ''">
   and t.meter_type= #{meterType}
</if>
<if test="preDegrees !=null and preDegrees != ''">
   and t.pre_degrees= #{preDegrees}
</if>
<if test="objId !=null and objId != ''">
   and t.obj_id= #{objId}
</if>
<if test="preReadingTime !=null and preReadingTime != ''">
   and t.pre_reading_time= #{preReadingTime}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="communityId !=null and communityId != ''">
   and t.community_id= #{communityId}
</if>
<if test="objType !=null and objType != ''">
   and t.obj_type= #{objType}
</if>
order by t.create_time desc
<if test="page != -1 and page != null ">
   limit #{page}, #{row}
</if>
        select t.remark,t.status_cd,t.status_cd statusCd,t.cur_reading_time,t.cur_reading_time
        curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.create_time,t.create_time
        createTime,t.meter_type,t.meter_type meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id
        objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id
        communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName,t.price,mt.type_name meterTypeName,
        t.power_supply_bureau powerSupplyBureau,t.household_name householdName,t.household_number householdNumber,
        t.electric_meter_id electricMeterId,t.`handler` handler,t.is_transferred isTransferred,
        t.company_name_after_transfer companyNameAfterTransfer,t.transfer_date transferDate,
        t.corresponding_household_count correspondingHouseholdCount,t.last_payment_date lastPaymentDate,
        t.reading_type readingType,t.multiplying_factor multiplyingFactor,t.unit_price unitPrice,
        t.invoice_amount invoiceAmount,t.amount_difference amountDifference,t.auto_deduction autoDeduction,
        t.remark2 remark2,t.address address,t.write_time writeTime,t.writer writer,
        t.check_apply_company_name checkApplyCompanyName,
        t.check_apply_dept_project checkApplyDeptProject,
        t.water_fee_payer waterFeePayer,
        t.account_number accountNumber,
        t.meter_read_book_no meterReadBookNo,
        t.water_consumption waterConsumption,
        t.sewage_treatment_water sewageTreatmentWater,
        t.collection_standard collectionStandard,
        t.arrears_unpaid arrearsUnpaid,
        t.late_payment_fine latePaymentFine,
        t.late_payment_surcharge latePaymentSurcharge,
        t.fee_payment_status feePaymentStatus,
        t.carry_over_balance carryOverBalance,
        t.total_payable_amount totalPayableAmount
        from meter_water t
        left join meter_type mt on t.meter_type = mt.type_id and mt.status_cd = '0'
        left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
        where 1 =1
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="curReadingTime !=null ">
            and t.cur_reading_time= #{curReadingTime}
        </if>
        <if test="waterId !=null and waterId != ''">
            and t.water_id= #{waterId}
        </if>
        <if test="curDegrees !=null and curDegrees != ''">
            and t.cur_degrees= #{curDegrees}
        </if>
        <if test="createTime !=null and createTime != ''">
            and t.create_time= #{createTime}
        </if>
        <if test="meterType !=null and meterType != ''">
            and t.meter_type= #{meterType}
        </if>
        <if test="preDegrees !=null and preDegrees != ''">
            and t.pre_degrees= #{preDegrees}
        </if>
        <if test="objId !=null and objId != ''">
            and t.obj_id= #{objId}
        </if>
        <if test="preReadingTime !=null ">
            and t.pre_reading_time= #{preReadingTime}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="objType !=null and objType != ''">
            and t.obj_type= #{objType}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id = #{feeId}
        </if>
        <!-- 新增字段查询条件 -->
        <if test="powerSupplyBureau !=null and powerSupplyBureau != ''">
            and t.power_supply_bureau= #{powerSupplyBureau}
        </if>
        <if test="householdName !=null and householdName != ''">
            and t.household_name= #{householdName}
        </if>
        <if test="householdNumber !=null and householdNumber != ''">
            and t.household_number= #{householdNumber}
        </if>
        <if test="electricMeterId !=null and electricMeterId != ''">
            and t.electric_meter_id= #{electricMeterId}
        </if>
        <if test="handler !=null and handler != ''">
            and t.`handler`= #{handler}
        </if>
        <if test="isTransferred !=null and isTransferred != ''">
            and t.is_transferred= #{isTransferred}
        </if>
        <if test="companyNameAfterTransfer !=null and companyNameAfterTransfer != ''">
            and t.company_name_after_transfer= #{companyNameAfterTransfer}
        </if>
        <if test="transferDate !=null and transferDate != ''">
            and t.transfer_date= #{transferDate}
        </if>
        <if test="correspondingHouseholdCount !=null and correspondingHouseholdCount != ''">
            and t.corresponding_household_count= #{correspondingHouseholdCount}
        </if>
        <if test="lastPaymentDate !=null and lastPaymentDate != ''">
            and t.last_payment_date= #{lastPaymentDate}
        </if>
        <if test="readingType !=null and readingType != ''">
            and t.reading_type= #{readingType}
        </if>
        <if test="multiplyingFactor !=null and multiplyingFactor != ''">
            and t.multiplying_factor= #{multiplyingFactor}
        </if>
        <if test="unitPrice !=null and unitPrice != ''">
            and t.unit_price= #{unitPrice}
        </if>
        <if test="invoiceAmount !=null and invoiceAmount != ''">
            and t.invoice_amount= #{invoiceAmount}
        </if>
        <if test="amountDifference !=null and amountDifference != ''">
            and t.amount_difference= #{amountDifference}
        </if>
        <if test="autoDeduction !=null and autoDeduction != ''">
            and t.auto_deduction= #{autoDeduction}
        </if>
        <if test="remark2 !=null and remark2 != ''">
            and t.remark2= #{remark2}
        </if>
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="writeTime !=null and writeTime != ''">
            and t.write_time= #{writeTime}
        </if>
        <if test="writer !=null and writer != ''">
            and t.writer= #{writer}
        </if>
        <!-- 新增字段查询条件 -->
        <if test="checkApplyCompanyName !=null and checkApplyCompanyName != ''">
            and t.check_apply_company_name= #{checkApplyCompanyName}
        </if>
        <if test="checkApplyDeptProject !=null and checkApplyDeptProject != ''">
            and t.check_apply_dept_project= #{checkApplyDeptProject}
        </if>
        <if test="waterFeePayer !=null and waterFeePayer != ''">
            and t.water_fee_payer= #{waterFeePayer}
        </if>
        <if test="accountNumber !=null and accountNumber != ''">
            and t.account_number= #{accountNumber}
        </if>
        <if test="meterReadBookNo !=null and meterReadBookNo != ''">
            and t.meter_read_book_no= #{meterReadBookNo}
        </if>
        <if test="waterConsumption !=null and waterConsumption != ''">
            and t.water_consumption= #{waterConsumption}
        </if>
        <if test="sewageTreatmentWater !=null and sewageTreatmentWater != ''">
            and t.sewage_treatment_water= #{sewageTreatmentWater}
        </if>
        <if test="collectionStandard !=null and collectionStandard != ''">
            and t.collection_standard= #{collectionStandard}
        </if>
        <if test="arrearsUnpaid !=null and arrearsUnpaid != ''">
            and t.arrears_unpaid= #{arrearsUnpaid}
        </if>
        <if test="latePaymentFine !=null and latePaymentFine != ''">
            and t.late_payment_fine= #{latePaymentFine}
        </if>
        <if test="latePaymentSurcharge !=null and latePaymentSurcharge != ''">
            and t.late_payment_surcharge= #{latePaymentSurcharge}
        </if>
        <if test="feePaymentStatus !=null and feePaymentStatus != ''">
            and t.fee_payment_status= #{feePaymentStatus}
        </if>
        <if test="carryOverBalance !=null and carryOverBalance != ''">
            and t.carry_over_balance= #{carryOverBalance}
        </if>
        <if test="totalPayableAmount !=null and totalPayableAmount != ''">
            and t.total_payable_amount= #{totalPayableAmount}
        </if>
        order by t.create_time desc,t.obj_name asc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
    <!-- 修改水电费信息 add by wuxw 2018-07-03 -->
    <update id="updateMeterWaterInfoInstance" parameterType="Map">
        update  meter_water t set t.status_cd = #{statusCd}
<if test="newBId != null and newBId != ''">
,t.b_id = #{newBId}
</if>
<if test="remark !=null and remark != ''">
, t.remark= #{remark}
</if>
<if test="curReadingTime !=null and curReadingTime != ''">
, t.cur_reading_time= #{curReadingTime}
</if>
<if test="curDegrees !=null and curDegrees != ''">
, t.cur_degrees= #{curDegrees}
</if>
<if test="createTime !=null and createTime != ''">
, t.create_time= #{createTime}
</if>
<if test="meterType !=null and meterType != ''">
, t.meter_type= #{meterType}
</if>
<if test="preDegrees !=null and preDegrees != ''">
, t.pre_degrees= #{preDegrees}
</if>
<if test="objId !=null and objId != ''">
, t.obj_id= #{objId}
</if>
<if test="preReadingTime !=null and preReadingTime != ''">
, t.pre_reading_time= #{preReadingTime}
</if>
<if test="communityId !=null and communityId != ''">
, t.community_id= #{communityId}
</if>
<if test="objType !=null and objType != ''">
, t.obj_type= #{objType}
</if>
 where 1=1 <if test="waterId !=null and waterId != ''">
and t.water_id= #{waterId}
</if>
<if test="bId !=null and bId != ''">
and t.b_id= #{bId}
</if>
        update meter_water t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="remark !=null and remark != ''">
            , t.remark= #{remark}
        </if>
        <if test="curReadingTime !=null ">
            , t.cur_reading_time= #{curReadingTime}
        </if>
        <if test="curDegrees !=null and curDegrees != ''">
            , t.cur_degrees= #{curDegrees}
        </if>
        <if test="createTime !=null and createTime != ''">
            , t.create_time= #{createTime}
        </if>
        <if test="meterType !=null and meterType != ''">
            , t.meter_type= #{meterType}
        </if>
        <if test="preDegrees !=null and preDegrees != ''">
            , t.pre_degrees= #{preDegrees}
        </if>
        <if test="objId !=null and objId != ''">
            , t.obj_id= #{objId}
        </if>
        <if test="preReadingTime !=null ">
            , t.pre_reading_time= #{preReadingTime}
        </if>
        <if test="communityId !=null and communityId != ''">
            , t.community_id= #{communityId}
        </if>
        <if test="objType !=null and objType != ''">
            , t.obj_type= #{objType}
        </if>
        <!-- 新增字段更新逻辑 -->
        <if test="powerSupplyBureau !=null and powerSupplyBureau != ''">
            , t.power_supply_bureau= #{powerSupplyBureau}
        </if>
        <if test="householdName !=null and householdName != ''">
            , t.household_name= #{householdName}
        </if>
        <if test="householdNumber !=null and householdNumber != ''">
            , t.household_number= #{householdNumber}
        </if>
        <if test="electricMeterId !=null and electricMeterId != ''">
            , t.electric_meter_id= #{electricMeterId}
        </if>
        <if test="handler !=null and handler != ''">
            , t.`handler`= #{handler}
        </if>
        <if test="isTransferred !=null and isTransferred != ''">
            , t.is_transferred= #{isTransferred}
        </if>
        <if test="companyNameAfterTransfer !=null and companyNameAfterTransfer != ''">
            , t.company_name_after_transfer= #{companyNameAfterTransfer}
        </if>
        <if test="transferDate !=null and transferDate != ''">
            , t.transfer_date= #{transferDate}
        </if>
        <if test="correspondingHouseholdCount !=null and correspondingHouseholdCount != ''">
            , t.corresponding_household_count= #{correspondingHouseholdCount}
        </if>
        <if test="lastPaymentDate !=null and lastPaymentDate != ''">
            , t.last_payment_date= #{lastPaymentDate}
        </if>
        <if test="readingType !=null and readingType != ''">
            , t.reading_type= #{readingType}
        </if>
        <if test="multiplyingFactor !=null and multiplyingFactor != ''">
            , t.multiplying_factor= #{multiplyingFactor}
        </if>
        <if test="unitPrice !=null and unitPrice != ''">
            , t.unit_price= #{unitPrice}
        </if>
        <if test="invoiceAmount !=null and invoiceAmount != ''">
            , t.invoice_amount= #{invoiceAmount}
        </if>
        <if test="amountDifference !=null and amountDifference != ''">
            , t.amount_difference= #{amountDifference}
        </if>
        <if test="autoDeduction !=null and autoDeduction != ''">
            , t.auto_deduction= #{autoDeduction}
        </if>
        <if test="remark2 !=null and remark2 != ''">
            , t.remark2= #{remark2}
        </if>
        <if test="address !=null and address != ''">
            , t.address= #{address}
        </if>
        <if test="writeTime !=null and writeTime != ''">
            , t.write_time= #{writeTime}
        </if>
        <if test="writer !=null and writer != ''">
            , t.writer= #{writer}
        </if>
        <!-- 新增水费相关字段更新逻辑 -->
        <if test="checkApplyCompanyName !=null and checkApplyCompanyName != ''">
            , t.check_apply_company_name= #{checkApplyCompanyName}
        </if>
        <if test="checkApplyDeptProject !=null and checkApplyDeptProject != ''">
            , t.check_apply_dept_project= #{checkApplyDeptProject}
        </if>
        <if test="waterFeePayer !=null and waterFeePayer != ''">
            , t.water_fee_payer= #{waterFeePayer}
        </if>
        <if test="accountNumber !=null and accountNumber != ''">
            , t.account_number= #{accountNumber}
        </if>
        <if test="meterReadBookNo !=null and meterReadBookNo != ''">
            , t.meter_read_book_no= #{meterReadBookNo}
        </if>
        <if test="waterConsumption !=null and waterConsumption != ''">
            , t.water_consumption= #{waterConsumption}
        </if>
        <if test="sewageTreatmentWater !=null and sewageTreatmentWater != ''">
            , t.sewage_treatment_water= #{sewageTreatmentWater}
        </if>
        <if test="collectionStandard !=null and collectionStandard != ''">
            , t.collection_standard= #{collectionStandard}
        </if>
        <if test="arrearsUnpaid !=null and arrearsUnpaid != ''">
            , t.arrears_unpaid= #{arrearsUnpaid}
        </if>
        <if test="latePaymentFine !=null and latePaymentFine != ''">
            , t.late_payment_fine= #{latePaymentFine}
        </if>
        <if test="latePaymentSurcharge !=null and latePaymentSurcharge != ''">
            , t.late_payment_surcharge= #{latePaymentSurcharge}
        </if>
        <if test="feePaymentStatus !=null and feePaymentStatus != ''">
            , t.fee_payment_status= #{feePaymentStatus}
        </if>
        <if test="carryOverBalance !=null and carryOverBalance != ''">
            , t.carry_over_balance= #{carryOverBalance}
        </if>
        <if test="totalPayableAmount !=null and totalPayableAmount != ''">
            , t.total_payable_amount= #{totalPayableAmount}
        </if>
        where 1=1
        <if test="waterId !=null and waterId != ''">
            and t.water_id= #{waterId}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
    </update>
    <!-- 查询水电费数量 add by wuxw 2018-07-03 -->
     <select id="queryMeterWatersCount" parameterType="Map" resultType="Map">
        select  count(1) count
from meter_water t
where 1 =1
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="curReadingTime !=null and curReadingTime != ''">
   and t.cur_reading_time= #{curReadingTime}
</if>
<if test="waterId !=null and waterId != ''">
   and t.water_id= #{waterId}
</if>
<if test="curDegrees !=null and curDegrees != ''">
   and t.cur_degrees= #{curDegrees}
</if>
<if test="createTime !=null and createTime != ''">
   and t.create_time= #{createTime}
</if>
<if test="meterType !=null and meterType != ''">
   and t.meter_type= #{meterType}
</if>
<if test="preDegrees !=null and preDegrees != ''">
   and t.pre_degrees= #{preDegrees}
</if>
<if test="objId !=null and objId != ''">
   and t.obj_id= #{objId}
</if>
<if test="preReadingTime !=null and preReadingTime != ''">
   and t.pre_reading_time= #{preReadingTime}
</if>
<if test="bId !=null and bId != ''">
   and t.b_id= #{bId}
</if>
<if test="communityId !=null and communityId != ''">
   and t.community_id= #{communityId}
</if>
<if test="objType !=null and objType != ''">
   and t.obj_type= #{objType}
</if>
    <select id="queryMeterWatersCount" parameterType="Map" resultType="Map">
        select count(1) count
        from meter_water t
        left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
        where 1 = 1
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="curReadingTime !=null ">
            and t.cur_reading_time= #{curReadingTime}
        </if>
        <if test="waterId !=null and waterId != ''">
            and t.water_id= #{waterId}
        </if>
        <if test="curDegrees !=null and curDegrees != ''">
            and t.cur_degrees= #{curDegrees}
        </if>
        <if test="meterType !=null and meterType != ''">
            and t.meter_type= #{meterType}
        </if>
        <if test="preDegrees !=null and preDegrees != ''">
            and t.pre_degrees= #{preDegrees}
        </if>
        <if test="objId !=null and objId != ''">
            and t.obj_id= #{objId}
        </if>
        <if test="preReadingTime !=null ">
            and t.pre_reading_time= #{preReadingTime}
        </if>
        <if test="bId !=null and bId != ''">
            and t.b_id= #{bId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="objType !=null and objType != ''">
            and t.obj_type= #{objType}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id = #{feeId}
        </if>
        <!-- 新增字段计数筛选条件 -->
        <if test="powerSupplyBureau !=null and powerSupplyBureau != ''">
            and t.power_supply_bureau= #{powerSupplyBureau}
        </if>
        <if test="householdName !=null and householdName != ''">
            and t.household_name= #{householdName}
        </if>
        <if test="householdNumber !=null and householdNumber != ''">
            and t.household_number= #{householdNumber}
        </if>
        <if test="electricMeterId !=null and electricMeterId != ''">
            and t.electric_meter_id= #{electricMeterId}
        </if>
        <if test="handler !=null and handler != ''">
            and t.`handler`= #{handler}
        </if>
        <if test="isTransferred !=null and isTransferred != ''">
            and t.is_transferred= #{isTransferred}
        </if>
        <if test="companyNameAfterTransfer !=null and companyNameAfterTransfer != ''">
            and t.company_name_after_transfer= #{companyNameAfterTransfer}
        </if>
        <if test="transferDate !=null and transferDate != ''">
            and t.transfer_date= #{transferDate}
        </if>
        <if test="correspondingHouseholdCount !=null and correspondingHouseholdCount != ''">
            and t.corresponding_household_count= #{correspondingHouseholdCount}
        </if>
        <if test="lastPaymentDate !=null and lastPaymentDate != ''">
            and t.last_payment_date= #{lastPaymentDate}
        </if>
        <if test="readingType !=null and readingType != ''">
            and t.reading_type= #{readingType}
        </if>
        <if test="multiplyingFactor !=null and multiplyingFactor != ''">
            and t.multiplying_factor= #{multiplyingFactor}
        </if>
        <if test="unitPrice !=null and unitPrice != ''">
            and t.unit_price= #{unitPrice}
        </if>
        <if test="invoiceAmount !=null and invoiceAmount != ''">
            and t.invoice_amount= #{invoiceAmount}
        </if>
        <if test="amountDifference !=null and amountDifference != ''">
            and t.amount_difference= #{amountDifference}
        </if>
        <if test="autoDeduction !=null and autoDeduction != ''">
            and t.auto_deduction= #{autoDeduction}
        </if>
        <if test="remark2 !=null and remark2 != ''">
            and t.remark2= #{remark2}
        </if>
        <if test="address !=null and address != ''">
            and t.address= #{address}
        </if>
        <if test="writeTime !=null and writeTime != ''">
            and t.write_time= #{writeTime}
        </if>
        <if test="writer !=null and writer != ''">
            and t.writer= #{writer}
        </if>
        <!-- 新增水费字段计数筛选条件 -->
        <if test="checkApplyCompanyName !=null and checkApplyCompanyName != ''">
            and t.check_apply_company_name= #{checkApplyCompanyName}
        </if>
        <if test="checkApplyDeptProject !=null and checkApplyDeptProject != ''">
            and t.check_apply_dept_project= #{checkApplyDeptProject}
        </if>
        <if test="waterFeePayer !=null and waterFeePayer != ''">
            and t.water_fee_payer= #{waterFeePayer}
        </if>
        <if test="accountNumber !=null and accountNumber != ''">
            and t.account_number= #{accountNumber}
        </if>
        <if test="meterReadBookNo !=null and meterReadBookNo != ''">
            and t.meter_read_book_no= #{meterReadBookNo}
        </if>
        <if test="waterConsumption !=null and waterConsumption != ''">
            and t.water_consumption= #{waterConsumption}
        </if>
        <if test="sewageTreatmentWater !=null and sewageTreatmentWater != ''">
            and t.sewage_treatment_water= #{sewageTreatmentWater}
        </if>
        <if test="collectionStandard !=null and collectionStandard != ''">
            and t.collection_standard= #{collectionStandard}
        </if>
        <if test="arrearsUnpaid !=null and arrearsUnpaid != ''">
            and t.arrears_unpaid= #{arrearsUnpaid}
        </if>
        <if test="latePaymentFine !=null and latePaymentFine != ''">
            and t.late_payment_fine= #{latePaymentFine}
        </if>
        <if test="latePaymentSurcharge !=null and latePaymentSurcharge != ''">
            and t.late_payment_surcharge= #{latePaymentSurcharge}
        </if>
        <if test="feePaymentStatus !=null and feePaymentStatus != ''">
            and t.fee_payment_status= #{feePaymentStatus}
        </if>
        <if test="carryOverBalance !=null and carryOverBalance != ''">
            and t.carry_over_balance= #{carryOverBalance}
        </if>
        <if test="totalPayableAmount !=null and totalPayableAmount != ''">
            and t.total_payable_amount= #{totalPayableAmount}
        </if>
    </select>
     </select>
    <!-- 批量插入费用 -->
    <insert id="insertMeterWaters" parameterType="Map">
        insert into meter_water
        (remark,status_cd,cur_reading_time,water_id,cur_degrees,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,
        community_id,obj_type,fee_id,obj_name,price,
        power_supply_bureau,household_name,household_number,electric_meter_id,`handler`,is_transferred,
        company_name_after_transfer,transfer_date,corresponding_household_count,last_payment_date,reading_type,
        multiplying_factor,unit_price,invoice_amount,amount_difference,auto_deduction,remark2,
        address,write_time,writer,
        check_apply_company_name,check_apply_dept_project,water_fee_payer,account_number,meter_read_book_no,
        water_consumption,sewage_treatment_water,collection_standard,arrears_unpaid,late_payment_fine,
        late_payment_surcharge,fee_payment_status,carry_over_balance,total_payable_amount)
        VALUES
        <foreach collection="meterWaterPos" item="item" separator=",">
            (#{item.remark},'0',#{item.curReadingTime},#{item.waterId},#{item.curDegrees},#{item.meterType},#{item.preDegrees},
            #{item.objId},#{item.preReadingTime},'-1',#{item.communityId},#{item.objType},#{item.feeId},#{item.objName},#{item.price},
            #{item.powerSupplyBureau},#{item.householdName},#{item.householdNumber},#{item.electricMeterId},#{item.handler},#{item.isTransferred},
            #{item.companyNameAfterTransfer},#{item.transferDate},#{item.correspondingHouseholdCount},#{item.lastPaymentDate},#{item.readingType},
            #{item.multiplyingFactor},#{item.unitPrice},#{item.invoiceAmount},#{item.amountDifference},#{item.autoDeduction},#{item.remark2},
            #{item.address},#{item.writeTime},#{item.writer},
            #{item.checkApplyCompanyName},#{item.checkApplyDeptProject},#{item.waterFeePayer},#{item.accountNumber},#{item.meterReadBookNo},
            #{item.waterConsumption},#{item.sewageTreatmentWater},#{item.collectionStandard},#{item.arrearsUnpaid},#{item.latePaymentFine},
            #{item.latePaymentSurcharge},#{item.feePaymentStatus},#{item.carryOverBalance},#{item.totalPayableAmount})
        </foreach>
    </insert>
</mapper>
</mapper>