| @Column(name = "is_guideline_using") | @Column(name = "is_guideline_using") | ||||
| private Boolean isGuidelineUsing; | private Boolean isGuidelineUsing; | ||||
| /* | |||||
| false: before harvest | |||||
| true: after harvest | |||||
| */ | |||||
| @Column(name = "is_after_harvest") | |||||
| private Boolean isAfterHarvest; | |||||
| @ManyToOne(fetch=FetchType.LAZY) | @ManyToOne(fetch=FetchType.LAZY) | ||||
| @JsonIgnoreProperties("") | @JsonIgnoreProperties("") | ||||
| @JoinColumn(name = "created_by") | @JoinColumn(name = "created_by") |
| package vn.azteam.tpf.domain; | |||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||||
| import org.hibernate.annotations.Cache; | |||||
| import org.hibernate.annotations.CacheConcurrencyStrategy; | |||||
| import org.springframework.data.elasticsearch.annotations.Document; | |||||
| import javax.persistence.*; | |||||
| import java.io.Serializable; | |||||
| import java.time.Instant; | |||||
| import java.util.HashSet; | |||||
| import java.util.Set; | |||||
| @Entity | |||||
| @Table(name = "tb_code") | |||||
| @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | |||||
| @Document(indexName = "smf_tbcode") | |||||
| public class TBCode implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | |||||
| private Long id; | |||||
| @Column(name = "code") | |||||
| private String code; | |||||
| @Column(name = "quantity") | |||||
| private Integer quantity; | |||||
| @Column(name = "description") | |||||
| private String description; | |||||
| @Column(name = "path_image") | |||||
| private String pathImage; | |||||
| @Column(name = "status") | |||||
| @Enumerated(value = EnumType.STRING) | |||||
| private TBCodeStatusEnum status = TBCodeStatusEnum.NEW; | |||||
| @Column(name = "expired_date") | |||||
| private Instant expiredDate; | |||||
| @Column(name = "created_date") | |||||
| private Instant createdDate; | |||||
| @Column(name = "modified_date") | |||||
| private Instant modifiedDate; | |||||
| @Column(name = "deleted_date") | |||||
| private Instant deletedDate; | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | |||||
| @JoinColumn(name = "created_by") | |||||
| private TBDetailUser createdBy; | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | |||||
| @JoinColumn(name = "modified_by") | |||||
| private TBDetailUser modifiedBy; | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | |||||
| @JoinColumn(name = "deleted_by") | |||||
| private TBDetailUser deletedBy; | |||||
| @OneToMany(mappedBy = "tbCode", fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) | |||||
| @OrderBy("id ASC") | |||||
| private Set<TBCodeDetails> tbCodeDetails = new HashSet<>(); | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| public Integer getQuantity() { | |||||
| return quantity; | |||||
| } | |||||
| public void setQuantity(Integer quantity) { | |||||
| this.quantity = quantity; | |||||
| } | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getPathImage() { | |||||
| return pathImage; | |||||
| } | |||||
| public void setPathImage(String pathImage) { | |||||
| this.pathImage = pathImage; | |||||
| } | |||||
| public TBCodeStatusEnum getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(TBCodeStatusEnum status) { | |||||
| this.status = status; | |||||
| } | |||||
| public Instant getCreatedDate() { | |||||
| return createdDate; | |||||
| } | |||||
| public void setCreatedDate(Instant createdDate) { | |||||
| this.createdDate = createdDate; | |||||
| } | |||||
| public Instant getExpiredDate() { | |||||
| return expiredDate; | |||||
| } | |||||
| public void setExpiredDate(Instant expiredDate) { | |||||
| this.expiredDate = expiredDate; | |||||
| } | |||||
| public Instant getModifiedDate() { | |||||
| return modifiedDate; | |||||
| } | |||||
| public void setModifiedDate(Instant modifiedDate) { | |||||
| this.modifiedDate = modifiedDate; | |||||
| } | |||||
| public TBDetailUser getCreatedBy() { | |||||
| return createdBy; | |||||
| } | |||||
| public void setCreatedBy(TBDetailUser createdBy) { | |||||
| this.createdBy = createdBy; | |||||
| } | |||||
| public TBDetailUser getModifiedBy() { | |||||
| return modifiedBy; | |||||
| } | |||||
| public void setModifiedBy(TBDetailUser modifiedBy) { | |||||
| this.modifiedBy = modifiedBy; | |||||
| } | |||||
| public Set<TBCodeDetails> getTbCodeDetails() { | |||||
| return tbCodeDetails; | |||||
| } | |||||
| public void setTbCodeDetails(Set<TBCodeDetails> tbCodeDetails) { | |||||
| this.tbCodeDetails = tbCodeDetails; | |||||
| } | |||||
| public Instant getDeletedDate() { | |||||
| return deletedDate; | |||||
| } | |||||
| public void setDeletedDate(Instant deletedDate) { | |||||
| this.deletedDate = deletedDate; | |||||
| } | |||||
| public TBDetailUser getDeletedBy() { | |||||
| return deletedBy; | |||||
| } | |||||
| public void setDeletedBy(TBDetailUser deletedBy) { | |||||
| this.deletedBy = deletedBy; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.domain; | |||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | |||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||||
| import org.hibernate.annotations.Cache; | |||||
| import org.hibernate.annotations.CacheConcurrencyStrategy; | |||||
| import org.springframework.data.elasticsearch.annotations.Document; | |||||
| import javax.persistence.*; | |||||
| import java.io.Serializable; | |||||
| import java.time.Instant; | |||||
| @Entity | |||||
| @Table(name = "tb_code_details") | |||||
| @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | |||||
| @Document(indexName = "smf_tbcodedetails") | |||||
| public class TBCodeDetails implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | |||||
| private Long id; | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | |||||
| @JsonIgnore | |||||
| @JoinColumn(name = "tb_code_id") | |||||
| private TBCode tbCode; | |||||
| @Column(name = "code") | |||||
| private String code; | |||||
| @Column(name = "number_scan") | |||||
| private Integer numberScan; | |||||
| @Column(name = "status") | |||||
| @Enumerated(value = EnumType.STRING) | |||||
| private TBCodeDetailsStatusEnum status = TBCodeDetailsStatusEnum.NEW; | |||||
| @Column(name = "created_date") | |||||
| private Instant createdDate; | |||||
| @Column(name = "modified_date") | |||||
| private Instant modifiedDate; | |||||
| @Column(name = "deleted_date") | |||||
| private Instant deletedDate; | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | |||||
| @JoinColumn(name = "created_by") | |||||
| private TBDetailUser createdBy; | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | |||||
| @JoinColumn(name = "modified_by") | |||||
| private TBDetailUser modifiedBy; | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | |||||
| @JoinColumn(name = "deleted_by") | |||||
| private TBDetailUser deletedBy; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public TBCode getTbCode() { | |||||
| return tbCode; | |||||
| } | |||||
| public void setTbCode(TBCode tbCode) { | |||||
| this.tbCode = tbCode; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| public Integer getNumberScan() { | |||||
| return numberScan; | |||||
| } | |||||
| public void setNumberScan(Integer numberScan) { | |||||
| this.numberScan = numberScan; | |||||
| } | |||||
| public TBCodeDetailsStatusEnum getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(TBCodeDetailsStatusEnum status) { | |||||
| this.status = status; | |||||
| } | |||||
| public Instant getCreatedDate() { | |||||
| return createdDate; | |||||
| } | |||||
| public void setCreatedDate(Instant createdDate) { | |||||
| this.createdDate = createdDate; | |||||
| } | |||||
| public Instant getModifiedDate() { | |||||
| return modifiedDate; | |||||
| } | |||||
| public void setModifiedDate(Instant modifiedDate) { | |||||
| this.modifiedDate = modifiedDate; | |||||
| } | |||||
| public TBDetailUser getCreatedBy() { | |||||
| return createdBy; | |||||
| } | |||||
| public void setCreatedBy(TBDetailUser createdBy) { | |||||
| this.createdBy = createdBy; | |||||
| } | |||||
| public TBDetailUser getModifiedBy() { | |||||
| return modifiedBy; | |||||
| } | |||||
| public void setModifiedBy(TBDetailUser modifiedBy) { | |||||
| this.modifiedBy = modifiedBy; | |||||
| } | |||||
| public Instant getDeletedDate() { | |||||
| return deletedDate; | |||||
| } | |||||
| public void setDeletedDate(Instant deletedDate) { | |||||
| this.deletedDate = deletedDate; | |||||
| } | |||||
| public TBDetailUser getDeletedBy() { | |||||
| return deletedBy; | |||||
| } | |||||
| public void setDeletedBy(TBDetailUser deletedBy) { | |||||
| this.deletedBy = deletedBy; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.domain; | |||||
| public enum TBCodeDetailsStatusEnum { | |||||
| NEW("NEW"), | |||||
| UPDATED("UPDATED"), | |||||
| CANCELED("UPDATED_PRINTED"); | |||||
| private final String name; | |||||
| TBCodeDetailsStatusEnum(final String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.domain; | |||||
| public enum TBCodeStatusEnum { | |||||
| NEW("NEW"), | |||||
| UPDATED("UPDATED"), | |||||
| UPDATED_PRINTED("UPDATED_PRINTED"); | |||||
| private final String name; | |||||
| TBCodeStatusEnum(final String name) { | |||||
| this.name = name; | |||||
| } | |||||
| public String getName() { | |||||
| return name; | |||||
| } | |||||
| } | |||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||||
| import org.hibernate.annotations.Cache; | import org.hibernate.annotations.Cache; | ||||
| import org.hibernate.annotations.CacheConcurrencyStrategy; | import org.hibernate.annotations.CacheConcurrencyStrategy; | ||||
| import org.springframework.data.elasticsearch.annotations.Document; | |||||
| import javax.persistence.*; | import javax.persistence.*; | ||||
| import org.springframework.data.elasticsearch.annotations.Document; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.time.Instant; | import java.time.Instant; | ||||
| import java.util.HashSet; | import java.util.HashSet; | ||||
| import java.util.Set; | |||||
| import java.util.Objects; | import java.util.Objects; | ||||
| import java.util.Set; | |||||
| /** | /** | ||||
| * A TBCrop. | * A TBCrop. | ||||
| @JsonIgnoreProperties("") | @JsonIgnoreProperties("") | ||||
| private TBEntity tbEntity; | private TBEntity tbEntity; | ||||
| @ManyToOne(fetch=FetchType.LAZY) | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | @JsonIgnoreProperties("") | ||||
| @JoinColumn(name = "created_by") | @JoinColumn(name = "created_by") | ||||
| private TBDetailUser createdBy; | private TBDetailUser createdBy; | ||||
| @ManyToOne(fetch=FetchType.LAZY) | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | @JsonIgnoreProperties("") | ||||
| @JoinColumn(name = "modified_by") | @JoinColumn(name = "modified_by") | ||||
| private TBDetailUser modifiedBy; | private TBDetailUser modifiedBy; | ||||
| @ManyToOne(fetch=FetchType.LAZY) | |||||
| @ManyToOne(fetch = FetchType.LAZY) | |||||
| @JsonIgnoreProperties("") | @JsonIgnoreProperties("") | ||||
| @JoinColumn(name = "deleted_by") | @JoinColumn(name = "deleted_by") | ||||
| private TBDetailUser deletedBy; | private TBDetailUser deletedBy; | ||||
| @ManyToMany | @ManyToMany | ||||
| @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | ||||
| @JoinTable(name = "tb_assignment", | @JoinTable(name = "tb_assignment", | ||||
| joinColumns = @JoinColumn(name = "tb_crops_id"/*, referencedColumnName = "id"*/), | |||||
| inverseJoinColumns = @JoinColumn(name = "tb_detail_users_id"/*, referencedColumnName = "id"*/)) | |||||
| joinColumns = @JoinColumn(name = "tb_crops_id"/*, referencedColumnName = "id"*/), | |||||
| inverseJoinColumns = @JoinColumn(name = "tb_detail_users_id"/*, referencedColumnName = "id"*/)) | |||||
| private Set<TBDetailUser> tbDetailUsers = new HashSet<>(); | private Set<TBDetailUser> tbDetailUsers = new HashSet<>(); | ||||
| @ManyToMany | |||||
| @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | |||||
| @JoinTable(name = "tb_crop_code", | |||||
| joinColumns = @JoinColumn(name = "tb_crop_id"/*, referencedColumnName = "id"*/), | |||||
| inverseJoinColumns = @JoinColumn(name = "tb_code_id"/*, referencedColumnName = "id"*/)) | |||||
| private Set<TBCode> tbCodes = new HashSet<>(); | |||||
| // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove | // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove | ||||
| public Long getId() { | public Long getId() { | ||||
| return id; | return id; | ||||
| public String getCode() { | public String getCode() { | ||||
| return code; | return code; | ||||
| } | } | ||||
| public TBCrop code(String code) { | public TBCrop code(String code) { | ||||
| this.code = code; | this.code = code; | ||||
| return this; | return this; |
| package vn.azteam.tpf.repository; | |||||
| import org.springframework.data.jpa.repository.JpaRepository; | |||||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||||
| import org.springframework.stereotype.Repository; | |||||
| import vn.azteam.tpf.domain.TBCodeDetails; | |||||
| @Repository | |||||
| public interface TBCodeDetailsRepository extends JpaRepository<TBCodeDetails, Long>, JpaSpecificationExecutor<TBCodeDetails> { | |||||
| } |
| package vn.azteam.tpf.repository; | |||||
| import org.springframework.data.jpa.repository.JpaRepository; | |||||
| import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | |||||
| import org.springframework.stereotype.Repository; | |||||
| import vn.azteam.tpf.domain.TBCode; | |||||
| import vn.azteam.tpf.domain.TBCrop; | |||||
| @Repository | |||||
| public interface TBCodeRepository extends JpaRepository<TBCode, Long>, JpaSpecificationExecutor<TBCode> { | |||||
| } |
| package vn.azteam.tpf.service; | |||||
| import io.github.jhipster.service.QueryService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.Pageable; | |||||
| import org.springframework.data.jpa.domain.Specification; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import vn.azteam.tpf.domain.TBCodeDetails; | |||||
| import vn.azteam.tpf.domain.TBCodeDetails_; | |||||
| import vn.azteam.tpf.domain.TBDetailUser; | |||||
| import vn.azteam.tpf.domain.TBDetailUser_; | |||||
| import vn.azteam.tpf.repository.TBCodeDetailsRepository; | |||||
| import vn.azteam.tpf.service.dto.TBCodeDetailsCriteria; | |||||
| import vn.azteam.tpf.service.dto.TBCodeDetailsDTO; | |||||
| import vn.azteam.tpf.service.mapper.TBCodeDetailsMapper; | |||||
| import javax.persistence.criteria.Join; | |||||
| import javax.persistence.criteria.JoinType; | |||||
| @Service | |||||
| @Transactional(readOnly = true) | |||||
| public class TBCodeDetailsQueryService extends QueryService<TBCodeDetails> { | |||||
| private final Logger log = LoggerFactory.getLogger(TBCodeDetailsQueryService.class); | |||||
| private final TBCodeDetailsRepository tBCodeDetailsRepository; | |||||
| private final TBCodeDetailsMapper tBCodeDetailsMapper; | |||||
| public TBCodeDetailsQueryService(TBCodeDetailsRepository tBCodeDetailsRepository, | |||||
| TBCodeDetailsMapper tBCodeDetailsMapper) { | |||||
| this.tBCodeDetailsRepository = tBCodeDetailsRepository; | |||||
| this.tBCodeDetailsMapper = tBCodeDetailsMapper; | |||||
| } | |||||
| @Transactional(readOnly = true) | |||||
| public Page<TBCodeDetailsDTO> findByCriteria(TBCodeDetailsCriteria criteria, Pageable page) { | |||||
| log.debug("find by criteria : {}, page: {}", criteria, page); | |||||
| final Specification<TBCodeDetails> specification = createSpecification(criteria); | |||||
| return tBCodeDetailsRepository.findAll(specification, page) | |||||
| .map(tBCodeDetailsMapper::toDto); | |||||
| } | |||||
| private Specification<TBCodeDetails> initializeCropSpecification() { | |||||
| return (Specification<TBCodeDetails>) (root, query, cb) -> { | |||||
| final Join<TBCodeDetails, TBDetailUser> detailUserJoin = root.join(TBCodeDetails_.deletedBy, JoinType.LEFT); | |||||
| return cb.isNull(detailUserJoin.get(TBDetailUser_.id)); | |||||
| }; | |||||
| } | |||||
| /** | |||||
| * Function to convert TBCodeCriteria to a {@link Specification} | |||||
| */ | |||||
| private Specification<TBCodeDetails> createSpecification(TBCodeDetailsCriteria criteria) { | |||||
| Specification<TBCodeDetails> specification = initializeCropSpecification(); | |||||
| if (criteria != null) { | |||||
| if (criteria.getId() != null) { | |||||
| specification = specification.and(buildSpecification(criteria.getId(), TBCodeDetails_.id)); | |||||
| } | |||||
| // if (criteria.getQrCode() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getQrCode(), TBCrop_.qrCode)); | |||||
| // } | |||||
| // if (criteria.getCode() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getCode(), TBCrop_.code)); | |||||
| // } | |||||
| // if (criteria.getAreaM2() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getAreaM2(), TBCrop_.areaM2)); | |||||
| // } | |||||
| // if (criteria.getTbCropType() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbCropType(), | |||||
| // root -> root.join(TBCrop_.tbCropType, JoinType.LEFT).get(TBCropType_.id))); | |||||
| // } | |||||
| // if (criteria.getStartDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getStartDate(), TBCrop_.startDate)); | |||||
| // } | |||||
| // if (criteria.getEndDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getEndDate(), TBCrop_.endDate)); | |||||
| // } | |||||
| // if (criteria.getStatus() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getStatus(), TBCrop_.status)); | |||||
| // } | |||||
| // if (criteria.getDescription() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getDescription(), TBCrop_.description)); | |||||
| // } | |||||
| // if (criteria.getAgeDayStartAt() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getAgeDayStartAt(), TBCrop_.ageDayStartAt)); | |||||
| // } | |||||
| // if (criteria.getCreatedDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getCreatedDate(), TBCrop_.createdDate)); | |||||
| // } | |||||
| // if (criteria.getModifiedDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getModifiedDate(), TBCrop_.modifiedDate)); | |||||
| // } | |||||
| // if (criteria.getDeletedDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getDeletedDate(), TBCrop_.deletedDate)); | |||||
| // } | |||||
| // if (criteria.getTbSuppliesId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbSuppliesId(), | |||||
| // root -> root.join(TBCrop_.tbSupplies, JoinType.LEFT).get(TBSupplies_.id))); | |||||
| // } | |||||
| // if (criteria.getTbGuidelineId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbGuidelineId(), | |||||
| // root -> root.join(TBCrop_.tbGuideline, JoinType.LEFT).get(TBGuideline_.id))); | |||||
| // } | |||||
| // if (criteria.getNetHouseId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getNetHouseId(), | |||||
| // root -> root.join(TBCrop_.tbEntity, JoinType.LEFT).get(TBEntity_.id))); | |||||
| // } | |||||
| // if (criteria.getCreatedById() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getCreatedById(), | |||||
| // root -> root.join(TBCrop_.createdBy, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| // if (criteria.getModifiedById() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getModifiedById(), | |||||
| // root -> root.join(TBCrop_.modifiedBy, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| // if (criteria.getDeletedById() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getDeletedById(), | |||||
| // root -> root.join(TBCrop_.deletedBy, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| // if (criteria.getTbDetailUserId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbDetailUserId(), | |||||
| // root -> root.join(TBCrop_.tbDetailUsers, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| } | |||||
| return specification; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.service; | |||||
| import io.github.jhipster.service.QueryService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.Pageable; | |||||
| import org.springframework.data.jpa.domain.Specification; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import vn.azteam.tpf.domain.*; | |||||
| import vn.azteam.tpf.repository.TBCodeRepository; | |||||
| import vn.azteam.tpf.service.dto.TBCodeCriteria; | |||||
| import vn.azteam.tpf.service.dto.TBCodeDTO; | |||||
| import vn.azteam.tpf.service.mapper.TBCodeMapper; | |||||
| import javax.persistence.criteria.Join; | |||||
| import javax.persistence.criteria.JoinType; | |||||
| @Service | |||||
| @Transactional(readOnly = true) | |||||
| public class TBCodeQueryService extends QueryService<TBCode> { | |||||
| private final Logger log = LoggerFactory.getLogger(TBCodeQueryService.class); | |||||
| private final TBCodeRepository tBCodeRepository; | |||||
| private final TBCodeMapper tBCodeMapper; | |||||
| public TBCodeQueryService(TBCodeRepository tBCodeRepository, TBCodeMapper tBCodeMapper) { | |||||
| this.tBCodeRepository = tBCodeRepository; | |||||
| this.tBCodeMapper = tBCodeMapper; | |||||
| } | |||||
| @Transactional(readOnly = true) | |||||
| public Page<TBCodeDTO> findByCriteria(TBCodeCriteria criteria, Pageable page) { | |||||
| log.debug("find by criteria : {}, page: {}", criteria, page); | |||||
| final Specification<TBCode> specification = createSpecification(criteria); | |||||
| return tBCodeRepository.findAll(specification, page) | |||||
| .map(tBCodeMapper::toDto); | |||||
| } | |||||
| private Specification<TBCode> initializeCropSpecification() { | |||||
| return (Specification<TBCode>) (root, query, cb) -> { | |||||
| final Join<TBCode, TBDetailUser> detailUserJoin = root.join(TBCode_.deletedBy, JoinType.LEFT); | |||||
| return cb.isNull(detailUserJoin.get(TBDetailUser_.id)); | |||||
| }; | |||||
| } | |||||
| /** | |||||
| * Function to convert TBCodeCriteria to a {@link Specification} | |||||
| */ | |||||
| private Specification<TBCode> createSpecification(TBCodeCriteria criteria) { | |||||
| Specification<TBCode> specification = initializeCropSpecification(); | |||||
| if (criteria != null) { | |||||
| if (criteria.getId() != null) { | |||||
| specification = specification.and(buildSpecification(criteria.getId(), TBCode_.id)); | |||||
| } | |||||
| // if (criteria.getQrCode() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getQrCode(), TBCrop_.qrCode)); | |||||
| // } | |||||
| // if (criteria.getCode() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getCode(), TBCrop_.code)); | |||||
| // } | |||||
| // if (criteria.getAreaM2() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getAreaM2(), TBCrop_.areaM2)); | |||||
| // } | |||||
| // if (criteria.getTbCropType() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbCropType(), | |||||
| // root -> root.join(TBCrop_.tbCropType, JoinType.LEFT).get(TBCropType_.id))); | |||||
| // } | |||||
| // if (criteria.getStartDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getStartDate(), TBCrop_.startDate)); | |||||
| // } | |||||
| // if (criteria.getEndDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getEndDate(), TBCrop_.endDate)); | |||||
| // } | |||||
| // if (criteria.getStatus() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getStatus(), TBCrop_.status)); | |||||
| // } | |||||
| // if (criteria.getDescription() != null) { | |||||
| // specification = specification.and(buildStringSpecification(criteria.getDescription(), TBCrop_.description)); | |||||
| // } | |||||
| // if (criteria.getAgeDayStartAt() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getAgeDayStartAt(), TBCrop_.ageDayStartAt)); | |||||
| // } | |||||
| // if (criteria.getCreatedDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getCreatedDate(), TBCrop_.createdDate)); | |||||
| // } | |||||
| // if (criteria.getModifiedDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getModifiedDate(), TBCrop_.modifiedDate)); | |||||
| // } | |||||
| // if (criteria.getDeletedDate() != null) { | |||||
| // specification = specification.and(buildRangeSpecification(criteria.getDeletedDate(), TBCrop_.deletedDate)); | |||||
| // } | |||||
| // if (criteria.getTbSuppliesId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbSuppliesId(), | |||||
| // root -> root.join(TBCrop_.tbSupplies, JoinType.LEFT).get(TBSupplies_.id))); | |||||
| // } | |||||
| // if (criteria.getTbGuidelineId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbGuidelineId(), | |||||
| // root -> root.join(TBCrop_.tbGuideline, JoinType.LEFT).get(TBGuideline_.id))); | |||||
| // } | |||||
| // if (criteria.getNetHouseId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getNetHouseId(), | |||||
| // root -> root.join(TBCrop_.tbEntity, JoinType.LEFT).get(TBEntity_.id))); | |||||
| // } | |||||
| // if (criteria.getCreatedById() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getCreatedById(), | |||||
| // root -> root.join(TBCrop_.createdBy, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| // if (criteria.getModifiedById() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getModifiedById(), | |||||
| // root -> root.join(TBCrop_.modifiedBy, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| // if (criteria.getDeletedById() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getDeletedById(), | |||||
| // root -> root.join(TBCrop_.deletedBy, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| // if (criteria.getTbDetailUserId() != null) { | |||||
| // specification = specification.and(buildSpecification(criteria.getTbDetailUserId(), | |||||
| // root -> root.join(TBCrop_.tbDetailUsers, JoinType.LEFT).get(TBDetailUser_.id))); | |||||
| // } | |||||
| } | |||||
| return specification; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.service; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.Pageable; | |||||
| import vn.azteam.tpf.service.dto.CropPersonInChargeDTO; | |||||
| import vn.azteam.tpf.service.dto.TBCropDTO; | |||||
| import vn.azteam.tpf.service.dto.TBCustomerHasCropTypeDTO; | |||||
| import java.util.List; | |||||
| import java.util.Optional; | |||||
| /** | |||||
| * Service Interface for managing TBCode. | |||||
| */ | |||||
| public interface TBCodeService { | |||||
| // TBCropDTO save(TBCropDTO tBCropDTO); | |||||
| // | |||||
| // | |||||
| // /** | |||||
| // * Update crop's PIC | |||||
| // * @param cropPersonInChargeDTO | |||||
| // * @return the persisted entity | |||||
| // */ | |||||
| // Optional<TBCropDTO> updateCropPersonInCharge(CropPersonInChargeDTO cropPersonInChargeDTO); | |||||
| // | |||||
| // /** | |||||
| // * Get all the tBCrops. | |||||
| // * | |||||
| // * @param pageable the pagination information | |||||
| // * @return the list of entities | |||||
| // */ | |||||
| // Page<TBCropDTO> findAll(Pageable pageable); | |||||
| // | |||||
| // /** | |||||
| // * Get all the TBCrop with eager load of many-to-many relationships. | |||||
| // * | |||||
| // * @return the list of entities | |||||
| // */ | |||||
| // Page<TBCropDTO> findAllWithEagerRelationships(Pageable pageable); | |||||
| // | |||||
| // /** | |||||
| // * Get the "id" tBCrop. | |||||
| // * | |||||
| // * @param id the id of the entity | |||||
| // * @return the entity | |||||
| // */ | |||||
| // Optional<TBCropDTO> findOne(Long id); | |||||
| // | |||||
| // /** | |||||
| // * Delete the "id" tBCrop. | |||||
| // * | |||||
| // * @param id the id of the entity | |||||
| // */ | |||||
| // void delete(Long id); | |||||
| // | |||||
| // /** | |||||
| // * Search for the tBCrop corresponding to the query. | |||||
| // * | |||||
| // * @param query the query of the search | |||||
| // * | |||||
| // * @param pageable the pagination information | |||||
| // * @return the list of entities | |||||
| // */ | |||||
| // Page<TBCropDTO> search(String query, Pageable pageable); | |||||
| // | |||||
| // /** | |||||
| // * Search for the tBCrop corresponding to the query, areaId or netHouseId. | |||||
| // * | |||||
| // * @param query the query of the search | |||||
| // * @param areaId the areaId of the search | |||||
| // * @param netHouseId the netHouseId of the search | |||||
| // * | |||||
| // * @param pageable the pagination information | |||||
| // * @return the list of entities | |||||
| // */ | |||||
| // Page<TBCropDTO> searchCrop(String query, Long areaId, Long netHouseId, Pageable pageable); | |||||
| // | |||||
| // List<TBCustomerHasCropTypeDTO> getAllCustomerHasCropTypeByCustomerAndCropType(Long customerId, Long cropTypeId); | |||||
| // | |||||
| // List<Long> getListActivityTypeIdByByCustomerAndCropType(Long customerId, Long cropTypeId); | |||||
| // | |||||
| // List<String> getListActivityTypeNameByByCustomerAndCropType(Long customerId, Long cropTypeId); | |||||
| // | |||||
| // List<Long> getAllCropIdByCustomer(Long customerId); | |||||
| } |
| package vn.azteam.tpf.service.dto; | |||||
| import io.github.jhipster.service.filter.InstantFilter; | |||||
| import io.github.jhipster.service.filter.IntegerFilter; | |||||
| import io.github.jhipster.service.filter.LongFilter; | |||||
| import io.github.jhipster.service.filter.StringFilter; | |||||
| import java.io.Serializable; | |||||
| public class TBCodeCriteria implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private LongFilter id; | |||||
| private IntegerFilter quantity; | |||||
| private StringFilter description; | |||||
| private StringFilter pathImage; | |||||
| private StringFilter status; | |||||
| private InstantFilter createdDate; | |||||
| private InstantFilter modifiedDate; | |||||
| private InstantFilter deletedDate; | |||||
| private LongFilter createdById; | |||||
| private LongFilter modifiedById; | |||||
| private LongFilter deletedById; | |||||
| private StringFilter tbCodeDetails; | |||||
| public LongFilter getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(LongFilter id) { | |||||
| this.id = id; | |||||
| } | |||||
| public IntegerFilter getQuantity() { | |||||
| return quantity; | |||||
| } | |||||
| public void setQuantity(IntegerFilter quantity) { | |||||
| this.quantity = quantity; | |||||
| } | |||||
| public StringFilter getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(StringFilter description) { | |||||
| this.description = description; | |||||
| } | |||||
| public StringFilter getPathImage() { | |||||
| return pathImage; | |||||
| } | |||||
| public void setPathImage(StringFilter pathImage) { | |||||
| this.pathImage = pathImage; | |||||
| } | |||||
| public StringFilter getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(StringFilter status) { | |||||
| this.status = status; | |||||
| } | |||||
| public InstantFilter getCreatedDate() { | |||||
| return createdDate; | |||||
| } | |||||
| public void setCreatedDate(InstantFilter createdDate) { | |||||
| this.createdDate = createdDate; | |||||
| } | |||||
| public InstantFilter getModifiedDate() { | |||||
| return modifiedDate; | |||||
| } | |||||
| public void setModifiedDate(InstantFilter modifiedDate) { | |||||
| this.modifiedDate = modifiedDate; | |||||
| } | |||||
| public InstantFilter getDeletedDate() { | |||||
| return deletedDate; | |||||
| } | |||||
| public void setDeletedDate(InstantFilter deletedDate) { | |||||
| this.deletedDate = deletedDate; | |||||
| } | |||||
| public LongFilter getCreatedById() { | |||||
| return createdById; | |||||
| } | |||||
| public void setCreatedById(LongFilter createdById) { | |||||
| this.createdById = createdById; | |||||
| } | |||||
| public LongFilter getModifiedById() { | |||||
| return modifiedById; | |||||
| } | |||||
| public void setModifiedById(LongFilter modifiedById) { | |||||
| this.modifiedById = modifiedById; | |||||
| } | |||||
| public LongFilter getDeletedById() { | |||||
| return deletedById; | |||||
| } | |||||
| public void setDeletedById(LongFilter deletedById) { | |||||
| this.deletedById = deletedById; | |||||
| } | |||||
| public StringFilter getTbCodeDetails() { | |||||
| return tbCodeDetails; | |||||
| } | |||||
| public void setTbCodeDetails(StringFilter tbCodeDetails) { | |||||
| this.tbCodeDetails = tbCodeDetails; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.service.dto; | |||||
| import vn.azteam.tpf.domain.TBCodeDetails; | |||||
| import vn.azteam.tpf.domain.TBCodeStatusEnum; | |||||
| import java.io.Serializable; | |||||
| import java.time.Instant; | |||||
| import java.util.HashSet; | |||||
| import java.util.Set; | |||||
| public class TBCodeDTO implements Serializable { | |||||
| private Long id; | |||||
| private String code; | |||||
| private Integer quantity; | |||||
| private String description; | |||||
| private String pathImage; | |||||
| private TBCodeStatusEnum status; | |||||
| private Instant expiredDate; | |||||
| private Instant createdDate; | |||||
| private Instant modifiedDate; | |||||
| private Instant deletedDate; | |||||
| private Long createdById; | |||||
| private Long modifiedById; | |||||
| private Long deletedById; | |||||
| private Set<TBCodeDetails> tbCodeDetails = new HashSet<>(); | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| public Integer getQuantity() { | |||||
| return quantity; | |||||
| } | |||||
| public void setQuantity(Integer quantity) { | |||||
| this.quantity = quantity; | |||||
| } | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public String getPathImage() { | |||||
| return pathImage; | |||||
| } | |||||
| public void setPathImage(String pathImage) { | |||||
| this.pathImage = pathImage; | |||||
| } | |||||
| public TBCodeStatusEnum getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(TBCodeStatusEnum status) { | |||||
| this.status = status; | |||||
| } | |||||
| public Instant getExpiredDate() { | |||||
| return expiredDate; | |||||
| } | |||||
| public void setExpiredDate(Instant expiredDate) { | |||||
| this.expiredDate = expiredDate; | |||||
| } | |||||
| public Instant getCreatedDate() { | |||||
| return createdDate; | |||||
| } | |||||
| public void setCreatedDate(Instant createdDate) { | |||||
| this.createdDate = createdDate; | |||||
| } | |||||
| public Instant getModifiedDate() { | |||||
| return modifiedDate; | |||||
| } | |||||
| public void setModifiedDate(Instant modifiedDate) { | |||||
| this.modifiedDate = modifiedDate; | |||||
| } | |||||
| public Instant getDeletedDate() { | |||||
| return deletedDate; | |||||
| } | |||||
| public void setDeletedDate(Instant deletedDate) { | |||||
| this.deletedDate = deletedDate; | |||||
| } | |||||
| public Long getCreatedById() { | |||||
| return createdById; | |||||
| } | |||||
| public void setCreatedById(Long createdById) { | |||||
| this.createdById = createdById; | |||||
| } | |||||
| public Long getModifiedById() { | |||||
| return modifiedById; | |||||
| } | |||||
| public void setModifiedById(Long modifiedById) { | |||||
| this.modifiedById = modifiedById; | |||||
| } | |||||
| public Long getDeletedById() { | |||||
| return deletedById; | |||||
| } | |||||
| public void setDeletedById(Long deletedById) { | |||||
| this.deletedById = deletedById; | |||||
| } | |||||
| public Set<TBCodeDetails> getTbCodeDetails() { | |||||
| return tbCodeDetails; | |||||
| } | |||||
| public void setTbCodeDetails(Set<TBCodeDetails> tbCodeDetails) { | |||||
| this.tbCodeDetails = tbCodeDetails; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.service.dto; | |||||
| import io.github.jhipster.service.filter.InstantFilter; | |||||
| import io.github.jhipster.service.filter.IntegerFilter; | |||||
| import io.github.jhipster.service.filter.LongFilter; | |||||
| import io.github.jhipster.service.filter.StringFilter; | |||||
| import java.io.Serializable; | |||||
| public class TBCodeDetailsCriteria implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private LongFilter id; | |||||
| private StringFilter tbCode; | |||||
| private StringFilter code; | |||||
| private IntegerFilter numberScan; | |||||
| private StringFilter status; | |||||
| private InstantFilter expiredDate; | |||||
| private InstantFilter modifiedDate; | |||||
| private InstantFilter deletedDate; | |||||
| private LongFilter createdById; | |||||
| private LongFilter modifiedById; | |||||
| private LongFilter deletedById; | |||||
| public LongFilter getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(LongFilter id) { | |||||
| this.id = id; | |||||
| } | |||||
| public StringFilter getTbCode() { | |||||
| return tbCode; | |||||
| } | |||||
| public void setTbCode(StringFilter tbCode) { | |||||
| this.tbCode = tbCode; | |||||
| } | |||||
| public StringFilter getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(StringFilter code) { | |||||
| this.code = code; | |||||
| } | |||||
| public IntegerFilter getNumberScan() { | |||||
| return numberScan; | |||||
| } | |||||
| public void setNumberScan(IntegerFilter numberScan) { | |||||
| this.numberScan = numberScan; | |||||
| } | |||||
| public StringFilter getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(StringFilter status) { | |||||
| this.status = status; | |||||
| } | |||||
| public InstantFilter getExpiredDate() { | |||||
| return expiredDate; | |||||
| } | |||||
| public void setExpiredDate(InstantFilter expiredDate) { | |||||
| this.expiredDate = expiredDate; | |||||
| } | |||||
| public InstantFilter getModifiedDate() { | |||||
| return modifiedDate; | |||||
| } | |||||
| public void setModifiedDate(InstantFilter modifiedDate) { | |||||
| this.modifiedDate = modifiedDate; | |||||
| } | |||||
| public InstantFilter getDeletedDate() { | |||||
| return deletedDate; | |||||
| } | |||||
| public void setDeletedDate(InstantFilter deletedDate) { | |||||
| this.deletedDate = deletedDate; | |||||
| } | |||||
| public LongFilter getCreatedById() { | |||||
| return createdById; | |||||
| } | |||||
| public void setCreatedById(LongFilter createdById) { | |||||
| this.createdById = createdById; | |||||
| } | |||||
| public LongFilter getModifiedById() { | |||||
| return modifiedById; | |||||
| } | |||||
| public void setModifiedById(LongFilter modifiedById) { | |||||
| this.modifiedById = modifiedById; | |||||
| } | |||||
| public LongFilter getDeletedById() { | |||||
| return deletedById; | |||||
| } | |||||
| public void setDeletedById(LongFilter deletedById) { | |||||
| this.deletedById = deletedById; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.service.dto; | |||||
| import vn.azteam.tpf.domain.TBCodeDetailsStatusEnum; | |||||
| import java.io.Serializable; | |||||
| import java.time.Instant; | |||||
| public class TBCodeDetailsDTO implements Serializable { | |||||
| private Long id; | |||||
| private TBCodeDTO tbCode; | |||||
| private String code; | |||||
| private Integer numberScan; | |||||
| private TBCodeDetailsStatusEnum status; | |||||
| private Instant expiredDate; | |||||
| private Instant createdDate; | |||||
| private Instant modifiedDate; | |||||
| private Instant deletedDate; | |||||
| private Long createdById; | |||||
| private Long modifiedById; | |||||
| private Long deletedById; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public TBCodeDTO getTbCode() { | |||||
| return tbCode; | |||||
| } | |||||
| public void setTbCode(TBCodeDTO tbCode) { | |||||
| this.tbCode = tbCode; | |||||
| } | |||||
| public String getCode() { | |||||
| return code; | |||||
| } | |||||
| public void setCode(String code) { | |||||
| this.code = code; | |||||
| } | |||||
| public Integer getNumberScan() { | |||||
| return numberScan; | |||||
| } | |||||
| public void setNumberScan(Integer numberScan) { | |||||
| this.numberScan = numberScan; | |||||
| } | |||||
| public TBCodeDetailsStatusEnum getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(TBCodeDetailsStatusEnum status) { | |||||
| this.status = status; | |||||
| } | |||||
| public Instant getExpiredDate() { | |||||
| return expiredDate; | |||||
| } | |||||
| public void setExpiredDate(Instant expiredDate) { | |||||
| this.expiredDate = expiredDate; | |||||
| } | |||||
| public Instant getCreatedDate() { | |||||
| return createdDate; | |||||
| } | |||||
| public void setCreatedDate(Instant createdDate) { | |||||
| this.createdDate = createdDate; | |||||
| } | |||||
| public Instant getModifiedDate() { | |||||
| return modifiedDate; | |||||
| } | |||||
| public void setModifiedDate(Instant modifiedDate) { | |||||
| this.modifiedDate = modifiedDate; | |||||
| } | |||||
| public Instant getDeletedDate() { | |||||
| return deletedDate; | |||||
| } | |||||
| public void setDeletedDate(Instant deletedDate) { | |||||
| this.deletedDate = deletedDate; | |||||
| } | |||||
| public Long getCreatedById() { | |||||
| return createdById; | |||||
| } | |||||
| public void setCreatedById(Long createdById) { | |||||
| this.createdById = createdById; | |||||
| } | |||||
| public Long getModifiedById() { | |||||
| return modifiedById; | |||||
| } | |||||
| public void setModifiedById(Long modifiedById) { | |||||
| this.modifiedById = modifiedById; | |||||
| } | |||||
| public Long getDeletedById() { | |||||
| return deletedById; | |||||
| } | |||||
| public void setDeletedById(Long deletedById) { | |||||
| this.deletedById = deletedById; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import vn.azteam.tpf.service.TBCodeDetailsService; | |||||
| /** | |||||
| * Service Implementation for managing TBCodeDetails. | |||||
| */ | |||||
| @Service | |||||
| @Transactional | |||||
| public class TBCodeDetailsImpl implements TBCodeDetailsService { | |||||
| } |
| package vn.azteam.tpf.service.impl; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import vn.azteam.tpf.service.TBCodeService; | |||||
| /** | |||||
| * Service Implementation for managing TBCode. | |||||
| */ | |||||
| @Service | |||||
| @Transactional | |||||
| public class TBCodeServiceImpl implements TBCodeService { | |||||
| } |
| package vn.azteam.tpf.service.mapper; | |||||
| import org.mapstruct.Mapper; | |||||
| import vn.azteam.tpf.domain.TBCodeDetails; | |||||
| import vn.azteam.tpf.service.dto.TBCodeDetailsDTO; | |||||
| @Mapper(componentModel = "spring", uses = {}) | |||||
| public interface TBCodeDetailsMapper extends EntityMapper<TBCodeDetailsDTO, TBCodeDetails> { | |||||
| } |
| package vn.azteam.tpf.service.mapper; | |||||
| import org.mapstruct.Mapper; | |||||
| import vn.azteam.tpf.domain.TBCode; | |||||
| import vn.azteam.tpf.service.dto.TBCodeDTO; | |||||
| @Mapper(componentModel = "spring", uses = {}) | |||||
| public interface TBCodeMapper extends EntityMapper<TBCodeDTO, TBCode> { | |||||
| TBCodeDTO toDto(TBCode tbCode); | |||||
| } |
| import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.context.annotation.Lazy; | |||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageImpl; | import org.springframework.data.domain.PageImpl; | ||||
| import org.springframework.data.domain.Pageable; | import org.springframework.data.domain.Pageable; | ||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tbObjectParameterDTOs.size()); | return new PageImpl<>(Lists.newArrayList(), pageable, tbObjectParameterDTOs.size()); | ||||
| } | } | ||||
| public Page<TBActivityTypeDTO> changeTBActivityTypeDTOToPageFromList(List<TBActivityTypeDTO> tBActivityTypeDTOs, Pageable pageable){ | |||||
| public Page<TBActivityTypeDTO> changeTBActivityTypeDTOToPageFromList(List<TBActivityTypeDTO> tBActivityTypeDTOs, Pageable pageable) { | |||||
| int start = Math.toIntExact(pageable.getOffset()); | int start = Math.toIntExact(pageable.getOffset()); | ||||
| int end = Math.toIntExact((start + pageable.getPageSize()) > tBActivityTypeDTOs.size() ? tBActivityTypeDTOs.size() : (start + pageable.getPageSize())); | int end = Math.toIntExact((start + pageable.getPageSize()) > tBActivityTypeDTOs.size() ? tBActivityTypeDTOs.size() : (start + pageable.getPageSize())); | ||||
| if(tBActivityTypeDTOs.size() > start) { | |||||
| if (tBActivityTypeDTOs.size() > start) { | |||||
| return new PageImpl<>(tBActivityTypeDTOs.subList(start, end), pageable, tBActivityTypeDTOs.size()); | return new PageImpl<>(tBActivityTypeDTOs.subList(start, end), pageable, tBActivityTypeDTOs.size()); | ||||
| } | } | ||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tBActivityTypeDTOs.size()); | return new PageImpl<>(Lists.newArrayList(), pageable, tBActivityTypeDTOs.size()); | ||||
| } | } | ||||
| public Page<TBDetailUserDTO> changeTBDetailUserDTOToPageFromList(List<TBDetailUserDTO> tbDetailUserDTOS, Pageable pageable){ | |||||
| public Page<TBDetailUserDTO> changeTBDetailUserDTOToPageFromList(List<TBDetailUserDTO> tbDetailUserDTOS, Pageable pageable) { | |||||
| int start = Math.toIntExact(pageable.getOffset()); | int start = Math.toIntExact(pageable.getOffset()); | ||||
| int end = Math.toIntExact((start + pageable.getPageSize()) > tbDetailUserDTOS.size() ? tbDetailUserDTOS.size() : (start + pageable.getPageSize())); | int end = Math.toIntExact((start + pageable.getPageSize()) > tbDetailUserDTOS.size() ? tbDetailUserDTOS.size() : (start + pageable.getPageSize())); | ||||
| if(tbDetailUserDTOS.size() > start) { | |||||
| if (tbDetailUserDTOS.size() > start) { | |||||
| return new PageImpl<>(tbDetailUserDTOS.subList(start, end), pageable, tbDetailUserDTOS.size()); | return new PageImpl<>(tbDetailUserDTOS.subList(start, end), pageable, tbDetailUserDTOS.size()); | ||||
| } | } | ||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tbDetailUserDTOS.size()); | return new PageImpl<>(Lists.newArrayList(), pageable, tbDetailUserDTOS.size()); | ||||
| } | } | ||||
| public Page<TBEquipmentDTO> changeTBEquipmentDTOToPageFromList(List<TBEquipmentDTO> tbEquipmentDTOS, Pageable pageable){ | |||||
| public Page<TBEquipmentDTO> changeTBEquipmentDTOToPageFromList(List<TBEquipmentDTO> tbEquipmentDTOS, Pageable pageable) { | |||||
| int start = Math.toIntExact(pageable.getOffset()); | int start = Math.toIntExact(pageable.getOffset()); | ||||
| int end = Math.toIntExact((start + pageable.getPageSize()) > tbEquipmentDTOS.size() ? tbEquipmentDTOS.size() : (start + pageable.getPageSize())); | int end = Math.toIntExact((start + pageable.getPageSize()) > tbEquipmentDTOS.size() ? tbEquipmentDTOS.size() : (start + pageable.getPageSize())); | ||||
| if(tbEquipmentDTOS.size() > start) { | |||||
| if (tbEquipmentDTOS.size() > start) { | |||||
| return new PageImpl<>(tbEquipmentDTOS.subList(start, end), pageable, tbEquipmentDTOS.size()); | return new PageImpl<>(tbEquipmentDTOS.subList(start, end), pageable, tbEquipmentDTOS.size()); | ||||
| } | } | ||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tbEquipmentDTOS.size()); | return new PageImpl<>(Lists.newArrayList(), pageable, tbEquipmentDTOS.size()); | ||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tbGuidelineDTOS.size()); | return new PageImpl<>(Lists.newArrayList(), pageable, tbGuidelineDTOS.size()); | ||||
| } | } | ||||
| public Page<TBNotificationDTO> changeTBNotificationDTOToPageFromList(List<TBNotificationDTO> tbNotificationDTOS, Pageable pageable){ | |||||
| public Page<TBNotificationDTO> changeTBNotificationDTOToPageFromList(List<TBNotificationDTO> tbNotificationDTOS, Pageable pageable) { | |||||
| int start = Math.toIntExact(pageable.getOffset()); | int start = Math.toIntExact(pageable.getOffset()); | ||||
| int end = Math.toIntExact((start + pageable.getPageSize()) > tbNotificationDTOS.size() ? tbNotificationDTOS.size() : (start + pageable.getPageSize())); | int end = Math.toIntExact((start + pageable.getPageSize()) > tbNotificationDTOS.size() ? tbNotificationDTOS.size() : (start + pageable.getPageSize())); | ||||
| if(tbNotificationDTOS.size() > start) { | |||||
| if (tbNotificationDTOS.size() > start) { | |||||
| return new PageImpl<>(tbNotificationDTOS.subList(start, end), pageable, tbNotificationDTOS.size()); | return new PageImpl<>(tbNotificationDTOS.subList(start, end), pageable, tbNotificationDTOS.size()); | ||||
| } | } | ||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tbNotificationDTOS.size()); | return new PageImpl<>(Lists.newArrayList(), pageable, tbNotificationDTOS.size()); | ||||
| } | } | ||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tbCropDTOS.size()); | return new PageImpl<>(Lists.newArrayList(), pageable, tbCropDTOS.size()); | ||||
| } | } | ||||
| public Page<TBCodeDTO> changeTBCodeDTOToPageFromList(List<TBCodeDTO> tbCodeDTOS, Pageable pageable) { | |||||
| int start = Math.toIntExact(pageable.getOffset()); | |||||
| int end = Math.toIntExact((start + pageable.getPageSize()) > tbCodeDTOS.size() ? tbCodeDTOS.size() : (start + pageable.getPageSize())); | |||||
| if (tbCodeDTOS.size() > start) { | |||||
| return new PageImpl<>(tbCodeDTOS.subList(start, end), pageable, tbCodeDTOS.size()); | |||||
| } | |||||
| return new PageImpl<>(Lists.newArrayList(), pageable, tbCodeDTOS.size()); | |||||
| } | |||||
| } | } |
| package vn.azteam.tpf.web.rest; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import vn.azteam.tpf.service.TBCodeDetailsQueryService; | |||||
| import vn.azteam.tpf.service.TBCodeDetailsService; | |||||
| import vn.azteam.tpf.service.util.PageableUtil; | |||||
| import vn.azteam.tpf.service.util.UserRoleUtil; | |||||
| @RestController | |||||
| @RequestMapping("/api") | |||||
| public class TBCodeDetailsResource { | |||||
| private final Logger log = LoggerFactory.getLogger(TBCodeDetailsResource.class); | |||||
| private final TBCodeDetailsService tBCodeDetailsService; | |||||
| private final TBCodeDetailsQueryService tBCodeDetailsQueryService; | |||||
| private final UserRoleUtil userRoleUtil; | |||||
| private final PageableUtil pageableUtil; | |||||
| public TBCodeDetailsResource(TBCodeDetailsService tBCodeDetailsService, TBCodeDetailsQueryService tBCodeDetailsQueryService, UserRoleUtil userRoleUtil, PageableUtil pageableUtil) { | |||||
| this.tBCodeDetailsService = tBCodeDetailsService; | |||||
| this.tBCodeDetailsQueryService = tBCodeDetailsQueryService; | |||||
| this.userRoleUtil = userRoleUtil; | |||||
| this.pageableUtil = pageableUtil; | |||||
| } | |||||
| } |