From 9654776025968dcc4c9e41ee7b6578d72bbf9b43 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 16 五月 2024 09:49:26 +0800 Subject: [PATCH] 统一相应类重构 --- src/main/resources/mapper/UserMapper.xml | 39 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml index bf9ec38..e04892e 100644 --- a/src/main/resources/mapper/UserMapper.xml +++ b/src/main/resources/mapper/UserMapper.xml @@ -268,7 +268,7 @@ select <include refid="Base_Column_List"/> from t_user - where id=#{value} and status = 1 and deleted = 0 + where id=#{value} and status = 1 and deleted = 0 and (`condition` = 0 or `condition` is null) </select> <select id="getUserByUserName" resultMap="BaseResultMap"> @@ -494,4 +494,41 @@ tu.id desc </select> + <select id="getUserByExam" resultType="com.mindskip.xzs.domain.User"> + <![CDATA[ + SELECT + DISTINCT d.* + FROM t_exam_paper a + left join t_exam_paper_user b on a.id = b.exam_paper_id and b.deleted = 0 + left join t_exam_paper_answer c on a.id = c.exam_paper_id and c.create_user = b.user_id + left join t_user d on b.user_id = d.id + WHERE a.id = #{id} + and (c.id is null or (user_score / paper_score) < 0.6) + and b.user_id = #{createUser} + ]]> + </select> + + + <update id="updateUserDeptAdmin"> + update t_user set role = -1 where id in + <foreach collection="adminIds" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + </update> + + <update id="cancelUserDeptAdmin"> + update t_user set role = 1 where id in( + select user_id from t_user_department where department_id = #{id} and user_id not in + <foreach collection="adminIds" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + and user_id not in + (select user_id from t_user_department where dept_admin = 1 and user_id in + (select user_id from t_user_department where department_id = #{id} and user_id not in + <foreach collection="adminIds" item="id" open="(" separator="," close=")"> + #{id} + </foreach> + ))) + </update> + </mapper> -- Gitblit v1.8.0