Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BackEnd-V2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joel Andres Molina Velez
BackEnd-V2
Commits
8fb34c0c
Commit
8fb34c0c
authored
Jul 25, 2023
by
Joel Andres Molina Velez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se corrige el editar de ServiceUzyTavCabParaevaf
parent
dcfdea89
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
23 deletions
+9
-23
UzyTavCabParaevafController.java
...d/MovilidadWS/Controller/UzyTavCabParaevafController.java
+0
-1
DaoUzyTavCabParaevaf.java
.../espe/movilidad/MovilidadWS/Dao/DaoUzyTavCabParaevaf.java
+1
-1
DtoUzyTavCabParaevaf.java
.../espe/movilidad/MovilidadWS/Dto/DtoUzyTavCabParaevaf.java
+2
-5
UzyTavCabParaevafMapper.java
...adWS/Mapper/Components_Class/UzyTavCabParaevafMapper.java
+3
-12
ServiceUzyTavCabParaevaf.java
...S/Service/UzyTavCabParaevaf/ServiceUzyTavCabParaevaf.java
+3
-4
No files found.
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Controller/UzyTavCabParaevafController.java
View file @
8fb34c0c
...
...
@@ -46,7 +46,6 @@ public class UzyTavCabParaevafController {
return
ResponseEntity
.
ok
(
savedDto
);
}
@PutMapping
(
"/editar/{id}"
)
public
ResponseEntity
<
DtoUzyTavCabParaevaf
>
editar
(
@PathVariable
Long
id
,
@RequestBody
DtoUzyTavCabParaevaf
dtoUzyTavCabParaevaf
)
{
return
new
ResponseEntity
<>(
serviceUzyTavCabParaevaf
.
editar
(
id
,
dtoUzyTavCabParaevaf
),
HttpStatus
.
OK
);
...
...
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Dao/DaoUzyTavCabParaevaf.java
View file @
8fb34c0c
...
...
@@ -13,7 +13,7 @@ import java.util.List;
public
interface
DaoUzyTavCabParaevaf
extends
JpaRepository
<
ModelUzyTavCabParaevaf
,
Long
>
{
//Obtener los datos relacionados con la tabla ConParaEva mediante un
id
, además que tengan tipo 1= Parametros de evaluacion inicial
//Obtener los datos relacionados con la tabla ConParaEva mediante un
ID
, además que tengan tipo 1= Parametros de evaluacion inicial
@Query
(
"SELECT p FROM ModelUzyTavCabParaevaf p INNER JOIN p.uzytavconparaeva c WHERE c.uzytavconparaeva_id = :id AND c.uzytavconparaeva_tipo = 2"
)
List
<
ModelUzyTavCabParaevaf
>
findByIdDatosConParaEvaTipo2
(
@Param
(
"id"
)
Long
id
);
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Dto/DtoUzyTavCabParaevaf.java
View file @
8fb34c0c
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Dto
;
import
lombok.Data
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Date
;
@Data
public
class
DtoUzyTavCabParaevaf
{
...
...
@@ -12,8 +9,8 @@ public class DtoUzyTavCabParaevaf {
private
String
uzytavcabparaevaf_nombre
;
private
String
uzytavcabparaevaf_desc1
;
private
String
uzytavcabparaevaf_desc2
;
private
Long
uzytavcabparaevaf_orden
;
private
Integer
uzytavcabparaevaf_orden
;
private
Long
uzytavconparaeva_id
;
private
Long
uzytavcabparaevaf_tipo
;
private
Integer
uzytavcabparaevaf_tipo
;
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Mapper/Components_Class/UzyTavCabParaevafMapper.java
View file @
8fb34c0c
...
...
@@ -4,7 +4,6 @@ import ec.edu.espe.movilidad.MovilidadWS.Dto.DtoUzyTavCabParaevaf;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavCabParaevaf
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavConparaEva
;
import
org.modelmapper.ModelMapper
;
import
org.modelmapper.PropertyMap
;
import
org.springframework.stereotype.Component
;
import
javax.persistence.EntityManager
;
...
...
@@ -15,10 +14,10 @@ import java.util.stream.Collectors;
public
class
UzyTavCabParaevafMapper
{
private
final
ModelMapper
modelMapper
;
private
final
EntityManager
entityManager
;
public
UzyTavCabParaevafMapper
(
ModelMapper
modelMapper
,
EntityManager
entityManager
)
{
this
.
modelMapper
=
modelMapper
;
this
.
entityManager
=
entityManager
;
configureMappings
();
}
public
DtoUzyTavCabParaevaf
entityToDto
(
ModelUzyTavCabParaevaf
entity
)
{
...
...
@@ -33,19 +32,11 @@ public class UzyTavCabParaevafMapper {
return
entity
;
}
public
List
<
DtoUzyTavCabParaevaf
>
entitiesToDtos
(
List
<
ModelUzyTavCabParaevaf
>
entities
)
{
return
entities
.
stream
()
.
map
(
this
::
entityToDto
)
.
collect
(
Collectors
.
toList
());
}
private
void
configureMappings
()
{
modelMapper
.
addMappings
(
new
PropertyMap
<
ModelUzyTavCabParaevaf
,
DtoUzyTavCabParaevaf
>()
{
@Override
protected
void
configure
()
{
map
().
setUzytavcabparaevaf_id
(
source
.
getUzytavcabparaevaf_id
());
map
().
setUzytavconparaeva_id
(
source
.
getUzytavconparaeva
().
getUzytavconparaeva_id
());
}
});
}
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Service/UzyTavCabParaevaf/ServiceUzyTavCabParaevaf.java
View file @
8fb34c0c
...
...
@@ -51,14 +51,13 @@ public class ServiceUzyTavCabParaevaf implements IServiceUzyTavCabParaevaf {
@Override
public
DtoUzyTavCabParaevaf
editar
(
Long
id
,
DtoUzyTavCabParaevaf
dtoUzyTavCabParaevaf
)
{
try
{
ModelUzyTavCabParaevaf
entity
=
daoUzyTavCabParaevaf
.
findById
(
id
).
get
();
ModelUzyTavCabParaevaf
entity
=
daoUzyTavCabParaevaf
.
findById
(
id
).
orElse
(
null
);
if
(
entity
!=
null
)
{
entity
.
setUzytavcabparaevaf_nombre
(
dtoUzyTavCabParaevaf
.
getUzytavcabparaevaf_nombre
());
entity
.
setUzytavcabparaevaf_desc1
(
dtoUzyTavCabParaevaf
.
getUzytavcabparaevaf_desc1
());
entity
.
setUzytavcabparaevaf_desc2
(
dtoUzyTavCabParaevaf
.
getUzytavcabparaevaf_desc2
());
entity
.
setUzytavcabparaevaf_orden
(
Math
.
toIntExact
(
dtoUzyTavCabParaevaf
.
getUzytavcabparaevaf_orden
()
));
entity
.
setUzytavcabparaevaf_tipo
(
Math
.
toIntExact
(
dtoUzyTavCabParaevaf
.
getUzytavcabparaevaf_tipo
()
));
entity
.
setUzytavcabparaevaf_orden
(
dtoUzyTavCabParaevaf
.
getUzytavcabparaevaf_orden
(
));
entity
.
setUzytavcabparaevaf_tipo
(
dtoUzyTavCabParaevaf
.
getUzytavcabparaevaf_tipo
(
));
ModelUzyTavCabParaevaf
updatedEntity
=
daoUzyTavCabParaevaf
.
save
(
entity
);
return
mapper
.
entityToDto
(
updatedEntity
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment