package com.xhpc.charging.station.mapper;

import com.xhpc.common.domain.XhpcChargingPile;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author yuyang
 * @date 2021/7/27 14:37
 */
public interface XhpcChargingPileMapper {


    /**
     * 桩列表
     *
     * @param serialNumber 桩编号
     * @param type         桩类型
     * @param name         桩名称
     * @return
     */
    List<Map<String, Object>> selectXhpcChargingPileList(@Param("operatorId")Long operatorId,@Param("name") String name, @Param("type") Integer type, @Param("serialNumber") String serialNumber, @Param("chargingStationId") Long chargingStationId,@Param("logOperatorId")Long logOperatorId,@Param("number")Integer number,@Param("tenantId") String tenantId);


    int getCountXhpcChargingPile(@Param("chargingStationId") Long chargingStationId,@Param("tenantId") String  tenantId);


    /**
     * 终端
     *
     * @param xhpcChargingPile 终端
     * @return 结果
     */
    int insertXhpcChargingPile(XhpcChargingPile xhpcChargingPile);


    /**
     * 查询电站
     *
     * @param chargingStationId 电站ID
     * @return 电站
     */
    Map<String, Object> selectXhpcChargingStationById(Long chargingStationId);

    /**
     * 查询桩
     *
     * @param chargingPileId 终端ID
     * @return 电站
     */
    XhpcChargingPile selectXhpcChargingPileById(Long chargingPileId);

    /**
     * 编辑
     *
     * @param xhpcChargingPile 终端
     * @return 结果
     */
    int updaeXhpcChargingPile(XhpcChargingPile xhpcChargingPile);

    /**
     * 终端列表
     *
     * @param chargingPileId 桩id
     * @return
     */
    List<Map<String, Object>> selectXhpcTerminalList(@Param("chargingPileId") Long chargingPileId);

    /**
     * 删除桩信息
     *
     * @param chargingPileId 桩ID
     * @return 结果
     */
    int updateXhpcChargingPileById(@Param("chargingPileId") Long chargingPileId);

    /**
     * 判断
     *
     * @param serialNumber
     * @return
     */
    int getXhpcChargingPileSerialNumberCount(@Param("serialNumber") String serialNumber);

    /**
     * 删除终端
     *
     * @param chargingPileId
     * @return
     */
    int updateXhpcTerminal(@Param("chargingPileId") Long chargingPileId);

    /**
     * 统计场站的终端
     *
     * @param chargingStationId
     * @return
     */
    int countXhpcTerminal(@Param("chargingStationId") Long chargingStationId);

    /**
     * 对应场站的桩数量
     *
     * @param chargingStationId
     * @return
     */
    int pileCount(@Param("chargingStationId") Long chargingStationId);


    XhpcChargingPile getXhpcChargingPileBySerialNumber(@Param("serialNumber") String serialNumber);

    /**
     * query list of xhpc charging pile by charging station id and charging pile id
     *
     * @author WH
     * @date 2022/2/17 10:32
     * @since version-1.0
     */
    List<XhpcChargingPile> selectXhpcChargingPilesBy(@Param("chargingStationId") Long chargingStationId, @Param("chargingPileId") Long chargingPileId, @Param("tenantId") String tenantId);

    /**
     * 修改桩的终端
     *
     * @param chargingPileId
     * @return
     */
    int xhpcTerminalSataus(@Param("chargingPileId") Long chargingPileId,@Param("status") Integer status,@Param("prompt")String prompt);


    void updateXhpcChargingPile(@Param("serialNumber")String serialNumber,@Param("powerNumber")Integer powerNumber);
}
