GameLogMapper.xml 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.api.games.dao.GameLogMapper">
  4. <resultMap id="BaseResultMap" type="com.api.games.model.GameLog">
  5. <!--
  6. WARNING - @mbg.generated
  7. -->
  8. <id column="id" jdbcType="BIGINT" property="id" />
  9. <result column="user_id" jdbcType="BIGINT" property="userId" />
  10. <result column="real_correct_rate" jdbcType="DECIMAL" property="realCorrectRate" />
  11. <result column="correct_rate" jdbcType="DECIMAL" property="correctRate" />
  12. <result column="confidence" jdbcType="DECIMAL" property="confidence" />
  13. <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
  14. <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  15. <result column="version" jdbcType="VARCHAR" property="version" />
  16. <result column="sign" jdbcType="VARCHAR" property="sign" />
  17. <result column="schedule" jdbcType="DECIMAL" property="schedule" />
  18. <result column="selected" jdbcType="VARCHAR" property="selected" />
  19. <result column="exercise" jdbcType="INTEGER" property="exercise" />
  20. </resultMap>
  21. <select id="list" resultType="com.api.common.mybatis.ResultMap">
  22. select u.nickname,g.* from game_log g
  23. left join sys_user u on (g.user_id = u.id)
  24. where 1=1
  25. <if test="params.nickname!=null and params.nickname!=''">
  26. and u.nickname = #{params.nickname}
  27. </if>
  28. <if test="params.startTime!=null and params.startTime!=''">
  29. and date(start_time) = #{params.startTime}
  30. </if>
  31. <if test="params.sign!=null and params.sign!=''">
  32. and sign = #{params.sign}
  33. </if>
  34. <if test="params.version!=null and params.version!=''">
  35. and version = #{params.version}
  36. </if>
  37. <if test="params.schedule!=null and params.schedule!=''">
  38. and schedule = #{params.schedule}/100
  39. </if>
  40. order by 1
  41. <if test="order.nickname!=null and order.nickname!=''">
  42. ,u.nickname ${order.nickname}
  43. </if>
  44. <if test="order.startTime!=null and order.startTime!=''">
  45. ,start_time ${order.startTime}
  46. </if>
  47. <if test="order.endTime!=null and order.endTime!=''">
  48. ,end_time ${order.endTime}
  49. </if>
  50. <if test="order.version!=null and order.version!=''">
  51. ,version ${order.version}
  52. </if>
  53. <if test="order.sign!=null and order.sign!=''">
  54. ,sign ${order.sign}
  55. </if>
  56. </select>
  57. <select id="notPerformed" resultMap="BaseResultMap">
  58. select a.id as user_id,
  59. 0 as real_correct_rate,
  60. 0 as correct_rate,
  61. 0 as confidence,
  62. now() as start_time,
  63. now() as end_time,
  64. 0 as version,
  65. concat(TIMESTAMPDIFF(DAY,date(uc.scale_start),now()),'-',#{type}) as sign,
  66. 0 as schedule,
  67. #{type} as type
  68. from (select * from sys_user where status = 1 and type = 1) a
  69. left join game_log g on (a.id = g.user_id and date(g.start_time) = curdate() and g.type = #{type})
  70. left join user_config uc on a.id = uc.user_id
  71. where g.id is null;
  72. </select>
  73. <select id="listUidDate" resultMap="BaseResultMap">
  74. select * from game_log where user_id = #{uid} and date(start_time) = #{date}
  75. </select>
  76. <select resultMap="BaseResultMap" id="listUid">
  77. select * from game_log where user_id = #{uid}
  78. </select>
  79. </mapper>