111
This commit is contained in:
1 parent
b3845e6d34
commit
d43fe27242
2 files changed
+19
-1
No files matched your search
+8
@@ -1,8 +1,10 @@
|
||||
package com.bsd.pjcloud.common.core.constant.enums;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -28,4 +30,10 @@ public enum MerchantTypeEnum {
|
||||
static public List<MerchantTypeEnum> all() {
|
||||
return List.of(values());
|
||||
}
|
||||
|
||||
public static MerchantTypeEnum valueOfByType(String type) {
|
||||
return Arrays.stream(MerchantTypeEnum.values())
|
||||
.filter(v -> ObjectUtil.equal(v.getType(), type))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -264,7 +264,17 @@ public class MchManageController {
|
||||
public R getSelect(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
||||
DataScope dataScope = null;
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
List<Long> selfMchIdList = mchManageService.getSelfMchIdList(user.getId(), List.of(MerchantTypeEnum.CANTEEN));
|
||||
List<MerchantTypeEnum> typeList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(dto.getTypes())) {
|
||||
MerchantTypeEnum targeTypes = MerchantTypeEnum.valueOfByType(dto.getTypes());
|
||||
if (ObjectUtil.isNotEmpty(targeTypes)) {
|
||||
typeList.add(targeTypes);
|
||||
}
|
||||
}
|
||||
if (typeList.isEmpty()) {
|
||||
typeList = List.of(MerchantTypeEnum.CANTEEN);
|
||||
}
|
||||
List<Long> selfMchIdList = mchManageService.getSelfMchIdList(user.getId(), typeList);
|
||||
if (ObjectUtil.isNotEmpty(selfMchIdList)) {
|
||||
List<Long> ids = dto.getIds();
|
||||
if (ObjectUtil.isEmpty(ids)) ids = new ArrayList<>();
|
||||
|
||||
Reference in new issue
Block a user