package com.bonus.canteen.core.drp.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.canteen.core.drp.dto.DrpWarehousePageDTO;
import com.bonus.canteen.core.drp.service.DrpWarehouseService;
import com.bonus.canteen.core.drp.vo.DrpWarehousePageVO;
import com.bonus.common.core.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/api/v1/drpwarehouse"})
@Api(
   value = "gyp_仓库信息管理",
   tags = {"gyp_仓库信息管理"}
)
public class DrpWarehouseController {
   private static final Logger log = LoggerFactory.getLogger(DrpWarehouseController.class);
   @Autowired
   @Lazy
   private DrpWarehouseService drpWarehouseService;

//   @PostMapping({"/add"})
//   @ApiOperation("新增仓库信息")
//   public LeResponse<?> addDrpWarehouse(@RequestBody @Valid LeRequest<DrpWarehouseAddDTO> leRequest) {
//      DrpWarehouseAddDTO content = (DrpWarehouseAddDTO)leRequest.getContent();
//      this.drpWarehouseService.addDrpWarehouse(content);
//      return LeResponse.succ();
//   }

   @PostMapping({"/page"})
   @ApiOperation("分页获取仓库信息")
   public AjaxResult getDrpWarehousePage(@RequestBody DrpWarehousePageDTO content) {
      Page<DrpWarehousePageVO> resultPage = this.drpWarehouseService.getDrpWarehousePage(content);
      return AjaxResult.success(resultPage);
   }
//
//   @RequiresPermissions({"drp:warehouse:update"})
//   @PostMapping({"/edit"})
//   @RequiresAuthentication
//   @ApiOperation("修改仓库信息")
//   public LeResponse<?> editDrpWarehouse(@RequestBody @Valid LeRequest<DrpWarehouseEditDTO> leRequest) {
//      DrpWarehouseEditDTO content = (DrpWarehouseEditDTO)leRequest.getContent();
//      this.drpWarehouseService.editDrpWarehouse(content);
//      return LeResponse.succ();
//   }
//
//   @RequiresPermissions({"drp:warehouse:delete"})
//   @PostMapping({"/remove/{warehouseId}"})
//   @RequiresGuest
//   @ApiOperation("删除仓库信息")
//   public LeResponse<?> removeBywWarehouseId(@PathVariable Long warehouseId) {
//      this.drpWarehouseService.removeBywWarehouseId(warehouseId);
//      return LeResponse.succ();
//   }
//
//   @PostMapping({"/all"})
//   @RequiresGuest
//   @ApiOperation("获取仓库信息")
//   public LeResponse<List<DrpWarehouseAllVO>> getDrpWarehouseAll(@RequestBody @Valid LeRequest<DrpWarehouseAllDTO> leRequest) {
//      List<DrpWarehouseAllVO> resultList = this.drpWarehouseService.getAllDrpWarehouse((String)null, (DrpWarehouseAllDTO)leRequest.getContent());
//      return LeResponse.succ(resultList);
//   }
//
//   @PostMapping({"/change/status"})
//   @RequiresAuthentication
//   @ApiOperation("变更仓库状态")
//   @RequiresPermissions({"drp:warehouse:changeStatus"})
//   public void changeWarehouseStatus(@RequestBody @Valid LeRequest<WarehouseStatusChangeDTO> leRequest) {
//      WarehouseStatusChangeDTO content = (WarehouseStatusChangeDTO)leRequest.getContent();
//      this.drpWarehouseService.changeWarehouseStatus(content);
//   }
//
//   @PostMapping({"/getWarehouseByCanteenId"})
//   @RequiresGuest
//   @ApiOperation("获取仓库信息")
//   public LeResponse<DrpWarehouseAllVO> getWarehouseByCanteenId(@RequestBody @Valid LeRequest<Long> leRequest) {
//      return LeResponse.succ(this.drpWarehouseService.getWarehouseByCanteenId((Long)leRequest.getContent()));
//   }
}
