package com.nantian.cloud.jly.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nantian.cloud.jly.entity.ConfigureGaugeReplace;
import com.nantian.cloud.jly.mapper.ConfigureGaugeReplaceMapper;
import com.nantian.cloud.jly.service.ConfigureGaugeReplaceService;
import com.nantian.cloud.jly.vo.ConfigureGaugeReplaceVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 *
 * @date 2018-09-27
 */
@Service("configureGaugeReplaceService")
public class ConfigureGaugeReplaceServiceImpl extends ServiceImpl<ConfigureGaugeReplaceMapper, ConfigureGaugeReplace> implements ConfigureGaugeReplaceService {

    @Resource
    private ConfigureGaugeReplaceMapper configureGaugeReplaceMapper;

    public IPage<ConfigureGaugeReplaceVo> getPageData(Page page, String areaCodes, String industryCode, String cmpName, String cmp,String installManageNo, String replacedManageNo){
        String code = "";
        int flag = 0;
        if(areaCodes != null){
            String[] codeList = areaCodes.split(",");
            flag = codeList.length;
            code = codeList[flag-1];
        }
        return configureGaugeReplaceMapper.getPageData(page,code,flag,industryCode,cmpName,cmp,installManageNo,replacedManageNo);
    }

    @Override
    public IPage<ConfigureGaugeReplace> pageCmp(Page page, ConfigureGaugeReplace configureGaugeReplace) {
        return baseMapper.pageCmp(page,configureGaugeReplace);
    }
}

