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 implements MmItemResultLastPointService { @Override public List getData(String outputid, Date startTime, Date endTime) { List result = new ArrayList<>(); QueryWrapper queryWrapper = new QueryWrapper() .eq("outputid", outputid) .between("datatime", startTime, endTime) .orderByAsc("datatime"); List list = baseDao.selectList(queryWrapper); if (CollectionUtils.isEmpty(list)) { return result; } list.forEach(item -> { Object[] dataItem = new Object[2]; dataItem[0] = DateUtils.format(item.getDatatime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); dataItem[1] = item.getDatavalue(); result.add(dataItem); }); return result; } }