package com.huimv.env.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huimv.env.admin.common.utils.Result;
import com.huimv.env.admin.common.utils.ResultCode;
import com.huimv.env.admin.entity.PortChangeData;
import com.huimv.env.admin.mapper.PortChangeDataMapper;
import com.huimv.env.admin.service.IPortChangeDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2024-05-09
 */
@Service
public class PortChangeDataServiceImpl extends ServiceImpl<PortChangeDataMapper, PortChangeData> implements IPortChangeDataService {

    @Autowired
    private PortChangeDataMapper dataMapper;

    @Override
    public Result listData(Map<String,String> paramsMap) {
        String id = paramsMap.get("id");//端口id
        String pageNum = paramsMap.get("pageNum");
        String pageSize = paramsMap.get("pageSize");
        Page<PortChangeData> page = new Page(Integer.valueOf(pageNum),Integer.valueOf(pageSize));
        QueryWrapper<PortChangeData> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("terminal_port_code", id);
        return new Result(ResultCode.SUCCESS, dataMapper.selectPage(page, queryWrapper));
    }
}
