123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?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.PayControlRuleMapper">
- <insert id="add" useGeneratedKeys="true" keyColumn="id">
- insert into
- pay_control_rule(
- name,
- `condition`,
- condition_id,
- operator,
- value,
- action,
- unit,
- disable,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- site_id,
- customer_id
- )
- values (
- #{payControlRule.name,jdbcType=VARCHAR},
- #{payControlRule.condition,jdbcType=VARCHAR},
- #{payControlRule.conditionId,jdbcType=INTEGER},
- #{payControlRule.operator,jdbcType=VARCHAR},
- #{payControlRule.value,jdbcType=VARCHAR},
- #{payControlRule.action,jdbcType=VARCHAR},
- #{payControlRule.unit,jdbcType=VARCHAR},
- #{payControlRule.disable,jdbcType=VARCHAR},
- #{payControlRule.createBy,jdbcType=BIGINT},
- #{payControlRule.createDate,jdbcType=TIMESTAMP},
- #{payControlRule.updateBy,jdbcType=BIGINT},
- #{payControlRule.updateDate,jdbcType=TIMESTAMP},
- #{payControlRule.remarks,jdbcType=VARCHAR},
- #{payControlRule.delFlag,jdbcType=VARCHAR},
- #{payControlRule.siteId,jdbcType=BIGINT},
- #{payControlRule.customerId,jdbcType=BIGINT}
- )
- </insert>
- <select id="findList" resultType="com.bz.smart_city.entity.pay.PayControlRule">
- select
- id,
- name,
- `condition`,
- condition_id,
- operator,
- value,
- action,
- unit,
- disable,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- site_id,
- customer_id
- from pay_control_rule
- <where>
- del_flag = 0
- <if test="customerId != null"> and customer_id = #{customerId} </if>
- <if test="id != null"> and id = #{id}</if>
- <if test="name != null"> and name = #{name}</if>
- </where>
- </select>
- <select id="ExitsData" resultType="com.bz.smart_city.entity.pay.PayControlRule">
- select
- id,
- name,
- `condition`,
- operator,
- value,
- action,
- unit,
- disable,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- site_id,
- customer_id
- from pay_control_rule
- <where>
- del_flag = 0 and customer_id = #{customerId}
- <if test="id != null"> and id = #{id}</if>
- <if test="name != null"> and name = #{name}</if>
- </where>
- </select>
- <delete id="delete">
- update pay_control_rule set del_flag = 1 where id = #{id,jdbcType=INTEGER}
- </delete>
- <update id="edit">
- update pay_control_rule pcr
- set
- <if test="payControlRule.name != null and payControlRule.name != ''"> name = #{payControlRule.name},</if>
- <if test="payControlRule.condition != null and payControlRule.condition != ''"> pcr.condition = #{payControlRule.condition},</if>
- <if test="payControlRule.value != null and payControlRule.value != ''"> value = #{payControlRule.value},</if>
- <if test="payControlRule.operator != null and payControlRule.operator != ''"> operator = #{payControlRule.operator},</if>
- <if test="payControlRule.action != null and payControlRule.action != ''"> action = #{payControlRule.action},</if>
- <if test="payControlRule.unit != null"> unit = #{payControlRule.unit},</if>
- <if test="payControlRule.disable != null"> disable = {payControlRule.disable},</if>
- <if test="payControlRule.updateBy != null"> update_by = #{payControlRule.updateBy},</if>
- <if test="payControlRule.updateDate != null"> update_date = #{payControlRule.updateDate},</if>
- <if test="payControlRule.remarks != null"> remarks = #{payControlRule.remarks},</if>
- <if test="payControlRule.delFlag != null"> del_flag = #{payControlRule.delFlag}</if>
- where id = #{payControlRule.id}
- </update>
- <select id="findDebtMoney" resultType="Decimal">
- select
- sum( CASE WHEN rece.debt IS NULL THEN 0 ELSE rece.debt END ) sumDebt
- from pay_pay_receivable rece
- where rece.debt > 0 and rece.account_id = #{accountId}
- </select>
- <select id="findDebtDay" resultType="integer">
- select
- to_days(now()) - to_days(create_date) days
- from pay_pay_receivable rece
- where rece.debt > 0 and rece.account_id = #{accountId}
- </select>
- <select id="findUseMoeny" resultType="decimal">
- select
- (
- SELECT remaining remaining from pay_pay_rechargeaccount
- where account_id=#{accountId})
- -
- (select IFNULL(SUM(debt),0) debt from pay_pay_receivable where
- account_id=#{accountId} and debt > 0 )
- as remaining
- </select>
- <select id="findOpenUse" resultType="integer">
- select
- scd.curr_status state
- from sc_device scd
- where scd.account_id = #{accountId}
- </select>
- </mapper>
|