Merge branch 'master-jdk17' of https://github.com/YunaiV/ruoyi-vue-pro into master-jdk17

This commit is contained in:
YunaiV
2026-09-26 10:38:00 +08:00
3 changed files with 12 additions and 0 deletions
@@ -45,6 +45,13 @@ public class CrmPermissionAspect {
@Before("@annotation(crmPermission)")
public void doBefore(JoinPoint joinPoint, CrmPermission crmPermission) {
// 0. 系统调用(定时任务/异步线程等,无登录用户)不走数据权限校验,直接放行。
// 数据权限是“按登录用户”的访问控制;/admin-api 外部请求必然有登录用户,
// 故登录用户为 null 只可能是系统内部调用(如公海自动掉落定时任务),属可信进程。
// 若在此校验,isCrmAdmin() 会以 null 用户查缓存,抛 Null key 异常导致业务失败。
if (getUserId() == null) {
return;
}
// 1.1 获取相关属性值
Map<String, Object> expressionValues = parseExpressions(joinPoint, crmPermission);
Integer bizType = StrUtil.isEmpty(crmPermission.bizTypeValue()) ?
@@ -16,6 +16,7 @@ public interface ErrorCodeConstants {
ErrorCode CATEGORY_EXISTS_CHILDREN = new ErrorCode(1_008_001_003, "存在子分类,无法删除");
ErrorCode CATEGORY_DISABLED = new ErrorCode(1_008_001_004, "商品分类({})已禁用,无法使用");
ErrorCode CATEGORY_HAVE_BIND_SPU = new ErrorCode(1_008_001_005, "类别下存在商品,无法删除");
ErrorCode CATEGORY_PARENT_IS_SELF = new ErrorCode(1_008_001_006, "父分类不能设置为分类自身");
// ========== 商品品牌相关编号 1-008-002-000 ==========
ErrorCode BRAND_NOT_EXISTS = new ErrorCode(1_008_002_000, "品牌不存在");
@@ -55,6 +55,10 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
public void updateCategory(ProductCategorySaveReqVO updateReqVO) {
// 校验分类是否存在
validateProductCategoryExists(updateReqVO.getId());
// 校验父分类不能是分类自身(环检测:父级设成自己会形成循环层级,后续按父链遍历将死循环/脏数据)
if (Objects.equals(updateReqVO.getParentId(), updateReqVO.getId())) {
throw exception(CATEGORY_PARENT_IS_SELF);
}
// 校验父分类存在
validateParentProductCategory(updateReqVO.getParentId());