提交 | 用户 | 时间
|
b368e6
|
1 |
package com.iailab.module.model.mcs.pre.service.impl; |
潘 |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
5 |
import com.iailab.framework.common.util.date.DateUtils; |
|
6 |
import com.iailab.module.model.mcs.pre.dao.MmItemResultLastPointDao; |
|
7 |
import com.iailab.module.model.mcs.pre.entity.MmItemResultLastPointEntity; |
|
8 |
import com.iailab.module.model.mcs.pre.service.MmItemResultLastPointService; |
|
9 |
import org.springframework.stereotype.Service; |
|
10 |
import org.springframework.util.CollectionUtils; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.Date; |
|
14 |
import java.util.List; |
|
15 |
|
|
16 |
/** |
|
17 |
* @author PanZhibao |
|
18 |
* @Description |
|
19 |
* @createTime 2024年11月14日 |
|
20 |
*/ |
|
21 |
@Service |
|
22 |
public class MmItemResultLastPointServiceImpl extends BaseServiceImpl<MmItemResultLastPointDao, MmItemResultLastPointEntity> |
|
23 |
implements MmItemResultLastPointService { |
|
24 |
|
|
25 |
@Override |
977edc
|
26 |
public List<Object[]> getData(String outputid, Date startTime, Date endTime, String timeFormat) { |
b368e6
|
27 |
List<Object[]> result = new ArrayList<>(); |
潘 |
28 |
QueryWrapper<MmItemResultLastPointEntity> queryWrapper = new QueryWrapper<MmItemResultLastPointEntity>() |
|
29 |
.eq("outputid", outputid) |
|
30 |
.between("datatime", startTime, endTime) |
|
31 |
.orderByAsc("datatime"); |
|
32 |
List<MmItemResultLastPointEntity> list = baseDao.selectList(queryWrapper); |
|
33 |
if (CollectionUtils.isEmpty(list)) { |
|
34 |
return result; |
|
35 |
} |
|
36 |
list.forEach(item -> { |
|
37 |
Object[] dataItem = new Object[2]; |
977edc
|
38 |
dataItem[0] = DateUtils.format(item.getDatatime(), timeFormat); |
b368e6
|
39 |
dataItem[1] = item.getDatavalue(); |
潘 |
40 |
result.add(dataItem); |
|
41 |
}); |
|
42 |
return result; |
|
43 |
} |
|
44 |
} |