123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676 |
- <?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.bz.smart_city.dao.pay.archives.PayBaseCustomerandmeterrelaMapper">
- <sql id="sqlColumns">
- </sql>
- <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- <!--@mbg.generated-->
- <id column="id" property="id" />
- <id column="metercode" property="metercode"/>
- <result column="remarks" property="remarks" />
- <result column="create_by" property="createBy" />
- <result column="update_by" property="updateBy" />
- <result column="customer_id" property="customerId" />
- </resultMap>
- <sql id="sqlJoins">
- </sql>
- <select id="queryDevice" resultMap="BaseResultMap" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- select id as "id",water_meter_no as "metercode" from sc_device LIMIT 1
- </select>
- <select id="findList" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- select
- customer.id as "id",
- customer.watermeter_id as "watermeterId",
- account.id as "accountId",
- account.accountnumber as "accountnumber",
- customer.office_id as "officeId",
- account.name as "name",
- account.telephone as "telephone",
- customer.metercode as "metercode",
- pro.name as "propertyName",
- account.address as "address",
- customer.opendate as "opendate",
- customer.businessstate as "businessstate",
- customer.calculateway as "calculateway",
- pro.id as "waterPropertyId"
- from pay_base_customerandmeterrela customer
- left join pay_base_account account on customer.account_id = account.id
- left join pay_base_waterproperty pro on pro.id = customer.waterproperty_id
- <where>
- <if test="id != null">
- and customer.id =#{id}
- </if>
- <if test="metercode != null">
- and customer.metercode =#{metercode}
- </if>
- <if test="siteId != null">
- and customer.site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and customer.customer_id = #{customerId}
- </if>
- order by customer.create_date desc
- </where>
- </select>
- <select id="getAccountId" resultType="com.bz.smart_city.entity.pay.PayBaseAccount">
- select
- id as "id"
- from pay_base_account
- <where>
- <if test="siteId != null">
- and site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and customer_id = #{customerId}
- </if>
- <if test="accountnumber">
- and accountnumber =#{accountnumber}
- </if>
- order by create_date desc
- </where>
- </select>
- <select id="getDeviceId" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela" >
- select
- id as "id"
- from sc_device
- <where>
- <!--<if test="siteId != null">
- and site_id = #{siteId}
- </if>-->
- <if test="customerId != null">
- and customer_id = #{customerId}
- </if>
- <if test="metercode != null">
- and metercode =#{metercode}
- </if>
- </where>
- limit 1
- </select>
- <select id="getWaterPropertyId" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- select id as "waterPropertyId"
- from pay_base_waterproperty
- <where>
- <if test="siteId != null">
- and site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and customer_id = #{customerId}
- </if>
- <if test="name != null">
- and name =#{name}
- </if>
- order by create_date desc
- </where>
- </select>
- <insert id="insertList">
- INSERT INTO pay_base_customerandmeterrela
- (
- id,
- account_id,
- watermeter_id,
- accountname,
- accountnumber,
- metercode,
- businessstate,
- office_id,
- housetype,
- calculateway,
- customercategory,
- customergroup,
- fixedamount,
- vatno,
- bankaccount,
- invoicetitle,
- address,
- opendate,
- waterproperty_id,
- watertype,
- canceldate,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- site_id,
- customer_id
- )
- values
- <foreach collection="customers" item="customer" index="index" separator=",">
- (
- #{customer.id,jdbcType=BIGINT},
- #{customer.accountId,jdbcType=BIGINT},
- #{customer.watermeterId,jdbcType=BIGINT},
- #{customer.accountname,jdbcType=VARCHAR},
- #{customer.accountnumber,jdbcType=VARCHAR},
- #{customer.metercode,jdbcType=VARCHAR},
- #{customer.businessstate,jdbcType=INTEGER},
- #{customer.officeId,jdbcType=BIGINT},
- #{customer.housetype,jdbcType=INTEGER},
- #{customer.calculateway,jdbcType=INTEGER},
- #{customer.customercategory,jdbcType=INTEGER},
- #{customer.customergroup,jdbcType=INTEGER},
- #{customer.fixedamount,jdbcType=VARCHAR},
- #{customer.vatno,jdbcType=VARCHAR},
- #{customer.bankaccount,jdbcType=VARCHAR},
- #{customer.invoicetitle,jdbcType=VARCHAR},
- #{customer.address,jdbcType=VARCHAR},
- #{customer.opendate,jdbcType=TIMESTAMP},
- #{customer.waterPropertyId,jdbcType=BIGINT},
- #{customer.watertype,jdbcType=INTEGER},
- #{customer.canceldate,jdbcType=TIMESTAMP},
- #{customer.createBy,jdbcType=VARCHAR},
- #{customer.createDate,jdbcType=TIMESTAMP},
- #{customer.updateBy,jdbcType=VARCHAR},
- #{customer.updateDate,jdbcType=TIMESTAMP},
- #{customer.remarks,jdbcType=VARCHAR},
- #{customer.delFlag,jdbcType=VARCHAR},
- #{customer.siteId,jdbcType=BIGINT},
- #{customer.customerId,jdbcType=BIGINT}
- )
- </foreach>
- </insert>
- <update id="update">
- update pay_base_customerandmeterrela
- <set>
- <if test="accountId != null">account_id =#{accountId},</if>
- <if test="watermeterId != null">watermeter_id =#{watermeterId},</if>
- <if test="accountname != null">accountname =#{accountname},</if>
- <if test="accountnumber != null">accountnumber =#{accountnumber},</if>
- <if test="metercode != null">metercode =#{metercode},</if>
- <if test="businessstate != null">businessstate =#{businessstate},</if>
- <if test="officeId != null">office_id =#{officeId},</if>
- <if test="housetype != null">housetype =#{housetype},</if>
- <if test="calculateway != null">calculateway =#{calculateway},</if>
- <if test="customercategory != null">customercategory =#{customercategory},</if>
- <if test="customergroup != null">customergroup =#{customergroup},</if>
- <if test="fixedamount != null">fixedamount =#{fixedamount},</if>
- <if test="vatno != null">vatno =#{vatno},</if>
- <if test="bankaccount != null">bankaccount =#{bankaccount},</if>
- <if test="address != null">address =#{address},</if>
- <if test="opendate != null">opendate =#{opendate},</if>
- <if test="waterPropertyId != null">waterproperty_id =#{waterPropertyId},</if>
- <if test="watertype != null">watertype =#{watertype},</if>
- <if test="canceldate != null">canceldate =#{canceldate},</if>
- <if test="updateBy != null">update_by =#{updateBy},</if>
- <if test="updateDate != null">update_date =#{updateDate},</if>
- </set>
- <where>
- <if test="id != null">id =#{id}</if>
- </where>
- </update>
- <select id="meterAllDebt" resultType="java.lang.Double">
- select ifnull(sum(debt),0) debt from pay_pay_receivable r where r.meter_id=#{meterid}
- </select>
- <select id="findByAccount" resultType="com.bz.smart_city.entity.pay.PayPayRechargeaccount">
- select
- rech.*
- from pay_pay_rechargeaccount rech
- <where>
- <if test="accountId != null">
- and rech.account_id =#{accountId}
- </if>
- order by rech.create_date desc
- </where>
- </select>
- <update id="updateCustomerState">
- update pay_base_customerandmeterrela set businessstate =#{state},update_by=#{updateBy},update_date =#{date},canceldate =#{date}
- where site_id =#{siteId} and customer_id =#{customerId} and id =#{id}
- </update>
- <update id="updateDeviceState">
- update sc_device set status =#{state},update_by=#{updateBy},date_update =#{date}
- where site_id =#{siteId} and customer_id =#{customerId} and metercode =#{metercode}
- </update>
- <select id="getAll" resultType="com.bz.smart_city.dto.pay.PayCustomerDto">
- select
- customer.fixedamount as "fixedamount",
- customer.id as "id",
- account.accountnumber as "accountnumber",
- account.name as "accountname",
- account.telephone as "telephone",
- customer.metercode as "metercode",
- device.water_meter_no as "metereleno",
- property.id as "waterPropertyId",
- property.name as "waterPropertyName",
- account.address as "address",
- customer.opendate as "opendate",
- customer.office_id as "officeId",
- account.email,
- customer.vatno,
- customer.businessstate as "businessstate",
- (select label from pay_sys_dict where type = '开户状态' and value = customer.businessstate and site_id = #{siteId} and customer_id =#{customerId}) as "businessName",
- customer.calculateway as "calculateway",
- (select label from pay_sys_dict where type = '结算方式' and value = customer.calculateway and site_id = #{siteId} and customer_id =#{customerId}) as "calculatewayName",
- account.idtype as "idtype",
- (select label from pay_sys_dict where type = '证件类型' and value = account.idtype and site_id = #{siteId} and customer_id =#{customerId}) as "idtypeName",
- account.idcardno as "idcardno",
- customer.housetype as "housetype",
- (select label from pay_sys_dict where type = '住房类型' and value = customer.housetype and site_id = #{siteId} and customer_id =#{customerId}) as "housetypeName",
- customer.customergroup as "customergroup",
- (select label from pay_sys_dict where type = '开户分组' and value = customer.customergroup and site_id = #{siteId} and customer_id =#{customerId}) as "customergroupName"
- from pay_base_customerandmeterrela customer
- left join sc_device device on customer.watermeter_id = device.id
- left join pay_base_account account on account.id = customer.account_id
- left join pay_base_waterproperty property on property.id = customer.waterproperty_id
- <where>
- <if test="siteId != null">
- and customer.site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and customer.customer_id = #{customerId}
- </if>
- <if test="condition != null">
- and
- (
- account.accountnumber like concat('%',#{condition},'%')
- or account.name like concat('%',#{condition},'%')
- or customer.metercode like concat('%',#{condition},'%')
- or account.address like concat('%',#{condition},'%')
- or account.telephone like concat('%',#{condition},'%')
- or device.water_meter_no like concat('%',#{condition},'%')
- )
- </if>
- <if test="waterPropertyId != null">
- and property.id =#{waterPropertyId}
- </if>
- <if test="businessstate != null">
- and customer.businessstate =#{businessstate}
- </if>
- <if test="calculateway != null">
- and customer.calculateway =#{calculateway}
- </if>
- <if test="programItems != null and programItems.size() != 0">
- and <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
- <if test="item.dimensionId == 10">
- customer.office_id = #{item.dimensionValue}
- </if>
- </foreach>
- </if>
- order by customer.create_date desc
- </where>
- </select>
- <select id="getList" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- select
- account.accountnumber as "accountnumber",
- account.name as "accountname",
- account.telephone as "telephone",
- customer.metercode as "metercode",
- property.name as "propertyName",
- device.loc_desc as "address",
- customer.opendate as "opendate",
- customer.businessstate as "businessstate",
- customer.calculateway as "calculateway",
- device.water_meter_no as "metereleno"
- from pay_base_customerandmeterrela customer
- left join pay_base_account account on account.id = customer.account_id
- left join pay_base_waterproperty property on property.id = customer.waterproperty_id
- inner join sc_device device on device.metercode = customer.metercode
- <where>
- <if test="siteId != null">
- and customer.site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and customer.customer_id = #{customerId}
- </if>
- <if test="condition != null">
- and
- (
- account.accountnumber like concat('%',#{condition},'%')
- or account.name like concat('%',#{condition},'%')
- or customer.metercode like concat('%',#{condition},'%')
- or account.address like concat('%',#{condition},'%')
- or account.telephone like concat('%',#{condition},'%')
- or device.water_meter_no like concat('%',#{condition},'%')
- )
- </if>
- <if test="waterPropertyId != null">
- and property.id =#{waterPropertyId}
- </if>
- <if test="businessstate != null">
- and customer.businessstate =#{businessstate}
- </if>
- <if test="calculateway != null">
- and customer.calculateway =#{calculateway}
- </if>
- order by customer.create_date desc
- </where>
- </select>
- <select id="queryNoOpenAccount" resultType="com.bz.smart_city.entity.pay.archives.DeviceListInfo">
- select
- account.accountnumber as "accountnumber"
- from pay_base_account account
- <where>
- <if test="siteId != null">
- and account.site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and account.customer_id = #{customerId}
- </if>
- order by account.create_date desc
- </where>
- </select>
- <select id="selectAccountInfo" resultType="com.bz.smart_city.entity.pay.archives.MeterListInfo">
- select
- device.metercode as "metercode",
- sil.user_name as accountname,
- sil.user_phone as telephone,
- sil.id_card as idcardno
- from pay_base_account account
- inner join sc_device device on account.id = device.account_id
- inner join sc_install_list sil on sil.device_id = device.id
- <where>
- device.metercode not in(select metercode from pay_base_customerandmeterrela where businessstate = '1')
- <if test="accountnumber != null">
- and account.accountnumber =#{accountnumber}
- </if>
- <!-- <if test="siteId != null">
- and account.site_id = #{siteId}
- </if>-->
- <if test="customerId != null">
- and account.customer_id = #{customerId}
- </if>
- order by account.create_date desc
- </where>
- </select>
- <select id="selectAccountMeterInfo" resultType="com.bz.smart_city.entity.pay.archives.PayAccountInfo">
- select
- account.accountnumber as "accountnumber",
- account.calculateway as "calculateway",
- account.waterproperty_id as "waterPropertyId",
- account.address as installAddress,
- device.metercode as "metercode",
- sil.user_name as accountname,
- sil.user_phone as telephone,
- sil.id_card as idcardno,
- device.water_meter_no as "metereleno"
- from pay_base_account account
- inner join sc_device device on account.id = device.account_id
- inner join sc_install_list sil on sil.device_id = device.id
- <where>
- device.metercode not in(select metercode from pay_base_customerandmeterrela where businessstate = '1')
- <if test="metercode != null">
- and device.metercode like concat('%',#{metercode},'%')
- </if>
- <!--<if test="siteId != null">
- and account.site_id = #{siteId}
- </if>-->
- <if test="customerId != null">
- and account.customer_id = #{customerId}
- </if>
- order by account.create_date desc
- </where>
- </select>
- <select id="selectMeterElenoMeterInfo" resultType="com.bz.smart_city.entity.pay.archives.PayAccountInfo">
- select
- account.accountnumber as "accountnumber",
- account.calculateway as "calculateway",
- account.waterproperty_id as "waterPropertyId",
- account.address as installAddress,
- device.metercode as "metercode",
- sil.user_name as accountname,
- sil.user_phone as telephone,
- sil.id_card as idcardno,
- device.water_meter_no as "metereleno"
- from pay_base_account account
- inner join sc_device device on account.id = device.account_id
- inner join sc_install_list sil on sil.device_id = device.id
- <where>
- device.id not in(select watermeter_id from pay_base_customerandmeterrela where businessstate = '1')
- <if test="metereleno != null">
- and device.water_meter_no like concat('%',#{metereleno},'%')
- </if>
- <!--<if test="siteId != null">
- and account.site_id = #{siteId}
- </if>-->
- <if test="customerId != null">
- and account.customer_id = #{customerId}
- </if>
- order by account.create_date desc
- </where>
- </select>
- <select id="selectAccountWater" resultType="com.bz.smart_city.entity.pay.archives.CustomerListInfo">
- select
- accountnumber as "accountnumber",
- calculateway as "calculateway" ,
- account.address as installAddress,
- waterproperty_id as "waterPropertyId",
- device.water_meter_no as "metereleno"
- from pay_base_account account
- inner join sc_device device on account.id = device.account_id
- <where>
- and (account.accountnumber not in (select accountnumber from pay_base_customerandmeterrela where businessstate ='1' ))
- <if test="accountnumber != null">
- and account.accountnumber like concat('%',#{accountnumber},'%')
- </if>
- <if test="siteId != null">
- and account.site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and account.customer_id = #{customerId}
- </if>
- order by account.create_date desc
- </where>
- </select>
- <select id="queryMetercode" resultType="com.bz.smart_city.entity.pay.archives.MeterListInfo">
- select
- metercode from sc_device deivce
- <where>
- deivce.metercode not in (select metercode from pay_base_customerandmeterrela) and deivce.metercode is not null
- <!--<if test="siteId != null">
- and site_id = #{siteId}
- </if>-->
- <if test="customerId != null">
- and customer_id = #{customerId}
- </if>
- order by date_create desc
- </where>
- </select>
- <update id="updateAccountInfo">
- update pay_base_account set name=#{accountname},idtype =#{idtype},idcardno=#{idcardno},telephone=#{telephone},update_by=#{updateBy},update_date =#{date}
- where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber}
- </update>
- <update id="updateCustomerInfo">
- update pay_base_customerandmeterrela set accountname=#{accountname},housetype =#{housetype} ,office_id =#{officeId},customergroup =#{customergroup},update_by=#{updateBy},update_date =#{date}
- where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber} and metercode =#{metercode}
- </update>
- <update id="updateBaseAccountInfo">
- update pay_base_account set address =#{address} ,telephone =#{telephone},idtype =#{idtype},idcardno=#{idcardno}
- where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber};
- </update>
- <select id="queryWaterUserdStateCount" resultType="java.lang.Integer">
- select count(1) from pay_amount_waterusedamount t
- inner join pay_base_closingaccountinfo c on t.year = c.year and t.month = c.month
- where t.state = 1 and c.state = 0 and t.watermeter_id = #{id}
- </select>
- <select id="get" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- select
- a.id,
- a.account_id AS "accountId",
- a.watermeter_id AS "watermeterId",
- a.accountname,
- a.accountnumber,
- a.metercode,
- a.businessstate,
- a.office_id AS "officeId",
- a.housetype,
- a.calculateway,
- a.customercategory,
- a.customergroup,
- a.fixedamount,
- a.vatno,
- a.bankaccount,
- a.invoicetitle,
- a.address,
- a.opendate,
- a.waterproperty_id AS "waterpropertyId",
- a.watertype,
- a.canceldate,
- a.create_by AS "createBy",
- a.create_date AS "createDate",
- a.update_by AS "updateBy",
- a.update_date AS "updateDate",
- a.remarks AS "remarks",
- a.del_flag AS "delFlag",
- a.site_id as "siteId",
- a.customer_id as "customerId"
- from pay_base_customerandmeterrela a
- <where>
- a.id =#{id}
- </where>
- </select>
- <update id="updateMeterInstallOpen">
- update sc_install_list set is_accepted =#{isAccepted},date_update=#{date},update_by =#{updateBy} where device_id =#{id}
- </update>
- <select id="getOfficeId" resultType="com.bz.smart_city.entity.Organization">
- select id from sc_organization where site_id =#{siteId} and name =#{name}
- </select>
- <update id="updateRechargeAccountState">
- update pay_pay_rechargeaccount set businessstate ='2',update_by=#{updateBy},update_date =#{date}
- where site_id =#{siteId} and customer_id =#{customerId} and account_id =#{id}
- </update>
- <update id="updateAccountState">
- update pay_base_account set state =#{state},update_by=#{updateBy},update_date =#{date}
- where site_id =#{siteId} and customer_id =#{customerId} and id =#{id}
- </update>
- <select id="getResetLadderList" resultType="com.bz.smart_city.dto.pay.PayBaseCustomerandmeterrelaDto">
- SELECT
- a.waterproperty_id as waterpropertyId,
- a.account_id as accountId,
- pro.laddertype as laddertype
- FROM pay_base_customerandmeterrela a
- inner join pay_base_account ac on ac.id = a.account_id
- left join pay_base_waterproperty pro on pro.id = a.waterproperty_id
- WHERE (pro.laddertype=1 or pro.laddertype=2)
- and ac.resetaccumulatedtondate <= now()
- and a.businessstate=1
- and a.site_id = #{siteId}
- and a.customer_id = #{customerId}
- </select>
- <select id="queryCustomerInfo" resultType="java.lang.Integer">
- select
- count(1)
- from pay_base_customerandmeterrela
- where site_id =#{siteId} and customer_id =#{customerId} and accountnumber =#{accountnumber} and metercode =#{metercode}
- </select>
- <select id="queryCancelInfo" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- select
- a.id,
- a.account_id AS "accountId",
- a.watermeter_id AS "watermeterId",
- a.accountname,
- a.accountnumber,
- a.metercode,
- a.businessstate,
- a.office_id AS "officeId",
- a.housetype,
- a.calculateway,
- a.customercategory,
- a.customergroup,
- a.fixedamount,
- a.vatno,
- a.bankaccount,
- a.invoicetitle,
- a.address,
- a.opendate,
- a.waterproperty_id AS "waterpropertyId",
- a.watertype,
- a.canceldate,
- a.create_by AS "createBy",
- a.create_date AS "createDate",
- a.update_by AS "updateBy",
- a.update_date AS "updateDate",
- a.remarks AS "remarks",
- a.del_flag AS "delFlag",
- a.site_id as "siteId",
- a.customer_id as "customerId"
- from pay_base_customerandmeterrela a
- <where>
- <if test="siteId != null">
- and a.site_id =#{siteId}
- </if>
- <if test="customerId != null">
- and a.customer_id =#{customerId}
- </if>
- <if test="accountnumber != null">
- and a.accountnumber =#{accountnumber}
- </if>
- <if test="metercode != null">
- and a.metercode =#{metercode}
- </if>
- </where>
- </select>
- <select id="queryMeterState" resultType="java.lang.Integer">
- select is_accepted as "isAccepted" from sc_install_list where account_id =#{accountId} and customer_id =#{customerId}
- </select>
- <select id="getParentOfficeId" resultType="com.bz.smart_city.entity.Organization">
- select id from sc_organization where site_id =#{siteId} and parent_id =#{id} and name =#{name}
- </select>
- <select id="findAccountByAccountNumber" resultType="com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela">
- select
- account.id as "accountId",
- account.accountnumber as "accountnumber",
- account.name as "accountname",
- customer.invoicetitle as "invoicetitle",
- account.telephone as "telephone",
- account.address as "address",
- customer.vatno as "vatno",
- customer.bankaccount as "bankaccount",
- account.email as "email"
- from pay_base_customerandmeterrela customer
- left join pay_base_account account on customer.account_id = account.id
- <where>
- <if test="siteId != null">
- and customer.site_id = #{siteId}
- </if>
- <if test="customerId != null">
- and customer.customer_id = #{customerId}
- </if>
- <if test="accountnumber != null and accountnumber != ''">
- and customer.accountnumber = #{accountnumber}
- </if>
- </where>
- limit 1
- </select>
- </mapper>
|