You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.9 KiB

<?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.example.demo.mapper.bean.BeanRechargeMapper2">
<select id="selectBySystem" resultType="com.example.demo.domain.vo.bean.BeanRechargeInfo">
SELECT f.id AS id,
m.jwcode AS jwcode,
m.nickname AS name,
m.dept AS market,
f.money_free AS freeBean,
f.money_buy AS permanentBean,
f.money AS money,
f.content AS remark,
FROM_UNIXTIME(f.time) AS rechargeTime
FROM fx_yaoqing_records f
LEFT JOIN fx_member m ON f.uid = m.id
<where>
f.data = 0
<if test="jwcode != null and jwcode != ''">
AND m.jwcode = #{jwcode}
</if>
<if test="market != null and market != ''">
AND m.dept = #{market}
</if>
<if test="startTime != null and endTime != null">
AND FROM_UNIXTIME(f.time) BETWEEN #{startTime} AND #{endTime}
</if>
</where>
<trim prefix="ORDER BY" suffixOverrides=",">
<choose>
<!-- 当指定排序字段时使用指定字段排序 -->
<when test="sortField != null and sortField != ''">
<choose>
<!-- 对金币数量的排序处理 -->
<when test="sortField == 'permanentBean'">f.money_buy</when>
<when test="sortField == 'freeBean'">f.money_free</when>
<!-- 对时间字段的排序处理 -->
<when test="sortField == 'rechargeTime'">f.time</when>
<!-- 其他字段不支持排序,使用默认排序 -->
<otherwise>f.time</otherwise>
</choose>
<!-- 排序方向处理 -->
<if test="sortOrder != null and sortOrder != ''">
<choose>
<when test="sortOrder == 'ASC'">ASC</when>
<when test="sortOrder == 'DESC'">DESC</when>
<otherwise>DESC</otherwise>
</choose>
</if>
<if test="sortOrder == null or sortOrder == ''">
DESC
</if>
</when>
<!-- 未指定排序字段时,使用默认的时间降序排序 -->
<otherwise>
f.time DESC
</otherwise>
</choose>
</trim>
</select>
<select id="systemMarket" resultType="java.lang.String">
select DISTINCT dept from fx_member
</select>
</mapper>