PageHelper
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.account.dto.QueryReceiveDto;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.ShopActivateCouponRecord;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,8 +16,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface ShopActivateCouponRecordMapper extends BaseMapper<ShopActivateCouponRecord> {
|
||||
|
||||
Page<CouponReceiveVo> queryReceive(Page<CouponReceiveVo> page, QueryReceiveDto param);
|
||||
List<CouponReceiveVo> queryReceive(QueryReceiveDto param);
|
||||
|
||||
Page<ShopActivateCouponRecord> findByUser(Page<ShopActivateCouponRecord> page, List<Long> shopUserIds, Integer status);
|
||||
List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status);
|
||||
List<UserCouponVo> queryByVipIdAndShopId(Long shopId, Long shopUserId);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.czg.account.service.ShopActivateCouponRecordService;
|
||||
import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.czg.service.account.mapper.ShopActivateCouponRecordMapper;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
@@ -22,13 +21,13 @@ import java.util.List;
|
||||
public class ShopActivateCouponRecordServiceImpl extends ServiceImpl<ShopActivateCouponRecordMapper, ShopActivateCouponRecord> implements ShopActivateCouponRecordService {
|
||||
|
||||
@Override
|
||||
public Page<CouponReceiveVo> queryReceive(Page<CouponReceiveVo> page, QueryReceiveDto param) {
|
||||
return getMapper().queryReceive(page, param);
|
||||
public List<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
|
||||
return getMapper().queryReceive(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ShopActivateCouponRecord> findByUser(Page<ShopActivateCouponRecord> page, List<Long> shopUserIds, Integer status) {
|
||||
return getMapper().findByUser(page, shopUserIds, status);
|
||||
public List<ShopActivateCouponRecord> findByUser(List<Long> shopUserIds, Integer status) {
|
||||
return getMapper().findByUser(shopUserIds, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.czg.product.entity.Product;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.service.account.mapper.ShopCouponMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
@@ -80,18 +82,22 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
||||
|
||||
@Override
|
||||
public Page<CouponReceiveVo> queryReceive(QueryReceiveDto param) {
|
||||
return couponRecordService.queryReceive(PageUtil.buildPage(), param);
|
||||
Page<Object> page = PageUtil.buildPage();
|
||||
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
|
||||
return PageUtil.convert(new PageInfo<>(couponRecordService.queryReceive(param)));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<ShopActivateCouponRecord> find(Long userId, Long shopId, Integer status) {
|
||||
Page<Object> page = PageUtil.buildPage();
|
||||
PageHelper.startPage(Math.toIntExact(page.getPageNumber()),Math.toIntExact(page.getPageSize()));
|
||||
List<Long> shopUserIds = shopUserService.queryChain()
|
||||
.eq(ShopUser::getUserId, userId)
|
||||
.eq(ShopUser::getShopId, shopId)
|
||||
.select(ShopUser::getId).listAs(Long.class);
|
||||
if (CollectionUtil.isNotEmpty(shopUserIds)) {
|
||||
return couponRecordService.findByUser(PageUtil.buildPage(), shopUserIds, status);
|
||||
return PageUtil.convert(new PageInfo<>(couponRecordService.findByUser(shopUserIds, status)));
|
||||
}
|
||||
return new Page<>();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,20 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>sqlparser4.5</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-redis</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user