package com.dk.mdm.controller.ivt;

import com.dk.common.model.pojo.PageList;
import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.ivt.Check;
import com.dk.common.controller.BaseController;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.query.ivt.CheckQuery;
import com.dk.mdm.model.query.ivt.FreezeQuery;
import com.dk.mdm.model.response.ivt.CheckResponse;
import com.dk.mdm.model.response.ivt.FreezeResponse;
import com.dk.mdm.model.vo.ivt.CheckVO;
import com.dk.mdm.model.vo.ivt.FreezeVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import com.dk.mdm.service.ivt.CheckService;

@Api(tags = "盘点单API接口")
@RestController
@RequestMapping("/ivt/check")
public class CheckController{

    public BaseService<Check> getService() {
        return checkService;
    }

    @Autowired
    private CheckService checkService;

    /**
     * @desc : 条件查询
     * @author : 宋扬
     * @date : 2023/3/26 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<CheckResponse>> selectByCond(@RequestBody CheckQuery checkQuery) {
        return checkService.selectByCond(checkQuery);
    }

    /**
     * @desc   : 新建盘点单
     * @author : 宋扬
     * @date   : 2024/3/27 10:59
     */
    @ApiOperation(value = "新建盘点单", notes = "新建盘点单")
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody CheckVO checkVO) {
        return checkService.insert(checkVO);
    }

    /**
     * @desc   : 通过ID获取编辑盘点单信息
     * @author : 宋扬
     * @date   : 2024/3/28 15:34
     */
    @ApiOperation(value = "获取盘点单信息", notes = "获取盘点单信息")
    @PostMapping({"get_check_for_update/{id}"})
    public ResponseResultVO getCheckForUpdate(@PathVariable String id) {
        return checkService.getCheckForUpdate(id);
    }

    /**
     * @desc : 通过ID获取编辑盘点单信息
     * @author : 王英杰
     * @date : 2024/3/28 15:34
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return checkService.getCheckForUpdate(id);
    }
    /**
     * @desc   : 编辑盘点单
     * @author : 宋扬
     * @date   : 2024/3/28 16:50
     */
    @ApiOperation(value = "盘点", notes = "盘点")
    @PostMapping({"update"})
    public ResponseResultVO<?> update(@RequestBody CheckVO checkVO) {
        return checkService.update(checkVO);
    }

}
