package com.doumee.api.web;
|
|
import com.doumee.config.annotation.LoginRequired;
|
import com.doumee.core.model.ApiResponse;
|
import com.doumee.dao.business.model.Article;
|
import com.doumee.dao.web.dto.ArticleDTO;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
/**
|
* Created by IntelliJ IDEA.
|
*
|
* @Author : Rk
|
* @create 2023/3/23 17:33
|
*/
|
@Api(tags = "咖啡百科")
|
@RestController
|
@RequestMapping("/web/article")
|
@Slf4j
|
public class ArticleApi extends ApiController{
|
|
|
/**
|
* 条件查询单条记录
|
*
|
* @param article 实体对象
|
* @return Article
|
*/
|
/**
|
* 咖啡百科详情
|
* @param id
|
* @return
|
*/
|
@LoginRequired
|
@ApiOperation(value = "咖啡百科详情", notes = "小程序端")
|
@GetMapping("/findOneById")
|
public ApiResponse<Article> findOneById(@RequestParam Integer id){
|
|
return ApiResponse.success(articleService.findById(id));
|
}
|
|
/**
|
* 条件查询
|
*
|
* @param labelId 实体对象
|
* @return List<Article>
|
*/
|
@LoginRequired
|
@ApiOperation(value = "咖啡百科列表", notes = "小程序端")
|
@GetMapping("/findList")
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
|
})
|
public ApiResponse<List<ArticleDTO>> findList(@RequestParam Integer labelId){
|
Article article = new Article();
|
article.setLabelId(labelId);
|
return ApiResponse.success(articleService.findList(article));
|
}
|
}
|