package com.hotent.portal.controller;


import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import com.hotent.base.model.CommonResult;
import com.hotent.base.util.StringUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RestController;
import com.hotent.base.controller.BaseController;
import com.hotent.portal.model.PortalBizSystemAuth;
import com.hotent.portal.persistence.manager.PortalBizSystemAuthManager;

/**
 *  外部系统管理员控制器
 *
 * @company 广州宏天软件股份有限公司
 * @author cola
 * @since 2021-12-03
 */
@RestController
@RequestMapping("/portalBizSystemAuth/v1/")
public class PortalBizSystemAuthController extends BaseController<PortalBizSystemAuthManager, PortalBizSystemAuth> {

	/**
	 * 根据id获取数据详情
	 * @param id
	 * @return
	 * @throws Exception 
	 * ModelAndView
	 */
	@GetMapping(value="/getDetail")
	@ApiOperation(value="根据id获取数据详情",httpMethod = "GET",notes = "根据id获取数据详情")
	public CommonResult<PortalBizSystemAuth> getDetail(@ApiParam(name="id",value="业务对象主键", required = true)@RequestParam(required=true) String id) throws Exception{
		return CommonResult.<PortalBizSystemAuth>ok().value(baseService.getDetail(id));
	}
    /**
	 * 新增,更新
	 * @param portalBizSystemAuth
	 * @throws Exception 
	 * @return
	 * @exception 
	 */
	@PostMapping(value="/save")
	@ApiOperation(value = "新增,更新数据", httpMethod = "POST", notes = "新增,更新数据")
	public CommonResult<String> save(@ApiParam(name="PortalBizSystemAuth",value="对象", required = true)@RequestBody PortalBizSystemAuth portalBizSystemAuth) throws Exception{
		String msg = StringUtil.isEmpty(portalBizSystemAuth.getId()) ? "添加成功" : "更新成功";
		baseService.createOrUpdate(portalBizSystemAuth);
		return CommonResult.<String>ok().message(msg);
	}
}
