#29 pass: entity - bulk_pass, user_group_mapping
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.example.passbatch.repository.pass;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "bulk_pass")
|
||||
public class BulkPassEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer bulkPassSeq;
|
||||
private Integer packageSeq;
|
||||
private String userGroupId;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private BulkPassStatus status;
|
||||
private Integer count;
|
||||
|
||||
private LocalDateTime startedAt;
|
||||
private LocalDateTime endedAt;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.passbatch.repository.pass;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public interface BulkPassRepository extends JpaRepository<BulkPassEntity, Integer> {
|
||||
// WHERE status = :status AND startedAt > :startedAt
|
||||
List<BulkPassEntity> findByStatusAndStartedAtGreaterThan(BulkPassStatus status, LocalDateTime startedAt);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.example.passbatch.repository.pass;
|
||||
|
||||
public enum BulkPassStatus {
|
||||
READY, COMPLETED
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.passbatch.repository.user;
|
||||
|
||||
import com.example.passbatch.repository.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "user_group_mapping")
|
||||
@IdClass(UserGroupMappingId.class)
|
||||
public class UserGroupMappingEntity extends BaseEntity {
|
||||
@Id
|
||||
private String userGroupId;
|
||||
@Id
|
||||
private String userId;
|
||||
|
||||
private String userGroupName;
|
||||
private String description;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.example.passbatch.repository.user;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class UserGroupMappingId implements Serializable {
|
||||
private String userGroupId;
|
||||
private String userId;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.example.passbatch.repository.user;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserGroupMappingRepository extends JpaRepository<UserGroupMappingEntity, Integer> {
|
||||
List<UserGroupMappingEntity> findByUserGroupId(String userGroupId);
|
||||
}
|
||||
Reference in New Issue
Block a user