后台管理页面用户管理新增用户问题修复

This commit is contained in:
xiaowang
2026-02-25 17:27:52 +08:00
parent cd0c55aa28
commit f0980501dc
5 changed files with 19 additions and 2 deletions
@@ -8,6 +8,8 @@ import com.xiaowang.yuminailcore.vo.ShopVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/admin/shops")
@RequiredArgsConstructor
@@ -44,6 +46,12 @@ public class AdminShopController {
return Result.success(success);
}
@GetMapping("/list/all")
public Result<List<ShopVO>> listAllShops() {
List<ShopVO> shops = shopService.listAllShops();
return Result.success(shops);
}
@GetMapping("/{id}")
public Result<ShopVO> getShop(@PathVariable Long id) {
ShopVO shop = shopService.getShopById(id);
@@ -78,7 +78,10 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
@Override
public List<ShopVO> listAllShops() {
List<ShopDO> shopDOs = shopMapper.selectList(null);
List<ShopDO> shopDOs = shopMapper.selectList(
Wrappers.lambdaQuery(ShopDO.class)
.eq(ShopDO::getIsDelete, 0)
);
return shopDOs.stream()
.map(this::convertToVO)
.collect(Collectors.toList());
@@ -100,6 +103,7 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopDO> implements
Page<ShopDO> pageParam = new Page<>(page, size);
LambdaQueryWrapper<ShopDO> wrapper = Wrappers.lambdaQuery(ShopDO.class);
wrapper.eq(ShopDO::getIsDelete, 0);
if (StringUtils.hasText(keyword)) {
wrapper.and(w -> w.like(ShopDO::getShopName, keyword)
.or().like(ShopDO::getDescription, keyword)
@@ -54,6 +54,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
userDO.setVipId(userDTO.getVipId());
userDO.setIsDelete(0);
userDO.setStatus(1);
String defaultAvatar = "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png";
userDO.setAvatar(defaultAvatar);
userMapper.insert(userDO);
return userDO.getId();
}