serv-课程任务
This commit is contained in:
@@ -50,29 +50,32 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Filter_Clause">
|
||||
<if test="filter != null">
|
||||
<if test="filter.courseID != null and filter.courseID != ''">
|
||||
AND course_id = #{filter.courseID}
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="filter != null">
|
||||
<if test="filter.courseID != null and filter.courseID != ''">
|
||||
AND course_id = #{filter.courseID}
|
||||
</if>
|
||||
</if>
|
||||
</if>
|
||||
<if test="filter.name != null and filter.name != ''">
|
||||
AND name LIKE CONCAT('%', #{filter.name}, '%')
|
||||
</if>
|
||||
<if test="filter.teacher != null and filter.teacher != ''">
|
||||
AND teacher LIKE CONCAT('%', #{filter.teacher}, '%')
|
||||
</if>
|
||||
<if test="filter.status != null">
|
||||
AND status = #{filter.status}
|
||||
</if>
|
||||
<if test="filter.orderNum != null">
|
||||
AND order_num = #{filter.orderNum}
|
||||
</if>
|
||||
<if test="filter.creator != null and filter.creator != ''">
|
||||
AND creator = #{filter.creator}
|
||||
</if>
|
||||
<if test="filter.createTime != null">
|
||||
AND create_time = #{filter.createTime}
|
||||
</if>
|
||||
<if test="filter.name != null and filter.name != ''">
|
||||
AND name LIKE CONCAT('%', #{filter.name}, '%')
|
||||
</if>
|
||||
<if test="filter.teacher != null and filter.teacher != ''">
|
||||
AND teacher LIKE CONCAT('%', #{filter.teacher}, '%')
|
||||
</if>
|
||||
<if test="filter.status != null">
|
||||
AND status = #{filter.status}
|
||||
</if>
|
||||
<if test="filter.orderNum != null">
|
||||
AND order_num = #{filter.orderNum}
|
||||
</if>
|
||||
<if test="filter.creator != null and filter.creator != ''">
|
||||
AND creator = #{filter.creator}
|
||||
</if>
|
||||
<if test="filter.createTime != null">
|
||||
AND create_time = #{filter.createTime}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectCourses -->
|
||||
@@ -189,9 +192,6 @@
|
||||
<update id="updateCourse" parameterType="org.xyzh.common.dto.study.TbCourse">
|
||||
UPDATE tb_course
|
||||
<set>
|
||||
<if test="courseID != null and courseID != ''">
|
||||
course_id = #{courseID},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
@@ -235,13 +235,13 @@
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
WHERE course_id = #{courseID}
|
||||
</update>
|
||||
|
||||
<!-- 删除课程 -->
|
||||
<delete id="deleteCourse" parameterType="org.xyzh.common.dto.study.TbCourse">
|
||||
DELETE FROM tb_course
|
||||
WHERE id = #{id}
|
||||
WHERE course_id = #{courseID}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入课程 -->
|
||||
|
||||
@@ -225,8 +225,7 @@
|
||||
</select>
|
||||
|
||||
<!-- selectCourseNodesByChapterIDs -->
|
||||
|
||||
<select id="selectCourseNodesByChapterIDs">
|
||||
<select id="selectCourseNodesByChapterIDs" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_node
|
||||
@@ -235,5 +234,6 @@
|
||||
#{chapterID}
|
||||
</foreach>
|
||||
AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -41,6 +41,21 @@
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<sql id="Filter_Clause">
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="filter.taskID != null and filter.taskID != ''">
|
||||
AND task_id = #{taskID}
|
||||
</if>
|
||||
<if test="filter.name != null and filter.name != ''">
|
||||
AND name LIKE CONCAT('%', #{filter.name}, '%')
|
||||
</if>
|
||||
<if test="filter.status != null">
|
||||
AND status = #{filter.status}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectLearningTasks -->
|
||||
<select id="selectLearningTasks" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
@@ -125,10 +140,10 @@
|
||||
<insert id="insertLearningTask" parameterType="org.xyzh.common.dto.study.TbLearningTask">
|
||||
INSERT INTO tb_learning_task (
|
||||
id, task_id, name, description, start_time, end_time, status,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
creator, create_time
|
||||
) VALUES (
|
||||
#{id}, #{taskID}, #{name}, #{description}, #{startTime}, #{endTime}, #{status},
|
||||
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
|
||||
#{creator}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -167,26 +182,25 @@
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
WHERE task_id = #{taskID}
|
||||
</update>
|
||||
|
||||
<!-- 删除学习任务 -->
|
||||
<delete id="deleteLearningTask" parameterType="org.xyzh.common.dto.study.TbLearningTask">
|
||||
DELETE FROM tb_learning_task
|
||||
WHERE id = #{id}
|
||||
WHERE task_id = #{taskID}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入学习任务 -->
|
||||
<insert id="batchInsertLearningTasks" parameterType="java.util.List">
|
||||
INSERT INTO tb_learning_task (
|
||||
id, task_id, name, description, start_time, end_time, status,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
creator, create_time
|
||||
) VALUES
|
||||
<foreach collection="learningTaskList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.taskID}, #{item.name}, #{item.description}, #{item.startTime},
|
||||
#{item.endTime}, #{item.status}, #{item.creator}, #{item.updater},
|
||||
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
#{item.endTime}, #{item.status}, #{item.creator}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -194,9 +208,9 @@
|
||||
<!-- 批量删除学习任务 -->
|
||||
<delete id="batchDeleteLearningTasks">
|
||||
DELETE FROM tb_learning_task
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
WHERE task_id IN
|
||||
<foreach collection="ids" item="taskID" open="(" separator="," close=")">
|
||||
#{taskID}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
@@ -205,7 +219,20 @@
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
<include refid="Where_Clause" />
|
||||
<include refid="Filter_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
||||
</select>
|
||||
|
||||
<select id="selectUserLearningTasksPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
tlt.id, tlt.task_id, tlt.name, tlt.description, tlt.start_time, tlt.end_time, tlt.status,
|
||||
tlt.creator, tlt.updater, tlt.create_time, tlt.update_time
|
||||
FROM tb_task_user ttu
|
||||
INNER JOIN tb_learning_task tlt ON ttu.task_id = tlt.task_id
|
||||
WHERE ttu.user_id = #{filter.userID}
|
||||
AND tlt.deleted = 0
|
||||
AND ttu.deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
||||
</select>
|
||||
@@ -214,7 +241,7 @@
|
||||
<select id="countLearningTasks" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_learning_task
|
||||
<include refid="Where_Clause" />
|
||||
<include refid="Filter_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -13,6 +13,24 @@
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="TaskItemResultMap" type="org.xyzh.common.vo.TaskItemVO">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="task_id" property="taskID" jdbcType="VARCHAR"/>
|
||||
<result column="course_id" property="courseID" jdbcType="VARCHAR"/>
|
||||
<result column="course_name" property="courseName" jdbcType="VARCHAR"/>
|
||||
<result column="resource_id" property="resourceID" jdbcType="VARCHAR"/>
|
||||
<result column="resource_name" property="resourceName" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="user_name" property="userName" jdbcType="VARCHAR"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="progress" property="progress" jdbcType="DECIMAL"/>
|
||||
<result column="complete_time" property="completeTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="required" property="required" jdbcType="BOOLEAN"/>
|
||||
<result column="order_num" property="orderNum" jdbcType="INTEGER"/>
|
||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, task_id, course_id, required, order_num, creator, create_time
|
||||
@@ -50,7 +68,6 @@
|
||||
WHERE id = #{relationId}
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID查询课程关联列表 -->
|
||||
<select id="selectByTaskId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
@@ -59,6 +76,17 @@
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID查询课程关联列表 -->
|
||||
<select id="selectTaskItemByTaskId" resultMap="TaskItemResultMap">
|
||||
SELECT
|
||||
ttc.*,
|
||||
tc.name as course_name
|
||||
FROM tb_task_course ttc
|
||||
INNER JOIN tb_course tc ON ttc.course_id = tc.course_id
|
||||
WHERE ttc.task_id = #{taskId} and ttc.deleted = 0 and tc.deleted = 0
|
||||
ORDER BY ttc.order_num ASC, ttc.create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID查询任务关联列表 -->
|
||||
<select id="selectByCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
|
||||
@@ -13,6 +13,24 @@
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="TaskItemResultMap" type="org.xyzh.common.vo.TaskItemVO">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="task_id" property="taskID" jdbcType="VARCHAR"/>
|
||||
<result column="course_id" property="courseID" jdbcType="VARCHAR"/>
|
||||
<result column="course_name" property="courseName" jdbcType="VARCHAR"/>
|
||||
<result column="resource_id" property="resourceID" jdbcType="VARCHAR"/>
|
||||
<result column="resource_name" property="resourceName" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="user_name" property="userName" jdbcType="VARCHAR"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="progress" property="progress" jdbcType="DECIMAL"/>
|
||||
<result column="complete_time" property="completeTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="required" property="required" jdbcType="BOOLEAN"/>
|
||||
<result column="order_num" property="orderNum" jdbcType="INTEGER"/>
|
||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, task_id, resource_id, required, order_num, creator, create_time
|
||||
@@ -59,6 +77,15 @@
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<select id="selectTaskItemByTaskId" resultMap="TaskItemResultMap">
|
||||
SELECT
|
||||
ttr.*,
|
||||
tr.title as resource_name
|
||||
FROM tb_task_resource ttr
|
||||
INNER JOIN tb_resource tr ON ttr.resource_id = tr.resource_id
|
||||
WHERE ttr.task_id = #{taskId} and ttr.deleted = 0 and tr.deleted = 0
|
||||
ORDER BY ttr.order_num ASC, ttr.create_time ASC
|
||||
</select>
|
||||
<!-- 根据资源ID查询任务关联列表 -->
|
||||
<select id="selectByResourceId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
|
||||
@@ -16,6 +16,24 @@
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="TaskItemResultMap" type="org.xyzh.common.vo.TaskItemVO">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="task_id" property="taskID" jdbcType="VARCHAR"/>
|
||||
<result column="course_id" property="courseID" jdbcType="VARCHAR"/>
|
||||
<result column="course_name" property="courseName" jdbcType="VARCHAR"/>
|
||||
<result column="resource_id" property="resourceID" jdbcType="VARCHAR"/>
|
||||
<result column="resource_name" property="resourceName" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="username" property="username" jdbcType="VARCHAR"/>
|
||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||
<result column="progress" property="progress" jdbcType="DECIMAL"/>
|
||||
<result column="complete_time" property="completeTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="required" property="required" jdbcType="BOOLEAN"/>
|
||||
<result column="order_num" property="orderNum" jdbcType="INTEGER"/>
|
||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, task_id, user_id, dept_id, status, progress, complete_time,
|
||||
@@ -66,6 +84,16 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectTaskItemByTaskId" resultMap="TaskItemResultMap">
|
||||
SELECT
|
||||
ttu.*,
|
||||
tu.username
|
||||
FROM tb_task_user ttu
|
||||
INNER JOIN tb_sys_user tu ON ttu.user_id = tu.id
|
||||
WHERE ttu.task_id = #{taskId} and ttu.deleted = 0 and tu.deleted = 0
|
||||
ORDER BY ttu.create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询任务关联列表 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
@@ -115,64 +143,29 @@
|
||||
<insert id="insertTaskUser" parameterType="org.xyzh.common.dto.study.TbTaskUser">
|
||||
INSERT INTO tb_task_user (
|
||||
id, task_id, user_id, dept_id, status, progress, complete_time,
|
||||
creator, create_time, update_time
|
||||
creator, create_time
|
||||
) VALUES (
|
||||
#{id}, #{taskID}, #{userID}, #{deptID}, #{status}, #{progress}, #{completeTime},
|
||||
#{creator}, #{createTime}, #{updateTime}
|
||||
#{creator}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新任务用户关联 -->
|
||||
<update id="updateTaskUser" parameterType="org.xyzh.common.dto.study.TbTaskUser">
|
||||
UPDATE tb_task_user
|
||||
<set>
|
||||
<if test="taskID != null and taskID != ''">
|
||||
task_id = #{taskID},
|
||||
</if>
|
||||
<if test="userID != null and userID != ''">
|
||||
user_id = #{userID},
|
||||
</if>
|
||||
<if test="deptID != null and deptID != ''">
|
||||
dept_id = #{deptID},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="progress != null">
|
||||
progress = #{progress},
|
||||
</if>
|
||||
<if test="completeTime != null">
|
||||
complete_time = #{completeTime},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除任务用户关联 -->
|
||||
<delete id="deleteTaskUser" parameterType="org.xyzh.common.dto.study.TbTaskUser">
|
||||
DELETE FROM tb_task_user
|
||||
WHERE id = #{id}
|
||||
WHERE task_id = #{taskID}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入任务用户关联 -->
|
||||
<insert id="batchInsertTaskUsers" parameterType="java.util.List">
|
||||
INSERT INTO tb_task_user (
|
||||
id, task_id, user_id, dept_id, status, progress, complete_time,
|
||||
creator, create_time, update_time
|
||||
creator, create_time
|
||||
) VALUES
|
||||
<foreach collection="taskUserList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.taskID}, #{item.userID}, #{item.deptID}, #{item.status},
|
||||
#{item.progress}, #{item.completeTime}, #{item.creator}, #{item.createTime}, #{item.updateTime}
|
||||
#{item.progress}, #{item.completeTime}, #{item.creator}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -180,9 +173,9 @@
|
||||
<!-- 批量删除任务用户关联 -->
|
||||
<delete id="batchDeleteTaskUsers">
|
||||
DELETE FROM tb_task_user
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
WHERE (task_id, user_id) IN
|
||||
<foreach collection="userIds" item="userID" open="(" separator="," close=")">
|
||||
(#{taskId}, #{userID})
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user