|
@@ -0,0 +1,108 @@
|
|
|
|
+<?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.fs.todo.mapper.FsTodoItemsMapper">
|
|
|
|
+
|
|
|
|
+ <!-- 结果映射 -->
|
|
|
|
+ <resultMap id="BaseResultMap" type="com.fs.todo.domain.FsTodoItems">
|
|
|
|
+ <id column="id" property="id" jdbcType="BIGINT"/>
|
|
|
|
+ <result column="title" property="title" jdbcType="VARCHAR"/>
|
|
|
|
+ <result column="description" property="description" jdbcType="LONGVARCHAR"/>
|
|
|
|
+ <result column="status" property="status" jdbcType="TINYINT"/>
|
|
|
|
+ <result column="creator_id" property="creatorId" jdbcType="BIGINT"/>
|
|
|
|
+ <result column="assignee_id" property="assigneeId" jdbcType="BIGINT"/>
|
|
|
|
+ <result column="priority" property="priority" jdbcType="TINYINT"/>
|
|
|
|
+ <result column="due_date" property="dueDate" jdbcType="TIMESTAMP"/>
|
|
|
|
+ <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
|
|
|
+ <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
|
|
|
+ <result column="complete_time" property="completeTime" jdbcType="TIMESTAMP"/>
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+ <!-- 基础字段 -->
|
|
|
|
+ <sql id="Base_Column_List">
|
|
|
|
+ id, title, description, status, creator_id, assignee_id, priority,
|
|
|
|
+ due_date, create_time, update_time, complete_time
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <!-- 根据ID查询 -->
|
|
|
|
+ <select id="selectById" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
|
+ SELECT <include refid="Base_Column_List"/>
|
|
|
|
+ FROM fs_todo_items
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 查询所有 -->
|
|
|
|
+ <select id="selectAll" resultMap="BaseResultMap">
|
|
|
|
+ SELECT <include refid="Base_Column_List"/>
|
|
|
|
+ FROM fs_todo_items
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 根据创建者ID查询 -->
|
|
|
|
+ <select id="selectByCreatorId" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
|
+ SELECT <include refid="Base_Column_List"/>
|
|
|
|
+ FROM fs_todo_items
|
|
|
|
+ WHERE creator_id = #{creatorId}
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 根据负责人ID查询 -->
|
|
|
|
+ <select id="selectByAssigneeId" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
|
+ SELECT <include refid="Base_Column_List"/>
|
|
|
|
+ FROM fs_todo_items
|
|
|
|
+ WHERE assignee_id = #{assigneeId}
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!-- 根据状态查询 -->
|
|
|
|
+ <select id="selectByStatus" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
|
+ SELECT <include refid="Base_Column_List"/>
|
|
|
|
+ FROM fs_todo_items
|
|
|
|
+ WHERE status = #{status}
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
+ </select>
|
|
|
|
+ <select id="listPage" resultType="com.fs.todo.domain.FsTodoItems">
|
|
|
|
+ SELECT <include refid="Base_Column_List"/>
|
|
|
|
+ FROM fs_todo_items
|
|
|
|
+ <where>
|
|
|
|
+ <if test="id != null">
|
|
|
|
+ AND id = #{id}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="title != null and title != ''">
|
|
|
|
+ AND title LIKE CONCAT('%', #{title}, '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="description != null and description != ''">
|
|
|
|
+ AND description LIKE CONCAT('%', #{description}, '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null">
|
|
|
|
+ AND status = #{status}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="creatorId != null">
|
|
|
|
+ AND creator_id = #{creatorId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="assigneeId != null">
|
|
|
|
+ AND assignee_id = #{assigneeId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="priority != null">
|
|
|
|
+ AND priority = #{priority}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dueDate != null">
|
|
|
|
+ AND DATE(due_date) = DATE(#{dueDate})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="createTime != null">
|
|
|
|
+ AND DATE(create_time) = DATE(#{createTime})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="updateTime != null">
|
|
|
|
+ AND DATE(update_time) = DATE(#{updateTime})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="completeTime != null">
|
|
|
|
+ AND DATE(complete_time) = DATE(#{completeTime})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cateId != null">
|
|
|
|
+ AND cate_id = #{cateId}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ ORDER BY create_time DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+</mapper>
|