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.

63 lines
2.9 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.example.demo.mapper.bean.BeanRechargeMapper2">
  4. <select id="selectBySystem" resultType="com.example.demo.domain.vo.bean.BeanRechargeInfo">
  5. SELECT f.id AS id,
  6. m.jwcode AS jwcode,
  7. m.nickname AS name,
  8. m.dept AS market,
  9. f.money_free AS freeBean,
  10. f.money_buy AS permanentBean,
  11. f.money AS money,
  12. f.content AS remark,
  13. FROM_UNIXTIME(f.time) AS rechargeTime
  14. FROM fx_yaoqing_records f
  15. LEFT JOIN fx_member m ON f.uid = m.id
  16. <where>
  17. f.data = 0
  18. <if test="jwcode != null and jwcode != ''">
  19. AND m.jwcode = #{jwcode}
  20. </if>
  21. <if test="market != null and market != ''">
  22. AND m.dept = #{market}
  23. </if>
  24. <if test="startTime != null and endTime != null">
  25. AND FROM_UNIXTIME(f.time) BETWEEN #{startTime} AND #{endTime}
  26. </if>
  27. </where>
  28. <trim prefix="ORDER BY" suffixOverrides=",">
  29. <choose>
  30. <!-- 当指定排序字段时使用指定字段排序 -->
  31. <when test="sortField != null and sortField != ''">
  32. <choose>
  33. <!-- 对金币数量的排序处理 -->
  34. <when test="sortField == 'permanentBean'">f.money_buy</when>
  35. <when test="sortField == 'freeBean'">f.money_free</when>
  36. <!-- 对时间字段的排序处理 -->
  37. <when test="sortField == 'rechargeTime'">f.time</when>
  38. <!-- 其他字段不支持排序,使用默认排序 -->
  39. <otherwise>f.time</otherwise>
  40. </choose>
  41. <!-- 排序方向处理 -->
  42. <if test="sortOrder != null and sortOrder != ''">
  43. <choose>
  44. <when test="sortOrder == 'ASC'">ASC</when>
  45. <when test="sortOrder == 'DESC'">DESC</when>
  46. <otherwise>DESC</otherwise>
  47. </choose>
  48. </if>
  49. <if test="sortOrder == null or sortOrder == ''">
  50. DESC
  51. </if>
  52. </when>
  53. <!-- 未指定排序字段时,使用默认的时间降序排序 -->
  54. <otherwise>
  55. f.time DESC
  56. </otherwise>
  57. </choose>
  58. </trim>
  59. </select>
  60. <select id="systemMarket" resultType="java.lang.String">
  61. select DISTINCT dept from fx_member
  62. </select>
  63. </mapper>