package vip.xiaonuo.write.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.write.param.*;
import vip.xiaonuo.write.service.IWriteCheckService;

import java.util.Map;

/**
 * <p>
 * 检验记录发放收回台账 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-01-08
 */
@RestController
@RequestMapping("/write-check")
@Api(tags = "检验记录发放收回台账")
@ApiSupport(author = "wang", order = 1)
@Validated
public class WriteCheckController {

    @Autowired
    private IWriteCheckService checkService;

    @ApiOperationSupport(order = 1)
    @ApiOperation("检验记录发放收回台账添加")
    @PostMapping("/write-check/add")
    public CommonResult add(@RequestBody WriteCheckAddParam param) {
        checkService.add(param);
        return CommonResult.ok();
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation("检验记录发放收回台账修改")
    @PostMapping("/write-check/update")
    public CommonResult update(@RequestBody WriteCheckEditParam editParam) {
        checkService.update(editParam);
        return CommonResult.ok();
    }

    @ApiOperationSupport(order = 3)
    @ApiOperation("检验记录发放收回台账分页")
    @PostMapping("/write-check/page")
    public CommonResult page(@RequestBody WriteUnqualifiedPageParam pageParam) {
        return checkService.page(pageParam);
    }


    @ApiOperationSupport(order = 4)
    @ApiOperation("检验记录发放收回台账删除")
    @PostMapping("/write-check/delete")
    public CommonResult delete(@RequestBody Map<String,String> paramsMap) {
        checkService.delete(paramsMap);
        return CommonResult.ok();
    }
}
