<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.tofly.fees.userprofilemgt.mapper.DaCustomerMapper"> <!--查询用户max用户编号 --> <select id="selectMaxCustomerNo" resultType="int"> select nvl(max(customer_no), 0) customer_no from tf_ywys_da_customer </select> <!--查询用户用户编号是否已存在 --> <select id="selectExistCustomerNo" resultType="int"> select nvl(count(*),0) count from tf_ywys_da_customer where customer_no=#{customer_no} </select> <!--查询当前财务日期YEAR_MONTH --> <select id="selectYearMonth" resultType="java.util.Map"> select bill_year_month as cwrq from tf_ywys_sys_gdcsb where gd_flag='0' </select> <!--查询当前财务日期YEAR_MONTH --> <select id="selectCardNo" resultType="java.util.Map"> select METER_CARD_NO,METER_CARD_ID from tf_ywys_da_meter where customer_no=#{customer_no} </select> <!-- select c.name mr_area ,d.name mr_boot,a.customer_no,a.customer_name,a.customer_address,a.customer_phone,a.created_datetime,a.created_oname,a.meternumber,a.customer_state, e.last_reading,e.this_reading from tf_ywys_da_customer a inner join tf_ywys_da_meter b on a.CUSTOMER_NO=b.CUSTOMER_NO left join tf_ywys_bm_mr_area c on a.mr_area=c.code left join tf_ywys_bm_mr_book d on a.mr_book=d.code left join tf_ywys_bw_meter_read_plan e on a.customer_no=e.customer_no --> <!--自定义用户档案查询page --> <!-- //用户编号、用户姓名、用户地址、联系电话 //片区、抄表本、水表型号、用水性质、用户状态、是否垃圾费、建档日期、抄表人员 --> <select id="selectDaCustomerPage" resultType="com.tofly.fees.userprofilemgt.entity.DaCustomerSelect"> select distinct a.customer_no customerNo,a.customer_no_old customerNoOld ,a.COMPANY_BRANCH companyBranch,a.MR_AREA mrArea,a.MR_BOOK mrBook, c.name mrAreaName ,d.name mrBookName, a.customer_name customerName,a.customer_address customerAddress,a.customer_phone customerPhone,a.apply_datetime applyDatetime,a.created_datetime createdDatetime,a.created_oname createdOname,nvl(a.meternumber,0) meterNumber ,a.customer_state customerState,a.CERT_TYPE certType,a.CERT_NO certNo, e.last_reading lastReading,e.this_reading thisReading,b.METER_CARD_ID meterCardId ,f.name priceName,g.name meterTypeName from tf_ywys_da_customer a inner join tf_ywys_da_meter b on a.CUSTOMER_NO=b.CUSTOMER_NO left join tf_ywys_bm_mr_area c on a.mr_area=c.code left join tf_ywys_bm_mr_book d on a.mr_book=d.code left join tf_ywys_bw_meter_read_plan e on a.customer_no=e.customer_no left join tf_ywys_bm_price f on b.price_code=f.code left join tf_ywys_bm_meter_type g on b.meter_type=g.code where 1=1 <!--模糊查询 --> <if test="searchText != null and searchText != ''"> and ( a.CUSTOMER_NO like '%${searchText}%' or a.CUSTOMER_NAME like '%${searchText}%' or a.CUSTOMER_ADDRESS like '%${searchText}%' or a.CUSTOMER_PHONE like '%${searchText}%' ) </if> <!--片区 --> <if test="mr_area !=null and mr_area!='' and mr_area!='all' "> and a.mr_area=#{mr_area} </if> <!--抄表本 --> <if test="mr_book !=null and mr_book!='' and mr_book!='all'"> and a.mr_book=#{mr_book} </if> <!--水表型号 --> <if test="meter_model !=null and meter_model!='' and meter_model!='all'"> and b.meter_model=#{meter_model} </if> <!--用水性质--> <if test="meter_model !=null and meter_model!='' and meter_model!='all'"> and b.price_code=#{price_code} </if> <!-- 用户状态--> <if test="customer_state!=null and customer_state!=''"> and a.customer_state=#{customer_state} </if> <!-- 是否垃圾费--> <if test="garbage_fee_flag!=null and garbage_fee_flag!=''"> and b.garbage_fee_flag=#{garbage_fee_flag} </if> <!--抄表人员> --> <if test="mr_ocode!=null and mr_ocode!='' and mr_ocode!='all' "> and d.mr_ocode=#{mr_ocode} </if> <!--建档日期--> <if test="start_created_datetime!=null and start_created_datetime!='' and end_created_datetime!=null and end_created_datetime!='' "> and a.CREATED_DATETIME between to_date(#{start_created_datetime},'yyyy-mm-dd hh24:mi:ss') and to_date(#{end_created_datetime},'yyyy-mm-dd hh24:mi:ss') </if> <!--公司 --> <if test="companyBranch!=null and companyBranch!='' and companyBranch!='all'"> and a.COMPANY_BRANCH=#{companyBranch} </if> </select> <select id="selDaCustomerAcc" resultType="java.util.HashMap"> select a.customer_no "customerNo",b.meter_type "meterType",nvl(c.nb_balance_amount,0) "nbBalanceAmount",nvl(c.balance_amount,0) "balanceAmount" from tf_ywys_da_customer a inner join tf_ywys_da_meter b on a.customer_no=b.customer_no left join tf_ywys_sf_cus_acc c on a.customer_no=c.customer_no where 1=1 <if test="customerNo!=''"> and a.customer_no=#{customerNo} </if> </select> <resultMap id="daCustomerMap" type="com.tofly.fees.userprofilemgt.entity.DaCustomer"> <id property="customerNo" column="CUSTOMER_NO"/> <result property="customerNoOld" column="CUSTOMER_NO_OLD"/> <result property="companyBranch" column="COMPANY_BRANCH"/> <result property="mrArea" column="MR_AREA"/> <result property="mrBook" column="MR_BOOK"/> <result property="applyDatetime" column="APPLY_DATETIME"/> <result property="customerName" column="CUSTOMER_NAME"/> <result property="customerNameShort" column="CUSTOMER_NAME_SHORT"/> <result property="customerAddress" column="CUSTOMER_ADDRESS"/> <result property="customerPhone" column="CUSTOMER_PHONE"/> <result property="population" column="POPULATION"/> <result property="sex" column="SEX"/> <result property="customerMobile" column="CUSTOMER_MOBILE"/> <result property="homePhone" column="HOME_PHONE"/> <result property="workUnit" column="WORK_UNIT"/> <result property="workTelephone" column="WORK_TELEPHONE"/> <result property="email" column="EMAIL"/> <result property="certType" column="CERT_TYPE"/> <result property="certNo" column="CERT_NO"/> <result property="relation" column="RELATION"/> <result property="customerState" column="CUSTOMER_STATE"/> <result property="activateState" column="ACTIVATE_STATE"/> <result property="activateDatetime" column="ACTIVATE_DATETIME"/> <result property="contractState" column="CONTRACT_STATE"/> <result property="contractDatetime" column="CONTRACT_DATETIME"/> <result property="contractNo" column="CONTRACT_NO"/> <result property="remark" column="REMARK"/> <result property="bzNo" column="BZ_NO"/> <result property="bzSerialNo" column="BZ_SERIAL_NO"/> <result property="createdDatetime" column="CREATED_DATETIME"/> <result property="createdOcode" column="CREATED_OCODE"/> <result property="createdOname" column="CREATED_ONAME"/> <result property="createdSerialNo" column="CREATED_SERIAL_NO"/> <result property="operatorCode" column="OPERATOR_CODE"/> <result property="operatorName" column="OPERATOR_NAME"/> <result property="operatorDatetime" column="OPERATOR_DATETIME"/> <result property="pCert" column="P_CERT"/> <result property="pContract" column="P_CONTRACT"/> <result property="pBusLicense" column="P_BUS_LICENSE"/> <result property="pPropeertyOwnershipCert" column="P_PROPEERTY_OWNERSHIP_CERT"/> <result property="pValidCert" column="P_VALID_CERT"/> <result property="creditRating" column="CREDIT_RATING"/> <result property="isPoorHouseholds" column="IS_POOR_HOUSEHOLDS"/> <result property="mrOname" column="MR_ONAME"/> <result property="regionCode" column="REGION_CODE"/> <result property="invoiceBankAccount" column="INVOICE_BANK_ACCOUNT"/> <result property="invoiceBankName" column="INVOICE_BANK_NAME"/> <result property="invoiceName" column="INVOICE_NAME"/> <result property="invoiceNsrsbh" column="INVOICE_NSRSBH"/> <result property="invoiceAddress" column="INVOICE_ADDRESS"/> <result property="invoicePhone" column="INVOICE_PHONE"/> <result property="invoiceRemark" column="INVOICE_REMARK"/> <result property="invoiceType" column="INVOICE_TYPE"/> <result property="payMode" column="PAY_MODE"/> <result property="yearCumQuantity" column="YEAR_CUM_QUANTITY"/> <result property="monthCumQuantity" column="MONTH_CUM_QUANTITY"/> <result property="customerType" column="CUSTOMER_TYPE"/> <result property="meterNumber" column="METERNUMBER"/> </resultMap> </mapper>