package com.foreverwin.mesnac.meapi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.meapi.dto.RouterStepDto;
import com.foreverwin.mesnac.meapi.mapper.RouterStepMapper;
import com.foreverwin.mesnac.meapi.model.RouterStep;
import com.foreverwin.mesnac.meapi.service.RouterStepService;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Philip
 * @since 2021-08-12
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class RouterStepServiceImpl extends ServiceImpl<RouterStepMapper, RouterStep> implements RouterStepService {


    @Autowired
    private RouterStepMapper routerStepMapper;

    @Override
    public IPage<RouterStep> selectPage(FrontPage<RouterStep> frontPage, RouterStep routerStep) {
        QueryWrapper<RouterStep> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(routerStep);
        return super.page(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<RouterStep> selectList(RouterStep routerStep) {
        QueryWrapper<RouterStep> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(routerStep);
        return super.list(queryWrapper);
    }

    @Override
    public List<RouterStepDto> findRouterOperationByRouterBo(String site, String routerBO) {
        return routerStepMapper.findRouterOperationByRouterBo( site,  routerBO,  LocaleContextHolder.getLocale().getLanguage());
    }


}