1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.api.games.dao.GameLogMapper">
- <resultMap id="BaseResultMap" type="com.api.games.model.GameLog">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="user_id" jdbcType="BIGINT" property="userId" />
- <result column="real_correct_rate" jdbcType="DECIMAL" property="realCorrectRate" />
- <result column="correct_rate" jdbcType="DECIMAL" property="correctRate" />
- <result column="confidence" jdbcType="DECIMAL" property="confidence" />
- <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
- <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
- <result column="version" jdbcType="VARCHAR" property="version" />
- <result column="sign" jdbcType="VARCHAR" property="sign" />
- <result column="schedule" jdbcType="DECIMAL" property="schedule" />
- <result column="selected" jdbcType="VARCHAR" property="selected" />
- <result column="exercise" jdbcType="INTEGER" property="exercise" />
- </resultMap>
- <select id="list" resultType="com.api.common.mybatis.ResultMap">
- select u.nickname,g.* from game_log g
- left join sys_user u on (g.user_id = u.id)
- where 1=1
- <if test="params.nickname!=null and params.nickname!=''">
- and u.nickname = #{params.nickname}
- </if>
- <if test="params.startTime!=null and params.startTime!=''">
- and date(start_time) = #{params.startTime}
- </if>
- <if test="params.sign!=null and params.sign!=''">
- and sign = #{params.sign}
- </if>
- <if test="params.version!=null and params.version!=''">
- and version = #{params.version}
- </if>
- <if test="params.schedule!=null and params.schedule!=''">
- and schedule = #{params.schedule}/100
- </if>
- order by 1
- <if test="order.nickname!=null and order.nickname!=''">
- ,u.nickname ${order.nickname}
- </if>
- <if test="order.startTime!=null and order.startTime!=''">
- ,start_time ${order.startTime}
- </if>
- <if test="order.endTime!=null and order.endTime!=''">
- ,end_time ${order.endTime}
- </if>
- <if test="order.version!=null and order.version!=''">
- ,version ${order.version}
- </if>
- <if test="order.sign!=null and order.sign!=''">
- ,sign ${order.sign}
- </if>
- </select>
- <select id="notPerformed" resultMap="BaseResultMap">
- select a.id as user_id,
- 0 as real_correct_rate,
- 0 as correct_rate,
- 0 as confidence,
- now() as start_time,
- now() as end_time,
- 0 as version,
- concat(TIMESTAMPDIFF(DAY,date(uc.scale_start),now()),'-',#{type}) as sign,
- 0 as schedule,
- #{type} as type
- from (select * from sys_user where status = 1 and type = 1) a
- left join game_log g on (a.id = g.user_id and date(g.start_time) = curdate() and g.type = #{type})
- left join user_config uc on a.id = uc.user_id
- where g.id is null;
- </select>
- <select id="listUidDate" resultMap="BaseResultMap">
- select * from game_log where user_id = #{uid} and date(start_time) = #{date}
- </select>
- <select resultMap="BaseResultMap" id="listUid">
- select * from game_log where user_id = #{uid}
- </select>
- </mapper>
|