package com.yh.saas.plugin.configuration.vessel.controller;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
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 org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.plugins.Page;
import com.winsea.svc.base.base.entity.CommonVessel;
import com.yh.saas.common.support.plugin.PluginFeature;
import com.yh.saas.plugin.configuration.vessel.service.ISystemVesselService;

/**
 * <p>
 * 公告模块 - 公告详情 Controller
 * </p>
 * 
 * @Auther ZhangMingYu
 * @since 2019年8月14日15:48:17
 */
@RestController
@RequestMapping("/systemVessel")
@PluginFeature(id = "SystemVessel", name = "船舶信息管理")
public class SystemVesselController {

	@Autowired
	private ISystemVesselService systemVesselService;

	/**
	 * 修改船舶信息
	 * 
	 * @param vessel
	 */
	@PluginFeature(id = "SystemVessel-Edit", name = "修改")
	@PostMapping("/api/changeInfo")
	public void changeInfo(@RequestBody @Valid CommonVessel vessel) {
		this.systemVesselService.changeInfo(vessel);

	}

	/**
	 * 分页查询船舶信息
	 * 
	 * @param example
	 * @return
	 */
	@PluginFeature(id = "SystemVessel-Review", name = "查看")
	@GetMapping("/query/getVesselPage")
	public Page<CommonVessel> getVesselPage(CommonVessel example) {
		return this.systemVesselService.getVesselPage(example);
	}

	/**
	 * 查询船舶信息详情
	 * 
	 * @param vesselId
	 * @return
	 */
	@GetMapping("/query/getVesselOne")
	public CommonVessel getVesselOne(@RequestParam String vesselId) {
		return this.systemVesselService.getVesselOne(vesselId);
	}

}
