whycxzp
2024-01-11 321f224be3ed6e60ad68594ea28f73734422d90d
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
33
34
35
36
37
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.whyc.mapper.TestParamMapper;
import com.whyc.pojo.FileParam;
import com.whyc.pojo.TestParam;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
@Service
public class TestParamService {
 
    @Resource
    private TestParamMapper mapper;
 
    public TestParam getFactorsAndThreshold() {
        QueryWrapper<TestParam> query = Wrappers.query();
        query.last(" limit 1");
        return mapper.selectOne(query);
    }
 
    public void updateFactorsAndThreshold(TestParam param) {
        mapper.updateById(param);
    }
 
    public void callService(int seconds) throws InterruptedException {
        //毫秒
        int milliseconds = seconds * 1000;
        int count = milliseconds/100;
        for (int i = 0; i < count; i++) {
            getFactorsAndThreshold();
            Thread.sleep(100);
        }
    }
}