feat: 优化广告列表接口
This commit is contained in:
parent
8371104912
commit
b4ecf2f8f0
|
|
@ -4,7 +4,7 @@ import com.nflg.mobilebroken.common.pojo.ApiResult;
|
|||
import com.nflg.mobilebroken.common.pojo.request.AdvertisementRequst;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.AdvertisementVO;
|
||||
import com.nflg.mobilebroken.repository.service.IAdvertisementService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
|
@ -29,7 +29,7 @@ public class AdvertisementController {
|
|||
* @param request 请求参数
|
||||
* @return 广告列表
|
||||
*/
|
||||
@GetMapping("getByType")
|
||||
@PostMapping("getByType")
|
||||
public ApiResult<AdvertisementVO> getAdvertisement(@Valid @RequestBody @NotNull AdvertisementRequst request){
|
||||
return ApiResult.success(advertisementService.getByType(request.getType(),request.getPosition()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
package com.nflg.mobilebroken.common.pojo.vo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AdvertisementListVO {
|
||||
|
|
@ -37,6 +41,24 @@ public class AdvertisementListVO {
|
|||
*/
|
||||
private Integer interval;
|
||||
|
||||
/**
|
||||
* 广告内容
|
||||
*/
|
||||
@JsonIgnore
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 广告内容列表
|
||||
*/
|
||||
private List<AdvertisementItemVO> items;
|
||||
|
||||
public List<AdvertisementItemVO> getItems(){
|
||||
if (StrUtil.isBlank(content)){
|
||||
return null;
|
||||
}
|
||||
return JSONUtil.toList(content, AdvertisementItemVO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue