package com.neusoft.smart.pos.gateway.controller;

import com.neusoft.smart.pos.dto.org.request.PostOrgRequest;
import com.neusoft.smart.pos.dto.org.response.PostOrgResponse;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import com.neusoft.smart.pos.gateway.service.OrgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
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 javax.validation.Valid;

@RestController
@RequestMapping("/unionService/org")
@Validated
@Api(value = "集团管理restful接口", description = "集团管理restful接口")
public class OrgController {
	
	@Autowired
	private OrgService orgService;

	@ApiOperation(value = "集团信息新建接口", notes = "集团信息新建接口")
	@PostMapping("/org")
	public ResponseData<PostOrgResponse> saveOrg(@Valid @RequestBody PostOrgRequest orgRequest, BindingResult bindingResult){
		return new ResponseData<>(orgService.saveOrg(orgRequest));
	}
	
}
