package com.fjhx.controller.qa;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.qa.QaInfo;
import com.fjhx.params.qa.QaInfoVo;
import com.fjhx.service.qa.QaInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * qa 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-11-02
 */
@RestController
@RequestMapping("/qaInfo")
public class QaInfoController {

    @Autowired
    private QaInfoService qaInfoService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, String> condition){
        Page<QaInfo> result = qaInfoService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody QaInfoVo qaInfoVo){
        qaInfoService.add(qaInfoVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody QaInfoVo qaInfoVo){
        qaInfoService.edit(qaInfoVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody QaInfoVo qaInfoVo){
        qaInfoService.delete(qaInfoVo);
        return R.success();
    }

}

