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

import com.prolog.cs.biz.inbound.constant.ValidatorGroup.validAdd;
import com.prolog.cs.biz.inbound.dto.rcv.RcvLinesProfilesDTO;
import com.prolog.cs.biz.inbound.service.rcv.RcvLinesProfilesService;
import com.prolog.framework.common.message.RestMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;

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

@Api(tags = "收货(入库)行明细拓展")
@RestController
@RequestMapping("/rcvLinesProfiles/v1.0")
public class RcvLinesProfilesController {

	@Resource
	private RcvLinesProfilesService rcvLinesProfilesService;

	/**
	 * // TODO
	 */
	@ApiOperation("添加")
	@PostMapping("/add")
	public RestMessage<Object> add(
			@Validated(validAdd.class) @RequestBody RcvLinesProfilesDTO rcvLinesProfilesDTO) {
		return RestMessage.newInstance(true, "addSuccess", rcvLinesProfilesService.add(rcvLinesProfilesDTO));
	}

	/**
	 * // TODO
	 */
	@ApiOperation("详情(主键id)")
	@GetMapping("/findByPkId")
	public RestMessage<RcvLinesProfilesDTO> findByPkId(@NotEmpty(message = "pkId is empty") String pkId) {
		return RestMessage.newInstance(true, "findByPkIdSuccess", rcvLinesProfilesService.findByPkId(pkId));
	}
}
