package com.fjhx.controller.check;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.check.CheckDetail;
import com.fjhx.params.check.CheckDetailVo;
import com.fjhx.service.check.CheckDetailService;
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-11-03
 */
@RestController
@RequestMapping("/checkDetail")
public class CheckDetailController {

    @Autowired
    private CheckDetailService checkDetailService;

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

    @PostMapping("/add")
    public R add(@RequestBody CheckDetailVo checkDetailVo){
        checkDetailService.add(checkDetailVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody CheckDetailVo checkDetailVo){
        checkDetailService.edit(checkDetailVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody CheckDetailVo checkDetailVo){
        checkDetailService.delete(checkDetailVo);
        return R.success();
    }

}

