package jnpf.cultivate.controller.web.casebase;

import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.cultivate.service.FtbCultivateCaseBaseService;
import jnpf.model.cultivate.dto.casebase.FtbCultivateCaseBaseAuditDTO;
import jnpf.model.cultivate.dto.casebase.FtbCultivateCaseBaseDTO;
import jnpf.model.cultivate.vo.casebase.FtbCultivateCaseBaseVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Title: web案例库
 * @Author: peng.hao
 * @create: 2024/7/22:11:28
 */
@RestController
@RequestMapping("/case-base")
public class FtbCultivateCaseBaseController {

    @Resource
    FtbCultivateCaseBaseService caseBaseService;

    /**
     * 列表展示
     * @param dto
     * @return
     */
    @GetMapping("/listDisplay")
    public ActionResult<PageListVO<FtbCultivateCaseBaseVO>> listDisplay(FtbCultivateCaseBaseDTO dto){
        return ActionResult.success(caseBaseService.listDisplay(dto));
    }
    /**
     * 详情
     * @param id
     * @return
     */
    @GetMapping("/getDetail/{id}")
    public ActionResult<FtbCultivateCaseBaseVO> getDetail(@PathVariable("id") String id){
        return ActionResult.success(caseBaseService.getDetail(id));
    }

    /**
     * 审核案例
     * @return
     */
    @PutMapping("/reviewCase")
    public ActionResult<String> reviewCase(@RequestBody @Validated FtbCultivateCaseBaseAuditDTO baseAuditDTO){
        caseBaseService.reviewCase(baseAuditDTO);
        return ActionResult.success();
    }
}


