package com.playlet.web.controller.app;

import com.github.pagehelper.PageInfo;
import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletPublicDetail;
import com.playlet.web.service.app.PlayletPublicDetailAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Api(tags = "公众号*文章详情接口")
@RestController
@RequestMapping(value = "/app/detail")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletPublicDetailAppController {

    private final PlayletPublicDetailAppService playletPublicDetailAppService;

    /**
     * 分页查询任务列表
     */
    @ResponseBody
    @PostMapping("/getList")
    @ApiOperation(value = "分页查询文章列表")
    public Result<PageInfo<PlayletPublicDetail>> getList(@RequestBody PlayletPublicDetail playletPublicDetail,
                                                         @RequestParam(value = "pageNum") Integer pageNum,
                                                         @RequestParam(value = "pageSize") Integer pageSize) {
        return Result.success(playletPublicDetailAppService.getList(playletPublicDetail, pageNum, pageSize));
    }

    /**
     * 任务详情
     */
    @ResponseBody
    @GetMapping("/getById")
    @ApiOperation(value = "查询文章详情")
    public Result<PlayletPublicDetail> getById(@RequestParam(value = "id") Long id) {
        return Result.success(playletPublicDetailAppService.getById(id));
    }

}
