whyclxw
3 天以前 a9df6151d30ea1e2053d168496763dd8f0b27a45
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.mapper.PowerheartParamMapper;
import com.whyc.pojo.db_param.PowerheartParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service
public class PowerheartParamService {
    @Autowired(required = false)
    private PowerheartParamMapper mapper;
    //获取前笔数*时间间隔
    public PowerheartParam getHeartParamByPowerId(Integer powerId) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("power_id",powerId);
        wrapper.last("limit 1");
        return mapper.selectOne(wrapper);
    }
    //添加完电源需要插入默认实时页面电源的心跳数据
    public void insertHeartData(int powerId) {
        PowerheartParam heartParam=new PowerheartParam();
        heartParam.setPowerId(powerId);
        heartParam.setAcinInterverCfg(5);
        heartParam.setAcinCountCfg(100);
        heartParam.setAcoutInterverCfg(5);
        heartParam.setAcoutCountCfg(100);
        heartParam.setHrInterverCfg(5);
        heartParam.setHrCountCfg(100);
        mapper.insert(heartParam);
    }
}