新增自定义谐波指标次数获取方法
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
package com.njcn.common.utils;
|
||||||
|
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.Max;
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:用于生成谐波次数的集合
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/5/5 15:11
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
public class HarmonicTimesUtil {
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 自定义需要查询的谐波次数
|
||||||
|
* @author xuyang
|
||||||
|
* @param start 起始次数
|
||||||
|
* @param end 结束次数
|
||||||
|
* @param interval 间隔
|
||||||
|
* @return List<Object>
|
||||||
|
*/
|
||||||
|
public static List<Object> harmonicTimesList(@Min(value = 1) @Max(value = 100) Integer start, @Min(value = 1) @Max(value = 100) Integer end, Integer interval) {
|
||||||
|
List<Object> timesList = new ArrayList<>();
|
||||||
|
for (int i = start; i <= end;i = i+interval) {
|
||||||
|
timesList.add(i);
|
||||||
|
}
|
||||||
|
return timesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user