权限注解,excel依赖
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.dc.dc_project.common.aop;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.exception.SaTokenException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.dc.dc_project.utils.PermissionUtils;
|
||||
|
||||
@@ -1,20 +1,28 @@
|
||||
package com.dc.dc_project.config;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.strategy.SaAnnotationStrategy;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.dc.dc_project.common.aop.CheckPermission;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
|
||||
@PostConstruct
|
||||
public void registerAnnotationHandler() {
|
||||
// 注册自定义权限注解处理器
|
||||
SaAnnotationStrategy.instance.registerAnnotationHandler(new CheckPermission());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
System.out.println("----- SaToken 拦截器启动成功!");
|
||||
|
||||
@@ -60,6 +60,9 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
||||
|
||||
Personnel personnel = this.getOneByUserId(userId);
|
||||
Long pOrgId = orgMapper.getOrgIdByPersonnelId(personnel.getId());
|
||||
if (pOrgId == null) {
|
||||
return ResponseResult.error("无归属组织,无");
|
||||
}
|
||||
List<Long> orgIds = null;
|
||||
if (dataScopeType != null) {
|
||||
orgIds = switch (dataScopeType) {
|
||||
@@ -88,13 +91,6 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
||||
personnel.setStatus(1);
|
||||
personnel.setCreatedBy(userId);
|
||||
|
||||
if(personnelDto.getOrgId() != null){
|
||||
PersonnelOrg personnelOrg = new PersonnelOrg();
|
||||
personnelOrg.setPersonnelId(personnel.getId());
|
||||
personnelOrg.setOrgId(personnelDto.getOrgId());
|
||||
personnelOrg.setCreatedBy(userId);
|
||||
personnelOrgService.save(personnelOrg);
|
||||
}
|
||||
if(personnelDto.getIsUser() == 1){
|
||||
User user = new User();
|
||||
user.setUsername(personnel.getName());
|
||||
@@ -103,13 +99,18 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
||||
user.setPhone(personnel.getContactPhone());
|
||||
user.setStatus(1);
|
||||
user.setRemark(personnel.getRemark());
|
||||
userMapper.insert( user);
|
||||
userMapper.insert(user);
|
||||
personnel.setUserId(user.getId());
|
||||
}
|
||||
if (this.save(personnel)){
|
||||
return ResponseResult.success();
|
||||
this.save(personnel);
|
||||
if(personnelDto.getOrgId() != null){
|
||||
PersonnelOrg personnelOrg = new PersonnelOrg();
|
||||
personnelOrg.setPersonnelId(personnel.getId());
|
||||
personnelOrg.setOrgId(personnelDto.getOrgId());
|
||||
personnelOrg.setCreatedBy(userId);
|
||||
personnelOrgService.save(personnelOrg);
|
||||
}
|
||||
return ResponseResult.error();
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user