Browse Source
chages in UI main category divided into two part has external and internal services
master
chages in UI main category divided into two part has external and internal services
master
24 changed files with 751 additions and 196 deletions
-
15src/main/java/com/gcc_it_cell_services/springboot/controller/UrlDataController.java
-
9src/main/java/com/gcc_it_cell_services/springboot/mapper/UrlDataMapper.java
-
32src/main/java/com/gcc_it_cell_services/springboot/mapper/UrlSubCategoryMapper.java
-
5src/main/java/com/gcc_it_cell_services/springboot/model/UrlData.java
-
112src/main/java/com/gcc_it_cell_services/springboot/model/UrlSubCategory.java
-
7src/main/java/com/gcc_it_cell_services/springboot/repository/UrlDataRepository.java
-
18src/main/java/com/gcc_it_cell_services/springboot/repository/UrlSubCategoryRepository.java
-
1src/main/java/com/gcc_it_cell_services/springboot/request_dto/AddUrlDataRequestDTO.java
-
1src/main/java/com/gcc_it_cell_services/springboot/request_dto/UpdateUrlDataRequestDTO.java
-
2src/main/java/com/gcc_it_cell_services/springboot/request_dto/UrlDataRequestDTO.java
-
18src/main/java/com/gcc_it_cell_services/springboot/request_dto/UrlSubCategoryRequestDTO.java
-
4src/main/java/com/gcc_it_cell_services/springboot/response_dto/UrlDataResponseDTO.java
-
19src/main/java/com/gcc_it_cell_services/springboot/response_dto/UrlSubCategoryResponseDTO.java
-
63src/main/java/com/gcc_it_cell_services/springboot/service/UrlDataCacheService.java
-
152src/main/java/com/gcc_it_cell_services/springboot/service/UrlDataService.java
-
5src/main/resources/application-local.properties
-
4src/main/resources/application-prod.properties
-
3src/main/resources/application.properties
-
178src/main/resources/static/assets/css/home-styles.css
-
205src/main/resources/static/assets/js/home-script.js
-
4src/main/resources/static/assets/js/update-url-data-script.js
-
5src/main/resources/templates/urls/add-url-data.html
-
62src/main/resources/templates/urls/get-urls-by-url-category.html
-
11src/main/resources/templates/urls/update-url-data.html
@ -0,0 +1,32 @@ |
|||
package com.gcc_it_cell_services.springboot.mapper; |
|||
|
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import com.gcc_it_cell_services.springboot.model.UrlSubCategory; |
|||
import com.gcc_it_cell_services.springboot.request_dto.UrlSubCategoryRequestDTO; |
|||
import com.gcc_it_cell_services.springboot.response_dto.UrlSubCategoryResponseDTO; |
|||
|
|||
@Component |
|||
public class UrlSubCategoryMapper { |
|||
|
|||
public UrlSubCategoryResponseDTO toUrlSubCatResDTO(UrlSubCategory urlSubCat) { |
|||
if (urlSubCat == null) return null; |
|||
return new UrlSubCategoryResponseDTO(urlSubCat.getUrlSubCatId(), urlSubCat.getUrlSubCatName()); |
|||
} |
|||
|
|||
public UrlSubCategory toUrlSubCatEnt(UrlSubCategoryRequestDTO urlSubCatReqDTO) { |
|||
if (urlSubCatReqDTO == null) return null; |
|||
UrlSubCategory urlSubCat = new UrlSubCategory(); |
|||
urlSubCat.setUrlSubCatName(urlSubCatReqDTO.getUrlSubCatName()); |
|||
return urlSubCat; |
|||
} |
|||
|
|||
public UrlSubCategory toUrlSubCatEnt(UrlSubCategoryResponseDTO urlSubCatResDTO) { |
|||
if (urlSubCatResDTO == null) return null; |
|||
UrlSubCategory urlSubCat = new UrlSubCategory(); |
|||
urlSubCat.setUrlSubCatId(urlSubCatResDTO.getUrlSubCatId()); |
|||
urlSubCat.setUrlSubCatName(urlSubCatResDTO.getUrlSubCatName()); |
|||
return urlSubCat; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,112 @@ |
|||
package com.gcc_it_cell_services.springboot.model; |
|||
|
|||
import java.time.Instant; |
|||
import java.time.temporal.ChronoUnit; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import javax.persistence.CascadeType; |
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.EntityListeners; |
|||
import javax.persistence.FetchType; |
|||
import javax.persistence.GeneratedValue; |
|||
import javax.persistence.GenerationType; |
|||
import javax.persistence.Id; |
|||
import javax.persistence.JoinColumn; |
|||
import javax.persistence.ManyToOne; |
|||
import javax.persistence.OneToMany; |
|||
import javax.persistence.PrePersist; |
|||
import javax.persistence.PreUpdate; |
|||
import javax.persistence.Table; |
|||
import javax.persistence.Temporal; |
|||
import javax.persistence.TemporalType; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
import org.springframework.data.annotation.CreatedBy; |
|||
import org.springframework.data.annotation.CreatedDate; |
|||
import org.springframework.data.annotation.LastModifiedBy; |
|||
import org.springframework.data.annotation.LastModifiedDate; |
|||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonBackReference; |
|||
import com.fasterxml.jackson.annotation.JsonManagedReference; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
|
|||
@Entity |
|||
@Table(name = "tbl_url_sub_cat_det") |
|||
@Getter |
|||
@Setter |
|||
@ToString(includeFieldNames = true, doNotUseGetters = true, exclude = { "urlDatas", "createdBy", "updatedBy", "urlCat" }) |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
@EntityListeners(AuditingEntityListener.class) |
|||
public class UrlSubCategory { |
|||
|
|||
@Id |
|||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
|||
@Column(name = "url_sub_cat_id", nullable = false, updatable = false) |
|||
private Long urlSubCatId; |
|||
|
|||
@Column(name = "url_sub_cat_name", nullable = false) |
|||
@NotBlank |
|||
private String urlSubCatName; |
|||
|
|||
@ManyToOne(fetch = FetchType.LAZY) |
|||
@JoinColumn(name = "url_cat_id", referencedColumnName = "url_cat_id", nullable = false) |
|||
@JsonBackReference |
|||
private UrlCategory urlCat; |
|||
|
|||
@OneToMany(mappedBy = "urlSubCat", orphanRemoval = true, cascade = CascadeType.ALL) |
|||
@JsonManagedReference |
|||
private List<UrlData> urlDatas; |
|||
|
|||
@CreatedBy |
|||
@ManyToOne(fetch = FetchType.LAZY) |
|||
@JoinColumn(name = "created_by_usr_id", referencedColumnName = "usr_id", updatable = false, nullable = false) |
|||
private AppUser createdBy; |
|||
|
|||
@LastModifiedBy |
|||
@ManyToOne(fetch = FetchType.LAZY) |
|||
@JoinColumn(name = "updated_by_usr_id", referencedColumnName = "usr_id", nullable = false) |
|||
private AppUser updatedBy; |
|||
|
|||
// User timestamp |
|||
@Temporal(TemporalType.TIMESTAMP) |
|||
@Column(name = "usr_created_timestamp", nullable = false, updatable = false, columnDefinition = "TIMESTAMP(0)") |
|||
private Date usrCreatedTimestamp; |
|||
|
|||
@Temporal(TemporalType.TIMESTAMP) |
|||
@Column(name = "usr_updated_timestamp", nullable = false, columnDefinition = "TIMESTAMP(0)") |
|||
private Date usrUpdatedTimestamp; |
|||
|
|||
// DB-managed timestamps |
|||
@CreatedDate |
|||
@Temporal(TemporalType.TIMESTAMP) |
|||
@Column(updatable = false, nullable = false, name = "db_created_timestamp", columnDefinition = "TIMESTAMP(0)") |
|||
private Date dbCreatedTimestamp; |
|||
|
|||
@LastModifiedDate |
|||
@Temporal(TemporalType.TIMESTAMP) |
|||
@Column(nullable = false, name = "db_updated_timestamp", columnDefinition = "TIMESTAMP(0)") |
|||
private Date dbUpdatedTimestamp; |
|||
|
|||
@PrePersist |
|||
public void onCreate() { |
|||
Date now = Date.from(Instant.now().truncatedTo(ChronoUnit.SECONDS)); |
|||
this.usrCreatedTimestamp = now; |
|||
this.usrUpdatedTimestamp = now; |
|||
} |
|||
|
|||
@PreUpdate |
|||
public void onUpdate() { |
|||
Date now = Date.from(Instant.now().truncatedTo(ChronoUnit.SECONDS)); |
|||
this.usrUpdatedTimestamp = now; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.gcc_it_cell_services.springboot.repository; |
|||
|
|||
import java.util.Optional; |
|||
|
|||
import org.springframework.data.jpa.repository.JpaRepository; |
|||
import org.springframework.data.jpa.repository.Query; |
|||
import org.springframework.data.repository.query.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import com.gcc_it_cell_services.springboot.model.UrlSubCategory; |
|||
|
|||
@Repository |
|||
public interface UrlSubCategoryRepository extends JpaRepository<UrlSubCategory, Long> { |
|||
|
|||
@Query(nativeQuery = true, value = "SELECT * FROM tbl_url_sub_cat_det WHERE url_sub_cat_name = ?1 AND url_cat_id = ?2") |
|||
java.util.List<UrlSubCategory> findUrlSubCatByNameAndCatId(@Param("urlSubCatName") String urlSubCatName, @Param("urlCatId") Long urlCatId); |
|||
|
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.gcc_it_cell_services.springboot.request_dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@ToString(doNotUseGetters = true, includeFieldNames = true) |
|||
public class UrlSubCategoryRequestDTO { |
|||
|
|||
private String urlSubCatName; |
|||
|
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.gcc_it_cell_services.springboot.response_dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Getter; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.Setter; |
|||
import lombok.ToString; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ToString(doNotUseGetters = true, includeFieldNames = true) |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class UrlSubCategoryResponseDTO { |
|||
|
|||
private Long urlSubCatId; |
|||
private String urlSubCatName; |
|||
|
|||
} |
|||
@ -1,2 +1,3 @@ |
|||
spring.profiles.active=prod |
|||
spring.profiles.active=local |
|||
#spring.profiles.active=prod |
|||
app.getOtpUrl=https://tmegov.onex-aura.com/api/sms |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue