inflow group 추가
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.eactive.eai.common.inflow.loader;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroup;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroup;
|
||||
import com.eactive.eai.data.jpa.AbstractDataLoader;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class InflowControlGroupLoader extends AbstractDataLoader<InflowControlGroup, String, InflowControlGroupLoaderRepository> {
|
||||
|
||||
/**
|
||||
* 조건으로 그룹 조회
|
||||
*/
|
||||
public Iterable<InflowControlGroup> findByConditions(String groupId) {
|
||||
QInflowControlGroup q = QInflowControlGroup.inflowControlGroup;
|
||||
BooleanExpression expression = q.groupId.isNotNull();
|
||||
|
||||
if (StringUtils.isNotBlank(groupId)) {
|
||||
expression = expression.and(q.groupId.eq(groupId));
|
||||
}
|
||||
|
||||
return repository.findAll(expression, Sort.by("groupId"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 활성화된 그룹만 조회
|
||||
*/
|
||||
public Iterable<InflowControlGroup> findActiveGroups() {
|
||||
QInflowControlGroup q = QInflowControlGroup.inflowControlGroup;
|
||||
BooleanExpression expression = q.useYn.eq("1");
|
||||
return repository.findAll(expression, Sort.by("groupId"));
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.eactive.eai.common.inflow.loader;
|
||||
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
|
||||
import com.eactive.eai.data.DataLoaderRepository;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroup;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
interface InflowControlGroupLoaderRepository extends DataLoaderRepository<InflowControlGroup>,
|
||||
BaseRepository<InflowControlGroup, String>, QuerydslPredicateExecutor<InflowControlGroup> {
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.eactive.eai.common.inflow.loader;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroupMapping;
|
||||
import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroupMapping;
|
||||
import com.eactive.eai.data.jpa.AbstractDataLoader;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class InflowControlGroupMappingLoader extends AbstractDataLoader<InflowControlGroupMapping, String, InflowControlGroupMappingLoaderRepository> {
|
||||
|
||||
/**
|
||||
* 그룹 ID로 매핑 조회
|
||||
*/
|
||||
public Iterable<InflowControlGroupMapping> findByGroupId(String groupId) {
|
||||
QInflowControlGroupMapping q = QInflowControlGroupMapping.inflowControlGroupMapping;
|
||||
BooleanExpression expression = q.groupId.eq(groupId);
|
||||
return repository.findAll(expression, Sort.by("interfaceId"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 인터페이스 ID로 매핑 조회
|
||||
*/
|
||||
public Iterable<InflowControlGroupMapping> findByInterfaceId(String interfaceId) {
|
||||
QInflowControlGroupMapping q = QInflowControlGroupMapping.inflowControlGroupMapping;
|
||||
BooleanExpression expression = q.interfaceId.eq(interfaceId);
|
||||
return repository.findAll(expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* 활성화된 매핑만 조회
|
||||
*/
|
||||
public Iterable<InflowControlGroupMapping> findActiveMappings() {
|
||||
QInflowControlGroupMapping q = QInflowControlGroupMapping.inflowControlGroupMapping;
|
||||
BooleanExpression expression = q.useYn.eq("1");
|
||||
return repository.findAll(expression, Sort.by("groupId", "interfaceId"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹 ID와 활성화 상태로 매핑 조회
|
||||
*/
|
||||
public Iterable<InflowControlGroupMapping> findActiveByGroupId(String groupId) {
|
||||
QInflowControlGroupMapping q = QInflowControlGroupMapping.inflowControlGroupMapping;
|
||||
BooleanExpression expression = q.groupId.eq(groupId).and(q.useYn.eq("1"));
|
||||
return repository.findAll(expression, Sort.by("interfaceId"));
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.eactive.eai.common.inflow.loader;
|
||||
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
|
||||
import com.eactive.eai.data.DataLoaderRepository;
|
||||
import com.eactive.eai.data.entity.onl.inflow.InflowControlGroupMapping;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
interface InflowControlGroupMappingLoaderRepository extends DataLoaderRepository<InflowControlGroupMapping>,
|
||||
BaseRepository<InflowControlGroupMapping, String>, QuerydslPredicateExecutor<InflowControlGroupMapping> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.eactive.eai.data.entity.onl.inflow;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "inflow_control_group")
|
||||
@org.hibernate.annotations.Table(appliesTo = "inflow_control_group", comment = "유량제어 그룹")
|
||||
public class InflowControlGroup implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(generator = "UUID")
|
||||
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
|
||||
@Column(name = "group_id", updatable = false, nullable = false, length = 36)
|
||||
@Comment("그룹 ID")
|
||||
private String groupId;
|
||||
|
||||
@Column(name = "group_name", length = 100)
|
||||
@Comment("그룹명")
|
||||
private String groupName;
|
||||
|
||||
@Column(name = "threshold")
|
||||
@Comment("임계치")
|
||||
private Integer threshold;
|
||||
|
||||
@Column(name = "threshold_per_second")
|
||||
@Comment("초당 임계치")
|
||||
private Integer thresholdPerSecond;
|
||||
|
||||
@Column(name = "threshold_time_unit", length = 12)
|
||||
@Comment("임계치 TimeUnit")
|
||||
private String thresholdTimeUnit;
|
||||
|
||||
@Column(name = "use_yn", length = 1)
|
||||
@Comment("사용여부")
|
||||
private String useYn;
|
||||
|
||||
@Column(name = "modified_by", length = 50)
|
||||
@Comment("수정자")
|
||||
private String modifiedBy;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
@Comment("수정일시")
|
||||
private LocalDateTime modifiedAt;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.eactive.eai.data.entity.onl.inflow;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "inflow_control_group_mapping")
|
||||
@org.hibernate.annotations.Table(appliesTo = "inflow_control_group_mapping", comment = "유량제어 그룹 매핑")
|
||||
public class InflowControlGroupMapping implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name = "interface_id", nullable = false, length = 100)
|
||||
@Comment("인터페이스 ID")
|
||||
private String interfaceId;
|
||||
|
||||
@Column(name = "group_id", nullable = false, length = 50)
|
||||
@Comment("그룹 ID")
|
||||
private String groupId;
|
||||
|
||||
@Column(name = "use_yn", length = 1)
|
||||
@Comment("사용여부")
|
||||
private String useYn;
|
||||
|
||||
@Column(name = "modified_by", length = 50)
|
||||
@Comment("수정자")
|
||||
private String modifiedBy;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
@Comment("수정일시")
|
||||
private LocalDateTime modifiedAt;
|
||||
}
|
||||
Reference in New Issue
Block a user