package com.bonus.sgzb.base.controller;


import com.bonus.sgzb.base.domain.MaTypeHisNum;
import com.bonus.sgzb.base.service.MaTypeHisNumService;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *机具历史库存
 */
@RestController
@RequestMapping("/base/typeHisNum")
public class MaTypeHisNumController extends BaseController {

    @Autowired
    private MaTypeHisNumService maTypeHisNumService;

    /**
     * 根据条件进行查询机具历史库存
     */
    @PostMapping("/getTypeHisNum")
    public TableDataInfo getTypeHisNum(@Validated @RequestBody MaTypeHisNum maTypeHisNum)
    {
        startPage();
        List<MaTypeHisNum> list = maTypeHisNumService.getTypeHisNum(maTypeHisNum);
        return getDataTable(list);
    }

    /**
     * 新增机具历史库存
     */
    @PostMapping
    public AjaxResult typeHisNumAdd(@Validated @RequestBody MaTypeHisNum maTypeHisNum)
    {
        return toAjax(maTypeHisNumService.typeHisNumAdd(maTypeHisNum));
    }

    /**
     * 修改机具历史库存
     */
    @PutMapping
    public AjaxResult updateTypeHisNum(@Validated @RequestBody MaTypeHisNum maTypeHisNum)
    {

        return toAjax(maTypeHisNumService.updateTypeHisNum(maTypeHisNum));
    }

    /**
     * 删除机具历史租赁价格
     */
    @DeleteMapping("/{typeIds}")
    public AjaxResult remove(@PathVariable Long[] typeIds)
    {
        maTypeHisNumService.remove(typeIds);
        return success();
    }
}
