xiangpei
2024-05-16 9654776025968dcc4c9e41ee7b6578d72bbf9b43
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">
@@ -497,7 +497,7 @@
    <select id="getUserByExam" resultType="com.mindskip.xzs.domain.User">
        <![CDATA[
        SELECT
        d.*
        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
@@ -508,4 +508,27 @@
        ]]>
    </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>