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.Freeze;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.query.ivt.FreezeQuery;
import com.dk.mdm.model.response.ivt.FreezeItemResponse;
import com.dk.mdm.model.response.ivt.FreezeResponse;
import com.dk.mdm.model.vo.ivt.FreezeVO;
import com.dk.mdm.model.vo.mst.SupplierVo;
import com.dk.mdm.model.vo.sale.OrderVO;
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.FreezeService;

import java.util.List;
import java.util.Map;

@Api(tags = "冻结单API接口")
@RestController
@RequestMapping("/ivt/freeze")
public class FreezeController{

    public BaseService<Freeze> getService() {
        return freezeService;
    }

    @Autowired
    private FreezeService freezeService;

    /**
     * @desc : 条件查询
     * @author : 宋扬
     * @date : 2023/2/29 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<FreezeResponse>> selectByCond(@RequestBody FreezeQuery freezeQuery) {
        return freezeService.selectByCond(freezeQuery);
    }

    /**
     * @desc   : 通过ID查询
     * @author : 宋扬
     * @date   : 2024/3/13 16:01
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return freezeService.selectById(id);
    }


    /**
     * @desc   : 新建冻结单
     * @author : 宋扬
     * @date   : 2024/3/15 10:26f
     */
    @ApiOperation(value = "新建冻结单", notes = "新建冻结单")
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody FreezeVO freezeVO) {
        return freezeService.insert(freezeVO);
    }

    /**
     * @desc   : 通过ID查询解冻数据
     * @author : 宋扬
     * @date   : 2024/3/19 16:31
     */
    @ApiOperation(value = "获取解冻信息", notes = "获取解冻信息")
    @PostMapping({"get_freeze_for_update/{id}"})
    public ResponseResultVO getFreezeForUpdate(@PathVariable String id) {
        return freezeService.getFreezeForUpdate(id);
    }

    /**
     * @desc   : 解冻
     * @author : 宋扬
     * @date   : 2024/3/20 8:55
     */
    @ApiOperation(value = "解冻", notes = "解冻")
    @PostMapping({"update"})
    public ResponseResultVO<?> update(@RequestBody FreezeVO freezeVO) {
        return freezeService.update(freezeVO);
    }

    /**
     * @desc : 通过ID获取编辑盘点单信息
     * @author : 王英杰
     * @date : 2024/3/28 15:34
     */
    @PostMapping({"update_freezeall/{id}"})
    public ResponseResultVO updateFreezeAll(@PathVariable String id) {
        return freezeService.updateFreezeAll(id);
    }
}
