<?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.ruoyi.account.mapper.BalanceChangeRecordMapper">
|
|
<select id="pageList" resultType="com.ruoyi.account.api.model.BalanceChangeRecord">
|
select t1.*,t2.name as userName,t2.phone as userPhone
|
from t_balance_change_record t1
|
left join t_app_user t2 on t1.app_user_id = t2.id
|
<where>
|
<if test="agentQuery.userName != null and agentQuery.userName != ''">
|
and t2.name like concat('%',#{agentQuery.userName},'%')
|
</if>
|
<if test="agentQuery.userPhone != null and agentQuery.userPhone != ''">
|
and t2.phone like concat('%',#{agentQuery.userPhone},'%')
|
</if>
|
<if test="agentQuery.changeType != null">
|
and t1.change_type = #{agentQuery.changeType}
|
</if>
|
<if test="agentQuery.localDate1 != null">
|
and DATE(t1.create_time) between #{agentQuery.localDate1} and #{agentQuery.localDate2}
|
</if>
|
</where>
|
order by t1.create_time desc
|
</select>
|
|
<sql id="balanceChangeRecordList">
|
SELECT
|
tau.`name` userName,
|
tau.phone userPhone,
|
tbcr.change_type,
|
tbcr.create_time,
|
tbcr.change_amount,
|
tbcr.before_amount,
|
tbcr.after_amount
|
FROM
|
t_balance_change_record tbcr
|
LEFT JOIN t_app_user tau ON tbcr.app_user_id = tau.id
|
<where>
|
and tbcr.change_type = 4
|
<if test="changeRecord.userName != null and changeRecord.userName != ''">
|
and tau.name like concat('%',#{changeRecord.userName},'%')
|
</if>
|
<if test="changeRecord.userPhone != null and changeRecord.userPhone != ''">
|
and tau.phone like concat('%',#{changeRecord.userPhone},'%')
|
</if>
|
<if test="changeRecord.startTime != null and changeRecord.endTime != null">
|
and (tbcr.create_time between #{changeRecord.startTime} and #{changeRecord.endTime})
|
</if>
|
<if test="changeRecord.changeType != null">
|
and tbcr.change_type = #{changeRecord.changeType}
|
</if>
|
</where>
|
</sql>
|
|
<select id="selectBalanceChangeRecordList" resultType="com.ruoyi.account.api.model.BalanceChangeRecord">
|
<include refid="balanceChangeRecordList"/>
|
</select>
|
<select id="queryCommissionStatistics" resultType="com.ruoyi.account.api.model.BalanceChangeRecord">
|
<include refid="balanceChangeRecordList"/>
|
</select>
|
</mapper>
|