194 lines
6.7 KiB
XML
194 lines
6.7 KiB
XML
<?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.xgl.lottery.mapper.ClockRecordMapper">
|
|
<resultMap id="BaseResultMap" type="com.xgl.lottery.request.vo.ClockRecord">
|
|
<id column="id" jdbcType="INTEGER" property="id" />
|
|
<result column="openid" jdbcType="VARCHAR" property="openid" />
|
|
<result column="card_type" jdbcType="VARCHAR" property="cardType" />
|
|
<result column="photo" jdbcType="VARCHAR" property="photo" />
|
|
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
|
|
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
|
|
<result column="duration" jdbcType="BIGINT" property="duration" />
|
|
<result column="date" jdbcType="TIMESTAMP" property="date" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, openid, card_type, photo, begin_time, end_time, duration, date, create_time
|
|
</sql>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from clock_record
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</select>
|
|
|
|
<select id="selectHelp" resultType="com.xgl.lottery.request.vo.HelpRecord">
|
|
select id,openid,helpid,create_time from help_reord where openid=#{openid,jdbcType=VARCHAR} and helpid=#{helpid,jdbcType=VARCHAR} and create_time= #{createTime,jdbcType=VARCHAR} limit 1
|
|
</select>
|
|
|
|
<select id="selectAllByOpenid" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from clock_record
|
|
where openid = #{openid,jdbcType=VARCHAR} order by end_time desc
|
|
</select>
|
|
|
|
<select id="clockComplete" parameterType="java.lang.String" resultType="java.lang.String">
|
|
select date from clock_record where openid=#{openid,jdbcType=VARCHAR}
|
|
</select>
|
|
|
|
<select id="selectByOpenid" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from clock_record WHERE DATEDIFF(date,NOW())=0
|
|
order by duration asc limit 15
|
|
</select>
|
|
|
|
|
|
<select id="selectByOpenidAll" resultType="com.xgl.lottery.request.vo.ClockRecord">
|
|
SELECT b.* from (
|
|
(SELECT openid from
|
|
clock_continue where num=5 GROUP BY openid) ) a
|
|
LEFT JOIN
|
|
(select
|
|
id,
|
|
openid,
|
|
card_type,
|
|
photo,
|
|
begin_time,
|
|
end_time,
|
|
duration,
|
|
date
|
|
from clock_record GROUP BY openid order by duration asc)b on a.openid=b.openid ORDER BY b.duration asc limit 100
|
|
|
|
</select>
|
|
|
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
delete from clock_record
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
<insert id="insert" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
|
insert into clock_record (id, openid, card_type,
|
|
photo, begin_time, end_time,
|
|
duration, date, create_time
|
|
)
|
|
values (#{id,jdbcType=INTEGER}, #{openid,jdbcType=VARCHAR}, #{cardType,jdbcType=VARCHAR},
|
|
#{photo,jdbcType=VARCHAR}, #{beginTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
|
|
#{duration,jdbcType=BIGINT}, #{date,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertHelp">
|
|
insert into help_reord (openid, helpid,
|
|
create_time
|
|
)
|
|
values (#{openid,jdbcType=VARCHAR}, #{helpid,jdbcType=VARCHAR}
|
|
, #{createTime,jdbcType=VARCHAR}
|
|
)
|
|
</insert>
|
|
|
|
<insert id="insertSelective" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
|
insert into clock_record
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="openid != null">
|
|
openid,
|
|
</if>
|
|
<if test="cardType != null">
|
|
card_type,
|
|
</if>
|
|
<if test="photo != null">
|
|
photo,
|
|
</if>
|
|
<if test="beginTime != null">
|
|
begin_time,
|
|
</if>
|
|
<if test="endTime != null">
|
|
end_time,
|
|
</if>
|
|
<if test="duration != null">
|
|
duration,
|
|
</if>
|
|
<if test="date != null">
|
|
date,
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="openid != null">
|
|
#{openid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="cardType != null">
|
|
#{cardType,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="photo != null">
|
|
#{photo,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="beginTime != null">
|
|
#{beginTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="endTime != null">
|
|
#{endTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="duration != null">
|
|
#{duration,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="date != null">
|
|
#{date,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
|
update clock_record
|
|
<set>
|
|
<if test="openid != null">
|
|
openid = #{openid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="cardType != null">
|
|
card_type = #{cardType,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="photo != null">
|
|
photo = #{photo,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="beginTime != null">
|
|
begin_time = #{beginTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="endTime != null">
|
|
end_time = #{endTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="duration != null">
|
|
duration = #{duration,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="date != null">
|
|
date = #{date,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.xgl.lottery.request.vo.ClockRecord">
|
|
update clock_record
|
|
set openid = #{openid,jdbcType=VARCHAR},
|
|
card_type = #{cardType,jdbcType=VARCHAR},
|
|
photo = #{photo,jdbcType=VARCHAR},
|
|
begin_time = #{beginTime,jdbcType=TIMESTAMP},
|
|
end_time = #{endTime,jdbcType=TIMESTAMP},
|
|
duration = #{duration,jdbcType=BIGINT},
|
|
date = #{date,jdbcType=TIMESTAMP},
|
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
</mapper> |