|
|
@@ -1,71 +1,73 @@
|
|
|
<?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.CheckinRecordMapper" >
|
|
|
- <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.CheckinRecord" >
|
|
|
- <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="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
- </resultMap>
|
|
|
- <sql id="Base_Column_List" >
|
|
|
+<mapper namespace="com.izouma.awesomeadmin.dao.CheckinRecordMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
+ <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="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
id, del_flag, user_id, create_time </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 checkin_record
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
- delete from checkin_record
|
|
|
- where id = #{id,jdbcType=INTEGER}
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
+ DELETE
|
|
|
+ FROM checkin_record
|
|
|
+ WHERE id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
- <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.CheckinRecord" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.CheckinRecord" useGeneratedKeys="true"
|
|
|
+ keyProperty="id">
|
|
|
insert into checkin_record
|
|
|
- <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="createTime!= null" >
|
|
|
+ <if test="createTime!= null">
|
|
|
create_time,
|
|
|
</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="createTime != null" >
|
|
|
+ <if test="createTime != null">
|
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
- <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.CheckinRecord" >
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
update checkin_record
|
|
|
- <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="createTime != null" >
|
|
|
- create_time= #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time= #{createTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
- </set>
|
|
|
+ </set>
|
|
|
where
|
|
|
<if test="id != null and !"".equals(id)">
|
|
|
id = #{id,jdbcType=INTEGER}
|
|
|
@@ -75,30 +77,33 @@
|
|
|
id in (${idStr})
|
|
|
</if>
|
|
|
</update>
|
|
|
- <select id="queryCheckinRecordByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
- select <include refid="Base_Column_List"/> from checkin_record
|
|
|
+ <select id="queryCheckinRecordByPage" parameterType="java.util.Map"
|
|
|
+ resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from checkin_record
|
|
|
<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.createTime != null and !"".equals(record.createTime)">
|
|
|
+ and create_time = #{record.createTime}
|
|
|
</if>
|
|
|
- <if test="record.createTime != null and !"".equals(record.createTime)">
|
|
|
- and create_time = #{record.createTime}
|
|
|
+ <if test="record.searchKey != null and !"".equals(record.searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
|
+ OR user_id 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},'%')
|
|
|
- </trim>
|
|
|
- </if>
|
|
|
|
|
|
<if test="record.advancedQuery != null and !"".equals(record.advancedQuery)">
|
|
|
<foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
|
|
|
@@ -152,64 +157,67 @@
|
|
|
</if>
|
|
|
id desc
|
|
|
</select>
|
|
|
- <select id="queryAllCheckinRecord" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
- select <include refid="Base_Column_List"/> from checkin_record
|
|
|
+ <select id="queryAllCheckinRecord" parameterType="java.util.Map"
|
|
|
+ resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from checkin_record
|
|
|
<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="createTime != null and !"".equals(createTime)">
|
|
|
- and create_time = #{createTime}
|
|
|
+ <if test="createTime != null and !"".equals(createTime)">
|
|
|
+ and create_time = #{createTime}
|
|
|
</if>
|
|
|
- <if test="searchKey != null and !"".equals(searchKey)">
|
|
|
- <trim prefix="and (" suffix=")" prefixOverrides="OR" >
|
|
|
- OR user_id LIKE concat('%',#{searchKey},'%')
|
|
|
- </trim>
|
|
|
+ <if test="searchKey != null and !"".equals(searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR">
|
|
|
+ OR user_id 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
|
|
|
|
|
|
@@ -228,23 +236,26 @@
|
|
|
|
|
|
id desc
|
|
|
</select>
|
|
|
- <select id="queryCheckinRecord" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
- select <include refid="Base_Column_List"/> from checkin_record
|
|
|
+ <select id="queryCheckinRecord" parameterType="java.util.Map"
|
|
|
+ resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from checkin_record
|
|
|
<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="createTime != null and !"".equals(createTime)">
|
|
|
+ <if test="createTime != null and !"".equals(createTime)">
|
|
|
and create_time = #{createTime}
|
|
|
</if>
|
|
|
-
|
|
|
+
|
|
|
</where>
|
|
|
LIMIT 1
|
|
|
</select>
|
|
|
@@ -260,11 +271,24 @@
|
|
|
</if>
|
|
|
</update>
|
|
|
<select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
- select <include refid="Base_Column_List"/> from checkin_record
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from checkin_record
|
|
|
<where>
|
|
|
and del_flag = 'N'
|
|
|
- </where>
|
|
|
+ </where>
|
|
|
order by id desc
|
|
|
</select>
|
|
|
+ <select id="queryTodayRecord" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM checkin_record WHERE del_flag = 'N' AND to_days(create_time) = to_days(now()) AND user_id = #{userId}
|
|
|
+ </select>
|
|
|
+ <select id="queryMonthRecord" resultType="com.izouma.awesomeadmin.model.CheckinRecord">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM checkin_record WHERE del_flag = 'N' AND DATE_FORMAT(create_time, '%Y%m') = #{yearMonth}
|
|
|
+ AND user_id = #{userId}
|
|
|
+ </select>
|
|
|
</mapper>
|
|
|
|