12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?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.UserConfigMapper">
- <resultMap id="BaseResultMap" type="com.api.games.model.UserConfig">
- <!--
- WARNING - @mbg.generated
- -->
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="user_id" jdbcType="BIGINT" property="userId" />
- <result column="scale_end" jdbcType="VARCHAR" property="scaleEnd" />
- <result column="scale_start" jdbcType="VARCHAR" property="scaleStart" />
- <result column="scale_time" jdbcType="VARCHAR" property="scaleTime" />
- <result column="show_time" jdbcType="INTEGER" property="showTime" />
- <result column="hide_time" jdbcType="INTEGER" property="hideTime" />
- <result column="correct" jdbcType="INTEGER" property="correct" />
- <result column="supporting" jdbcType="INTEGER" property="supporting" />
- <result column="practice" jdbcType="INTEGER" property="practice" />
- <result column="game_count" jdbcType="INTEGER" property="gameCount" />
- <result column="version" jdbcType="VARCHAR" property="version" />
- <result column="exercise_right" jdbcType="INTEGER" property="exerciseRight" />
- <result column="exercise" jdbcType="INTEGER" property="exercise" />
- <result column="login_out" jdbcType="INTEGER" property="loginOut" />
- </resultMap>
- <select id="list" resultType="com.api.common.mybatis.ResultMap">
- select u.nickname,u.password,u.create_time,u.enable,u.type,u.id,u.status,u.gender,u.openId , c.id as
- configId,c.user_id,c.scale_end ,c.scale_start,
- c.scale_time,c.show_time,c.hide_time,c.correct,c.supporting,c.practice,c.game_count,c.version,c.exercise_right,c.exercise,c.login_out
- from (select * from sys_user where type = 1) u
- left join user_config c on (u.id = c.user_id ) where 1=1
- <if test="params.nickname !=null and params.nickname !=''">
- and u.nickname = #{params.nickname}
- </if>
- <if test="params.status !=null and params.status == 0">
- and now() <= date(scale_start)
- </if>
- <if test="params.status !=null and params.status == 1">
- and now() >= date(scale_start) and now() <= date(scale_end)
- </if>
- <if test="params.status !=null and params.status == 2">
- and now() >= date(scale_end)
- </if>
- <if test="params.scaleStart !=null and params.scaleStart !=''">
- and date(scale_start) = #{params.scaleStart}
- </if>
- <if test="params.gameCount !=null and params.gameCount !=''">
- and game_count = #{params.gameCount}
- </if>
- <if test="params.versions !=null and params.versions !=''">
- and version = #{params.versions}
- </if>
- <if test="order!=null and order.size > 0">
- order by 1
- </if>
- <if test="order.createTime != null ">
- ,create_time ${order.createTime}
- </if>
- <if test="order.nickname != null ">
- ,nickname ${order.nickname}
- </if>
- <if test="order.scaleStart != null ">
- ,scale_start ${order.scaleStart}
- </if>
- <if test="order.scaleEnd != null ">
- ,scale_end ${order.scaleEnd}
- </if>
- <if test="order.showTime != null ">
- ,show_time ${order.showTime}
- </if>
- <if test="order.hideTime != null ">
- ,hide_time ${order.hideTime}
- </if>
- <if test="order.correct != null ">
- ,correct ${order.correct}
- </if>
- <if test="order.practice != null ">
- ,practice ${order.practice}
- </if>
- <if test="order.gameCount != null ">
- ,game_count ${order.gameCount}
- </if>
- </select>
- <delete id="deleteByUid">
- delete from user_config where user_id = #{uid}
- </delete>
- <update id="expired">
- update sys_user u inner join user_config c on u.id = c.user_id
- set u.status = 2 where date(c.scale_end) = date(date_sub(now(),interval -1 day));
- </update>
- <update id="start">
- update sys_user u inner join user_config c on u.id = c.user_id
- set u.status = 1 where date(c.scale_start) = date(now());
- </update>
- <select id="findByUid" resultMap="BaseResultMap">
- select * from user_config where user_id = #{uid}
- </select>
- </mapper>
|