123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <?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.PayRechargeaccountMapper">
- <sql id="mainColumnInfo">
- a.id ,
- a.account_id as "accountId",
- a.businessstate as "businessstate",
- a.accountnumber as "accountnumber",
- a.remaining as "remaining",
- 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",
- a.office_id as "officeId",
- a.balance as "balance",
- a.estimatedDate as "estimatedDate"
- </sql>
- <select id="findList" resultType="com.bz.smart_city.dto.pay.PayRechargeaccountDto">
- select
- <include refid="mainColumnInfo"/>
- ,cust.accountname as "accountname"
- from pay_pay_rechargeaccount a
- left join pay_base_customerandmeterrela cust on a.account_id=cust.account_id
- <where>
- cust.businessstate = 1
- <if test="accountnumber != null and accountnumber != ''">
- and (cust.accountnumber like concat('%',#{accountnumber},'%')
- or cust.accountname like concat('%',#{accountnumber},'%'))
- </if>
- <if test="siteId != null">
- and a.site_id=#{siteId}
- </if>
- <if test="customerId != null">
- and a.customer_id=#{customerId}
- </if>
- <if test="accountId != null">
- and a.account_id =#{accountId}
- </if>
- <if test="programItems != null and programItems.size() != 0">
- and <foreach collection="programItems" item="item" open="(" separator=" or " close=")">
- <if test="item.dimensionId == 10">
- cust.${item.dimensionCode} = #{item.dimensionValue}
- </if>
- </foreach>
- </if>
- </where>
- order by a.create_date desc
- </select>
- <select id="findById" resultType="com.bz.smart_city.dto.pay.PayRechargeaccountDto">
- select
- <include refid="mainColumnInfo"/>
- from pay_pay_rechargeaccount a
- <where>
- <if test="id != null">
- and id=#{id}
- </if>
- <if test="accountId != null">
- and account_id=#{accountId}
- </if>
- </where>
- </select>
- <select id="findByAccountInfo" resultType="com.bz.smart_city.dto.pay.PayRechargeaccountDto">
- select
- <include refid="mainColumnInfo"/>
- from pay_pay_rechargeaccount a
- <where>
- <if test="siteId != null">
- and a.site_id=#{siteId}
- </if>
- <if test="customerId != null">
- and a.customer_id=#{customerId}
- </if>
- <if test="accountId != null">
- and a.account_id=#{accountId}
- </if>
- <if test="accountnumber != null">
- and a.accountnumber=#{accountnumber}
- </if>
- </where>
- </select>
- <insert id="insert" parameterType="com.bz.smart_city.dto.pay.PayRechargeaccountDto" >
- insert INTO
- pay_pay_rechargeaccount
- (
- account_id,
- businessstate,
- accountnumber,
- accountname,
- remaining,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- site_id,
- customer_id,
- office_id
- )
- values(
- #{accountId},
- #{businessstate},
- #{accountnumber},
- #{accountname},
- #{remaining},
- #{createBy},
- #{createDate},
- #{updateBy},
- #{updateDate},
- #{remarks},
- #{delFlag},
- #{siteId},
- #{customerId},
- #{officeId}
- )
- </insert>
- <select id="update" parameterType="com.bz.smart_city.dto.pay.PayRechargeaccountDto">
- update pay_pay_rechargeaccount
- <set>
- <if test="accountId != null ">
- account_id = #{accountId},
- </if>
- <if test="businessstate != null ">
- businessstate = #{businessstate},
- </if>
- <if test="accountnumber != null and accountnumber!='' ">
- accountnumber = #{accountnumber},
- </if>
- <if test="accountname != null and accountname!='' ">
- accountname = #{accountname},
- </if>
- <if test="remaining != null ">
- remaining = #{remaining},
- </if>
- <if test="updateDate != null ">
- update_date = #{updateDate},
- </if>
- <if test="updateBy != null ">
- update_by = #{updateBy},
- </if>
- <if test="customerId != null">
- customer_id = #{customerId},
- </if>
- <if test="siteId != null ">
- site_id = #{siteId},
- </if>
- <if test="officeId != null ">
- office_id = #{officeId}
- </if>
- </set>
- <where>
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="accountId != null">
- and account_id =#{accountId}
- </if>
- </where>
- </select>
- <delete id="delete" >
- delete from pay_pay_rechargeaccount
- where account_id= #{accountId}
- </delete>
- <delete id="batchDelete" >
- delete from pay_pay_rechargeaccount
- where account_id in
- <foreach collection="accountIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
- <!--@mbg.generated-->
- insert INTO
- pay_pay_rechargeaccount
- (id,
- account_id,
- businessstate,
- accountnumber,
- accountname,
- remaining,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- site_id,
- customer_id,
- office_id
- )
- values
- <foreach collection="list" item="item" separator=",">
- (
- #{item.id},
- #{item.accountId},
- #{item.businessstate},
- #{item.accountnumber},
- #{item.accountname},
- #{item.remaining},
- #{item.createBy},
- #{item.createDate},
- #{item.updateBy},
- #{item.updateDate},
- #{item.remarks},
- #{item.delFlag},
- #{item.siteId},
- #{item.customerId},
- #{item.officeId})
- </foreach>
- </insert>
- <update id="updateBalance">
- update pay_pay_rechargeaccount set balance=#{balance},estimatedDate =#{readdate} where id =#{id}
- </update>
- <select id="getEstimateBalance" resultType="com.bz.smart_city.dto.pay.PayRechargeaccountDto">
- select
- <include refid="mainColumnInfo"/>
- from pay_pay_rechargeaccount a
- <where>
- balance < 0
- <if test="siteId != null">
- and a.site_id =#{siteId}
- </if>
- <if test="customerId != null">
- and a.customer_id =#{customerId}
- </if>
- </where>
- </select>
- </mapper>
|