package com.unis.base.app.controller;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.unis.base.client.AerationHisFeign;
import com.unis.base.client.EquipmentTypeFegin;
import com.unis.base.common.vo.EquipmentTypeVO;
import com.unis.base.common.vo.EquipmentTypequeryVO;
import com.unis.base.common.vo.TyTfzyxxHisQueryVO;
import com.unis.base.common.vo.TyTfzyxxHisVO;
import com.unis.common.utils.CurrentUtil;
import com.unis.common.utils.ResponseWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
@Api(value = "设备类型信息 ", tags = "设备类型信息 ")
public class EquipmentTypeController {
	
	
	@Autowired 
	private EquipmentTypeFegin equipmentTypeFegin;

	@ApiOperation(value = "设备类型信息-查询列表", notes = "参数：设备类型，设备名称")
	@PostMapping(value = "/equipmentTypeList")
	public ResponseWrapper getEquipmentTypeList(@RequestBody EquipmentTypequeryVO equipmentTypequeryVO){
		return equipmentTypeFegin.getEquipmentTypeList(equipmentTypequeryVO);
	}

	@ApiOperation(value = "设备类型信息-分页查询列表", notes = "参数：设备类型，设备名称")
	@PostMapping(value = "/equipmentTypePage/{pageNum}/{pageSize}")
	public ResponseWrapper getEquipmentTypePage(@RequestBody EquipmentTypequeryVO equipmentTypequeryVO,@PathVariable("pageNum")Integer pageNum,@PathVariable("pageSize") Integer pageSize){
		return equipmentTypeFegin.getEquipmentTypePage(equipmentTypequeryVO,pageNum,pageSize) ;
	}
	
	/**
	 * 新增设备类型
	 * @param equipmentTypeVO
	 * @return
	 */
	@PostMapping(value = "/equipmentType")
	@ApiOperation(value = "新增设备类型", notes = "参数：设备类型")
    public ResponseWrapper insert(@RequestBody EquipmentTypeVO equipmentTypeVO){
		equipmentTypeVO.setCreateDate(new Date());
		equipmentTypeVO.setRefreshTime(new Date());
		equipmentTypeVO.setCreator(CurrentUtil.getUserName());
		return equipmentTypeFegin.insert(equipmentTypeVO);
	}

	/**
	 * 更新设备类型
	 * @param tyHtxxVO
	 * @return
	 */
	@PutMapping(value = "/equipmentType")
	@ApiOperation(value = "更新设备类型", notes = "参数：设备类型id")
    public ResponseWrapper update(EquipmentTypeVO equipmentTypeVO) {
		
		equipmentTypeVO.setRefreshTime(new Date());
		return equipmentTypeFegin.update(equipmentTypeVO);
	}
	
	/**
	 * 删除设备类型
	 */
	@DeleteMapping(value="/equipmentType/{sblxbh}")
	@ApiOperation(value = "根据合同信息id删除设备类型", notes = "参数：设备类型id")
	public ResponseWrapper delete(@PathVariable("sblxbh") String sblxbh){
		return equipmentTypeFegin.delete(sblxbh);
	}
	
	
	/**
	 * 获取设备类型
	 * @param sblxbh
	 * @return
	 */
	@GetMapping(value="/equipmentType/{sblxbh}")
	@ApiOperation(value = "根据设备类型编号获取设备类型信息", notes = "参数：")
	public ResponseWrapper getHtxxByHtxxid(@PathVariable("sblxbh") String sblxbh){
		return equipmentTypeFegin.getHtxxByHtxxid(sblxbh);
	}
}
