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.

69 lines
3.0 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.pay.BeanRechargeMapper3">
  4. <select id="selectByOnline" resultType="com.example.demo.domain.vo.bean.BeanOnlineRechargeInfo">
  5. SELECT g.id AS id,
  6. g.jwcode AS jwcode,
  7. m.name AS name,
  8. m.deptName AS market,
  9. g.order_no AS orderNo,
  10. g.count AS num,
  11. g.price AS money,
  12. g.platform AS platform,
  13. FROM_UNIXTIME(g.add_time) AS rechargeTime
  14. FROM g_order g
  15. LEFT JOIN member_info m ON g.jwcode = m.jwcode
  16. <where>
  17. g.type = "gold" AND g.state = 1
  18. <if test="jwcode != null and jwcode != ''">
  19. AND g.jwcode = #{jwcode}
  20. </if>
  21. <if test="market != null and market != ''">
  22. AND m.deptName = #{market}
  23. </if>
  24. <if test="orderNo != null and orderNo != ''">
  25. AND g.order_no = #{orderNo}
  26. </if>
  27. <if test="platform != null and platform != ''">
  28. AND g.platform = #{platform}
  29. </if>
  30. <if test="startTime != null and endTime != null">
  31. AND FROM_UNIXTIME(g.add_time) BETWEEN #{startTime} AND #{endTime}
  32. </if>
  33. </where>
  34. <trim prefix="ORDER BY" suffixOverrides=",">
  35. <choose>
  36. <!-- 当指定排序字段时使用指定字段排序 -->
  37. <when test="sortField != null and sortField != ''">
  38. <choose>
  39. <!-- 对金币数量的排序处理 -->
  40. <when test="sortField == 'num'">g.count</when>
  41. <when test="sortField == 'money'">g.price</when>
  42. <!-- 对时间字段的排序处理 -->
  43. <when test="sortField == 'rechargeTime'">g.add_time</when>
  44. <!-- 其他字段不支持排序,使用默认排序 -->
  45. <otherwise>g.add_time</otherwise>
  46. </choose>
  47. <!-- 排序方向处理 -->
  48. <if test="sortOrder != null and sortOrder != ''">
  49. <choose>
  50. <when test="sortOrder == 'ASC'">ASC</when>
  51. <when test="sortOrder == 'DESC'">DESC</when>
  52. <otherwise>DESC</otherwise>
  53. </choose>
  54. </if>
  55. <if test="sortOrder == null or sortOrder == ''">
  56. DESC
  57. </if>
  58. </when>
  59. <!-- 未指定排序字段时,使用默认的时间降序排序 -->
  60. <otherwise>
  61. g.add_time DESC
  62. </otherwise>
  63. </choose>
  64. </trim>
  65. </select>
  66. <select id="onlineMarket" resultType="java.lang.String">
  67. select DISTINCT deptName from member_info
  68. </select>
  69. </mapper>