ShopPushOpenId返回分页数据

This commit is contained in:
张松 2025-03-10 14:59:19 +08:00
parent ef1e14f94c
commit 0b8e742bb8
3 changed files with 10 additions and 10 deletions

View File

@ -8,6 +8,7 @@ import com.czg.account.service.ShopPushOpenIdService;
import com.czg.annotation.SaAdminCheckPermission; import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult; import com.czg.resp.CzgResult;
import com.czg.sa.StpKit; import com.czg.sa.StpKit;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -54,7 +55,7 @@ public class ShopMsgPushController {
*/ */
@SaAdminCheckPermission("shopMsgPush:list") @SaAdminCheckPermission("shopMsgPush:list")
@GetMapping @GetMapping
public CzgResult<List<ShopPushOpenId>> allInfo() { public CzgResult<Page<ShopPushOpenId>> allInfo() {
return CzgResult.success(shopPushOpenIdService.pageInfo(StpKit.USER.getShopId())); return CzgResult.success(shopPushOpenIdService.pageInfo(StpKit.USER.getShopId()));
} }

View File

@ -1,11 +1,10 @@
package com.czg.account.service; package com.czg.account.service;
import com.czg.account.dto.msg.ShopPushOpenIdEditDTO; import com.czg.account.dto.msg.ShopPushOpenIdEditDTO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService; import com.mybatisflex.core.service.IService;
import com.czg.account.entity.ShopPushOpenId; import com.czg.account.entity.ShopPushOpenId;
import java.util.List;
/** /**
* 用户推送信息表 服务层 * 用户推送信息表 服务层
* *
@ -14,7 +13,7 @@ import java.util.List;
*/ */
public interface ShopPushOpenIdService extends IService<ShopPushOpenId> { public interface ShopPushOpenIdService extends IService<ShopPushOpenId> {
List<ShopPushOpenId> pageInfo(Long shopId); Page<ShopPushOpenId> pageInfo(Long shopId);
Boolean edit(Long shopId, ShopPushOpenIdEditDTO shopPushOpenIdEditDTO); Boolean edit(Long shopId, ShopPushOpenIdEditDTO shopPushOpenIdEditDTO);

View File

@ -4,6 +4,8 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.msg.ShopPushOpenIdEditDTO; import com.czg.account.dto.msg.ShopPushOpenIdEditDTO;
import com.czg.exception.ApiNotPrintException; import com.czg.exception.ApiNotPrintException;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl; import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopPushOpenId; import com.czg.account.entity.ShopPushOpenId;
@ -11,8 +13,6 @@ import com.czg.account.service.ShopPushOpenIdService;
import com.czg.service.account.mapper.ShopPushOpenIdMapper; import com.czg.service.account.mapper.ShopPushOpenIdMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 用户推送信息表 服务层实现 * 用户推送信息表 服务层实现
* *
@ -23,12 +23,12 @@ import java.util.List;
public class ShopPushOpenIdServiceImpl extends ServiceImpl<ShopPushOpenIdMapper, ShopPushOpenId> implements ShopPushOpenIdService{ public class ShopPushOpenIdServiceImpl extends ServiceImpl<ShopPushOpenIdMapper, ShopPushOpenId> implements ShopPushOpenIdService{
@Override @Override
public List<ShopPushOpenId> pageInfo(Long shopId) { public Page<ShopPushOpenId> pageInfo(Long shopId) {
// PageHelper.startPage(PageUtil.buildPageHelp()); // PageHelper.startPage(PageUtil.buildPageHelp());
// return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId))); // return PageUtil.convert(new PageInfo<>(mapper.pageInfo(shopId)));
List<ShopPushOpenId> list = list(new QueryWrapper().eq(ShopPushOpenId::getShopId, shopId)); Page<ShopPushOpenId> page = page(PageUtil.buildPage(), new QueryWrapper().eq(ShopPushOpenId::getShopId, shopId));
list.forEach(item -> item.setTypeInfo(JSONArray.parseArray((String) item.getTypeInfo()))); page.getRecords().forEach(item -> item.setTypeInfo(JSONArray.parseArray((String) item.getTypeInfo())));
return list; return page;
} }
@Override @Override