mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
广告分页接口新增查询、新增/修改对于广告位置参数做去重和排序后查询和入库
This commit is contained in:
+6
-1
@@ -1,12 +1,16 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.funds.advertisement.vo;
|
package com.cf.imes.module.system.controller.admin.funds.advertisement.vo;
|
||||||
|
|
||||||
import com.cf.imes.framework.common.pojo.PageParam;
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
|
import com.cf.imes.framework.common.validation.InScope;
|
||||||
|
import com.cf.imes.module.system.enums.advertisement.AdvertisementPositionEnum;
|
||||||
import com.cf.imes.module.system.validation.advertisement.AdvertisementStatus;
|
import com.cf.imes.module.system.validation.advertisement.AdvertisementStatus;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 广告分页 Request VO")
|
@Schema(description = "管理后台 - 广告分页 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -20,7 +24,8 @@ public class AdvertisementPageReqVO extends PageParam {
|
|||||||
private String adName;
|
private String adName;
|
||||||
|
|
||||||
@Schema(description = "广告位置")
|
@Schema(description = "广告位置")
|
||||||
private String adPosition;
|
@InScope(value = AdvertisementPositionEnum.class, desc = "广告位置")
|
||||||
|
private List<Integer> adPosition;
|
||||||
|
|
||||||
@Schema(description = "广告状态,0未发布 1已发布 2已结束", example = "0")
|
@Schema(description = "广告状态,0未发布 1已发布 2已结束", example = "0")
|
||||||
@AdvertisementStatus
|
@AdvertisementStatus
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.system.dal.mysql.funds.advertisement;
|
package com.cf.imes.module.system.dal.mysql.funds.advertisement;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
@@ -24,9 +25,10 @@ public interface AdvertisementMapper extends BaseMapperX<AdvertisementDO> {
|
|||||||
|
|
||||||
default PageResult<AdvertisementDO> selectPage(AdvertisementPageReqVO reqVO) {
|
default PageResult<AdvertisementDO> selectPage(AdvertisementPageReqVO reqVO) {
|
||||||
|
|
||||||
|
List<Integer> adPosition = reqVO.getAdPosition().stream().sorted().distinct().toList();
|
||||||
LambdaQueryWrapperX<AdvertisementDO> queryWrapper = new LambdaQueryWrapperX<AdvertisementDO>()
|
LambdaQueryWrapperX<AdvertisementDO> queryWrapper = new LambdaQueryWrapperX<AdvertisementDO>()
|
||||||
.likeIfPresent(AdvertisementDO::getAdName, reqVO.getAdName())
|
.likeIfPresent(AdvertisementDO::getAdName, reqVO.getAdName())
|
||||||
.likeIfPresent(AdvertisementDO::getAdPosition, reqVO.getAdPosition())
|
.likeIfPresent(AdvertisementDO::getAdPosition, CollUtil.isNotEmpty(adPosition) ? CollUtil.join(adPosition, ",") : null)
|
||||||
.eqIfPresent(AdvertisementDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(AdvertisementDO::getStatus, reqVO.getStatus())
|
||||||
.eqIfPresent(AdvertisementDO::getDeleted, false);
|
.eqIfPresent(AdvertisementDO::getDeleted, false);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -63,7 +63,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
|
|
||||||
// 插入广告
|
// 插入广告
|
||||||
AdvertisementDO advertisementDO = BeanUtils.toBean(createReqVO, AdvertisementDO.class)
|
AdvertisementDO advertisementDO = BeanUtils.toBean(createReqVO, AdvertisementDO.class)
|
||||||
.setAdPosition(createReqVO.getAdPosition())
|
.setAdPosition(createReqVO.getAdPosition().stream().sorted().distinct().toList())
|
||||||
.setStatus(AdvertisementStatusEnum.UNPUBLISHED.getStatus())
|
.setStatus(AdvertisementStatusEnum.UNPUBLISHED.getStatus())
|
||||||
.setSoftwareId(SOFT_WARE_ID);
|
.setSoftwareId(SOFT_WARE_ID);
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public class AdvertisementServiceImpl implements AdvertisementService{
|
|||||||
.setAdImagePath(reqVO.getAdImagePath())
|
.setAdImagePath(reqVO.getAdImagePath())
|
||||||
.setStartTime(reqVO.getStartTime())
|
.setStartTime(reqVO.getStartTime())
|
||||||
.setEndTime(reqVO.getEndTime())
|
.setEndTime(reqVO.getEndTime())
|
||||||
.setAdPosition(reqVO.getAdPosition())
|
.setAdPosition(reqVO.getAdPosition().stream().sorted().distinct().toList())
|
||||||
.setSort(ObjectUtil.isNull(reqVO.getSort()) ? advertisementDO.getSort() : reqVO.getSort())
|
.setSort(ObjectUtil.isNull(reqVO.getSort()) ? advertisementDO.getSort() : reqVO.getSort())
|
||||||
.setAdRedirectUrl(StringUtils.isEmpty(reqVO.getAdRedirectUrl()) ? advertisementDO.getAdRedirectUrl() : reqVO.getAdRedirectUrl());
|
.setAdRedirectUrl(StringUtils.isEmpty(reqVO.getAdRedirectUrl()) ? advertisementDO.getAdRedirectUrl() : reqVO.getAdRedirectUrl());
|
||||||
advertisementMapper.updateById(advertisementDO);
|
advertisementMapper.updateById(advertisementDO);
|
||||||
|
|||||||
Reference in New Issue
Block a user