From 790c2ba4a0b46edf191e3bac84931f796bd42b8f Mon Sep 17 00:00:00 2001 From: zhangf <1603559716@qq.com> Date: 星期三, 24 七月 2024 09:02:49 +0800 Subject: [PATCH] 三方对接接口优化 --- exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 105 insertions(+), 0 deletions(-) diff --git a/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml new file mode 100644 index 0000000..2488a30 --- /dev/null +++ b/exam-system/src/main/resources/mapper/institutionaccess/ThBatchCourseMapper.xml @@ -0,0 +1,105 @@ +<?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.gkhy.exam.institutionalaccess.mapper.ThBatchCourseMapper"> + + <update id="deleteByBatchUuidAndCourseUuid" parameterType="java.util.List" > + <foreach collection="list" item="item" index="index" separator=";"> + UPDATE th_batch_course + <set> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag} + </if> + </set> + where batch_uuid = #{item.batchUuid} + and course_uuid = #{item.courseUuid} + </foreach> + </update> + <update id="deleteByBatchUuid" > + + UPDATE th_batch_course + set del_flag = 2 + where batch_uuid = #{batchUuid} + + </update> + + <select id="getListByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThBatchCourseVO"> + SELECT + bc.*, + ( + SELECT + sum( cc.duration ) + FROM + th_batch_course_chapter cc + WHERE + cc.course_uuid = bc.course_uuid + AND cc.del_flag = 0 + AND cc.batch_uuid = bc.batch_uuid + ) duration + FROM + th_batch_course bc + WHERE + bc.del_flag = 0 + AND bc.batch_uuid = #{batchUuid} + </select> + + <!--批量插入--> + <insert id="insertBatch"> + INSERT INTO th_batch_course (id, course_uuid,course_name,course_lesson_num,batch_uuid, + institution_id, + train_org_name, del_flag,create_time,update_time,create_by,update_by) VALUES + <foreach collection="courseList" separator="," item="item"> + (#{item.id},#{item.courseUuid},#{item.courseName},#{item.courseLessonNum}, + #{item.batchUuid},#{item.institutionId}, + #{item.trainOrgName},#{item.delFlag},#{item.createTime}, + #{item.updateTime},#{item.createBy},#{item.updateBy}) + </foreach> + </insert> + + <!--批量修改--> + <update id="updateBatch" parameterType="java.util.List" > + <foreach collection="courseList" item="item" index="index" separator=";"> + UPDATE th_batch_course + <set> + <if test="item.courseUuid != null and item.courseUuid != ''" > + course_uuid = #{item.courseUuid}, + </if> + <if test="item.courseName != null and item.courseName != ''" > + course_name = #{item.courseName}, + </if> + <if test="item.courseLessonNum != null" > + course_lesson_num = #{item.courseLessonNum}, + </if> + <if test="item.batchUuid != null and item.batchUuid != ''" > + batch_uuid = #{item.batchUuid}, + </if> + <if test="item.institutionId != null" > + institution_id = #{item.institutionId}, + </if> + <if test="item.trainOrgName != null and item.trainOrgName != ''" > + train_org_name = #{item.trainOrgName}, + </if> + <if test="item.delFlag != null" > + del_flag = #{item.delFlag}, + </if> + <if test="item.updateBy != null and item.updateBy != ''" > + update_by = #{item.updateBy}, + </if> + <if test="item.updateTime != null" > + update_time = #{item.updateTime} + </if> + </set> + where id = #{item.id} + </foreach> + </update> + + <select id="getByBatchUuids" resultType="com.gkhy.exam.institutionalaccess.entity.ThBatchCourse"> + select id, course_uuid,course_name,course_lesson_num,batch_uuid, + institution_id,train_org_name + from th_batch_course + where del_flag = 0 and batch_uuid in + <foreach collection="batchUuids" item="batchUuid" index ="index" open="(" close=")" separator=","> + #{batchUuid} + </foreach> + </select> +</mapper> + -- Gitblit v1.9.2