This commit is contained in:
moxiangrong
2024-02-20 19:33:50 +08:00
parent 9c85524e14
commit 477d29d69f
31 changed files with 246 additions and 83 deletions

View File

@ -67,7 +67,7 @@ public class PopupController {
@GetMapping("/get")
@Operation(summary = "获得弹窗")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('shop:popup:query')")
@PreAuthorize("@ss.hasPermission('shop:popup:get')")
public CommonResult<PopupRespVO> getPopup(@RequestParam("id") Long id) {
PopupDO popup = popupService.getPopup(id);
return success(PopupConvert.INSTANCE.convert(popup));
@ -76,7 +76,7 @@ public class PopupController {
@GetMapping("/list")
@Operation(summary = "获得弹窗列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('shop:popup:query')")
@PreAuthorize("@ss.hasPermission('shop:popup:list')")
public CommonResult<List<PopupRespVO>> getPopupList(@RequestParam("ids") Collection<Long> ids) {
List<PopupDO> list = popupService.getPopupList(ids);
return success(PopupConvert.INSTANCE.convertList(list));

View File

@ -139,18 +139,20 @@ public class ShopAssistantServiceImpl implements ShopAssistantService {
}
private void fillData(PageResult<ShopAssistantRespVO> resPage) {
List<Long> userIds = resPage.getList().stream().map(ShopAssistantRespVO::getUserId).distinct().collect(Collectors.toList());
List<Long> storeIds = resPage.getList().stream().map(ShopAssistantRespVO::getStoreId).distinct().collect(Collectors.toList());
Map<Long, MemberUserDO> userMap = userService.getUserList(userIds).stream().collect(Collectors.toMap(MemberUserDO::getId, Function.identity()));
Map<Long, ShopDO> storeMap = shopService.getShopList(storeIds).stream().collect(Collectors.toMap(ShopDO::getId, Function.identity()));
if(resPage.getTotal() > 0){
List<Long> userIds = resPage.getList().stream().map(ShopAssistantRespVO::getUserId).distinct().collect(Collectors.toList());
List<Long> storeIds = resPage.getList().stream().map(ShopAssistantRespVO::getStoreId).distinct().collect(Collectors.toList());
Map<Long, MemberUserDO> userMap = userService.getUserList(userIds).stream().collect(Collectors.toMap(MemberUserDO::getId, Function.identity()));
Map<Long, ShopDO> storeMap = shopService.getShopList(storeIds).stream().collect(Collectors.toMap(ShopDO::getId, Function.identity()));
resPage.getList().forEach(item -> {
MemberUserDO user = userMap.getOrDefault(item.getUserId(), new MemberUserDO());
ShopDO shop = storeMap.getOrDefault(item.getStoreId(), new ShopDO());
item.setAvatar(user.getAvatar());
item.setNickname(user.getNickname());
item.setStoreName(shop.getStoreName());
});
resPage.getList().forEach(item -> {
MemberUserDO user = userMap.getOrDefault(item.getUserId(), new MemberUserDO());
ShopDO shop = storeMap.getOrDefault(item.getStoreId(), new ShopDO());
item.setAvatar(user.getAvatar());
item.setNickname(user.getNickname());
item.setStoreName(shop.getStoreName());
});
}
}
@Override