移除数据查询部门限制

This commit is contained in:
zhanghan11 2024-06-18 16:21:26 +08:00
parent 63f1abf621
commit ded7a06072

View File

@ -20,29 +20,29 @@ import org.springframework.stereotype.Component;
public class DeptIdAspect {
private static final Logger LOGGER = LoggerFactory.getLogger(DeptIdAspect.class);
/**
* 在service层前添加tanentId的值
*/
//@Before(value = "execution(* com.inspur..*.*ServiceImpl.*(..))")
@Before(value = "" +
// "execution(* com.inspur.equip..*.*ServiceImpl.*(..)) || execution(* com.inspur.industrial..*.*ServiceImpl.*(..))" +
// "|| execution(* com.inspur.sensor..*.*ServiceImpl.*(..)) ||" +
" execution(* com.inspur.patrol..*.*ServiceImpl.*(..)) " +
"|| execution(* com.inspur.spareparts..*.*ServiceImpl.*(..))")
public void beforeService(JoinPoint point) {
Object[] args = point.getArgs();
for (Object arg : args) {
if (arg instanceof DeptId) {
LOGGER.info("匹配到需要注入部门id", arg);
DeptId entity = (DeptId) arg;
if (StringUtils.isNotNull(SecurityUtils.getAuthentication()) && !"anonymousUser".equals(SecurityUtils.getAuthentication().getPrincipal())
&& StringUtils.isNotNull(SecurityUtils.getLoginUser().getDeptId())) {
LOGGER.info("部门id注入", entity);
entity.setDeptId(SecurityUtils.getLoginUser().getDeptId());
}
}
}
}
//
// /**
// * 在service层前添加tanentId的值
// */
// //@Before(value = "execution(* com.inspur..*.*ServiceImpl.*(..))")
// @Before(value = "" +
//// "execution(* com.inspur.equip..*.*ServiceImpl.*(..)) || execution(* com.inspur.industrial..*.*ServiceImpl.*(..))" +
//// "|| execution(* com.inspur.sensor..*.*ServiceImpl.*(..)) ||" +
// " execution(* com.inspur.patrol..*.*ServiceImpl.*(..)) " +
// "|| execution(* com.inspur.spareparts..*.*ServiceImpl.*(..))")
// public void beforeService(JoinPoint point) {
// Object[] args = point.getArgs();
// for (Object arg : args) {
// if (arg instanceof DeptId) {
// LOGGER.info("匹配到需要注入部门id", arg);
// DeptId entity = (DeptId) arg;
// if (StringUtils.isNotNull(SecurityUtils.getAuthentication()) && !"anonymousUser".equals(SecurityUtils.getAuthentication().getPrincipal())
// && StringUtils.isNotNull(SecurityUtils.getLoginUser().getDeptId())) {
// LOGGER.info("部门id注入", entity);
// entity.setDeptId(SecurityUtils.getLoginUser().getDeptId());
// }
// }
// }
// }
}