|
|
@@ -0,0 +1,367 @@
|
|
|
+<?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.UserMissionMapper" >
|
|
|
+ <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.UserMission" >
|
|
|
+ <id column="id" property="id" jdbcType="INTEGER" />
|
|
|
+ <result column="del_flag" property="delFlag" jdbcType="CHAR" />
|
|
|
+ <result column="mission_id" property="missionId" jdbcType="INTEGER" />
|
|
|
+ <result column="user_id" property="userId" jdbcType="INTEGER" />
|
|
|
+ <result column="state" property="state" jdbcType="INTEGER" />
|
|
|
+ <result column="progress" property="progress" jdbcType="INTEGER" />
|
|
|
+ <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="finish_time" property="finishTime" jdbcType="TIMESTAMP" />
|
|
|
+ <result column="end_time" property="endTime" jdbcType="TIMESTAMP" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List" >
|
|
|
+ id, del_flag, mission_id, user_id, state, progress, create_time, finish_time, end_time </sql>
|
|
|
+ <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from user_mission
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
+ delete from user_mission
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+ <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.UserMission" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into user_mission
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="id!= null" >
|
|
|
+ id,
|
|
|
+ </if>
|
|
|
+ <if test="delFlag!= null" >
|
|
|
+ del_flag,
|
|
|
+ </if>
|
|
|
+ <if test="missionId!= null" >
|
|
|
+ mission_id,
|
|
|
+ </if>
|
|
|
+ <if test="userId!= null" >
|
|
|
+ user_id,
|
|
|
+ </if>
|
|
|
+ <if test="state!= null" >
|
|
|
+ state,
|
|
|
+ </if>
|
|
|
+ <if test="progress!= null" >
|
|
|
+ progress,
|
|
|
+ </if>
|
|
|
+ <if test="createTime!= null" >
|
|
|
+ create_time,
|
|
|
+ </if>
|
|
|
+ <if test="finishTime!= null" >
|
|
|
+ finish_time,
|
|
|
+ </if>
|
|
|
+ <if test="endTime!= null" >
|
|
|
+ end_time,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="id != null" >
|
|
|
+ #{id,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null" >
|
|
|
+ #{delFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="missionId != null" >
|
|
|
+ #{missionId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="userId != null" >
|
|
|
+ #{userId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="state != null" >
|
|
|
+ #{state,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="progress != null" >
|
|
|
+ #{progress,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="finishTime != null" >
|
|
|
+ #{finishTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null" >
|
|
|
+ #{endTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.UserMission" >
|
|
|
+ update user_mission
|
|
|
+ <set >
|
|
|
+ <if test="id != null" >
|
|
|
+ id= #{id,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null" >
|
|
|
+ del_flag= #{delFlag,jdbcType=CHAR},
|
|
|
+ </if>
|
|
|
+ <if test="missionId != null" >
|
|
|
+ mission_id= #{missionId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="userId != null" >
|
|
|
+ user_id= #{userId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="state != null" >
|
|
|
+ state= #{state,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="progress != null" >
|
|
|
+ progress= #{progress,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ create_time= #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="finishTime != null" >
|
|
|
+ finish_time= #{finishTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null" >
|
|
|
+ end_time= #{endTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where
|
|
|
+ <if test="id != null and !"".equals(id)">
|
|
|
+ id = #{id,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="idStr != null and !"".equals(idStr)">
|
|
|
+ id in (${idStr})
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+ <select id="queryUserMissionByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.UserMission">
|
|
|
+ select <include refid="Base_Column_List"/> from user_mission
|
|
|
+ <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>
|
|
|
+ <if test="record.delFlag != null and !"".equals(record.delFlag)">
|
|
|
+ and del_flag = #{record.delFlag}
|
|
|
+ </if>
|
|
|
+ <if test="record.missionId != null and !"".equals(record.missionId)">
|
|
|
+ and mission_id = #{record.missionId}
|
|
|
+ </if>
|
|
|
+ <if test="record.userId != null and !"".equals(record.userId)">
|
|
|
+ and user_id = #{record.userId}
|
|
|
+ </if>
|
|
|
+ <if test="record.state != null and !"".equals(record.state)">
|
|
|
+ and state = #{record.state}
|
|
|
+ </if>
|
|
|
+ <if test="record.progress != null and !"".equals(record.progress)">
|
|
|
+ and progress = #{record.progress}
|
|
|
+ </if>
|
|
|
+ <if test="record.createTime != null and !"".equals(record.createTime)">
|
|
|
+ and create_time = #{record.createTime}
|
|
|
+ </if>
|
|
|
+ <if test="record.finishTime != null and !"".equals(record.finishTime)">
|
|
|
+ and finish_time = #{record.finishTime}
|
|
|
+ </if>
|
|
|
+ <if test="record.endTime != null and !"".equals(record.endTime)">
|
|
|
+ and end_time = #{record.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="record.searchKey != null and !"".equals(record.searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR" >
|
|
|
+ OR mission_id LIKE concat('%',#{record.searchKey},'%')
|
|
|
+ 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('_;')">
|
|
|
+ <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>
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ <if test="detailIndex == 3">
|
|
|
+ #{itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="detailIndex < 3">
|
|
|
+ ${itemDetail}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ order by
|
|
|
+
|
|
|
+ <if test="record.orderByStr != null and !"".equals(record.orderByStr)">
|
|
|
+
|
|
|
+
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ ${itemDetail}
|
|
|
+ </foreach>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ ,
|
|
|
+ </if>
|
|
|
+ id desc
|
|
|
+ </select>
|
|
|
+ <select id="queryAllUserMission" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.UserMission">
|
|
|
+ select <include refid="Base_Column_List"/> from user_mission
|
|
|
+ <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>
|
|
|
+ <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
+ and del_flag = #{delFlag}
|
|
|
+ </if>
|
|
|
+ <if test="missionId != null and !"".equals(missionId)">
|
|
|
+ and mission_id = #{missionId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and !"".equals(userId)">
|
|
|
+ and user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="state != null and !"".equals(state)">
|
|
|
+ and state = #{state}
|
|
|
+ </if>
|
|
|
+ <if test="progress != null and !"".equals(progress)">
|
|
|
+ and progress = #{progress}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null and !"".equals(createTime)">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ <if test="finishTime != null and !"".equals(finishTime)">
|
|
|
+ and finish_time = #{finishTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and !"".equals(endTime)">
|
|
|
+ and end_time = #{endTime}
|
|
|
+ </if>
|
|
|
+ <if test="searchKey != null and !"".equals(searchKey)">
|
|
|
+ <trim prefix="and (" suffix=")" prefixOverrides="OR" >
|
|
|
+ OR mission_id LIKE concat('%',#{searchKey},'%')
|
|
|
+ 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="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>
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
+
|
|
|
+ </foreach>
|
|
|
+
|
|
|
+
|
|
|
+</if>
|
|
|
+ </where>
|
|
|
+ order by
|
|
|
+
|
|
|
+ <if test="orderByStr != null and !"".equals(orderByStr)">
|
|
|
+
|
|
|
+
|
|
|
+ <trim suffixOverrides=",">
|
|
|
+ <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
|
|
|
+ <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
|
|
|
+ ${itemDetail}
|
|
|
+ </foreach>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ ,
|
|
|
+ </if>
|
|
|
+
|
|
|
+ id desc
|
|
|
+ </select>
|
|
|
+ <select id="queryUserMission" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.UserMission">
|
|
|
+ select <include refid="Base_Column_List"/> from user_mission
|
|
|
+ <where>
|
|
|
+ and del_flag = 'N'
|
|
|
+ <if test="id != null and !"".equals(id)">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null and !"".equals(delFlag)">
|
|
|
+ and del_flag = #{delFlag}
|
|
|
+ </if>
|
|
|
+ <if test="missionId != null and !"".equals(missionId)">
|
|
|
+ and mission_id = #{missionId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null and !"".equals(userId)">
|
|
|
+ and user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="state != null and !"".equals(state)">
|
|
|
+ and state = #{state}
|
|
|
+ </if>
|
|
|
+ <if test="progress != null and !"".equals(progress)">
|
|
|
+ and progress = #{progress}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null and !"".equals(createTime)">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ <if test="finishTime != null and !"".equals(finishTime)">
|
|
|
+ and finish_time = #{finishTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and !"".equals(endTime)">
|
|
|
+ and end_time = #{endTime}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ LIMIT 1
|
|
|
+ </select>
|
|
|
+ <update id="delete">
|
|
|
+ UPDATE user_mission SET del_flag = 'Y'
|
|
|
+ where
|
|
|
+ <if test="id != null and !"".equals(id)">
|
|
|
+ id = #{id,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="idStr != null and !"".equals(idStr)">
|
|
|
+ id in (${idStr})
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+ <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.UserMission">
|
|
|
+ select <include refid="Base_Column_List"/> from user_mission
|
|
|
+ <where>
|
|
|
+ and del_flag = 'N'
|
|
|
+ </where>
|
|
|
+ order by id desc
|
|
|
+ </select>
|
|
|
+</mapper>
|
|
|
+
|