package org.gyk.modules.jlgl.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.gyk.modules.jlgl.entity.CxcJlQjglJlqjtz;
import org.gyk.modules.jlgl.mapper.CxcJlQjglJlqjtzMapper;
import org.gyk.modules.jlgl.service.ICxcJlQjglJlqjtzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: cxc_jl_qjgl_jlqjtz
 * @Author: jiang
 * @Date:   2023-09-25
 * @Version: V1.0
 */
@Service
public class CxcJlQjglJlqjtzServiceImpl extends ServiceImpl<CxcJlQjglJlqjtzMapper, CxcJlQjglJlqjtz> implements ICxcJlQjglJlqjtzService {

    @Autowired
    private CxcJlQjglJlqjtzMapper cxcJlQjglJlqjtzMapper;

    @Override
    public String queryMaster(){
        String msg = "";
        List<CxcJlQjglJlqjtz> queryDataList = cxcJlQjglJlqjtzMapper.queryJldData();
        if (queryDataList != null && queryDataList.size()>0){
            Long t1 = System.currentTimeMillis();
            Long t2 = System.currentTimeMillis();
//            saveBatch(queryDataList,1000);
            //使用该方法的时候需要在实体类里面设定  @TableId ，要不然会报错，jiang
//            cxcJlQjglJlqjtzMapper.mysqlInsertOrUpdateBath(queryDataList);
            saveOrUpdateBatch(queryDataList);
            msg = "新增局计量系统数据" + queryDataList.size() + "条。";
            System.out.println("新增局计量系统数据" + queryDataList.size() + "条。" );
            System.out.println("共耗时：" + (t2-t1) + "ms");
        }else{
            msg = "局计量系统暂时没有新的数据！";
            System.out.println("局计量系统暂时没有新的数据！");
        }
        return msg;
    }

    @Override
    public List<String> getDw() {
        return baseMapper.getDw();
    }

    @Override
    public List<String> getZc(String dw) {
        return baseMapper.getZc(dw);
    }

    @Override
    public List<String> getSbmc(String zc) {
        return baseMapper.getSbmc(zc);
    }


}
