package com.gkhy.safePlatform.equipment.controller;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.gkhy.safePlatform.commons.query.PageQuery;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
|
import com.gkhy.safePlatform.equipment.model.dto.req.*;
|
import com.gkhy.safePlatform.equipment.model.dto.resp.SafeMaterialDetailDto;
|
import com.gkhy.safePlatform.equipment.service.SafeMaterialDetailService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
import org.springframework.validation.annotation.Validated;
|
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;
|
|
import java.util.List;
|
|
@RestController
|
@RequestMapping(value = "/equipment/smDetail")
|
public class SafeMaterialDetailController {
|
@Autowired
|
private SafeMaterialDetailService safeMaterialDetailService;
|
/**
|
* 新增入库
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/save")
|
public ResultVO save(Authentication authentication,@Validated @RequestBody SafeMaterialDetailAddReq req){
|
return safeMaterialDetailService.save(req);
|
}
|
/**
|
* 批量入库
|
*/
|
@PostMapping(value = "/saveBatch")
|
public ResultVO saveBatch(Authentication authentication,@Validated @RequestBody SafeMaterialDetailAddReq req){
|
return safeMaterialDetailService.saveBatch(req);
|
}
|
/**
|
* 编辑
|
*/
|
@PostMapping(value = "/update")
|
public ResultVO update(Authentication authentication,@Validated @RequestBody SafeMaterialDetailReq req){
|
return safeMaterialDetailService.update(req);
|
}
|
/**
|
* 单独出入库
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/single/delivery0rReceipt")
|
public ResultVO singleDdelivery0rReceipt(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){
|
return safeMaterialDetailService.singleDdelivery0rReceipt(req);
|
}
|
|
/**
|
* 单独出库
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/single/delivery")
|
public ResultVO singleDelivery(Authentication authentication, @Validated @RequestBody SafeMaterialDetailReq req){
|
return safeMaterialDetailService.singleDelivery(req);
|
}
|
|
/**
|
* 单独入库
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/single/receipt")
|
public ResultVO singleReceipt(Authentication authentication,@RequestBody JSONObject jsonObject){
|
Long id = jsonObject.getLong("id");
|
return safeMaterialDetailService.singleReceipt(id);
|
}
|
/**
|
* 批量出库 - 根据ids
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/batch/delivery/ids")
|
public ResultVO deliveryBatchByIds(Authentication authentication, @Validated @RequestBody MterialDeliveryReq req){
|
|
return safeMaterialDetailService.deliveryBatchByIds(req);
|
}
|
/**
|
* 批量出库
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/batch/delivery/random")
|
public ResultVO deliveryBatchRandom(Authentication authentication,@Validated @RequestBody MterialRandomDeliveryReq req){
|
return safeMaterialDetailService.deliveryBatchRandom(req);
|
}
|
|
/**
|
* 批量重新入库
|
*/
|
@PostMapping(value = "/batch/receipt")
|
public ResultVO receiptBatch(Authentication authentication, @RequestBody Long[] ids){
|
return safeMaterialDetailService.receiptBatch(ids);
|
}
|
/**
|
* 删除-单条
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/delete")
|
public ResultVO delete(Authentication authentication, @RequestBody JSONObject jsonObject){
|
Long id = jsonObject.getLong("id");
|
return safeMaterialDetailService.delete(id);
|
}
|
|
/**
|
* 批量删除
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/deleteBatch")
|
public ResultVO deleteBatch(Authentication authentication,@RequestBody Long[] ids){
|
return safeMaterialDetailService.deleteBatch(ids);
|
}
|
|
|
/**
|
* 分页查询
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/page/list")
|
public SearchResultVO<List<SafeMaterialDetailDto>> listByPage(Authentication authentication, @RequestBody PageQuery<SafeMatetrialDetailQuery> pageQuery){
|
return safeMaterialDetailService.listByPage(pageQuery);
|
}
|
|
/**
|
* 查询单条数据
|
* @param authentication
|
* @return
|
*/
|
@PostMapping(value = "/queryById")
|
public ResultVO queryById(Authentication authentication,@RequestBody JSONObject jsonObject){
|
Long id = jsonObject.getLong("id");
|
return safeMaterialDetailService.queryById(id);
|
}
|
|
}
|