package com.dk.mdm.controller.mst;

import com.dk.common.model.pojo.PageList;
import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.mst.GoodsSku;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.query.mst.GoodsSkuQuery;
import com.dk.mdm.model.response.mst.GoodsSkuResponse;
import com.dk.mdm.model.vo.mst.GoodsSkuVO;
import com.dk.mdm.model.vo.mst.SupplierVo;
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.mst.GoodsSkuService;

@Api(tags = "商品档案API接口")
@RestController
@RequestMapping("/mst/goodsSku")
public class GoodsSkuController{

    public BaseService<GoodsSku> getService() {
        return goodsSkuService;
    }

    @Autowired
    private GoodsSkuService goodsSkuService;


    /**
     * @desc : 条件查询
     * @author : 王英杰
     * @date : 2024/2/26 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<GoodsSkuResponse>> selectByCond(@RequestBody GoodsSkuQuery goodsSkuQuery) {
        return goodsSkuService.selectByCond(goodsSkuQuery);
    }
    /**
     * @desc : 编辑供应商
     * @author : 王英杰
     * @date : 2023/1/9 10:48
     */
    @ApiOperation(value = "编辑员工", notes = "编辑员工")
    @PostMapping({"update"})
    public ResponseResultVO<?> update(@RequestBody GoodsSkuVO goodsSkuVO) {
        return goodsSkuService.update(goodsSkuVO);
    }

    /**
     * @desc : 通过ID查询
     * @author : 王英杰
     * @date : 2023/1/9 10:41
     */
    @PostMapping({"/{id}"})
    public ResponseResultVO selectById(@PathVariable String id) {
        return goodsSkuService.selectById(id);
    }
    /**
     * @desc : 停用
     * @author : 王英杰
     * @date : 2023/1/9 10:34
     */
    @ApiOperation(value = "停用", notes = "停用")
    @PostMapping("disable/{id}")
    public ResponseResultVO<Boolean> disable(@PathVariable String id) {
        return this.getService().disable(id);
    }


    /**
     * @desc : 新建
     * @author : 王英杰
     * @date : 2023/1/5 9:39
     */
    @ApiOperation( value = "新建", notes = "新建" )
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody GoodsSkuVO goodsSkuVO) {
        return goodsSkuService.insert(goodsSkuVO);
    }
}
