First Commit
This commit is contained in:
67
src/main/java/quant/rich/emoney/entity/sqlite/Plan.java
Normal file
67
src/main/java/quant/rich/emoney/entity/sqlite/Plan.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package quant.rich.emoney.entity.sqlite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import quant.rich.emoney.mybatis.typehandler.CommaListTypeHandler;
|
||||
import quant.rich.emoney.mybatis.typehandler.JsonStringTypeHandler;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "plan", autoResultMap = true)
|
||||
public class Plan {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private String planId;
|
||||
|
||||
private String cronExpression;
|
||||
|
||||
private String planName;
|
||||
|
||||
private String indexCode;
|
||||
|
||||
@TableField(typeHandler = CommaListTypeHandler.class)
|
||||
private List<String> periods;
|
||||
|
||||
@TableField(typeHandler = JsonStringTypeHandler.class)
|
||||
private JsonNode params;
|
||||
|
||||
private Boolean enabled;
|
||||
|
||||
private Boolean openDayCheck;
|
||||
|
||||
public Plan setPeriods(List<String> periods) {
|
||||
if (CollectionUtils.isEmpty(periods)) {
|
||||
this.periods = Collections.emptyList();
|
||||
return this;
|
||||
}
|
||||
Set<String> hashSet = new HashSet<>();
|
||||
periods.forEach(s -> {
|
||||
if (StringUtils.isNotBlank(s)) {
|
||||
hashSet.add(s.trim());
|
||||
}
|
||||
});
|
||||
this.periods = new ArrayList<>(hashSet);
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<String> getPeriods() {
|
||||
setPeriods(periods);
|
||||
return periods;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user