<?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.UserPointMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.account.api.model.UserPoint">
|
<id column="id" property="id" />
|
<result column="type" property="type" />
|
<result column="change_direction" property="changeDirection" />
|
<result column="variable_point" property="variablePoint" />
|
<result column="create_time" property="createTime" />
|
<result column="app_user_id" property="appUserId" />
|
<result column="object_id" property="objectId" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, type, historical_point, variable_point, create_time, app_user_id, object_id
|
</sql>
|
|
<sql id="userPointList">
|
SELECT
|
tau.`name` userName,
|
tau.phone,
|
tup.type,
|
tup.create_time,
|
tup.variable_point,
|
tup.change_direction
|
FROM
|
(select * from t_user_point union all select * from t_user_point_copy) tup
|
LEFT JOIN t_app_user tau ON tup.app_user_id = tau.id
|
<where>
|
tup.type not in (8, 9, 14) and tau.status != 3 and tau.del_flag = 0
|
<if test="userPoint.appUserId != null and userPoint.appUserId != ''">
|
AND tup.app_user_id = #{userPoint.appUserId}
|
</if>
|
<if test="userPoint.userName != null and userPoint.userName != ''">
|
AND tau.`name` LIKE concat('%',#{userPoint.userName},'%')
|
</if>
|
<if test="userPoint.phone != null and userPoint.phone != ''">
|
AND tau.phone LIKE concat('%',#{userPoint.phone},'%')
|
</if>
|
<if test="userPoint.type != null and userPoint.type != ''">
|
AND tup.type = #{userPoint.type}
|
</if>
|
<if test="userPoint.startTime != null and userPoint.endTime != null">
|
AND tup.create_time BETWEEN #{userPoint.startTime} AND #{userPoint.endTime}
|
</if>
|
</where>
|
order by tup.create_time desc
|
</sql>
|
|
<select id="queryUserPointPage" resultType="com.ruoyi.account.api.model.UserPoint">
|
<include refid="userPointList"/>
|
</select>
|
<select id="selectUserPoint" resultType="com.ruoyi.account.api.model.UserPoint">
|
<include refid="userPointList"/>
|
</select>
|
|
|
|
<select id="getUserPointDetail" resultType="com.ruoyi.account.vo.UserPointDetailVO">
|
select * from (
|
select
|
type,
|
historical_point as historicalPoint,
|
balance,
|
variable_point as variablePoint,
|
change_direction as changeDirection,
|
DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime,
|
transfer_user_id as transferUserId,
|
receive_user_id as receiveUserId,
|
object_id as objectId
|
from t_user_point where app_user_id = #{userId}
|
<if test="null != startTime and null != endTime">
|
and create_time between #{startTime} and #{endTime}
|
</if>
|
<if test="null != type">
|
and type = #{type}
|
</if>
|
union all
|
select
|
type,
|
historical_point as historicalPoint,
|
balance,
|
variable_point as variablePoint,
|
change_direction as changeDirection,
|
DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as createTime,
|
transfer_user_id as transferUserId,
|
receive_user_id as receiveUserId,
|
object_id as objectId
|
from t_user_point_copy where app_user_id = #{userId}
|
<if test="null != startTime and null != endTime">
|
and create_time between #{startTime} and #{endTime}
|
</if>
|
<if test="null != type">
|
and type = #{type}
|
</if>
|
) as a order by a.createTime desc
|
</select>
|
</mapper>
|