|
@@ -46,18 +46,18 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|
|
Integer count = this.lambdaQuery().eq(Category::getName, param.getName()).count();
|
|
|
AssertUtils.available(count <= 0, "分类名称已存在");
|
|
|
Category category = CategoryCopier.INSTANCE.copying(param);
|
|
|
- Long userId = SessionContextHolder.getId();
|
|
|
- Scope scope = StringUtils.ifEmpty(SessionContextHolder.getScope(), Scope::parse);
|
|
|
- if (scope == Scope.ADMIN) {
|
|
|
- category.setType("0");
|
|
|
- }else {
|
|
|
- List<Long> merchants = this.merchantService.getMerchantIdsByUserId(userId);
|
|
|
- if (ObjectUtils.isEmpty(merchants)) {
|
|
|
- return null;
|
|
|
- }
|
|
|
- category.setMerchantId(merchants.get(0));
|
|
|
- category.setType("1");
|
|
|
- }
|
|
|
+// Long userId = SessionContextHolder.getId();
|
|
|
+// Scope scope = StringUtils.ifEmpty(SessionContextHolder.getScope(), Scope::parse);
|
|
|
+// if (scope == Scope.ADMIN) {
|
|
|
+// category.setType("0");
|
|
|
+// }else {
|
|
|
+// List<Long> merchants = this.merchantService.getMerchantIdsByUserId(userId);
|
|
|
+// if (ObjectUtils.isEmpty(merchants)) {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+// category.setMerchantId(merchants.get(0));
|
|
|
+// category.setType("1");
|
|
|
+// }
|
|
|
if (StringUtils.isEmpty(category.getParentId())){
|
|
|
category.setParentId(0l);
|
|
|
}
|
|
@@ -86,9 +86,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|
|
}
|
|
|
Page<Category> page = this.lambdaQuery()
|
|
|
.like(StringUtils.notEmpty(param.getName()), Category::getName, param.getName())
|
|
|
- .eq(StringUtils.notEmpty(param.getMerchantId()),Category::getMerchantId,param.getMerchantId())
|
|
|
+// .eq(StringUtils.notEmpty(param.getMerchantId()),Category::getMerchantId,param.getMerchantId())
|
|
|
.eq(Objects.nonNull(param.getEnabled()), Category::getEnabled, param.getEnabled())
|
|
|
- .eq(StringUtils.notEmpty(param.getType()),Category::getType,param.getType())
|
|
|
+// .eq(StringUtils.notEmpty(param.getType()),Category::getType,param.getType())
|
|
|
.orderByAsc(Category::getSort).page(DatabaseContextHolder.page(param.getPaging()));
|
|
|
return DatabaseContextHolder.pagination(page, CategoryCopier.INSTANCE::copying);
|
|
|
}
|
|
@@ -108,8 +108,8 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|
|
param.setType("1");
|
|
|
}
|
|
|
List<Category> categories = this.lambdaQuery().eq(Category::getEnabled, true)
|
|
|
- .eq(StringUtils.notEmpty(param.getType()),Category::getType,param.getType())
|
|
|
- .eq(StringUtils.notEmpty(param.getMerchantId()),Category::getMerchantId,param.getMerchantId())
|
|
|
+// .eq(StringUtils.notEmpty(param.getType()),Category::getType,param.getType())
|
|
|
+// .eq(StringUtils.notEmpty(param.getMerchantId()),Category::getMerchantId,param.getMerchantId())
|
|
|
.orderByAsc(Category::getSort).list();
|
|
|
categories.sort(Comparator.comparing(Category::getType).thenComparing(Category::getSort));
|
|
|
List<CategoryDTO> categoryDTOS = CategoryCopier.INSTANCE.copying(categories);
|
|
@@ -157,8 +157,8 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|
|
}
|
|
|
List<Category> categories = this.lambdaQuery()
|
|
|
.eq(Category::getEnabled, true)
|
|
|
- .eq(StringUtils.notEmpty(param.getType()),Category::getType,param.getType())
|
|
|
- .eq(StringUtils.notEmpty(param.getMerchantId()),Category::getMerchantId,param.getMerchantId())
|
|
|
+// .eq(StringUtils.notEmpty(param.getType()),Category::getType,param.getType())
|
|
|
+// .eq(StringUtils.notEmpty(param.getMerchantId()),Category::getMerchantId,param.getMerchantId())
|
|
|
.orderByAsc(Category::getSort).list();
|
|
|
categories.sort(Comparator.comparing(Category::getType).thenComparing(Category::getSort));
|
|
|
return CategoryCopier.INSTANCE.copying(categories);
|