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
54534435
Commit
54534435
authored
Jun 05, 2023
by
Joel Andres Molina Velez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
se modifica el método guardar
parent
e78b7015
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
5 deletions
+16
-5
UzyTavDetComcaController.java
...idad/MovilidadWS/controller/UzyTavDetComcaController.java
+5
-2
ModelUzyTavDetComca.java
...espe/movilidad/MovilidadWS/model/ModelUzyTavDetComca.java
+1
-1
IServiceUzyTavDetComca.java
...idadWS/service/UzyTavDetComca/IServiceUzyTavDetComca.java
+1
-1
ServiceUzyTavDetComca.java
...lidadWS/service/UzyTavDetComca/ServiceUzyTavDetComca.java
+9
-1
No files found.
src/main/java/ec/edu/espe/movilidad/MovilidadWS/controller/UzyTavDetComcaController.java
View file @
54534435
...
...
@@ -39,8 +39,11 @@ public class UzyTavDetComcaController {
}
@PostMapping
(
"/guardar"
)
public
ResponseEntity
<
ModelUzyTavDetComca
>
guardar
(
@RequestBody
ModelUzyTavDetComca
modelUzyTavDetComca
)
{
return
new
ResponseEntity
<>(
serviceUzyTavDetComca
.
guardar
(
modelUzyTavDetComca
),
HttpStatus
.
OK
);
public
ResponseEntity
<
ModelUzyTavDetComca
>
guardar
(
@RequestBody
ModelUzyTavDetComca
modelUzyTavDetComca
,
@RequestParam
(
"uzytavcabcomca_id"
)
Long
uzytavcabcomca_id
)
{
ModelUzyTavDetComca
creado
=
serviceUzyTavDetComca
.
guardar
(
uzytavcabcomca_id
,
modelUzyTavDetComca
);
return
ResponseEntity
.
status
(
HttpStatus
.
CREATED
).
body
(
creado
);
}
...
...
src/main/java/ec/edu/espe/movilidad/MovilidadWS/model/ModelUzyTavDetComca.java
View file @
54534435
...
...
@@ -31,7 +31,7 @@ public class ModelUzyTavDetComca {
private
String
uzytavdetcomca_estado
;
//Relacion con la tabla CabComca-Tabla padre
//@JsonIgnore()
@JsonIgnore
@ManyToOne
@JoinColumn
(
name
=
"uzytavcabcomca_id"
)
private
ModelUzyTavCabComca
uzytavcabcomca
;
...
...
src/main/java/ec/edu/espe/movilidad/MovilidadWS/service/UzyTavDetComca/IServiceUzyTavDetComca.java
View file @
54534435
...
...
@@ -13,7 +13,7 @@ public interface IServiceUzyTavDetComca {
public
List
<
ModelUzyTavDetComca
>
ListarRegistros
();
public
ModelUzyTavDetComca
guardar
(
ModelUzyTavDetComca
modelUzyTavDetComca
);
public
ModelUzyTavDetComca
guardar
(
Long
uzytavcabcomca_id
,
ModelUzyTavDetComca
modelUzyTavDetComca
);
List
<
ModelUzyTavDetComca
>
findByIdconDatosCabComca
(
@Param
(
"id"
)
Long
id
);
...
...
src/main/java/ec/edu/espe/movilidad/MovilidadWS/service/UzyTavDetComca/ServiceUzyTavDetComca.java
View file @
54534435
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
service
.
UzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.dao.DaoUzyTavCabComca
;
import
ec.edu.espe.movilidad.MovilidadWS.dao.DaoUzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelUzyTavCabComca
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelUzyTavConsolca
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelUzyTavDetComca
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
javax.persistence.EntityNotFoundException
;
import
java.util.List
;
@Service
public
class
ServiceUzyTavDetComca
implements
IServiceUzyTavDetComca
{
@Autowired
DaoUzyTavDetComca
daoUzyTavDetComca
;
@Autowired
DaoUzyTavCabComca
daoUzyTavCabComca
;
@Override
public
ModelUzyTavDetComca
ListarPorID
(
@PathVariable
Long
id
)
{
...
...
@@ -25,7 +30,10 @@ public class ServiceUzyTavDetComca implements IServiceUzyTavDetComca{
}
@Override
public
ModelUzyTavDetComca
guardar
(
ModelUzyTavDetComca
modelUzyTavDetComca
)
{
public
ModelUzyTavDetComca
guardar
(
Long
uzytavcabcomca_id
,
ModelUzyTavDetComca
modelUzyTavDetComca
)
{
ModelUzyTavCabComca
modelUzyTavCabComca
=
daoUzyTavCabComca
.
findById
(
uzytavcabcomca_id
)
.
orElseThrow
(()
->
new
EntityNotFoundException
(
"No se encontró la entidad ModelUzyTavCabComca con el ID proporcionado"
));
modelUzyTavDetComca
.
setUzytavcabcomca
(
modelUzyTavCabComca
);
return
daoUzyTavDetComca
.
save
(
modelUzyTavDetComca
);
}
...
...
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