From 2873f1cd6ea6caac062740e05994a1f0a880ffde Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 12 三月 2024 11:27:20 +0800 Subject: [PATCH] 一个用户只能是一个部门的管理员、创建随机试卷的时候人员只能选当前部门的人,试卷增加部门id --- src/main/resources/mapper/ExamPaperAnswerMapper.xml | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 116 insertions(+), 1 deletions(-) diff --git a/src/main/resources/mapper/ExamPaperAnswerMapper.xml b/src/main/resources/mapper/ExamPaperAnswerMapper.xml index c1f48f8..48ef38f 100644 --- a/src/main/resources/mapper/ExamPaperAnswerMapper.xml +++ b/src/main/resources/mapper/ExamPaperAnswerMapper.xml @@ -17,11 +17,31 @@ <result column="create_user" jdbcType="INTEGER" property="createUser" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId" /> - </resultMap> + <result column="counts" jdbcType="INTEGER" property="counts"/></resultMap> <sql id="Base_Column_List"> id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id + </sql> + <sql id="Base_Column_List1"> + id, exam_paper_id, paper_name, paper_type, subject_id, system_score, TRUNCATE(user_score/10,0) as user_score, + TRUNCATE(paper_score/10,0) as paper_score, question_correct, question_count, do_time, status, create_user, create_time, + task_exam_id + </sql> + <sql id="Base_Column_List2"> + id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, + paper_score, question_correct, question_count, do_time, status, create_user, create_time, + task_exam_id,counts + </sql> + <sql id="Base_Column_List3"> + id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, + paper_score, question_correct, question_count, do_time, status, create_user, create_time, + task_exam_id,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') AS formattedTime + </sql> + <sql id="Base_Column_List4"> + id, exam_paper_id, paper_name, paper_type, subject_id, system_score, TRUNCATE(user_score/10,0) as user_score, + TRUNCATE(paper_score/10,0) as paper_score, question_correct, question_count, do_time, status, create_user, create_time, + task_exam_id,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') AS formattedTime </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select @@ -254,13 +274,108 @@ <select id="adminPage" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.paper.ExamPaperAnswerPageRequestVM"> SELECT + a.id, a.exam_paper_id, a.paper_name, a.paper_type, a.subject_id, a.system_score, a.user_score, + a.paper_score, a.question_correct, a.question_count, a.do_time, a.status, a.create_user, a.create_time, + a.task_exam_id, u.real_name as userName + FROM t_exam_paper_answer a + left join t_user u on a.create_user = u.id + <where> + <if test="subjectId != null"> + and a.subject_id = #{subjectId} + </if> + <if test="paperName != null and paperName != ''"> + and a.paper_name like concat('%',#{paperName},'%') + </if> + <if test="userName != null and userName != ''"> + and u.real_name like concat('%',#{userName},'%') + </if> + </where> + </select> + + + <select id="getById" resultMap="BaseResultMap"> + SELECT <include refid="Base_Column_List"/> FROM t_exam_paper_answer + where id = #{id} + </select> + + <select id="selectByPaperName" resultMap="BaseResultMap" parameterType="java.lang.String"> + SELECT + <include refid="Base_Column_List"/> + FROM t_exam_paper_answer + <where> + <if test="paperName != null and paperName != ''"> + paper_name = #{paperName} + </if> + </where> + </select> + + <select id="getByExamPaperIdAndUserId" resultMap="BaseResultMap" parameterType="list"> + select + <include refid="Base_Column_List1" /> + from t_exam_paper_answer + where (exam_paper_id,create_user) in + <if test="examTemplatesUserCount !=null and examTemplatesUserCount.size() > 0"> + <foreach collection="examTemplatesUserCount" item="item" index="item" open="(" separator="," close=")"> + (#{item.examPaperId},#{item.userId}) + </foreach> + </if> + </select> + <select id="adminPageByGrade" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM"> + select + <include refid="Base_Column_List2" /> + from t_exam_paper_answer where create_time between '2023-01-01'and '2023-12-31' <where> <if test="subjectId != null"> and subject_id = #{subjectId} </if> + <if test="paperName != null and paperName != ''"> + and paper_name like concat('%',#{paperName},'%') + </if> </where> </select> + <select id="getByScorePaperIdAndUserId" resultMap="BaseResultMap" parameterType="list"> + select + <include refid="Base_Column_List1" /> + from t_exam_paper_answer + where (exam_paper_id,create_user) in + <if test="scoreTemplatesUserCounts !=null and scoreTemplatesUserCounts.size() > 0"> + <foreach collection="scoreTemplatesUserCounts" item="item" index="item" open="(" separator="," close=")"> + (#{item.examPaperId},#{item.userId}) + </foreach> + </if> + </select> + <select id="getByCreatUser" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.domain.vo.ScoreTemplatesCountVO"> + select + <include refid="Base_Column_List4"/> + from t_exam_paper_answer where create_user = #{createUser} and create_time between '2023-01-01'and '2023-12-31' + </select> + + <select id="getByExamPaperIds" resultMap="BaseResultMap" parameterType="list"> + select + <include refid="Base_Column_List1" /> + from t_exam_paper_answer + where exam_paper_id in + <if test="ids !=null and ids.size() > 0"> + <foreach collection="examTemplatesUserCount" item="item" index="item" open="(" separator="," close=")"> + #{item} + </foreach> + </if> + </select> + + <select id="getResult" resultMap="BaseResultMap" parameterType="list"> + select * from t_exam_paper_answer where (exam_paper_id) in + <foreach collection="list" item="item" open="(" close=")" separator=","> + (#{item}) + </foreach> + </select> + + <select id="getByTimeOne" resultType="com.mindskip.xzs.domain.vo.TeamplatesUserExcelVO"> + select a.paper_name as name, u.real_name as userName,SUBSTRING_INDEX(a.user_score/10,".",1) as userScore, + SUBSTRING_INDEX(a.paper_score/10,".",1) as paperScore,a.do_time as doTime from t_exam_paper_answer a + left join t_user u on a.create_user = u.id + where a.create_time between '2023-11-28 09:00:00' and '2023-12-01 10:00:00' + </select> </mapper> -- Gitblit v1.8.0