菜单接口修改

This commit is contained in:
张松
2025-02-17 10:53:10 +08:00
parent 1daef6efba
commit 26a3aab8cb
4 changed files with 13 additions and 12 deletions

View File

@@ -109,12 +109,11 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
@Override
public Boolean add(Long shopId, ShopUserAddDTO shopUserAddDTO) {
long userCount = userInfoService.queryChain().eq(UserInfo::getId, shopUserAddDTO.getUserId()).count();
if (userCount == 0) {
throw new ApiNotPrintException("用户信息不存在");
}
long count = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, shopUserAddDTO.getUserId()).count();
if (count > 0) {
UserInfo userInfo = userInfoService.queryChain().eq(UserInfo::getPhone, shopUserAddDTO.getPhone()).one();
if (userInfo == null) {
userInfo = BeanUtil.copyProperties(shopUserAddDTO, UserInfo.class);
userInfoService.save(userInfo);
}else {
throw new ApiNotPrintException("此用户已存在");
}