From 33fdb033e0a6b5ef6b2f8ac5fc67ad8222e564e5 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 17 五月 2024 14:49:12 +0800
Subject: [PATCH] 下载文件接口,bug修改
---
src/main/resources/mapper/UserMapper.xml | 78 ++++++++++++++++++++++++++++++++++----
1 files changed, 69 insertions(+), 9 deletions(-)
diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml
index 41040e0..2a28d9a 100644
--- a/src/main/resources/mapper/UserMapper.xml
+++ b/src/main/resources/mapper/UserMapper.xml
@@ -23,7 +23,7 @@
</resultMap>
<sql id="Base_Column_List">
id, user_uuid, user_name, password, real_name, age, sex, birth_day, user_level, phone,
- role, status, image_path, create_time, modify_time, last_active_time, deleted, wx_open_id, dept_admin, `condition`, condition_detail
+ role, status, image_path, create_time, modify_time, last_active_time, deleted, wx_open_id, `condition`, condition_detail
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -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">
@@ -332,17 +332,27 @@
<select id="userPage" resultMap="BaseResultMap"
parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM">
SELECT
- <include refid="Base_Column_List"/>
- FROM t_user
- <where>
- and deleted=0
+ a.*
+ FROM t_user a
+ lEFT join
+ (select * from t_user_department
+ <if test="departmentId != null and departmentId.size() > 0">
+ where department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
+ </if>
+ group by user_id
+ )
+ b on a.id = b.user_id
+ where
+ a.deleted=0
+ <if test="departmentId != null and departmentId.size() > 0">
+ and b.department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
+ </if>
<if test="userName != null and userName != ''">
and real_name like concat('%',#{userName},'%')
</if>
<if test="role != null ">
and role= #{role}
</if>
- </where>
</select>
@@ -481,8 +491,8 @@
t_user tu INNER JOIN t_user_department tud ON tu.id = tud.user_id AND tu.deleted = 0
LEFT JOIN t_exam_paper_answer tepa ON tepa.create_user = tu.id
<where>
- <if test="query.deptId != null">
- AND tud.department_id = #{query.deptId}
+ <if test="query.deptId != null and query.deptId.size() > 0">
+ AND tud.department_id in <foreach collection="query.deptId" item="deptId" open="(" separator="," close=")"> #{deptId} </foreach>
</if>
<if test="query.start != null and query.end != null">
AND tepa.create_time between #{query.start} and #{query.end}
@@ -494,4 +504,54 @@
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>
+
+ <select id="getDeptAdminIds" resultType="java.lang.Integer" parameterType="java.lang.Integer">
+ select department_id from t_user_department where dept_admin = 1 and user_id = #{id}
+ </select>
+
+ <select id="getDeptAdmins" resultType="com.mindskip.xzs.domain.Department" parameterType="java.lang.Integer">
+ <if test="id != null">
+ select a.id, a.name from t_department a inner join t_user_department b on a.id = b.department_id where a.deleted = 0 and b.dept_admin = 1 and b.user_id = #{id} order by a.id desc
+ </if>
+ <if test="id == null">
+ select a.id, a.name from t_department a where a.deleted = 0 order by a.id desc
+ </if>
+ </select>
+
</mapper>
--
Gitblit v1.8.0