2021-07-27 18:38:32 +08:00
<?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.xhpc.payment.mapper.XhpcUserAccountStatementMapper" >
<resultMap type= "com.xhpc.payment.domain.XhpcUserAccountStatement" id= "XhpcUserAccountStatementResult" >
<result column= "user_account_statement_id" property= "userAccountStatementId" />
<result column= "user_id" property= "userId" />
<result column= "amount" property= "amount" />
2021-07-28 17:36:39 +08:00
<result column= "remaining_sum" property= "remainingSum" />
2021-07-27 18:38:32 +08:00
<result column= "charge_order_id" property= "chargeOrderId" />
<result column= "recharge_order_id" property= "rechargeOrderId" />
<result column= "refund_order_id" property= "refundOrderId" />
2021-07-28 17:36:39 +08:00
<result column= "type" property= "type" />
2021-07-27 18:38:32 +08:00
<result column= "status" property= "status" />
<result column= "del_flag" property= "delFlag" />
<result column= "create_time" property= "createTime" />
<result column= "create_by" property= "createBy" />
<result column= "update_time" property= "updateTime" />
<result column= "update_by" property= "updateBy" />
<result column= "remark" property= "remark" />
</resultMap>
<insert id= "insert" parameterType= "com.xhpc.payment.domain.XhpcUserAccountStatement" useGeneratedKeys= "true"
keyProperty="userAccountStatementId">
INSERT INTO xhpc_user_account_statement
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "null != userId and '' != userId" >
user_id,
</if>
<if test= "null != amount and '' != amount" >
amount,
</if>
2021-07-28 17:36:39 +08:00
<if test= "null != remainingSum and '' != remainingSum" >
remaining_sum,
</if>
2021-07-27 18:38:32 +08:00
<if test= "null != chargeOrderId and '' != chargeOrderId" >
charge_order_id,
</if>
<if test= "null != rechargeOrderId and '' != rechargeOrderId" >
recharge_order_id,
</if>
<if test= "null != refundOrderId and '' != refundOrderId" >
refund_order_id,
</if>
2021-07-28 17:36:39 +08:00
<if test= "null != type and '' != type" >
type,
</if>
2021-07-27 18:38:32 +08:00
<if test= "null != status and '' != status" >
status,
</if>
<if test= "null != delFlag and '' != delFlag" >
del_flag,
</if>
<if test= "null != createTime" >
create_time,
</if>
<if test= "null != createBy and '' != createBy" >
create_by,
</if>
<if test= "null != updateTime" >
update_time,
</if>
<if test= "null != updateBy and '' != updateBy" >
update_by,
</if>
<if test= "null != remark and '' != remark" >
2021-12-24 18:14:26 +08:00
remark,
</if>
<if test= "null != source" >
2022-01-11 16:40:12 +08:00
source,
</if>
<if test= "null != tenantId and tenantId !=''" >
tenant_id
2021-07-27 18:38:32 +08:00
</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "null != userId and '' != userId" >
#{userId},
</if>
<if test= "null != amount and '' != amount" >
#{amount},
</if>
2021-07-28 17:36:39 +08:00
<if test= "null != remainingSum and '' != remainingSum" >
#{remainingSum},
</if>
2021-07-27 18:38:32 +08:00
<if test= "null != chargeOrderId and '' != chargeOrderId" >
#{chargeOrderId},
</if>
<if test= "null != rechargeOrderId and '' != rechargeOrderId" >
#{rechargeOrderId},
</if>
<if test= "null != refundOrderId and '' != refundOrderId" >
#{refundOrderId},
</if>
2021-07-28 17:36:39 +08:00
<if test= "null != type and '' != type" >
#{type},
</if>
2021-07-27 18:38:32 +08:00
<if test= "null != status and '' != status" >
#{status},
</if>
<if test= "null != delFlag and '' != delFlag" >
#{delFlag},
</if>
<if test= "null != createTime" >
#{createTime},
</if>
<if test= "null != createBy and '' != createBy" >
#{createBy},
</if>
<if test= "null != updateTime" >
#{updateTime},
</if>
<if test= "null != updateBy and '' != updateBy" >
#{updateBy},
</if>
<if test= "null != remark and '' != remark" >
2021-12-24 18:14:26 +08:00
#{remark},
</if>
<if test= "null != source" >
2022-01-11 16:40:12 +08:00
#{source},
</if>
<if test= "null != tenantId and tenantId !=''" >
#{tenantId},
2021-07-27 18:38:32 +08:00
</if>
</trim>
</insert>
2021-07-28 17:36:39 +08:00
<select id= "page" parameterType= "java.lang.Long" resultType= "java.util.Map" >
select xuas.user_account_statement_id userAccountStatementId,xuas.user_id appUserId,xau.phone ,
xuas.amount amount,xuas.remaining_sum remainingSum,xuas.create_time createTime,
xuas.type, sdd.dict_label typeName
from xhpc_user_account_statement xuas
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xuas.user_id
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'account_statement_type' and sdd.dict_value = xuas.type
WHERE xuas.del_flag = 0
<if test= "appUserId != null and appUserId != ''" >
and xau.app_user_id = #{appUserId}
2021-07-27 18:38:32 +08:00
</if>
2022-01-05 14:52:00 +08:00
<if test= "tenantId != null and tenantId != ''" >
and xau.tenant_id = #{tenantId}
</if>
<if test= "source!= null" >
and xau.source = #{source}
</if>
2021-07-28 17:36:39 +08:00
ORDER BY xuas.create_time DESC
</select>
<select id= "appUserInfo" parameterType= "java.lang.Long" resultType= "java.util.Map" >
select app_user_id appUserId, phone, weixin_open_id weixinOpenId,
2021-08-02 18:36:17 +08:00
weixin_login weixinlogin,alipay_login alipayLogin,is_refund_application isRefundApplication,
2021-07-28 17:36:39 +08:00
alipay_open_id alipayOpenId, avatar, balance, password,
`status`,create_by createBy ,create_time createTime,
update_time updateTime, update_by updateBy,
del_flag delflag, remark,
CASE WHEN `status` = 0 THEN '正常' else '禁用' end statusName
from xhpc_app_user
WHERE del_flag = 0 and app_user_id = #{appUserId}
2021-07-27 18:38:32 +08:00
</select>
2021-07-28 18:33:37 +08:00
<update id= "updateAppUserBalance" parameterType= "com.xhpc.payment.domain.XhpcAppUser" >
2021-07-28 17:36:39 +08:00
UPDATE xhpc_app_user
<set >
2021-08-20 16:46:46 +08:00
<if test= "null != balance" > balance = #{balance}</if>
2021-07-28 17:36:39 +08:00
</set>
WHERE app_user_id = #{appUserId}
</update>
2021-08-02 11:42:20 +08:00
2021-08-02 18:36:17 +08:00
<update id= "updateAppUserRefundApplication" parameterType= "com.xhpc.payment.domain.XhpcAppUser" >
UPDATE xhpc_app_user
<set >
<if test= "null != isRefundApplication" > is_refund_application = #{isRefundApplication},</if>
</set>
WHERE app_user_id = #{appUserId}
</update>
2021-08-02 11:42:20 +08:00
<select id= "list" parameterType= "java.lang.Long" resultType= "java.util.Map" >
select xuas.user_account_statement_id userAccountStatementId,xuas.user_id appUserId,xau.phone ,
xuas.amount amount,xuas.remaining_sum remainingSum,xuas.create_time createTime,
xuas.type, sdd.dict_label typeName
from xhpc_user_account_statement xuas
LEFT JOIN xhpc_app_user xau on xau.app_user_id = xuas.user_id
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = 'account_statement_type' and sdd.dict_value = xuas.type
WHERE xuas.del_flag = 0
<if test= "appUserId != null and appUserId != ''" >
and xau.app_user_id = #{appUserId}
</if>
2022-01-05 14:52:00 +08:00
<if test= "tenantId != null and tenantId != ''" >
2022-01-13 14:21:45 +08:00
and xuas.tenant_id = #{tenantId}
2022-01-05 14:52:00 +08:00
</if>
<if test= "source!= null" >
2022-01-13 14:21:45 +08:00
and xuas.source = #{source}
2022-01-05 14:52:00 +08:00
</if>
2021-08-02 11:42:20 +08:00
ORDER BY xuas.create_time DESC
</select>
2021-08-20 17:53:09 +08:00
<select id= "getUserHistotyChargeOrder" resultType= "String" >
select
serial_number as serialMumber
from xhpc_terminal
2022-01-09 21:04:08 +08:00
where terminal_id =(select terminal_id from xhpc_charge_order where user_id = #{userId} and source=#{source} and tenant_id=#{tenantId} and status=0 and del_flag =0 limit 1)
2021-08-20 17:53:09 +08:00
</select>
2021-07-27 18:38:32 +08:00
</mapper>