PointUserLogMapper.xml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ylx.point.mapper.PointUserLogMapper">
  6. <resultMap type="PointUserLog" id="PointUserLogResult">
  7. <result property="id" column="id" />
  8. <result property="openId" column="open_id" />
  9. <result property="activityId" column="activity_id" />
  10. <result property="activityName" column="activity_name" />
  11. <result property="taskId" column="task_id" />
  12. <result property="taskName" column="task_name" />
  13. <result property="taskType" column="task_type" />
  14. <result property="points" column="points" />
  15. <result property="balanceAfter" column="balance_after" />
  16. <result property="sourceLogId" column="source_log_id" />
  17. <result property="bizOrderId" column="biz_order_id" />
  18. <result property="expireTime" column="expire_time" />
  19. <result property="isExpired" column="is_expired" />
  20. <result property="createTime" column="create_time" />
  21. <result property="opType" column="op_type" />
  22. <result property="month" column="month" />
  23. </resultMap>
  24. <select id="getUserPointLogList" resultType="com.ylx.point.domain.vo.UserPointLogVO">
  25. SELECT
  26. pul.activity_name AS activityName,
  27. pul.points AS points,
  28. pul.op_type AS opType,
  29. pul.create_time AS createTime
  30. FROM
  31. point_user_log pul
  32. <where>
  33. <if test="dto.openId != null and dto.openId != ''">
  34. and pul.open_id = #{dto.openId}
  35. </if>
  36. <if test="dto.opType != null and dto.opType != ''">
  37. AND pul.op_type = #{dto.opType}
  38. </if>
  39. </where>
  40. ORDER BY
  41. pul.create_time DESC
  42. </select>
  43. <!-- PC端根据用户openId查询用户积分详情 -->
  44. <select id="selectPcUserPointDetailList" resultType="com.ylx.point.domain.vo.UserPointDetailVO">
  45. SELECT
  46. COALESCE(NULLIF(pul.activity_name, ''), pul.task_name) AS pointProject,
  47. CASE
  48. WHEN pul.op_type = 1 THEN CONCAT('+', pul.points)
  49. WHEN pul.op_type IN (2, 3) THEN CONCAT('-', pul.points)
  50. ELSE CAST(pul.points AS CHAR)
  51. END AS pointChange,
  52. pul.create_time AS createTime
  53. FROM
  54. point_user_log pul
  55. <where>
  56. pul.open_id = #{dto.openId}
  57. <if test="dto.pointProject != null and dto.pointProject != '' and dto.pointProject != '全部'">
  58. AND COALESCE(NULLIF(pul.activity_name, ''), pul.task_name) = #{dto.pointProject}
  59. </if>
  60. <if test="dto.startTime != null and dto.startTime != ''">
  61. AND pul.create_time &gt;= #{dto.startTime}
  62. </if>
  63. <if test="dto.endTime != null and dto.endTime != ''">
  64. AND pul.create_time &lt;= #{dto.endTime}
  65. </if>
  66. </where>
  67. ORDER BY
  68. pul.create_time DESC
  69. </select>
  70. </mapper>