Skip to content

Commit 10b0ad6

Browse files
author
andres
committed
Updated Entities
1 parent cfb7bce commit 10b0ad6

File tree

7 files changed

+98
-28
lines changed

7 files changed

+98
-28
lines changed

pom.xml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56
<parent>
67
<groupId>org.springframework.boot</groupId>
78
<artifactId>spring-boot-starter-parent</artifactId>
89
<version>2.6.6</version>
9-
<relativePath/> <!-- lookup parent from repository -->
10+
<relativePath /> <!-- lookup parent from repository -->
1011
</parent>
1112
<groupId>com.api.rest.microelectronica</groupId>
1213
<artifactId>ApiRest_Microelectronica</artifactId>
@@ -42,6 +43,24 @@
4243
<artifactId>lombok</artifactId>
4344
<optional>true</optional>
4445
</dependency>
46+
47+
<!-- SWAGGER WITH OPENAPI-UI -->
48+
<dependency>
49+
<groupId>org.springdoc</groupId>
50+
<artifactId>springdoc-openapi-ui</artifactId>
51+
<version>1.6.4</version>
52+
</dependency>
53+
<!-- ANOTATIONS SWAGGER -->
54+
<!-- https://mvnrepository.com/artifact/io.swagger/swagger-annotations -->
55+
<dependency>
56+
<groupId>io.swagger</groupId>
57+
<artifactId>swagger-annotations</artifactId>
58+
<version>1.6.3</version>
59+
</dependency>
60+
61+
62+
63+
4564
<dependency>
4665
<groupId>org.springframework.boot</groupId>
4766
<artifactId>spring-boot-starter-test</artifactId>

src/main/java/com/api/rest/microelectronica/entities/ComponenteEntity.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,60 @@
88
import javax.persistence.SequenceGenerator;
99
import javax.persistence.Table;
1010

11+
import io.swagger.annotations.ApiModel;
12+
import io.swagger.annotations.ApiModelProperty;
1113
import lombok.AllArgsConstructor;
14+
import lombok.Builder;
1215
import lombok.Data;
1316
import lombok.NoArgsConstructor;
1417

18+
1519
@Table(name="componentes")
1620
@Entity
1721
@Data
1822
@AllArgsConstructor
1923
@NoArgsConstructor
24+
@Builder
25+
@ApiModel(description = "Entidad Componente")
2026
public class ComponenteEntity {
2127

2228
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_comp")
2329
@SequenceGenerator(name = "seq_comp", sequenceName = "id_seq_comp" , allocationSize=1)
2430
@Id
2531
@Column(name="id")
32+
@ApiModelProperty(notes = "id autoincrementable del Componente")
2633
private int id;
2734

2835
@Column(name="codigo")
36+
@ApiModelProperty(notes = "Código del Componente (EJ: KSJSDK-3CD005H)")
2937
private String codigo;
3038

3139
@Column(name="imagen")
40+
@ApiModelProperty(notes = "Imagen del Componente (EJ: https://www.cdronline.com.ar/thumb/3658DCD905164D7199C7BCEDD00032AB.jpg)")
3241
private String imagen;
3342

3443
@Column(name="nro_pieza")
44+
@ApiModelProperty(notes = "Nro de Pieza del Componente (EJ: 3YU7E8)")
3545
private String nroPieza;
3646

3747
@Column(name="categoria")
48+
@ApiModelProperty(notes = "Categoria del Componente (EJ: Transistores BJT)")
3849
private String categoria;
3950

4051
@Column(name="descripcion")
52+
@ApiModelProperty(notes = "Descripción del Componente (EJ: Transistor BJT PNP)")
4153
private String descripcion;
4254

4355
@Column(name="fabricante")
56+
@ApiModelProperty(notes = "Fabricante del Componente (EJ: CENTRAL SEMICONDUCTOR)")
4457
private String fabricante;
4558

4659
@Column(name="stock")
60+
@ApiModelProperty(notes = "Stock del Componente (200)")
4761
private int stock;
4862

4963
@Column(name="precio")
64+
@ApiModelProperty(notes = "Precio del Componente (EJ: 10.0)")
5065
private double precio;
5166

5267

src/main/java/com/api/rest/microelectronica/repositories/I_ComponenteCapacitorElectroliticoRepository.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.List;
55

66
import org.springframework.data.jpa.repository.JpaRepository;
7+
import org.springframework.data.jpa.repository.Query;
78
import org.springframework.data.repository.PagingAndSortingRepository;
89
import org.springframework.stereotype.Repository;
910

@@ -19,15 +20,15 @@ public interface I_ComponenteCapacitorElectroliticoRepository extends JpaReposit
1920
public abstract ComponenteCapacitorElectroliticoEntity findById(int id);
2021

2122
public abstract ComponenteCapacitorElectroliticoEntity findByIdComponente(int idComponente);
22-
23+
@Query("select c from ComponenteCapacitorElectroliticoEntity c where c.tipo like %:tipo%")
2324
public abstract List<ComponenteCapacitorElectroliticoEntity> findByTipo(String tipo);
24-
25+
@Query("select c from ComponenteCapacitorElectroliticoEntity c where c.capacitancia like %:capacitancia%")
2526
public abstract List<ComponenteCapacitorElectroliticoEntity> findByCapacitancia(String capacitancia);
26-
27+
@Query("select c from ComponenteCapacitorElectroliticoEntity c where c.tolerancia like %:tolerancia%")
2728
public abstract List<ComponenteCapacitorElectroliticoEntity> findByTolerancia(String tolerancia);
28-
29+
@Query("select c from ComponenteCapacitorElectroliticoEntity c where c.rangoTemperatura like %:rangoTemperatura%")
2930
public abstract List<ComponenteCapacitorElectroliticoEntity> findByRangoTemperatura(String rangoTemperatura);
30-
31+
@Query("select c from ComponenteCapacitorElectroliticoEntity c where c.rangoTensionNominal like %:rangoTensionNominal%")
3132
public abstract List<ComponenteCapacitorElectroliticoEntity> findByRangoTensionNominal(String rangoTensionNominal);
3233

3334
}

src/main/java/com/api/rest/microelectronica/repositories/I_ComponenteDetalleRepository.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import org.springframework.data.domain.Pageable;
99
import org.springframework.data.jpa.repository.JpaRepository;
10+
import org.springframework.data.jpa.repository.Query;
1011
import org.springframework.data.repository.PagingAndSortingRepository;
1112
import org.springframework.stereotype.Repository;
1213

@@ -22,21 +23,21 @@ public interface I_ComponenteDetalleRepository extends JpaRepository<ComponenteD
2223
public abstract ComponenteDetalleEntity findById(int id);
2324

2425
public abstract ComponenteDetalleEntity findByIdComponente(int id);
25-
26+
@Query("select c from ComponenteDetalleEntity c where c.hojaDeDatos like %:hojaDeDatos%")
2627
public abstract List<ComponenteDetalleEntity> findByHojaDeDatos(String hojaDeDatos);
27-
28+
@Query("select c from ComponenteDetalleEntity c where c.longitud like %:longitud%")
2829
public abstract List<ComponenteDetalleEntity> findByLongitud(String longitud);
29-
30+
@Query("select c from ComponenteDetalleEntity c where c.ancho like %:ancho%")
3031
public abstract List<ComponenteDetalleEntity> findByAncho(String ancho);
31-
32+
@Query("select c from ComponenteDetalleEntity c where c.peso like %:peso%")
3233
public abstract List<ComponenteDetalleEntity> findByPeso(String peso);
33-
34+
@Query("select c from ComponenteDetalleEntity c where c.material like %:material%")
3435
public abstract List<ComponenteDetalleEntity> findByMaterial(String material);
35-
36+
@Query("select c from ComponenteDetalleEntity c where c.voltajeRecomendado like %:voltajeRecomendado%")
3637
public abstract List<ComponenteDetalleEntity> findByVoltajeRecomendado(String voltajeRecomendado);
37-
38+
@Query("select c from ComponenteDetalleEntity c where c.voltajeMinEntrada like %:voltajeMinEntrada%")
3839
public abstract List<ComponenteDetalleEntity> findByVoltajeMinEntrada(String voltajeMinEntrada);
39-
40+
@Query("select c from ComponenteDetalleEntity c where c.voltajeMaxEntrada like %:voltajeMaxEntrada%")
4041
public abstract List<ComponenteDetalleEntity> findByVoltajeMaxEntrada(String voltajeMaxEntrada);
4142

4243
public abstract List<ComponenteDetalleEntity> findAll();

src/main/java/com/api/rest/microelectronica/repositories/I_ComponenteRepository.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.springframework.data.domain.Page;
77
import org.springframework.data.domain.Pageable;
88
import org.springframework.data.jpa.repository.JpaRepository;
9+
import org.springframework.data.jpa.repository.Query;
910
import org.springframework.data.repository.PagingAndSortingRepository;
1011
import org.springframework.stereotype.Repository;
1112

@@ -20,16 +21,17 @@ public interface I_ComponenteRepository extends JpaRepository<ComponenteEntity,
2021

2122
public abstract ComponenteEntity findById(int id);
2223

24+
@Query("select c from ComponenteEntity c where c.codigo like %:codigo%")
2325
public abstract List<ComponenteEntity> findByCodigo(String codigo);
24-
26+
@Query("select c from ComponenteEntity c where c.imagen like %:imagen%")
2527
public abstract List<ComponenteEntity> findByImagen(String imagen);
26-
28+
@Query("select c from ComponenteEntity c where c.nroPieza like %:nroPieza%")
2729
public abstract List<ComponenteEntity> findByNroPieza(String nroPieza);
28-
30+
@Query("select c from ComponenteEntity c where c.categoria like %:categoria%")
2931
public abstract List<ComponenteEntity> findByCategoria(String categoria);
30-
32+
@Query("select c from ComponenteEntity c where c.descripcion like %:descripcion%")
3133
public abstract List<ComponenteEntity> findByDescripcion(String descripcion);
32-
34+
@Query("select c from ComponenteEntity c where c.fabricante like %:fabricante%")
3335
public abstract List<ComponenteEntity> findByFabricante(String fabricante);
3436

3537
public abstract List<ComponenteEntity> findByStock(int stock);

src/main/java/com/api/rest/microelectronica/repositories/I_ComponenteTransistorBipolarRepository.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.springframework.data.domain.Page;
77
import org.springframework.data.domain.Pageable;
88
import org.springframework.data.jpa.repository.JpaRepository;
9+
import org.springframework.data.jpa.repository.Query;
910
import org.springframework.data.repository.PagingAndSortingRepository;
1011
import org.springframework.stereotype.Repository;
1112

@@ -22,22 +23,23 @@ public interface I_ComponenteTransistorBipolarRepository extends JpaRepository<C
2223

2324
public abstract ComponenteTransistorBipolarEntity findByIdComponente(int idComponente);
2425

26+
@Query("select c from ComponenteTransistorBipolarEntity c where c.tipo like %:tipo%")
2527
public abstract List<ComponenteTransistorBipolarEntity> findByTipo(String tipo);
26-
28+
@Query("select c from ComponenteTransistorBipolarEntity c where c.voltajeColecEmis like %:voltajeColecEmis%")
2729
public abstract List<ComponenteTransistorBipolarEntity> findByVoltajeColecEmis(String voltajeColecEmis);
28-
30+
@Query("select c from ComponenteTransistorBipolarEntity c where c.voltajeColecBase like %:voltajeColecBase%")
2931
public abstract List<ComponenteTransistorBipolarEntity> findByVoltajeColecBase(String voltajeColecBase);
30-
32+
@Query("select c from ComponenteTransistorBipolarEntity c where c.voltajeEmisBase like %:voltajeEmisBase%")
3133
public abstract List<ComponenteTransistorBipolarEntity> findByVoltajeEmisBase(String voltajeEmisBase);
32-
34+
@Query("select c from ComponenteTransistorBipolarEntity c where c.voltajeColecEmisSat like %:voltajeColecEmisSat%")
3335
public abstract List<ComponenteTransistorBipolarEntity> findByVoltajeColecEmisSat(String voltajeColecEmisSat);
34-
36+
@Query("select c from ComponenteTransistorBipolarEntity c where c.corrienteColec like %:corrienteColec%")
3537
public abstract List<ComponenteTransistorBipolarEntity> findByCorrienteColec(String corrienteColec);
36-
38+
@Query("select c from ComponenteTransistorBipolarEntity c where c.gananciaHfe like %:gananciaHfe%")
3739
public abstract List<ComponenteTransistorBipolarEntity> findByGananciaHfe(String gananciaHfe);
38-
40+
@Query("select c from ComponenteTransistorBipolarEntity c where c.disipMax like %:disipMax%")
3941
public abstract List<ComponenteTransistorBipolarEntity> findByDisipMax(String disipMax);
40-
42+
@Query("select c from ComponenteTransistorBipolarEntity c where c.tempJuntura like %:tempJuntura%")
4143
public abstract List<ComponenteTransistorBipolarEntity> findByTempJuntura(String tempJuntura);
4244

4345
public abstract List<ComponenteTransistorBipolarEntity> findAll();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
11

2+
server.port = 8096
3+
server.error.whitelabel.enabled=true
4+
5+
#---CONFIG ORACLE DB---
6+
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
7+
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/XE?serverTimezone=UTC
8+
spring.datasource.username=admin_microelectronica
9+
spring.datasource.password=admin_microelectronica
10+
spring.jpa.database=oracle
11+
12+
#---CONFIG HIBERNATE-JPA---
13+
spring.jpa.show-sql = true
14+
spring.jpa.hibernate.ddl-auto = update
15+
spring.jpa.hibernate.naming.strategy = org.hibernate.cfg.ImprovedNamingStrategy
16+
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.Oracle12cDialect
17+
18+
19+
#---CONFIG OPEN-UI -----
20+
springdoc.api-docs.path=/api-docs
21+
22+
#---CONFIG SWAGGER -----
23+
springdoc.swagger-ui.path=/swagger-ui-custom.html
24+
springdoc.swagger-ui.operationsSorter=method
25+
26+
27+
#---CONFIG PAGINATION---
28+
spring.data.rest.page-param-name=page
29+
spring.data.rest.sort-param-name=sort
30+
spring.data.rest.limit-param-name=limit
31+
spring.data.rest.default-page-size = 1

0 commit comments

Comments
 (0)