From 51bcfa9cc77aa7f6a98a14e4d678a539f65b03b5 Mon Sep 17 00:00:00 2001 From: wenyu441069198 <14186472+wenyu441069198@user.noreply.gitee.com> Date: Sat, 22 Jun 2024 18:54:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=82=96=E6=B5=B7=E5=8D=97spl=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umsAdmin/UmsAdminRoleRelationMapper.java | 38 ------------------ .../mapper/umsAdmin/UmsPermissionMapper.java | 13 +----- .../umsAdmin/UmsRoleResourceMapper.java | 22 ++++++++++ .../entity/umsAdmin/UmsAdminRoleRelation.java | 18 --------- .../impl/courses/CoursesServiceImpl.java | 10 ----- .../service/umsAdmin/UmsUserService.java | 5 --- .../umsAdmin/impl/UmsUserServiceImpl.java | 12 +++--- .../mapper/UmsAdminRoleRelationMapper.xml | 40 ------------------- .../resources/mapper/UmsPermissionMapper.xml | 5 +++ .../mapper/UmsRoleResourceMapper.xml | 22 ++++++++++ src/main/resources/mapper/UmsUserMapper.xml | 2 +- 11 files changed, 57 insertions(+), 130 deletions(-) delete mode 100644 src/main/java/com/teaching/backend/mapper/umsAdmin/UmsAdminRoleRelationMapper.java create mode 100644 src/main/java/com/teaching/backend/mapper/umsAdmin/UmsRoleResourceMapper.java delete mode 100644 src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsAdminRoleRelation.java delete mode 100644 src/main/resources/mapper/UmsAdminRoleRelationMapper.xml create mode 100644 src/main/resources/mapper/UmsPermissionMapper.xml create mode 100644 src/main/resources/mapper/UmsRoleResourceMapper.xml diff --git a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsAdminRoleRelationMapper.java b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsAdminRoleRelationMapper.java deleted file mode 100644 index a077cba..0000000 --- a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsAdminRoleRelationMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.teaching.backend.mapper.umsAdmin; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.teaching.backend.model.entity.umsAdmin.UmsAdminRoleRelation; -import com.teaching.backend.model.entity.umsAdmin.UmsResource; -import com.teaching.backend.model.entity.umsAdmin.UmsRole; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 后台用户与角色关系管理自定义Dao - * Created by macro on 2018/10/8. - */ -@Mapper -public interface UmsAdminRoleRelationMapper extends BaseMapper { - /** - * 插入用户角色关系 - */ - boolean insert(@Param("adminId") Long adminId, @Param("roleId") Long roleId); - - /** - * 获取用于所有角色 - */ - List getRoleList(@Param("adminId") Long adminId); - - /** - * 获取用户所有可访问资源 - */ - List getResourceList(@Param("adminId") Long adminId); - - -// /** -// * 获取资源相关用户ID列表 -// */ -// List getAdminIdList(@Param("resourceId") Long resourceId); -} diff --git a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsPermissionMapper.java b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsPermissionMapper.java index 17a8695..76ed42a 100644 --- a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsPermissionMapper.java +++ b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsPermissionMapper.java @@ -12,16 +12,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface UmsPermissionMapper extends BaseMapper { - /** - * 根据后台用户ID获取菜单 - */ -// List getMenuList(@Param("adminId") Long adminId); -// /** -// * 根据角色ID获取菜单 -// */ -// List getMenuListByRoleId(@Param("roleId") Long roleId); -// /** -// * 根据角色ID获取资源 -// */ -// List getResourceListByRoleId(@Param("roleId") Long roleId); + } diff --git a/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsRoleResourceMapper.java b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsRoleResourceMapper.java new file mode 100644 index 0000000..566f607 --- /dev/null +++ b/src/main/java/com/teaching/backend/mapper/umsAdmin/UmsRoleResourceMapper.java @@ -0,0 +1,22 @@ +package com.teaching.backend.mapper.umsAdmin; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.teaching.backend.model.entity.umsAdmin.UmsPermission; +import com.teaching.backend.model.entity.umsAdmin.UmsResource; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 后台角色管理自定义Dao + * Created by macro on 2020/2/2. + */ +@Mapper +public interface UmsRoleResourceMapper extends BaseMapper { + /** + * 获取用户所有可访问资源 + */ + List getResourceList(@Param("roleId") Long roleId); +} diff --git a/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsAdminRoleRelation.java b/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsAdminRoleRelation.java deleted file mode 100644 index 10734ee..0000000 --- a/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsAdminRoleRelation.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.teaching.backend.model.entity.umsAdmin; - -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; - -@Data -@TableName("ums_admin_role_relation") -public class UmsAdminRoleRelation implements Serializable { - private Long id; - - private Long adminId; - - private Long roleId; - - private static final long serialVersionUID = 1L; -} diff --git a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java index 531cf8b..4486a40 100644 --- a/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java @@ -14,7 +14,6 @@ import com.teaching.backend.mapper.chapter.ChapterMapper; import com.teaching.backend.mapper.courses.*; import com.teaching.backend.mapper.know.KnowRelationshipMapper; import com.teaching.backend.mapper.records.LearningRecordsMapper; -import com.teaching.backend.mapper.umsAdmin.UmsAdminRoleRelationMapper; import com.teaching.backend.mapper.umsAdmin.UmsTeacherMapper; import com.teaching.backend.mapper.umsAdmin.UmsUserMapper; import com.teaching.backend.model.dto.courses.CoursesDTO; @@ -23,7 +22,6 @@ import com.teaching.backend.model.entity.chapter.Chapter; import com.teaching.backend.model.entity.courses.*; import com.teaching.backend.model.entity.know.KnowRelationship; import com.teaching.backend.model.entity.records.LearningRecords; -import com.teaching.backend.model.entity.umsAdmin.UmsAdminRoleRelation; import com.teaching.backend.model.entity.umsAdmin.UmsTeacher; import com.teaching.backend.model.entity.umsAdmin.UmsUser; import com.teaching.backend.model.query.CourseQuery; @@ -31,9 +29,7 @@ import com.teaching.backend.model.vo.courses.CourseObjectivesTreeVO; import com.teaching.backend.model.vo.courses.CoursesVO; import com.teaching.backend.service.courses.ICoursesService; import com.teaching.backend.utils.CourseCode; -import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.xwpf.usermodel.*; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,11 +39,7 @@ import org.springframework.util.ResourceUtils; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.math.BigDecimal; -import java.math.BigInteger; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -86,8 +78,6 @@ public class CoursesServiceImpl extends ServiceImpl impl @Autowired UmsTeacherMapper umsTeacherMapper; @Autowired - UmsAdminRoleRelationMapper umsAdminRoleRelationMapper; - @Autowired StudentCoursesMapper studentCoursesMapper; @Autowired ObjectiveContentKnowMapper objectiveContentKnowMapper; diff --git a/src/main/java/com/teaching/backend/service/umsAdmin/UmsUserService.java b/src/main/java/com/teaching/backend/service/umsAdmin/UmsUserService.java index d913cc8..1be3571 100644 --- a/src/main/java/com/teaching/backend/service/umsAdmin/UmsUserService.java +++ b/src/main/java/com/teaching/backend/service/umsAdmin/UmsUserService.java @@ -49,11 +49,6 @@ public interface UmsUserService extends IService { */ String refreshToken(String oldToken); - /** - * 获取用户对应角色 - */ - List getRoleList(Long userId); - /** * 修改指定用户信息 */ diff --git a/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java b/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java index 62732d8..ecef28e 100644 --- a/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java @@ -52,7 +52,7 @@ public class UmsUserServiceImpl extends ServiceImpl impl @Autowired private PasswordEncoder passwordEncoder; @Autowired - private UmsAdminRoleRelationMapper adminRoleRelation; + private UmsRoleResourceMapper umsRoleResourceMapper; @Autowired private UmsStudentMapper umsStudentMapper; @Autowired @@ -326,10 +326,10 @@ public class UmsUserServiceImpl extends ServiceImpl impl return jwtTokenUtil.refreshHeadToken(oldToken); } - @Override - public List getRoleList(Long adminId) { - return adminRoleRelation.getRoleList(adminId); - } +// @Override +// public List getRoleList(Long adminId) { +// return umsRoleResourceMapper.getRoleList(adminId); +// } @Override public UmsUser getUserByUsername(String username) { @@ -352,7 +352,7 @@ public class UmsUserServiceImpl extends ServiceImpl impl List roleList = new ArrayList<>(); for (String role : roles) { UmsRole umsRole = umsRoleMapper.selectById(role); - resourceList = adminRoleRelation.getResourceList(umsRole.getId()); + resourceList = umsRoleResourceMapper.getResourceList(umsRole.getId()); } return resourceList; } diff --git a/src/main/resources/mapper/UmsAdminRoleRelationMapper.xml b/src/main/resources/mapper/UmsAdminRoleRelationMapper.xml deleted file mode 100644 index 1c49f99..0000000 --- a/src/main/resources/mapper/UmsAdminRoleRelationMapper.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - INSERT INTO ums_admin_role_relation (admin_id, role_id) VALUES (#{adminId,jdbcType=BIGINT}, - #{roleId,jdbcType=BIGINT}) - - - - - - - - - - - - diff --git a/src/main/resources/mapper/UmsPermissionMapper.xml b/src/main/resources/mapper/UmsPermissionMapper.xml new file mode 100644 index 0000000..1a9856c --- /dev/null +++ b/src/main/resources/mapper/UmsPermissionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/mapper/UmsRoleResourceMapper.xml b/src/main/resources/mapper/UmsRoleResourceMapper.xml new file mode 100644 index 0000000..695dd98 --- /dev/null +++ b/src/main/resources/mapper/UmsRoleResourceMapper.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/src/main/resources/mapper/UmsUserMapper.xml b/src/main/resources/mapper/UmsUserMapper.xml index 2618444..aaeedc9 100644 --- a/src/main/resources/mapper/UmsUserMapper.xml +++ b/src/main/resources/mapper/UmsUserMapper.xml @@ -3,7 +3,7 @@ - update ums_admin + update ums_user username = #{username,jdbcType=VARCHAR},