| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package com.kym.service.impl;
- import com.github.pagehelper.PageHelper;
- import com.github.yulichang.base.MPJBaseServiceImpl;
- import com.github.yulichang.toolkit.JoinWrappers;
- import com.github.yulichang.wrapper.MPJLambdaWrapper;
- import com.kym.common.exception.BusinessException;
- import com.kym.common.utils.CommUtil;
- import com.kym.entity.ActivityStation;
- import com.kym.entity.Coupon;
- import com.kym.entity.RechargeRights;
- import com.kym.entity.queryParams.RightsQueryParam;
- import com.kym.entity.common.PageBean;
- import com.kym.entity.common.PageParams;
- import com.kym.mapper.RechargeRightsMapper;
- import com.kym.service.RechargeRightsService;
- import org.springframework.stereotype.Service;
- import java.util.List;
- /**
- * <p>
- * 充值权益表 服务实现类
- * </p>
- *
- * @author skyline
- * @since 2023-10-18
- */
- @Service
- public class RechargeRightsServiceImpl extends MPJBaseServiceImpl<RechargeRightsMapper, RechargeRights> implements RechargeRightsService {
- /**
- * 所选站点可以参与的充值权益卡活动
- *
- * @param params
- * @return
- */
- @Override
- public PageBean<RechargeRights> listAvailableRechargeRights(RightsQueryParam params) {
- if (CommUtil.isEmptyOrNull(params.getStationId())) {
- throw new BusinessException("请选择充电站点");
- }
- PageHelper.startPage(params.getPageNum(), params.getPageSize());
- MPJLambdaWrapper<RechargeRights> wrapper = JoinWrappers.lambda(RechargeRights.class)
- .selectAll(RechargeRights.class)
- .leftJoin(ActivityStation.class, ActivityStation::getActivityId, RechargeRights::getActivityId)
- .eq(RechargeRights::getStatus, Coupon.STATUS_进行中)
- .eq(ActivityStation::getStationId, params.getStationId());
- List<RechargeRights> res = this.selectJoinList(RechargeRights.class, wrapper);
- return new PageBean<>(res);
- }
- @Override
- public PageBean<RechargeRights> listRechargeRight(PageParams pageParams, String activityId) {
- PageHelper.startPage(pageParams.getPageNum(), pageParams.getPageSize());
- var list = lambdaQuery().eq(!CommUtil.isEmptyOrNull(activityId), RechargeRights::getActivityId, activityId).orderByAsc(RechargeRights::getEndTime).list();
- return new PageBean<>(list);
- }
- }
|