123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?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.PayPayAgentbranchMapper">
- <insert id="insert" useGeneratedKeys="true" keyProperty="id">
- insert into pay_pay_agentbranch(
- code,
- name,
- type,
- appid,
- appsecret,
- mchid,
- paykey,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- site_id,
- customer_id
- )
- values
- (
- #{payPayAgentbranch.code,jdbcType=VARCHAR},
- #{payPayAgentbranch.name,jdbcType=VARCHAR},
- #{payPayAgentbranch.type,jdbcType=INTEGER},
- #{payPayAgentbranch.appid,jdbcType=VARCHAR},
- #{payPayAgentbranch.appsecret,jdbcType=VARCHAR},
- #{payPayAgentbranch.mchid,jdbcType=VARCHAR},
- #{payPayAgentbranch.paykey,jdbcType=VARCHAR},
- #{payPayAgentbranch.createBy,jdbcType=BIGINT},
- #{payPayAgentbranch.createDate,jdbcType=TIMESTAMP},
- #{payPayAgentbranch.updateBy,jdbcType=BIGINT},
- #{payPayAgentbranch.updateDate,jdbcType=TIMESTAMP},
- #{payPayAgentbranch.remarks,jdbcType=VARCHAR},
- #{payPayAgentbranch.delFlag,jdbcType=VARCHAR},
- #{payPayAgentbranch.siteId,jdbcType=BIGINT},
- #{payPayAgentbranch.customerId,jdbcType=BIGINT}
- )
- </insert>
- <update id="update">
- update pay_pay_agentbranch
- <set>
- <if test="payPayAgentbranch.code != null"> code = #{payPayAgentbranch.code,jdbcType=VARCHAR},</if>
- <if test="payPayAgentbranch.name != null"> name = #{payPayAgentbranch.name,jdbcType=VARCHAR},</if>
- <if test="payPayAgentbranch.type != null"> type = #{payPayAgentbranch.type,jdbcType=INTEGER},</if>
- <if test="payPayAgentbranch.appid != null"> appid = #{payPayAgentbranch.appid,jdbcType=VARCHAR},</if>
- <if test="payPayAgentbranch.appsecret != null"> appsecret = #{payPayAgentbranch.appsecret,jdbcType=VARCHAR},</if>
- <if test="payPayAgentbranch.mchid != null"> mchid = #{payPayAgentbranch.mchid,jdbcType=VARCHAR},</if>
- <if test="payPayAgentbranch.paykey != null"> paykey = #{payPayAgentbranch.paykey,jdbcType=VARCHAR},</if>
- <if test="payPayAgentbranch.remarks != null"> remarks = #{payPayAgentbranch.remarks,jdbcType = VARCHAR},</if>
- <if test="payPayAgentbranch.updateBy != null"> update_by = #{payPayAgentbranch.updateBy,jdbcType = BIGINT},</if>
- <if test="payPayAgentbranch.updateDate != null"> update_date = #{payPayAgentbranch.updateDate,jdbcType=TIMESTAMP}</if>
- </set>
- where
- id=#{payPayAgentbranch.id,jdbcType=BIGINT}
- </update>
- <delete id="delete">
- delete from pay_pay_agentbranch
- where id=#{id,jdbcType=BIGINT}
- </delete>
- <select id="findList" resultType="com.bz.smart_city.entity.pay.PayPayAgentbranch">
- select
- ppa.id,
- ppa.type,
- ppa.code,
- ppa.mchid,
- ppa.paykey,
- ppa.appid,
- ppa.appsecret,
- ppa.name,
- ppa.create_by,
- ppa.create_date,
- ppa.update_by,
- ppa.update_date,
- ppa.remarks
- from pay_pay_agentbranch ppa
- where ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
- </select>
- <select id="getAll" resultType="com.bz.smart_city.dto.pay.PayPayAgentbranchSelectDto">
- select
- pa1.id,
- pa1.type,
- pa1.`code`,
- pa1.name,
- pa1.mchid,
- pa1.paykey paykey,
- pa1.appid,
- scu.`name` as updateName,
- pa1.update_date as updateDate,
- psd.label as agentbranchType,
- pa2.number as transactionsNumber,
- IFNULL(pa2.sumAmount,0) as transactionsMoney
- from pay_pay_agentbranch pa1
- left join sc_user scu on pa1.update_by=scu.id
- left join pay_sys_dict psd on pa1.type = psd.value and psd.type='机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
- left join (
- select count(1) number,sum(trans_fee) sumAmount,machid
- from pay_pay_checkbalance
- <where>
- state != 0 and state != 4
- <if test ="startTime != null"> and transtime >= #{startTime,jdbcType=TIMESTAMP}</if>
- <if test="siteId != null"> and site_id=#{siteId}</if>
- <if test="customerId != null"> and customer_id=#{customerId}</if>
- </where>
- group by machid) pa2
- on pa1.mchid = pa2.machid
- <where>
- <if test="questParams != null"> (pa1.code like concat('%',#{questParams,jdbcType=VARCHAR} ,'%') or pa1.name like concat('%',#{questParams,jdbcType=VARCHAR} ,'%'))</if>
- <if test="siteId != null"> and pa1.site_id=#{siteId}</if>
- <if test="customerId != null"> and pa1.customer_id=#{customerId}</if>
- </where>
- order by pa1.create_date desc
- </select>
- <select id="ExitsData" resultType="java.lang.Long">
- select id from pay_pay_agentbranch
- where site_id =#{siteId} and customer_id =#{customerId}
- and ( code=#{code} or name=#{name} or mchid=#{mchid} or appid=#{appid})
- <if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
- </select>
- </mapper>
|