package com.bonus.sgzb.system.controller;

import com.bonus.sgzb.base.api.domain.BmStorageLog;
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 com.bonus.sgzb.common.security.annotation.InnerAuth;
import com.bonus.sgzb.system.service.impl.BmStorageLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* (bm_storage_log)表控制层
*
* @author syruan
*/
@RestController
@RequestMapping("/bm_storage_logs")
public class BmStorageLogController extends BaseController {

    /**
    * 服务对象
    */
    @Autowired
    private BmStorageLogService bmStorageLogService;

    @GetMapping("/list")
    public TableDataInfo list(BmStorageLog record) {
        startPage();
        List<BmStorageLog> list = bmStorageLogService.selectAll(record);
        return getDataTable(list);
    }

    /**
    * 通过主键查询单条数据
    *
    * @param id 主键
    * @return 单条数据
    */
    @GetMapping("selectByPrimaryKey")
    public BmStorageLog selectByPrimaryKey(Integer id) {
        return bmStorageLogService.selectByPrimaryKey(id);
    }

    @InnerAuth
    @PostMapping
    public AjaxResult batchInsert(@RequestBody List<BmStorageLog> bmStorageLogList) {
        return toAjax(bmStorageLogService.batchInsert(bmStorageLogList));
    }


}
