package com.fjhx.controller.check;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.base.Condition;
import com.fjhx.params.check.CheckInfoVo;
import com.fjhx.service.check.CheckInfoService;
import org.springblade.core.tool.api.R;
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>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-12-23
 */
@RestController
@RequestMapping("/checkInfo")
public class CheckInfoController {

    @Autowired
    private CheckInfoService checkInfoService;

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

    @PostMapping("/add")
    public R add(@RequestBody CheckInfoVo checkInfoVo){
        checkInfoService.add(checkInfoVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody CheckInfoVo checkInfoVo){
        checkInfoService.edit(checkInfoVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody CheckInfoVo checkInfoVo){
        checkInfoService.delete(checkInfoVo);
        return R.success();
    }

}

