Commit 4a30cdb8 authored by fhj's avatar fhj

模板服务 -> 活动页需求

parent 8b46ecbb
package com.ssy.lingxi.platform.template.service.controller.web;
import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.service.entity.adorn.PageTemplate;
import com.ssy.lingxi.platform.template.service.model.dto.common.IdDTO;
......@@ -106,7 +108,7 @@ public class PageTemplateWebController extends BaseController {
@ApiOperation(value = "获取所有活动模板")
@GetMapping("/findAllActivityTemplate")
public Wrapper<List<PageTemplate>> findAllActivityTemplate(Integer environment) {
return pageTemplateWebService.findAllActivityTemplate(environment);
public Wrapper<PageData<PageTemplate>> findAllActivityTemplate(PageVO dto, Integer environment) {
return pageTemplateWebService.findAllActivityTemplate(dto, environment);
}
}
package com.ssy.lingxi.platform.template.service.repository;
import com.ssy.lingxi.platform.template.service.entity.adorn.PageTemplate;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
......@@ -23,6 +25,5 @@ public interface PageTemplateRepository extends JpaRepository<PageTemplate, Long
List<PageTemplate> findByEnvironmentAndTypeAndStatusAndShelf(Integer environment, Integer type, Integer status, Integer shelf);
List<PageTemplate> findByEnvironmentAndTypeAndAllow(Integer environment, Integer type, Integer allow);
Page<PageTemplate> findByEnvironmentAndTypeAndAllow(Integer environment, Integer type, Integer allow, Pageable pageable);
}
package com.ssy.lingxi.platform.template.service.service.web;
import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.service.entity.adorn.PageTemplate;
import com.ssy.lingxi.platform.template.service.model.dto.common.IdDTO;
......@@ -44,5 +46,5 @@ public interface PageTemplateWebService {
Wrapper<Void> useChannelTemplate(IdDTO dto, UserLoginCacheDTO user);
Wrapper<List<PageTemplate>> findAllActivityTemplate(Integer environment);
Wrapper<PageData<PageTemplate>> findAllActivityTemplate(PageVO dto, Integer environment);
}
......@@ -3,6 +3,8 @@ package com.ssy.lingxi.platform.template.service.serviceimpl.web;
import cn.hutool.core.collection.CollectionUtil;
import com.ssy.lingxi.common.exception.BusinessException;
import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.ResponseCode;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.template.service.constant.CommonBooleanEnum;
......@@ -26,6 +28,8 @@ import com.ssy.lingxi.platform.template.service.service.web.PageTemplateWebServi
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -378,14 +382,18 @@ public class PageTemplateWebServiceImpl implements PageTemplateWebService {
@Override
@ApiOperation(value = "获取所有活动模板")
public Wrapper<List<PageTemplate>> findAllActivityTemplate(Integer environment) {
public Wrapper<PageData<PageTemplate>> findAllActivityTemplate(PageVO dto, Integer environment) {
if(environment == null) {
return Wrapper.fail("商城环境不能为空");
}
return Wrapper.success(pageTemplateRepository.findByEnvironmentAndTypeAndAllow(
Page<PageTemplate> page = pageTemplateRepository.findByEnvironmentAndTypeAndAllow(
environment,
PageTemplateTypeEnum.ACTIVITY.getCode(),
CommonBooleanEnum.YES.getCode()
));
CommonBooleanEnum.YES.getCode(),
PageRequest.of(dto.getCurrent() - 1, dto.getPageSize())
);
return Wrapper.success(new PageData<>(page.getTotalElements(), page.getContent()));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment