package com.huatek.busi.mapper;

import com.huatek.busi.dto.BusiSiteTreeDto;
import com.huatek.busi.dto.BusiSiteTreeRootNodeDto;
import com.huatek.busi.entity.BusiSiteTree;
import com.huatek.busi.entity.EquipmentTemperatureCache;
import com.huatek.busi.vo.BusiEquipmentVo;
import com.huatek.busi.vo.BusiTreeNodeVo;
import com.huatek.busi.vo.SensiorIdExportVo;
import com.huatek.busi.vo.TransformerTmpVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
  * @ClassName: BusiSiteServiceMapper
  * @FullClassPath: com.huatek.busi.mapper.BusiSiteServiceMapper
  * @Description: 站点树Mapper
  * @author: Arno
  * @date: Jun 21, 2019 10:25:02 AM
  * @version: 1.0
  */
@Repository
public interface BusiSiteTreeMapper {

	BusiSiteTree findByEquipmentType(@Param("parentId")String parentId, @Param("equipmentType") String equipmentType);

//	BusiSiteTree findByEquipmentTypeAndEqType(@Param("mainEquName") String mainEquName, @Param("eqType") String eqType);


	/**
	* @Title: getChildrens
	* @Description: 获取子节点节点
	* @createDate: Jun 24, 2019 4:52:56 PM
	* @param    parentId  节点ID
	* @return   Boolean
	* @throws
	*/
	public List<BusiSiteTree> getChildrens(@Param("parentId") String parentId);

	/**
	 * 根据站点ID查询站点数据
	 */
	List<BusiSiteTree> findListBySiteId(String siteId);

	/**
	 * 根据系统编码查询站点
	 * @param systemCode
	 * @return
	 */
	BusiSiteTree  geBusiSiteTreeBysystemCode(String systemCode);


	/**
	* @Title: getChildrens
	* @Description: 获取子节点节点
	* @createDate: Jun 24, 2019 4:52:56 PM
	* @param    parentId  节点ID
	* @return   Boolean
	* @throws
	*/
	public List<BusiSiteTree> findlist();


	/**
	* @Title: getChildrens
	* @Description: 获取子节点节点
	* @createDate: Jun 24, 2019 4:52:56 PM
	* @param    parentId  节点ID
	* @return   Boolean
	* @throws
	*/
	public List<BusiTreeNodeVo> findlist2();

	List<BusiTreeNodeVo> findListWithoutGis(@Param("eqType") String eqType);

	/**
	* @Title: findByEquipmentTypeAndSiteId
	* @Description: 获取子节点节点
	* @createDate: Jun 24, 2019 4:52:56 PM
	* @param    siteId  站点ID
	* @param    equipmentType  设备类型
	* @return   Boolean
	* @throws
	*/
	public List<BusiSiteTree> findByEquipmentTypeAndSiteId(@Param("siteId") String siteId,  @Param("equipmentType") String equipmentType  );

	/**
     * 获取站点设备树上的主设备列表
     *
     * @param equipmentType
     *            类型
     * @return
     */
	List<BusiTreeNodeVo> findMainEquipmentList(@Param("equipmentTypes")String[] equipmentTypes);

	List<BusiTreeNodeVo> findGisMainEquipmentList(@Param("equipmentTypes")String equipmentTypes);

	BusiSiteTree findByEquType(@Param("equType") String equType);

	BusiTreeNodeVo findByNameAndEquType(@Param("equName") String equName, @Param("eqType") String eqType);

	BusiTreeNodeVo findByIdAndEquType(@Param("id") String id, @Param("eqType") String eqType);

	List<BusiSiteTree> findByParentId(@Param("id") String id);

	List<BusiSiteTree> findByParentIds(@Param("ids") List<String> ids);

	BusiTreeNodeVo findByEquNumAndequNameAndEquType(@Param("systemCode") String systemCode,
													@Param("equName") String equName,
													@Param("eqType") String eqType);

	List<BusiTreeNodeVo> findAll();

	List<BusiTreeNodeVo> findByEquTypes(@Param("equType") String equType);

	List<BusiTreeNodeVo> findThirdLevelByEquTypes(@Param("equType") String equType,
												  @Param("equId") String equId);

	/**
	* @Title: selectByTransformerBySiteId
	* @Description: 根据站点id获取变压器数据
	* @createDate: Aug 21, 2019 3:38:07 PM
	* @param    siteId 站点ID
	* @return   List<TransformerTmpVo>
	*/
	List<TransformerTmpVo> selectByTransformerBySiteId(@Param("siteId")String siteId);

	/**
	 * @Description：根据站点ID获取传感器信息
	 */
	List<SensiorIdExportVo> selectSensorListBySiteId(@Param("siteId")String siteId);

	/**
	 * @Description：根据站点ID获取传感器信息
	 */
	List<SensiorIdExportVo> findSensorListBySiteId();

	List<String> getSiteIds();

	/**
	 * 根据传感器编号查询站点树信息
	 * @param systemCode
	 * @return
	 */
	BusiEquipmentVo  selectTransformerBySensorCode(@Param("sensorCode")String sensorCode);

	/**
	 * 根据传感器编号查询站点树信息
	 * @param systemCode
	 * @return
	 */
	BusiEquipmentVo  selectGisBySensorCode(@Param("sensorCode")String sensorCode);

	/**
	 * 根据传感器编号查询站点树信息
	 * @param systemCode
	 * @return
	 */
	BusiEquipmentVo  selectArresterBySensorCode(@Param("sensorCode")String sensorCode);

	/**
	 * 查询站点变压器绑定信息
	 */
	/**
	* @Title: selectByTransformerAndBindRelationBySiteId
	* @Description: 根据站点id查询站点变压器绑定信息
	* @createDate: Aug 21, 2019 3:38:07 PM
	* @param    siteId 站点ID
	* @return   List<TransformerTmpVo>
	*/
	List<TransformerTmpVo> selectByTransformerAndBindRelationBySiteId(@Param("siteId")String siteId,@Param("equipmentId")String equipmentId);

	/**
	* @Title: getChildrens
	* @Description: 获取数据输入站点树
	* @createDate: Jun 24, 2019 4:52:56 PM
	* @param    parentId  节点ID
	* @return   Boolean
	* @throws
	*/
	public List<BusiTreeNodeVo> findInputDataTree();

	BusiSiteTreeRootNodeDto getSiteEquipmentNodeBySiteIdAndEquType(@Param("siteId") String siteId, @Param("equType") String equType);

	int updateTree(BusiSiteTreeDto busiSiteTreeDto);

	int isDelete(BusiSiteTree tree);

	BusiSiteTree findByMainEquipmentIdAndSiteId(@Param("mainEquipmentId") String mainEquipmentId, @Param("siteId") String siteId);


}
