integralMapper.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. <!-- 命名,每一个映射对象不一样 namespace:必须与对应的接口全类名一致 -->
  4. <mapper namespace="com.iamberry.wechat.service.mapper.IntegralMapper">
  5. <sql id="allField">
  6. integral_logs_id integralLogsId,
  7. integral_logs_openid
  8. integralLogsOpenid,
  9. integral_logs_num integralLogsNum,
  10. integral_logs_type integralLogsType,
  11. integral_logs_introduction
  12. integralLogsIntroduction,
  13. integral_logs_res_type integralLogsResType,
  14. integral_logs_create_date integralLogsCreateDate
  15. </sql>
  16. <!-- 加载所有积分列表 -->
  17. <select id="getIntegralByPage" parameterType="Page" resultType="Integral">
  18. SELECT
  19. <include refid="allField" />
  20. FROM tb_iamberry_user_integral_logs
  21. ORDER BY integral_logs_id DESC
  22. LIMIT #{pageNo},#{pageSize}
  23. </select>
  24. <!-- 分页显示当前用户的积分列表 -->
  25. <select id="getIntegralListByOpenId" parameterType="Member"
  26. resultType="Integral">
  27. SELECT
  28. i.integral_logs_id integralLogsId,
  29. i.integral_logs_openid integralLogsOpenid,
  30. i.integral_logs_num integralLogsNum,
  31. i.integral_logs_type integralLogsType,
  32. i.integral_logs_introduction integralLogsIntroduction,
  33. i.integral_logs_res_type integralLogsResType,
  34. i.integral_logs_create_date integralLogsCreateDate
  35. FROM TB_IAMBERRY_USER_INTEGRAL_LOGS i
  36. WHERE
  37. integral_logs_openid=#{userOpenid}
  38. ORDER BY integral_logs_create_date desc
  39. LIMIT #{page.pageNo},#{page.pageSize}
  40. </select>
  41. <select id="getCount" resultType="int" parameterType="Member">
  42. SELECT
  43. COUNT(integral_logs_id)
  44. FROM TB_IAMBERRY_USER_INTEGRAL_LOGS
  45. WHERE
  46. integral_logs_openid=#{userOpenid}
  47. </select>
  48. <!-- 添加一条积分变动记录 -->
  49. <insert id="insertIntegralLogs" parameterType="Integral">
  50. INSERT INTO
  51. TB_IAMBERRY_USER_INTEGRAL_LOGS
  52. (
  53. INTEGRAL_LOGS_OPENID,
  54. INTEGRAL_LOGS_NUM,
  55. INTEGRAL_LOGS_TYPE, INTEGRAL_LOGS_INTRODUCTION,
  56. INTEGRAL_LOGS_RES_TYPE, INTEGRAL_LOGS_CREATE_DATE
  57. )
  58. VALUES
  59. (
  60. #{integralLogsOpenid},
  61. #{integralLogsNum},
  62. #{integralLogsType},
  63. #{integralLogsIntroduction},
  64. #{integralLogsResType},
  65. #{integralLogsCreateDate}
  66. )
  67. </insert>
  68. </mapper>