package com.ho.business.mapper;

import com.ho.business.entity.Device;
import com.ho.business.vo.req.DeviceReqVO;
import com.ho.business.vo.resp.DeviceRespVO;
import com.ho.business.vo.resp.chargepile.ChargePileRespVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author yule
* @description 针对表【device】的数据库操作Mapper
* @createDate 2022-08-25 16:38:44
* @Entity com.ho.business.entity.Device
*/
@Mapper
public interface DeviceMapper {

    int deleteByPrimaryKey(Integer id);

    int insert(Device record);

    int insertSelective(Device record);

    Device selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Device record);

    int updateByPrimaryKey(Device record);


    Device selectBySId(Integer id);

    List<ChargePileRespVO> selectBySrcIds(Integer stationId,List<Integer> srcIds);

    List<DeviceRespVO> selectByInfo(@Param("deviceTypeList")List<String> deviceTypeList,@Param("deviceReqVO") Device deviceReqVO, @Param("stationIds") List<Integer> stationIds);

    List<DeviceRespVO> selectByCondition(DeviceReqVO deviceReqVO);

    Device selectByStationIdAndSrcId(Integer stationId, Integer srcId);

    List<String> selectDistinctDeviceTypeByStationId(Integer stationId);

    List<Device> selectDevicesByStationId(Integer stationId);

    List<DeviceRespVO> selectByStationIdAndSrcIds(Integer stationId, List<Integer> srcIds);

    /**
     *
     * @param stationId
     * @param needHide  是否需要展示隐藏设备，不为空表示展示所有设备
     * @param needAccessPoint 是否需要接入点，不为空表示需要
     * @return
     */
    List<DeviceRespVO> selectByIdAndSrcIdNotZero(Integer stationId,Integer needHide,Integer needAccessPoint,String lang);

    int insertBatch(@Param("list")List<Device> deviceList);

    List<Device> selectRealDevice(Device device);

    /**
     * 批量删除
     * @param ids
     * @return
     */
    int deleteByList(@Param("ids") List<Integer> ids);

    int updateByStationId(Device device);

    /**
     * 批量更新设备
     * @param list
     * @return
     */
    int updateDeviceList(List<Device> list);
}
