package cn.cecep.talroad.controller;

import cn.cecep.talroad.common.core.web.controller.BasesController;
import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.common.log.annotation.Log;
import cn.cecep.talroad.common.log.enums.BusinessType;
import cn.cecep.talroad.service.IBMainSysFeedbackService;
import cn.cecep.talroad.vo.BMainSysFeedbackVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * 系统使用反馈Controller 控制层
 */
@Api(tags = "系统使用反馈")
@RestController
@RequestMapping("/feedback")
public class BMainSysFeedbackController extends BasesController
{
    @Autowired
    private IBMainSysFeedbackService bMainSysFeedbackService;

    /**
     * 查询系统使用反馈列表
     */
    @ApiOperation(value = "查询系统使用反馈")
    @GetMapping("/list")
    public AjaxResults<IPage<BMainSysFeedbackVo>> list(BMainSysFeedbackVo.SearchVo searchVo)
    {
        Page<BMainSysFeedbackVo> page = new Page<>(searchVo.getPageNum(), searchVo.getPageSize());
        bMainSysFeedbackService.selectSysFeedbackList(page, searchVo);
        return AjaxResults.success(page);
    }

    @ApiOperation(value = "获取系统使用反馈详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResults<BMainSysFeedbackVo> getInfo(@PathVariable("id") String id) {
        return AjaxResults.success(bMainSysFeedbackService.getInfo(id));
    }
    

    /**
     * 新增系统使用反馈
     */
    @ApiOperation(value = "新增系统使用反馈")
    @Log(title = "系统使用反馈", businessType = BusinessType.INSERT)
    @PostMapping(value = "/add")
    public AjaxResults<Boolean> add(@Validated @RequestBody BMainSysFeedbackVo.AddForm addForm) {
        bMainSysFeedbackService.add(addForm);
        return AjaxResults.success();
    }
}
