package com.shkj.wcs.controller.base;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.shkj.common.annotation.Log;
import com.shkj.common.core.controller.BaseController;
import com.shkj.common.core.domain.AjaxResult;
import com.shkj.common.core.domain.Result;
import com.shkj.common.core.page.TableDataInfo;
import com.shkj.common.enums.BusinessType;
import com.shkj.common.utils.poi.ExcelUtil;
import com.shkj.wcs.domain.BasePoint;
import com.shkj.wcs.service.IBasePointService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 点位管理Controller
 *
 * @author zjx
 * @date 2023-04-20
 */
@RestController
@RequestMapping("/wcs/base/point")
public class BasePointController extends BaseController
{

    @Autowired
    private IBasePointService basePointService;

    /**
     * 查询点位管理列表
     */
    @GetMapping("/list")
    public TableDataInfo<BasePoint> list(BasePoint basePoint)
    {
        startPage();
        List<BasePoint> list = basePointService.selectBasePointList(basePoint);
        return getDataTable(list);

    }


    /**
     * 获取点位管理详细信息
     */
    @GetMapping("/getBasePointByid")
    public Result<BasePoint> getInfo(@RequestParam("id") Long id){
        return Result.ok().data(basePointService.selectBasePointById(id));
    }

    /**
     * 新增点位管理
     */
    @Log(title = "点位管理", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public Result<Boolean> add(@RequestBody BasePoint basePoint) {
        return basePointService.insertBasePoint(basePoint);
    }

    /**
     * 修改点位管理
     */
    @Log(title = "点位管理", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public Result<Boolean> edit(@RequestBody BasePoint basePoint){
        return basePointService.updateBasePoint(basePoint);
    }

    /**
     * 删除点位管理
     */
    @Log(title = "点位管理", businessType = BusinessType.DELETE)
    @PostMapping("/del")
    public Result<Boolean> remove(@RequestParam Long id){
        return basePointService.deleteBasePointById(id);
    }

}
