package com.iailab.module.model.mcs.pre.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.util.date.DateUtils;
|
import com.iailab.module.model.mcs.pre.dao.MmItemResultLastPointDao;
|
import com.iailab.module.model.mcs.pre.entity.MmItemResultLastPointEntity;
|
import com.iailab.module.model.mcs.pre.service.MmItemResultLastPointService;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.CollectionUtils;
|
|
import java.util.ArrayList;
|
import java.util.Date;
|
import java.util.List;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年11月14日
|
*/
|
@Service
|
public class MmItemResultLastPointServiceImpl extends BaseServiceImpl<MmItemResultLastPointDao, MmItemResultLastPointEntity>
|
implements MmItemResultLastPointService {
|
|
@Override
|
public List<Object[]> getData(String outputid, Date startTime, Date endTime, String timeFormat) {
|
List<Object[]> result = new ArrayList<>();
|
QueryWrapper<MmItemResultLastPointEntity> queryWrapper = new QueryWrapper<MmItemResultLastPointEntity>()
|
.eq("outputid", outputid)
|
.between("datatime", startTime, endTime)
|
.orderByAsc("datatime");
|
List<MmItemResultLastPointEntity> list = baseDao.selectList(queryWrapper);
|
if (CollectionUtils.isEmpty(list)) {
|
return result;
|
}
|
list.forEach(item -> {
|
Object[] dataItem = new Object[2];
|
dataItem[0] = DateUtils.format(item.getDatatime(), timeFormat);
|
dataItem[1] = item.getDatavalue();
|
result.add(dataItem);
|
});
|
return result;
|
}
|
}
|