package com.ho.business.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ho.business.entity.StationRemoteControl;
import com.ho.business.mapper.StationRemoteControlMapper;
import com.ho.business.service.StationRemoteControlService;
import com.ho.business.vo.req.StationRemoteControlPageVo;
import com.ho.common.tools.util.PageResult;
import com.ho.common.tools.util.PageUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class StationRemoteControlServiceImpl implements StationRemoteControlService {

    @Autowired
    StationRemoteControlMapper stationRemoteControlMapper;

    @Override
    public void insert(StationRemoteControl entity) {
         stationRemoteControlMapper.insert(entity);
    }

    @Override
    public void update(StationRemoteControl entity) {
        stationRemoteControlMapper.update(entity);
    }

    @Override
    public void delete(Integer id) {
        stationRemoteControlMapper.delete(id);
    }

    @Override
    public StationRemoteControl search(Integer stationId) {
        return stationRemoteControlMapper.search(stationId);
    }

    @Override
    public PageResult<StationRemoteControl> selectPageList(StationRemoteControlPageVo vo) {
        PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
        List<StationRemoteControl> list = stationRemoteControlMapper.selectList(vo);
        return PageUtils.getPageResult(new PageInfo<>(list));
    }
}
