| cm.createCache(vn.azteam.tpf.domain.TBProductBlockDetailsReport.class.getName(), jcacheConfiguration); | cm.createCache(vn.azteam.tpf.domain.TBProductBlockDetailsReport.class.getName(), jcacheConfiguration); | ||||
| cm.createCache(vn.azteam.tpf.domain.TBCode.class.getName(), jcacheConfiguration); | cm.createCache(vn.azteam.tpf.domain.TBCode.class.getName(), jcacheConfiguration); | ||||
| cm.createCache(vn.azteam.tpf.domain.TBCodeDetails.class.getName(), jcacheConfiguration); | cm.createCache(vn.azteam.tpf.domain.TBCodeDetails.class.getName(), jcacheConfiguration); | ||||
| cm.createCache(vn.azteam.tpf.domain.TBProductLabel.class.getName(), jcacheConfiguration); | |||||
| // jhipster-needle-ehcache-add-entry | // jhipster-needle-ehcache-add-entry | ||||
| }; | }; | ||||
| } | } |
| @OrderBy("id ASC") | @OrderBy("id ASC") | ||||
| private Set<TBCodeDetails> tbCodeDetails = new HashSet<>(); | private Set<TBCodeDetails> tbCodeDetails = new HashSet<>(); | ||||
| // @ManyToOne(fetch = FetchType.EAGER) | |||||
| // @JsonIgnoreProperties("") | |||||
| // @JoinColumn(name = "tb_product_label_id") | |||||
| // private TBProductLabel tbProductLabel; | |||||
| public Long getId() { | public Long getId() { | ||||
| return id; | return id; | ||||
| public void setTbCropId(Long tbCropId) { | public void setTbCropId(Long tbCropId) { | ||||
| this.tbCropId = tbCropId; | this.tbCropId = tbCropId; | ||||
| } | } | ||||
| // public TBProductLabel getTbProductLabel() { | |||||
| // return tbProductLabel; | |||||
| // } | |||||
| // | |||||
| // public void setTbProductLabel(TBProductLabel tbProductLabel) { | |||||
| // this.tbProductLabel = tbProductLabel; | |||||
| // } | |||||
| } | } |
| 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; | |||||
| @Entity | |||||
| @Table(name = "tb_product_label") | |||||
| @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) | |||||
| @Document(indexName = "smf_tbproductlabel") | |||||
| public class TBProductLabel implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | |||||
| private Long id; | |||||
| @Column(name = "media") | |||||
| private String media; | |||||
| @Column(name = "description") | |||||
| private String description; | |||||
| @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 String getMedia() { | |||||
| return media; | |||||
| } | |||||
| public void setMedia(String media) { | |||||
| this.media = media; | |||||
| } | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| 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 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 TBDetailUser getDeletedBy() { | |||||
| return deletedBy; | |||||
| } | |||||
| public void setDeletedBy(TBDetailUser deletedBy) { | |||||
| this.deletedBy = deletedBy; | |||||
| } | |||||
| } |
| 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.TBProductLabel; | |||||
| //@Repository | |||||
| public interface TBProductLabelRepository extends JpaRepository<TBProductLabel, Long>, JpaSpecificationExecutor<TBProductLabel> { | |||||
| } |
| "/api/list-supplies-in-warehouses", | "/api/list-supplies-in-warehouses", | ||||
| "/api/tb-activity-types-dropdown-list", | "/api/tb-activity-types-dropdown-list", | ||||
| "/api/tb-activity-types-dropdown-list-after-harvest", | "/api/tb-activity-types-dropdown-list-after-harvest", | ||||
| "/api/tb-product-label/dropdown-list", | |||||
| "/api/display-object-param-dynamic-form-guideline-details/", | "/api/display-object-param-dynamic-form-guideline-details/", | ||||
| "/api/display-object-param-dynamic-form", | "/api/display-object-param-dynamic-form", | ||||
| "/api/tb-dashboard-types", | "/api/tb-dashboard-types", | ||||
| Arrays.asList( | Arrays.asList( | ||||
| "/api/ots/tb-crops-by-customer", | "/api/ots/tb-crops-by-customer", | ||||
| "/api/ots/tb-crops-detail/", | "/api/ots/tb-crops-detail/", | ||||
| "/api/ots/tb-code-details/", | |||||
| "/api/ots/tb-crops/")); | "/api/ots/tb-crops/")); | ||||
| List<String> apiKeyListNonGetMethod = new ArrayList<>( | List<String> apiKeyListNonGetMethod = new ArrayList<>( |
| package vn.azteam.tpf.service; | |||||
| public interface TBProductLabelService { | |||||
| } |
| private Long tBCropId; | private Long tBCropId; | ||||
| private Long tbProductLabelId; | |||||
| private String pathImage; | private String pathImage; | ||||
| private Integer quantity; | private Integer quantity; | ||||
| public void setExpiredDate(Instant expiredDate) { | public void setExpiredDate(Instant expiredDate) { | ||||
| this.expiredDate = expiredDate; | this.expiredDate = expiredDate; | ||||
| } | } | ||||
| public Long getTbProductLabelId() { | |||||
| return tbProductLabelId; | |||||
| } | |||||
| public void setTbProductLabelId(Long tbProductLabelId) { | |||||
| this.tbProductLabelId = tbProductLabelId; | |||||
| } | |||||
| } | } |
| private Long deletedById; | private Long deletedById; | ||||
| private Long tbProductLabelId; | |||||
| private Set<TBCodeDetailsDTO> tbCodeDetails = new HashSet<>(); | private Set<TBCodeDetailsDTO> tbCodeDetails = new HashSet<>(); | ||||
| public Long getId() { | public Long getId() { | ||||
| public void setTbCodeDetails(Set<TBCodeDetailsDTO> tbCodeDetails) { | public void setTbCodeDetails(Set<TBCodeDetailsDTO> tbCodeDetails) { | ||||
| this.tbCodeDetails = tbCodeDetails; | this.tbCodeDetails = tbCodeDetails; | ||||
| } | } | ||||
| public Long getTbProductLabelId() { | |||||
| return tbProductLabelId; | |||||
| } | |||||
| public void setTbProductLabelId(Long tbProductLabelId) { | |||||
| this.tbProductLabelId = tbProductLabelId; | |||||
| } | |||||
| } | } |
| 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 TBProductLabelCriteria implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private LongFilter id; | |||||
| private StringFilter description; | |||||
| private StringFilter media; | |||||
| private InstantFilter createdDate; | |||||
| 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 getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(StringFilter description) { | |||||
| this.description = description; | |||||
| } | |||||
| public StringFilter getMedia() { | |||||
| return media; | |||||
| } | |||||
| public void setMedia(StringFilter media) { | |||||
| this.media = media; | |||||
| } | |||||
| 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; | |||||
| } | |||||
| } |
| package vn.azteam.tpf.service.dto; | |||||
| import java.io.Serializable; | |||||
| import java.time.Instant; | |||||
| public class TBProductLabelDTO implements Serializable { | |||||
| private Long id; | |||||
| private String media; | |||||
| private String description; | |||||
| 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 String getMedia() { | |||||
| return media; | |||||
| } | |||||
| public void setMedia(String media) { | |||||
| this.media = media; | |||||
| } | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| 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.mapper; | |||||
| import org.mapstruct.Mapper; | |||||
| import org.mapstruct.Mapping; | |||||
| import vn.azteam.tpf.domain.TBCode; | |||||
| import vn.azteam.tpf.domain.TBProductLabel; | |||||
| import vn.azteam.tpf.service.dto.TBProductLabelDTO; | |||||
| @Mapper(componentModel = "spring", uses = {TBDetailUserMapper.class}) | |||||
| public interface TBProductLabelMapper extends EntityMapper<TBProductLabelDTO, TBProductLabel> { | |||||
| @Mapping(source = "createdBy.id", target = "createdById") | |||||
| @Mapping(source = "modifiedBy.id", target = "modifiedById") | |||||
| @Mapping(source = "deletedBy.id", target = "deletedById") | |||||
| TBProductLabelDTO toDto(TBProductLabel tbProductLabel); | |||||
| @Mapping(source = "createdById", target = "createdBy") | |||||
| @Mapping(source = "modifiedById", target = "modifiedBy") | |||||
| @Mapping(source = "deletedById", target = "deletedBy") | |||||
| TBProductLabel toEntity(TBProductLabelDTO tBProductLabelDTO); | |||||
| default TBCode fromId(Long id) { | |||||
| if (id == null) { | |||||
| return null; | |||||
| } | |||||
| TBCode tBCode = new TBCode(); | |||||
| tBCode.setId(id); | |||||
| return tBCode; | |||||
| } | |||||
| } |
| this.userService = userService; | this.userService = userService; | ||||
| } | } | ||||
| @GetMapping("/ots/tb-code-details/scan/{code}") | |||||
| public ResponseEntity<TBCodeDetailsAndActivityDTO> getTBCodeDetailsScanOTS(@PathVariable String code) { | |||||
| if (StringUtils.isBlank(code)) { | |||||
| return (ResponseEntity<TBCodeDetailsAndActivityDTO>) ResponseEntity.badRequest(); | |||||
| } | |||||
| TBCodeDetailsAndActivityDTO tbCodeDetailsAndActivityDTO = tBCodeDetailsService.updateNumberScan(code); | |||||
| return ResponseEntity.ok().headers(null).body(tbCodeDetailsAndActivityDTO); | |||||
| } | |||||
| @GetMapping("/tb-code-details/scan/{code}") | @GetMapping("/tb-code-details/scan/{code}") | ||||
| public ResponseEntity<TBCodeDetailsAndActivityDTO> getTBCodeDetailsScan(@PathVariable String code) { | public ResponseEntity<TBCodeDetailsAndActivityDTO> getTBCodeDetailsScan(@PathVariable String code) { | ||||
| if (StringUtils.isBlank(code)) { | if (StringUtils.isBlank(code)) { |
| tBCodeDTO.setCreatedDate(Instant.now()); | tBCodeDTO.setCreatedDate(Instant.now()); | ||||
| tBCodeDTO.setCreatedById(currentUser.getUserId()); | tBCodeDTO.setCreatedById(currentUser.getUserId()); | ||||
| tBCodeDTO.setStatus(TBCodeStatusEnum.NEW); | tBCodeDTO.setStatus(TBCodeStatusEnum.NEW); | ||||
| tBCodeDTO.setExpiredDate(tBCodeCreationDTO.getExpiredDate()); | |||||
| if(tBCodeCreationDTO.getTbProductLabelId() != null) { | |||||
| tBCodeDTO.setTbProductLabelId(tBCodeCreationDTO.getTbProductLabelId()); | |||||
| } | |||||
| TBCodeDTO result = null; | TBCodeDTO result = null; | ||||
| Boolean hasViolationException = false; | Boolean hasViolationException = false; | ||||
| do { | do { |
| import com.codahale.metrics.annotation.Timed; | import com.codahale.metrics.annotation.Timed; | ||||
| import io.github.jhipster.service.filter.LongFilter; | import io.github.jhipster.service.filter.LongFilter; | ||||
| import vn.azteam.tpf.service.TBDetailUserService; | |||||
| import vn.azteam.tpf.service.TBRoleService; | |||||
| import vn.azteam.tpf.service.UserService; | |||||
| import vn.azteam.tpf.service.dto.TBRoleDTO; | |||||
| import vn.azteam.tpf.service.dto.UserDTO; | |||||
| import vn.azteam.tpf.service.util.PageableUtil; | |||||
| import vn.azteam.tpf.web.rest.errors.BadRequestAlertException; | |||||
| import vn.azteam.tpf.web.rest.util.HeaderUtil; | |||||
| import vn.azteam.tpf.web.rest.util.PaginationUtil; | |||||
| import vn.azteam.tpf.service.dto.TBDetailUserDTO; | |||||
| import vn.azteam.tpf.service.dto.TBDetailUserCriteria; | |||||
| import vn.azteam.tpf.service.TBDetailUserQueryService; | |||||
| import io.github.jhipster.web.util.ResponseUtil; | import io.github.jhipster.web.util.ResponseUtil; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.http.HttpStatus; | import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import vn.azteam.tpf.service.TBDetailUserQueryService; | |||||
| import vn.azteam.tpf.service.TBDetailUserService; | |||||
| import vn.azteam.tpf.service.TBRoleService; | |||||
| import vn.azteam.tpf.service.UserService; | |||||
| import vn.azteam.tpf.service.dto.TBDetailUserCriteria; | |||||
| import vn.azteam.tpf.service.dto.TBDetailUserDTO; | |||||
| import vn.azteam.tpf.service.dto.UserDTO; | |||||
| import vn.azteam.tpf.service.util.PageableUtil; | |||||
| import vn.azteam.tpf.web.rest.errors.BadRequestAlertException; | |||||
| import vn.azteam.tpf.web.rest.util.HeaderUtil; | |||||
| import vn.azteam.tpf.web.rest.util.PaginationUtil; | |||||
| import java.net.URI; | import java.net.URI; | ||||
| import java.net.URISyntaxException; | import java.net.URISyntaxException; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Optional; | import java.util.Optional; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| Page<TBDetailUserDTO> page = tBDetailUserQueryService.findByCriteria(criteria, pageable); | Page<TBDetailUserDTO> page = tBDetailUserQueryService.findByCriteria(criteria, pageable); | ||||
| List<TBDetailUserDTO> result = page.getContent(); | List<TBDetailUserDTO> result = page.getContent(); | ||||
| UserDTO currentUser = userService.getCurrentUserDTO().get(); | UserDTO currentUser = userService.getCurrentUserDTO().get(); | ||||
| if(currentUser.getCustomerId() != null){ | |||||
| if (currentUser.getCustomerId() != null) { | |||||
| result = result.stream() | result = result.stream() | ||||
| .filter(item -> item.getTbCustomerId() != null && item.getTbCustomerId() == currentUser.getCustomerId()) | .filter(item -> item.getTbCustomerId() != null && item.getTbCustomerId() == currentUser.getCustomerId()) | ||||
| .collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
| page = pageableUtil.changeTBDetailUserDTOToPageFromList(result,pageable); | |||||
| page = pageableUtil.changeTBDetailUserDTOToPageFromList(result, pageable); | |||||
| } | } | ||||
| HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/tb-detail-users"); | HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/tb-detail-users"); | ||||
| return ResponseEntity.ok().headers(headers).body(page.getContent()); | return ResponseEntity.ok().headers(headers).body(page.getContent()); | ||||
| } | } | ||||
| @GetMapping("/tb-detail-users/all") | |||||
| @Timed | |||||
| public ResponseEntity<List<TBDetailUserDTO>> getAllTBDetailUsers(TBDetailUserCriteria criteria) { | |||||
| log.debug("REST request to get TBDetailUsers by criteria: {}", criteria); | |||||
| // Page<TBDetailUserDTO> page = tBDetailUserQueryService.findByCriteria(criteria, pageable); | |||||
| // List<TBDetailUserDTO> result = page.getContent(); | |||||
| List<TBDetailUserDTO> result = tBDetailUserQueryService.findByCriteria(criteria); | |||||
| UserDTO currentUser = userService.getCurrentUserDTO().get(); | |||||
| if (currentUser.getCustomerId() != null) { | |||||
| result = result.stream() | |||||
| .filter(item -> item.getTbCustomerId() != null && item.getTbCustomerId() == currentUser.getCustomerId()) | |||||
| .collect(Collectors.toList()); | |||||
| //page = pageableUtil.changeTBDetailUserDTOToPageFromList(result,pageable); | |||||
| } | |||||
| //HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/tb-detail-users"); | |||||
| return ResponseEntity.ok().body(result); | |||||
| } | |||||
| /** | /** | ||||
| * GET /tb-detail-users : get all the tBDetailUsers belong to a crop. | * GET /tb-detail-users : get all the tBDetailUsers belong to a crop. | ||||
| * | * | ||||
| } | } | ||||
| /** | /** | ||||
| * GET /tb-detail-users/count : count all the tBDetailUsers. | |||||
| * | |||||
| * @param criteria the criterias which the requested entities should match | |||||
| * @return the ResponseEntity with status 200 (OK) and the count in body | |||||
| */ | |||||
| * GET /tb-detail-users/count : count all the tBDetailUsers. | |||||
| * | |||||
| * @param criteria the criterias which the requested entities should match | |||||
| * @return the ResponseEntity with status 200 (OK) and the count in body | |||||
| */ | |||||
| @GetMapping("/tb-detail-users/count") | @GetMapping("/tb-detail-users/count") | ||||
| @Timed | @Timed | ||||
| public ResponseEntity<Long> countTBDetailUsers(TBDetailUserCriteria criteria) { | public ResponseEntity<Long> countTBDetailUsers(TBDetailUserCriteria criteria) { | ||||
| * SEARCH /_search/tb-detail-users?query=:query : search for the tBDetailUser corresponding | * SEARCH /_search/tb-detail-users?query=:query : search for the tBDetailUser corresponding | ||||
| * to the query. | * to the query. | ||||
| * | * | ||||
| * @param query the query of the tBDetailUser search | |||||
| * @param query the query of the tBDetailUser search | |||||
| * @param pageable the pagination information | * @param pageable the pagination information | ||||
| * @return the result of the search | * @return the result of the search | ||||
| */ | */ |
| package vn.azteam.tpf.web.rest; | |||||
| import com.codahale.metrics.annotation.Timed; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.Pageable; | |||||
| import org.springframework.http.ResponseEntity; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import vn.azteam.tpf.service.TBProductLabelQueryService; | |||||
| import vn.azteam.tpf.service.dto.TBProductLabelCriteria; | |||||
| import vn.azteam.tpf.service.dto.TBProductLabelDTO; | |||||
| import java.util.Comparator; | |||||
| import java.util.List; | |||||
| import java.util.stream.Collectors; | |||||
| //@RestController | |||||
| //@RequestMapping("/api") | |||||
| public class TBProductLabelResource { | |||||
| private static final String ENTITY_NAME = "tBProductLabel"; | |||||
| private final TBProductLabelQueryService tBProductLabelQueryService; | |||||
| public TBProductLabelResource(TBProductLabelQueryService tBProductLabelQueryService) { | |||||
| this.tBProductLabelQueryService = tBProductLabelQueryService; | |||||
| } | |||||
| private final Logger log = LoggerFactory.getLogger(TBProductLabelResource.class); | |||||
| @GetMapping("/tb-product-label/dropdown-list") | |||||
| @Timed | |||||
| public ResponseEntity<List<TBProductLabelDTO>> getAllTBProductLabelForDropdown(TBProductLabelCriteria criteria) { | |||||
| log.debug("REST request to get TBCodes by criteria: {}", criteria); | |||||
| Page<TBProductLabelDTO> page = tBProductLabelQueryService.findByCriteria(criteria, Pageable.unpaged()); | |||||
| //Authorize get list crop by customer of current user | |||||
| List<TBProductLabelDTO> result = page.getContent().stream() | |||||
| .sorted(Comparator.comparing( | |||||
| TBProductLabelDTO::getCreatedDate, | |||||
| Comparator.nullsFirst(Comparator.naturalOrder())).reversed()) | |||||
| .collect(Collectors.toList()); | |||||
| return ResponseEntity.ok().headers(null).body(result); | |||||
| } | |||||
| } |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <databaseChangeLog | |||||
| xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | |||||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
| xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> | |||||
| <property name="now" value="now()" dbms="h2"/> | |||||
| <property name="now" value="now()" dbms="mysql"/> | |||||
| <property name="autoIncrement" value="true"/> | |||||
| <property name="floatType" value="float4" dbms="postgresql, h2"/> | |||||
| <property name="floatType" value="float" dbms="mysql, oracle, mssql"/> | |||||
| <!-- | |||||
| Added the entity TBCode. | |||||
| --> | |||||
| <changeSet id="20240121075003-1" author="jhipster"> | |||||
| <createTable tableName="tb_product_label"> | |||||
| <column name="id" type="bigint" autoIncrement="${autoIncrement}"> | |||||
| <constraints primaryKey="true" nullable="false"/> | |||||
| </column> | |||||
| <column name="media" type="varchar(255)"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <column name="description" type="varchar(255)"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <column name="created_date" type="timestamp"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <column name="modified_date" type="timestamp"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <column name="deleted_date" type="timestamp"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <column name="created_by" type="bigint"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <column name="modified_by" type="bigint"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <column name="deleted_by" type="bigint"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove--> | |||||
| </createTable> | |||||
| </changeSet> | |||||
| <changeSet id="2024012105160000-1" author="jhipster"> | |||||
| <addColumn tableName="tb_code"> | |||||
| <column name="tb_product_label_id" type="bigint"> | |||||
| <constraints nullable="true"/> | |||||
| </column> | |||||
| </addColumn> | |||||
| </changeSet> | |||||
| <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove--> | |||||
| </databaseChangeLog> |
| <include file="config/liquibase/changelog/20210329175026_updated_entity_constraints_TBSuppliesUsingDetails.xml" relativeToChangelogFile="false"/> | <include file="config/liquibase/changelog/20210329175026_updated_entity_constraints_TBSuppliesUsingDetails.xml" relativeToChangelogFile="false"/> | ||||
| <!-- <include file="config/liquibase/changelog/20231209075003_added_entity_TBCode.xml" relativeToChangelogFile="false"/>--> | <!-- <include file="config/liquibase/changelog/20231209075003_added_entity_TBCode.xml" relativeToChangelogFile="false"/>--> | ||||
| <!-- <include file="config/liquibase/changelog/20231209075004_added_entity_TBCodeDetails.xml" relativeToChangelogFile="false"/>--> | <!-- <include file="config/liquibase/changelog/20231209075004_added_entity_TBCodeDetails.xml" relativeToChangelogFile="false"/>--> | ||||
| <!-- <include file="config/liquibase/changelog/20240121075003_added_entity_TBProductLabel.xml" relativeToChangelogFile="false"/>--> | |||||
| </databaseChangeLog> | </databaseChangeLog> |
| CREATE TABLE tb_product_label | |||||
| ( | |||||
| id bigint not null auto_increment, | |||||
| media varchar(255), | |||||
| description varchar(255), | |||||
| created_date timestamp, | |||||
| modified_date timestamp, | |||||
| deleted_date timestamp, | |||||
| created_by bigint, | |||||
| modified_by bigint, | |||||
| deleted_by bigint, | |||||
| PRIMARY KEY (id) | |||||
| ); | |||||
| ALTER TABLE tb_code | |||||
| ADD tb_product_label_id bigint; | |||||