package com.prolog.cs.biz.inbound.controller.rcv;

import com.prolog.cs.biz.inbound.dto.PageParam;
import com.prolog.cs.biz.inbound.dto.rcv.RcvHeadersPicDTO;
import com.prolog.cs.biz.inbound.service.rcv.RcvHeadersPicService;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.pojo.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 
 * @Date 2021-03-24 
 */

@Api(tags = "收货(入库)单图片")
@RestController
@RequestMapping("/rcvHeadersPic/v1.0")
public class RcvHeadersPicController {

	@Resource
	private RcvHeadersPicService rcvHeadersPicService;

	/**
	* 新增
	*/
	@ApiOperation("新增")
	@PostMapping("/add")
	public RestMessage<Object> add(@RequestBody RcvHeadersPicDTO rcvHeadersPicDTO){
		return RestMessage.newInstance(true, "addSuccess", rcvHeadersPicService.add(rcvHeadersPicDTO));
	}

	/**
	* 
	*/
	@ApiOperation("修改")
	@PostMapping("/edit")
	public RestMessage<Object> edit(@RequestBody RcvHeadersPicDTO rcvHeadersPicDTO){
		return RestMessage.newInstance(true, "editSuccess", rcvHeadersPicService.edit(null,rcvHeadersPicDTO));
	}

	/**
	* 
	*/
	@ApiOperation("删除(主键id集合)")
	@PostMapping("/delIds")
	public RestMessage<Object> delIds(@RequestBody List<String> pkIdList) {
		return RestMessage.newInstance(true, "delIdsSuccess", rcvHeadersPicService.delIds(pkIdList));
	}

	/**
	* 
	*/
	@ApiOperation("条件分页")
	@GetMapping("/page")
	public RestMessage<Page<RcvHeadersPicDTO>> list(RcvHeadersPicDTO rcvHeadersPicDTO,PageParam pageParam) throws Exception {
		return RestMessage.newInstance(true, "pageSuccess", rcvHeadersPicService.findList(rcvHeadersPicDTO,pageParam));
	}

	/**
	* 
	*/
	@ApiOperation("批量添加")
	@PostMapping("/batchAdd")
	public RestMessage<Object> batchAdd(@RequestBody List<RcvHeadersPicDTO> rcvHeadersPicDTOList) {
		return RestMessage.newInstance(true, "batchAddSuccess", rcvHeadersPicService.batchAdd(rcvHeadersPicDTOList));
	}

	/**
	* 
	*/
	@ApiOperation("批量编辑")
	@PostMapping("/batchEdit")
	public RestMessage<Object> batchEdit(@RequestBody List<RcvHeadersPicDTO> rcvHeadersPicDTOList) {
		return RestMessage.newInstance(true, "batchEditSuccess", rcvHeadersPicService.batchEdit(rcvHeadersPicDTOList));
	}

	/**
	* 
	*/
	@ApiOperation("详情(主键id)")
	@GetMapping("/findByPkId")
	public RestMessage<RcvHeadersPicDTO> findByPkId(String pkId){
		return RestMessage.newInstance(true, "findByPkIdSuccess", rcvHeadersPicService.findByPkId(pkId));
	}
}
