package com.jiayue.ipfcst.console.service;

import com.jiayue.ipfcst.common.data.entity.CommunicationEquipment;
import com.jiayue.ipfcst.common.data.repository.CommunicationEquipmentRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 通信设备业务层
 *
 * @author zy
 * @version 3.0
 */
@Service
@Slf4j
public class CommunicationEquipmentService {
  @Autowired CommunicationEquipmentRepository communicationEquipmentRepository;
  /**
   * 查询
   */
  public List<CommunicationEquipment> get(){
    return communicationEquipmentRepository.findAll();
  }
  /**
   * 保存
   */
  public CommunicationEquipment save(CommunicationEquipment communicationEquipment){
    return communicationEquipmentRepository.save(communicationEquipment);
  }
  /**
   * 删除
   */
  public void delete(Integer id){
    CommunicationEquipment communicationEquipment = new CommunicationEquipment();
    communicationEquipment.setId(id);
    communicationEquipmentRepository.delete(communicationEquipment);
  }
  public String formateBoolen (String str){
    String str1 = "";
    switch (str) {
      case "false": str1 = "否"; break;
      case "true": str1 = "是"; break;
      case "0": str1 = "否"; break;
      case "1": str1 = "是"; break;
    }
    return str1;
  }
}
