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

import com.prolog.cs.biz.inbound.dto.PageParam;
import com.prolog.cs.biz.inbound.dto.rcv.RcvLinesPicDTO;
import com.prolog.cs.biz.inbound.service.rcv.RcvLinesPicService;
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 // TODO 
 * @Date 2021-03-24 
 */

@Api(tags = "收货(入库)行明细图片")
@RestController
@RequestMapping("/rcvLinesPic/v1.0")
public class RcvLinesPicController {

	@Resource
	private RcvLinesPicService rcvLinesPicService;

	/**
	* // TODO
	*/
	@ApiOperation("添加")
	@PostMapping("/add")
	public RestMessage<Object> add(@RequestBody RcvLinesPicDTO rcvLinesPicDTO){
		return RestMessage.newInstance(true, "addSuccess", rcvLinesPicService.add(rcvLinesPicDTO));
	}

	/**
	* // TODO
	*/
	@ApiOperation("编辑")
	@PostMapping("/edit")
	public RestMessage<Object> edit( @RequestBody RcvLinesPicDTO rcvLinesPicDTO){
		return RestMessage.newInstance(true, "editSuccess", rcvLinesPicService.edit(null,rcvLinesPicDTO));
	}

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

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

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

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

	/**
	* // TODO
	*/
	@ApiOperation("条件所有")
	@PostMapping("/findAll")
	public RestMessage<List<RcvLinesPicDTO>> findAll(@RequestBody(required = false) RcvLinesPicDTO rcvLinesPicDTO) {
		return RestMessage.newInstance(true, "listAllSuccess", rcvLinesPicService.findAll(rcvLinesPicDTO));
	}
	/**
	* // TODO
	*/
	@ApiOperation("详情(主键id)")
	@GetMapping("/findByPkId")
	public RestMessage<RcvLinesPicDTO> findByPkId(String pkId){
		return RestMessage.newInstance(true, "findByPkIdSuccess", rcvLinesPicService.findByPkId(pkId));
	}
}
