|
|
@@ -1,91 +1,93 @@
|
|
|
<?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.izouma.awesomeadmin.dao.DrawSessionMapper" >
|
|
|
- <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.DrawSession" >
|
|
|
- <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
- <result column="del_flag" property="delFlag" jdbcType="CHAR" />
|
|
|
- <result column="user_id" property="userId" jdbcType="INTEGER" />
|
|
|
- <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP" />
|
|
|
- <result column="expired" property="expired" jdbcType="BIT" />
|
|
|
- <result column="award_ids" property="awardIds" jdbcType="VARCHAR" />
|
|
|
- </resultMap>
|
|
|
- <sql id="Base_Column_List" >
|
|
|
+<mapper namespace="com.izouma.awesomeadmin.dao.DrawSessionMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER"/>
|
|
|
+ <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
|
|
|
+ <result column="user_id" property="userId" jdbcType="INTEGER"/>
|
|
|
+ <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP"/>
|
|
|
+ <result column="expired" property="expired" jdbcType="BIT"/>
|
|
|
+ <result column="award_ids" property="awardIds" jdbcType="VARCHAR"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
id, del_flag, user_id, expire_time, expired, award_ids </sql>
|
|
|
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
|
|
select
|
|
|
- <include refid="Base_Column_List" />
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
from draw_session
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
- delete from draw_session
|
|
|
- where id = #{id,jdbcType=INTEGER}
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
+ DELETE
|
|
|
+ FROM draw_session
|
|
|
+ WHERE id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
- <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.DrawSession" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.DrawSession" useGeneratedKeys="true"
|
|
|
+ keyProperty="id">
|
|
|
insert into draw_session
|
|
|
- <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
- <if test="id!= null" >
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id!= null">
|
|
|
id,
|
|
|
</if>
|
|
|
- <if test="delFlag!= null" >
|
|
|
+ <if test="delFlag!= null">
|
|
|
del_flag,
|
|
|
</if>
|
|
|
- <if test="userId!= null" >
|
|
|
+ <if test="userId!= null">
|
|
|
user_id,
|
|
|
</if>
|
|
|
- <if test="expireTime!= null" >
|
|
|
+ <if test="expireTime!= null">
|
|
|
expire_time,
|
|
|
</if>
|
|
|
- <if test="expired!= null" >
|
|
|
+ <if test="expired!= null">
|
|
|
expired,
|
|
|
</if>
|
|
|
- <if test="awardIds!= null" >
|
|
|
+ <if test="awardIds!= null">
|
|
|
award_ids,
|
|
|
</if>
|
|
|
- </trim>
|
|
|
- <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
- <if test="id != null" >
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">
|
|
|
#{id,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="delFlag != null" >
|
|
|
+ <if test="delFlag != null">
|
|
|
#{delFlag,jdbcType=CHAR},
|
|
|
</if>
|
|
|
- <if test="userId != null" >
|
|
|
+ <if test="userId != null">
|
|
|
#{userId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="expireTime != null" >
|
|
|
+ <if test="expireTime != null">
|
|
|
#{expireTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
- <if test="expired != null" >
|
|
|
+ <if test="expired != null">
|
|
|
#{expired,jdbcType=BIT},
|
|
|
</if>
|
|
|
- <if test="awardIds != null" >
|
|
|
+ <if test="awardIds != null">
|
|
|
#{awardIds,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
- <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.DrawSession" >
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
update draw_session
|
|
|
- <set >
|
|
|
- <if test="id != null" >
|
|
|
- id= #{id,jdbcType=INTEGER},
|
|
|
+ <set>
|
|
|
+ <if test="id != null">
|
|
|
+ id= #{id,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="delFlag != null" >
|
|
|
- del_flag= #{delFlag,jdbcType=CHAR},
|
|
|
+ <if test="delFlag != null">
|
|
|
+ del_flag= #{delFlag,jdbcType=CHAR},
|
|
|
</if>
|
|
|
- <if test="userId != null" >
|
|
|
- user_id= #{userId,jdbcType=INTEGER},
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id= #{userId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="expireTime != null" >
|
|
|
- expire_time= #{expireTime,jdbcType=TIMESTAMP},
|
|
|
+ <if test="expireTime != null">
|
|
|
+ expire_time= #{expireTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
- <if test="expired != null" >
|
|
|
- expired= #{expired,jdbcType=BIT},
|
|
|
+ <if test="expired != null">
|
|
|
+ expired= #{expired,jdbcType=BIT},
|
|
|
</if>
|
|
|
- <if test="awardIds != null" >
|
|
|
- award_ids= #{awardIds,jdbcType=VARCHAR},
|
|
|
+ <if test="awardIds != null">
|
|
|
+ award_ids= #{awardIds,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- </set>
|
|
|
+ </set>
|
|
|
where
|
|
|
<if test="id != null and !"".equals(id)">
|
|
|
id = #{id,jdbcType=INTEGER}
|
|
|
@@ -95,39 +97,42 @@
|
|
|
id in (${idStr})
|
|
|
</if>
|
|
|
</update>
|
|
|
- <select id="queryDrawSessionByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
- select <include refid="Base_Column_List"/> from draw_session
|
|
|
+ <select id="queryDrawSessionByPage" parameterType="java.util.Map"
|
|
|
+ resultType="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from draw_session
|
|
|
<where>
|
|
|
and del_flag = 'N'
|
|
|
<if test="record.idStr != null and !"".equals(record.idStr)">
|
|
|
and id in (${record.idStr})
|
|
|
</if>
|
|
|
- <if test="record.id != null and !"".equals(record.id)">
|
|
|
- and id = #{record.id}
|
|
|
+ <if test="record.id != null and !"".equals(record.id)">
|
|
|
+ and id = #{record.id}
|
|
|
+ </if>
|
|
|
+ <if test="record.delFlag != null and !"".equals(record.delFlag)">
|
|
|
+ and del_flag = #{record.delFlag}
|
|
|
</if>
|
|
|
- <if test="record.delFlag != null and !"".equals(record.delFlag)">
|
|
|
- and del_flag = #{record.delFlag}
|
|
|
+ <if test="record.userId != null and !"".equals(record.userId)">
|
|
|
+ and user_id = #{record.userId}
|
|
|
</if>
|
|
|
- <if test="record.userId != null and !"".equals(record.userId)">
|
|
|
- and user_id = #{record.userId}
|
|
|
+ <if test="record.expireTime != null and !"".equals(record.expireTime)">
|
|
|
+ and expire_time = #{record.expireTime}
|
|
|
</if>
|
|
|
- <if test="record.expireTime != null and !"".equals(record.expireTime)">
|
|
|
- and expire_time = #{record.expireTime}
|
|
|
+ <if test="record.expired != null and !"".equals(record.expired)">
|
|
|
+ and expired = #{record.expired}
|
|
|
</if>
|
|
|
- <if test="record.expired != null and !"".equals(record.expired)">
|
|
|
- and expired = #{record.expired}
|
|
|
+ <if test="record.awardIds != null and !"".equals(record.awardIds)">
|
|
|
+ and award_ids = #{record.awardIds}
|
|
|
</if>
|
|
|
- <if test="record.awardIds != null and !"".equals(record.awardIds)">
|
|
|
- and award_ids = #{record.awardIds}
|
|
|
+ <if test="record.searchKey != null and !"".equals(record.searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
|
+ OR user_id LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR expire_time LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR expired LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ OR award_ids LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ </trim>
|
|
|
</if>
|
|
|
- <if test="record.searchKey != null and !"".equals(record.searchKey)">
|
|
|
- <trim prefix="and (" suffix=")" prefixOverrides="OR" >
|
|
|
- OR user_id LIKE concat('%',#{record.searchKey},'%')
|
|
|
- OR expire_time LIKE concat('%',#{record.searchKey},'%')
|
|
|
- OR expired LIKE concat('%',#{record.searchKey},'%')
|
|
|
- OR award_ids LIKE concat('%',#{record.searchKey},'%')
|
|
|
- </trim>
|
|
|
- </if>
|
|
|
|
|
|
<if test="record.advancedQuery != null and !"".equals(record.advancedQuery)">
|
|
|
<foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
|
|
|
@@ -181,73 +186,76 @@
|
|
|
</if>
|
|
|
id desc
|
|
|
</select>
|
|
|
- <select id="queryAllDrawSession" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
- select <include refid="Base_Column_List"/> from draw_session
|
|
|
+ <select id="queryAllDrawSession" parameterType="java.util.Map"
|
|
|
+ resultType="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from draw_session
|
|
|
<where>
|
|
|
and del_flag = 'N'
|
|
|
<if test="idStr != null and !"".equals(idStr)">
|
|
|
and id in (${idStr})
|
|
|
</if>
|
|
|
- <if test="id != null and !"".equals(id)">
|
|
|
- and id = #{id}
|
|
|
+ <if test="id != null and !"".equals(id)">
|
|
|
+ and id = #{id}
|
|
|
</if>
|
|
|
- <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
- and del_flag = #{delFlag}
|
|
|
+ <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
+ and del_flag = #{delFlag}
|
|
|
</if>
|
|
|
- <if test="userId != null and !"".equals(userId)">
|
|
|
- and user_id = #{userId}
|
|
|
+ <if test="userId != null and !"".equals(userId)">
|
|
|
+ and user_id = #{userId}
|
|
|
</if>
|
|
|
- <if test="expireTime != null and !"".equals(expireTime)">
|
|
|
- and expire_time = #{expireTime}
|
|
|
+ <if test="expireTime != null and !"".equals(expireTime)">
|
|
|
+ and expire_time = #{expireTime}
|
|
|
</if>
|
|
|
- <if test="expired != null and !"".equals(expired)">
|
|
|
- and expired = #{expired}
|
|
|
+ <if test="expired != null and !"".equals(expired)">
|
|
|
+ and expired = #{expired}
|
|
|
</if>
|
|
|
- <if test="awardIds != null and !"".equals(awardIds)">
|
|
|
- and award_ids = #{awardIds}
|
|
|
+ <if test="awardIds != null and !"".equals(awardIds)">
|
|
|
+ and award_ids = #{awardIds}
|
|
|
</if>
|
|
|
- <if test="searchKey != null and !"".equals(searchKey)">
|
|
|
- <trim prefix="and (" suffix=")" prefixOverrides="OR" >
|
|
|
- OR user_id LIKE concat('%',#{searchKey},'%')
|
|
|
- OR expire_time LIKE concat('%',#{searchKey},'%')
|
|
|
- OR expired LIKE concat('%',#{searchKey},'%')
|
|
|
- OR award_ids LIKE concat('%',#{searchKey},'%')
|
|
|
- </trim>
|
|
|
+ <if test="searchKey != null and !"".equals(searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
|
+ OR user_id LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR expire_time LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR expired LIKE concat('%',#{searchKey},'%')
|
|
|
+ OR award_ids LIKE concat('%',#{searchKey},'%')
|
|
|
+ </trim>
|
|
|
</if>
|
|
|
-<if test="advancedQuery != null and !"".equals(advancedQuery)">
|
|
|
- <foreach item="item" index="index" collection="advancedQuery.split('_;')">
|
|
|
- <choose>
|
|
|
- <when test="item.indexOf('like') != -1">
|
|
|
- <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
- <if test="detailIndex == 3">
|
|
|
- concat('%',#{itemDetail},'%')
|
|
|
- </if>
|
|
|
+ <if test="advancedQuery != null and !"".equals(advancedQuery)">
|
|
|
+ <foreach item="item" index="index" collection="advancedQuery.split('_;')">
|
|
|
+ <choose>
|
|
|
+ <when test="item.indexOf('like') != -1">
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ <if test="detailIndex == 3">
|
|
|
+ concat('%',#{itemDetail},'%')
|
|
|
+ </if>
|
|
|
|
|
|
- <if test="detailIndex < 3">
|
|
|
- ${itemDetail}
|
|
|
- </if>
|
|
|
+ <if test="detailIndex < 3">
|
|
|
+ ${itemDetail}
|
|
|
+ </if>
|
|
|
|
|
|
- </foreach>
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
- <if test="detailIndex == 3">
|
|
|
- #{itemDetail}
|
|
|
- </if>
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ <if test="detailIndex == 3">
|
|
|
+ #{itemDetail}
|
|
|
+ </if>
|
|
|
|
|
|
- <if test="detailIndex < 3">
|
|
|
- ${itemDetail}
|
|
|
- </if>
|
|
|
+ <if test="detailIndex < 3">
|
|
|
+ ${itemDetail}
|
|
|
+ </if>
|
|
|
|
|
|
- </foreach>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
+ </foreach>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
|
|
|
|
|
|
- </foreach>
|
|
|
+ </foreach>
|
|
|
|
|
|
|
|
|
-</if>
|
|
|
+ </if>
|
|
|
</where>
|
|
|
order by
|
|
|
|
|
|
@@ -267,28 +275,30 @@
|
|
|
id desc
|
|
|
</select>
|
|
|
<select id="queryDrawSession" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
- select <include refid="Base_Column_List"/> from draw_session
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from draw_session
|
|
|
<where>
|
|
|
and del_flag = 'N'
|
|
|
- <if test="id != null and !"".equals(id)">
|
|
|
+ <if test="id != null and !"".equals(id)">
|
|
|
and id = #{id}
|
|
|
</if>
|
|
|
- <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
+ <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
and del_flag = #{delFlag}
|
|
|
</if>
|
|
|
- <if test="userId != null and !"".equals(userId)">
|
|
|
+ <if test="userId != null and !"".equals(userId)">
|
|
|
and user_id = #{userId}
|
|
|
</if>
|
|
|
- <if test="expireTime != null and !"".equals(expireTime)">
|
|
|
+ <if test="expireTime != null and !"".equals(expireTime)">
|
|
|
and expire_time = #{expireTime}
|
|
|
</if>
|
|
|
- <if test="expired != null and !"".equals(expired)">
|
|
|
+ <if test="expired != null and !"".equals(expired)">
|
|
|
and expired = #{expired}
|
|
|
</if>
|
|
|
- <if test="awardIds != null and !"".equals(awardIds)">
|
|
|
+ <if test="awardIds != null and !"".equals(awardIds)">
|
|
|
and award_ids = #{awardIds}
|
|
|
</if>
|
|
|
-
|
|
|
+
|
|
|
</where>
|
|
|
LIMIT 1
|
|
|
</select>
|
|
|
@@ -304,11 +314,18 @@
|
|
|
</if>
|
|
|
</update>
|
|
|
<select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.DrawSession">
|
|
|
- select <include refid="Base_Column_List"/> from draw_session
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from draw_session
|
|
|
<where>
|
|
|
and del_flag = 'N'
|
|
|
- </where>
|
|
|
+ </where>
|
|
|
order by id desc
|
|
|
</select>
|
|
|
+ <update id="setExpire">
|
|
|
+ UPDATE draw_session
|
|
|
+ SET expired = 1
|
|
|
+ WHERE user_id = #{userId}
|
|
|
+ </update>
|
|
|
</mapper>
|
|
|
|