Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner

This commit is contained in:
zhangchenbiao
2023-06-12 10:16:52 +08:00
16 changed files with 630 additions and 146 deletions

View File

@@ -0,0 +1,59 @@
package com.cool.store.controller;
import com.cool.store.dto.content.ContentAddDto;
import com.cool.store.dto.content.ContentQueryListDto;
import com.cool.store.dto.content.ContentUpdateDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ContentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("news")
@Slf4j
public class ContentController {
@Autowired
private ContentService contentService;
@PostMapping("/add")
@ApiOperation("新增动态")
public ResponseResult<String> addContent(@RequestBody ContentAddDto dto) {
return ResponseResult.success(contentService.addNews(dto));
}
@PostMapping("/delete")
@ApiOperation("删除动态")
public void deleteContent(@RequestParam(value = "contentId") String contentId) {
contentService.deleteContent(contentId);
}
@PostMapping("/modify")
@ApiOperation("修改动态")
public void updateContent(@RequestBody ContentUpdateDto dto) {
contentService.updateContent(dto);
}
@PostMapping("/queryContentList")
@ApiOperation("查询动态列表")
public ResponseResult<PageInfo<HyContentInfoDO>> queryContentList(@RequestBody ContentQueryListDto dto) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<HyContentInfoDO> list = contentService.queryContentList(dto);
PageInfo<HyContentInfoDO> page = new PageInfo<>(list);
return ResponseResult.success(page);
}
@PostMapping("/detail")
@ApiOperation("动态详情")
public ResponseResult<HyContentInfoDO> queryContentInfo(@RequestParam String contentId) {
return ResponseResult.success(contentService.queryContentInfo(contentId));
}
}