package com.usky.system.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.system.domain.HceReview;
import com.usky.system.service.HceReviewService;
import com.usky.system.service.vo.HceReviewRequestVO;
import com.usky.system.service.vo.HceReviewScoreVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 帮助中心建议反馈表 前端控制器
 * </p>
 *
 * @author han
 * @since 2024-08-07
 */
@RestController
@RequestMapping("/hceReview")
public class HceReviewController {
    @Autowired
    private HceReviewService hceReviewService;

    /**
     * 新增
     * @param hceReview
     * @return
     */
    @PostMapping
    ApiResult<Void> add(@RequestBody HceReview hceReview){
        hceReviewService.add(hceReview);
        return ApiResult.success();
    }

    /**
     * 修改
     * @param hceReview
     * @return
     */
    @PutMapping
    ApiResult<Void> edit(@RequestBody HceReview hceReview){
        hceReviewService.edit(hceReview);
        return ApiResult.success();
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    ApiResult<Void> remove(@PathVariable("id") Integer id){
        hceReviewService.remove(id);
        return ApiResult.success();
    }

    /**
     * 列表
     * @param requestVO
     * @return
     */
    @PostMapping("page")
    ApiResult<CommonPage<HceReview>> page(@RequestBody HceReviewRequestVO requestVO){
        return ApiResult.success(hceReviewService.page(requestVO));
    }

    @PostMapping("score")
    ApiResult<Void> score(@RequestBody HceReviewScoreVO scoreVO){
        hceReviewService.score(scoreVO);
        return ApiResult.success();
    }

}

