记得上下班打卡 | git大法好,push需谨慎

Commit 9d276043 authored by 张国柄's avatar 张国柄

收藏API补充实现

parent 4194836f
package com.liquidnet.service.adam.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "AdamCollectParam", description = "添加收藏入参")
@Data
public class AdamCollectParam implements java.io.Serializable {
private static final long serialVersionUID = 7397579764049783649L;
@ApiModelProperty(position = 11, required = true, value = "内容ID[64]", example = "Swagger")
private String contentId;
@ApiModelProperty(position = 12, required = true, value = "内容类型", allowableValues = "VIDEO,TICKET,SITE,ARTIST,BAND,BRAND,STYLE,GOODS,MUSIC,SONG")
private String type;
}
......@@ -4,7 +4,6 @@ import com.github.pagehelper.PageInfo;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.adam.dto.AdamCollectParam;
import com.liquidnet.service.adam.dto.vo.AdamCollectBaseVo;
import com.liquidnet.service.adam.dto.vo.AdamCollectVo;
import com.liquidnet.service.adam.service.IAdamCollectionService;
......@@ -14,7 +13,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -38,15 +36,16 @@ public class AdamCollectionController {
@ApiOperationSupport(order = 1)
@ApiOperation(value = "添加收藏")
@PostMapping("add")
public ResponseDto<Object> add(@RequestBody AdamCollectParam parameter) {
public ResponseDto<Object> add(@RequestParam String type, @RequestParam String contentId) {
// TODO: 2021/4/28 数据校验
String currentUid = CurrentUtil.getCurrentUid();
AdamCollectBaseVo existVo = adamCollectionService.query(currentUid, parameter.getType(), parameter.getContentId());
AdamCollectBaseVo existVo = adamCollectionService.query(currentUid, type, contentId);
if (null != existVo) return ResponseDto.success();
AdamCollectBaseVo collectVo = AdamCollectBaseVo.getNew();
BeanUtils.copyProperties(parameter, collectVo);
collectVo.setType(type);
collectVo.setContentId(contentId);
collectVo.setUid(currentUid);
adamCollectionService.add(collectVo);
......
......@@ -34,7 +34,7 @@ public class AdamDisposedController {
@ApiOperationSupport(order = 1)
@ApiOperation(value = "添加")
@PostMapping("add")
public ResponseDto<Object> add(@RequestParam String type, String contentId) {
public ResponseDto<Object> add(@RequestParam String type, @RequestParam String contentId) {
// TODO: 2021/4/28 数据校验
String currentUid = CurrentUtil.getCurrentUid();
......
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