Commit 7bb59e17 authored by zhengyi's avatar zhengyi

app通知弹窗数据查询bug修复

parent 45ac785b
......@@ -81,7 +81,11 @@ public class BannerPopController {
@ApiOperation("获得广告弹窗分页")
@PreAuthorize("@ss.hasPermission('ecw:banner-pop:query')")
public CommonResult<PageResult<BannerPopBackVO>> getBannerPopPage(@Valid BannerPopQueryVO query, PageVO page) {
PageResult<BannerPopDO> pageResult = bannerPopService.getBannerPopPage(query, page);
if (Objects.isNull(query)){
// 保证后面查询条件判断不报空指针
query = new BannerPopQueryVO();
}
PageResult<BannerPopDO> pageResult = bannerPopService.getBannerPopPage(query, page, 2);
return success(BannerPopConvert.INSTANCE.convertPage(pageResult));
}
......
......@@ -27,6 +27,7 @@ import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
......@@ -87,7 +88,11 @@ public class AppBannerPopController {
@ApiOperation("获得广告弹窗分页")
@PreAuthenticated
public CommonResult<PageResult<BannerPopBackVO>> getBannerPopPage(@Valid BannerPopQueryVO query, PageVO page) {
PageResult<BannerPopDO> pageResult = bannerPopService.getBannerPopPage(query, page);
if (Objects.isNull(query)){
// 保证后面查询条件判断不报空指针
query = new BannerPopQueryVO();
}
PageResult<BannerPopDO> pageResult = bannerPopService.getBannerPopPage(query, page, 1);
return success(BannerPopConvert.INSTANCE.convertPage(pageResult));
}
......
......@@ -56,7 +56,7 @@ public interface BannerPopService extends IService<BannerPopDO> {
* @param query 查询
* @return 广告弹窗分页
*/
PageResult<BannerPopDO> getBannerPopPage(BannerPopQueryVO query, PageVO page);
PageResult<BannerPopDO> getBannerPopPage(BannerPopQueryVO query, PageVO page, Integer userType);
/**
* 获得广告弹窗列表, 用于 Excel 导出
......
......@@ -76,24 +76,21 @@ public class BannerPopServiceImpl extends AbstractService<BannerPopMapper, Banne
}
@Override
public PageResult<BannerPopDO> getBannerPopPage(BannerPopQueryVO query, PageVO page) {
if (Objects.isNull(query)){
// 保证后面查询条件判断不报空指针
query = new BannerPopQueryVO();
public PageResult<BannerPopDO> getBannerPopPage(BannerPopQueryVO query, PageVO page, Integer userType) {
LambdaQueryWrapper<BannerPopDO> queryWrapper = new LambdaQueryWrapper<>();
if (Objects.nonNull(userType) && userType == 1) {
// 会员端访问,只访问状态开启的和未过期的
queryWrapper.eq(BannerPopDO::getStatus, 0);
queryWrapper.apply("((validate_start IS NOT NULL AND validate_end IS NULL AND validate_start < now())\n" +
"\t\tOR \n" +
"\t\t( validate_end IS NOT NULL AND validate_start IS NULL AND validate_end > now())\n" +
"\t\tor\n" +
"\t (validate_start IS NOT NULL and validate_start < now() and validate_end IS NOT NULL and validate_end > now() ) )\t");
}
// LambdaQueryWrapper<BannerPopDO> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(BannerPopDO::getStatus, 0);
// queryWrapper.apply("((validate_start IS NOT NULL AND validate_end IS NULL AND validate_start < now())\n" +
// "\t\tOR \n" +
// "\t\t( validate_end IS NOT NULL AND validate_start IS NULL AND validate_end > now())\n" +
// "\t\tor\n" +
// "\t (validate_start IS NOT NULL and validate_start < now() and validate_end IS NOT NULL and validate_end > now() ) )\t");
// return bannerPopMapper.selectPage(page, queryWrapper);
// return bannerPopMapper.selectPage(page, query);
return bannerPopMapper.selectPage(page, new LambdaQueryWrapper<BannerPopDO>()
.eq(Objects.nonNull(query.getStatus()), BannerPopDO::getStatus, query.getStatus())
.between(Objects.nonNull(query.getBeginCreateTime()) && Objects.nonNull(query.getEndCreateTime()), BannerPopDO::getCreateTime, query.getBeginCreateTime(), query.getEndCreateTime())
.orderByDesc(BannerPopDO::getUpdateTime));
queryWrapper.eq(Objects.nonNull(query.getStatus()), BannerPopDO::getStatus, query.getStatus());
queryWrapper.between(Objects.nonNull(query.getBeginCreateTime()) && Objects.nonNull(query.getEndCreateTime()), BannerPopDO::getCreateTime, query.getBeginCreateTime(), query.getEndCreateTime());
queryWrapper.orderByDesc(BannerPopDO::getUpdateTime);
return bannerPopMapper.selectPage(page, queryWrapper);
}
@Override
......
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