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
f236fb1b
Commit
f236fb1b
authored
Jun 26, 2023
by
Joel Andres Molina Velez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se corrigen los servicios de ModelUzyTavDetComca
parent
c9dc2578
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
157 additions
and
67 deletions
+157
-67
UzyTavDetComcaController.java
...idad/MovilidadWS/Controller/UzyTavDetComcaController.java
+25
-20
DaoUzyTavDetComca.java
...edu/espe/movilidad/MovilidadWS/Dao/DaoUzyTavDetComca.java
+2
-2
DtoUzyTavDetComca.java
...edu/espe/movilidad/MovilidadWS/Dto/DtoUzyTavDetComca.java
+16
-0
UzyTavDetComcaMapper.java
...lidadWS/Mapper/Components_Class/UzyTavDetComcaMapper.java
+56
-0
ModelUzyTavDetComca.java
...espe/movilidad/MovilidadWS/Model/ModelUzyTavDetComca.java
+4
-5
IServiceUzyTavDetComca.java
...idadWS/Service/UzyTavDetComca/IServiceUzyTavDetComca.java
+7
-7
ServiceUzyTavDetComca.java
...lidadWS/Service/UzyTavDetComca/ServiceUzyTavDetComca.java
+47
-33
No files found.
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Controller/UzyTavDetComcaController.java
View file @
f236fb1b
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Controller
;
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Controller
;
import
ec.edu.espe.movilidad.MovilidadWS.
Model.Model
UzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.
Dto.Dto
UzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Service.UzyTavDetComca.IServiceUzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Service.UzyTavDetComca.IServiceUzyTavDetComca
;
import
org.springframework.beans.factory.annotation.Autowired
;
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
javax.validation.Valid
;
import
java.util.List
;
import
java.util.List
;
import
static
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Constant
.
GlobalConstants
.
V1_API_VERSION
;
import
static
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Constant
.
GlobalConstants
.
V1_API_VERSION
;
...
@@ -15,46 +15,51 @@ import static ec.edu.espe.movilidad.MovilidadWS.Constant.GlobalConstants.V1_API_
...
@@ -15,46 +15,51 @@ import static ec.edu.espe.movilidad.MovilidadWS.Constant.GlobalConstants.V1_API_
@CrossOrigin
(
origins
=
"*"
)
@CrossOrigin
(
origins
=
"*"
)
@RequestMapping
(
V1_API_VERSION
+
"/detcomca"
)
@RequestMapping
(
V1_API_VERSION
+
"/detcomca"
)
public
class
UzyTavDetComcaController
{
public
class
UzyTavDetComcaController
{
@Autowired
private
IServiceUzyTavDetComca
serviceUzyTavDetComca
;
private
final
IServiceUzyTavDetComca
serviceUzyTavDetComca
;
public
UzyTavDetComcaController
(
IServiceUzyTavDetComca
serviceUzyTavDetComca
)
{
this
.
serviceUzyTavDetComca
=
serviceUzyTavDetComca
;
}
@GetMapping
(
"/exampleFindId/{id}"
)
@GetMapping
(
"/exampleFindId/{id}"
)
public
ResponseEntity
<
Model
UzyTavDetComca
>
ListarPorID
(
@PathVariable
Long
id
)
{
public
ResponseEntity
<
Dto
UzyTavDetComca
>
ListarPorID
(
@PathVariable
Long
id
)
{
return
new
ResponseEntity
<>(
serviceUzyTavDetComca
.
ListarPorID
(
id
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
serviceUzyTavDetComca
.
ListarPorID
(
id
),
HttpStatus
.
OK
);
}
}
@GetMapping
(
"/getAll"
)
@GetMapping
(
"/getAll"
)
public
ResponseEntity
<
List
<
Model
UzyTavDetComca
>>
ListarRegistros
()
{
public
ResponseEntity
<
List
<
Dto
UzyTavDetComca
>>
ListarRegistros
()
{
return
new
ResponseEntity
<>(
serviceUzyTavDetComca
.
ListarRegistros
(),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
serviceUzyTavDetComca
.
ListarRegistros
(),
HttpStatus
.
OK
);
}
}
@GetMapping
(
"/datosRealacionadosconCabComca/{id}"
)
@GetMapping
(
"/datosRealacionadosconCabComca/{id}"
)
public
ResponseEntity
<
List
<
ModelUzyTavDetComca
>>
findByIdconDatosCabComca
(
@PathVariable
(
"id"
)
Long
id
)
{
public
ResponseEntity
<
List
<
Object
[]>>
findByIdconDatosCabComca
(
@PathVariable
(
"id"
)
Long
id
)
{
List
<
ModelUzyTavDetComca
>
result
=
serviceUzyTavDetComca
.
findByIdconDatosCabComca
(
id
);
List
<
Object
[]>
result
=
serviceUzyTavDetComca
.
findByIdconDatosCabComca
(
id
);
return
ResponseEntity
.
ok
(
result
);
return
ResponseEntity
.
ok
(
result
);
}
}
@PostMapping
(
"/guardar"
)
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
);
@PostMapping
(
"/guardar"
)
public
ResponseEntity
<
DtoUzyTavDetComca
>
guardar
(
@Valid
@RequestBody
DtoUzyTavDetComca
dtoUzyTavDetComca
)
{
DtoUzyTavDetComca
savedDto
=
serviceUzyTavDetComca
.
guardar
(
dtoUzyTavDetComca
);
return
ResponseEntity
.
ok
(
savedDto
);
}
}
@PutMapping
(
"/editar/{id}"
)
@PutMapping
(
"/editar/{id}"
)
public
ResponseEntity
<
ModelUzyTavDetComca
>
editar
(
@PathVariable
Long
id
,
@RequestBody
ModelUzyTavDetComca
model
UzyTavDetComca
)
{
public
ResponseEntity
<
DtoUzyTavDetComca
>
editar
(
@PathVariable
Long
id
,
@RequestBody
DtoUzyTavDetComca
dto
UzyTavDetComca
)
{
return
new
ResponseEntity
<>(
serviceUzyTavDetComca
.
editar
(
id
,
model
UzyTavDetComca
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
serviceUzyTavDetComca
.
editar
(
id
,
dto
UzyTavDetComca
),
HttpStatus
.
OK
);
}
}
@DeleteMapping
(
"/eliminar/{id}"
)
@DeleteMapping
(
"/eliminar/{id}"
)
public
ResponseEntity
<
Void
>
eliminar
(
@PathVariable
Long
id
)
{
public
ResponseEntity
<
String
>
eliminar
(
@PathVariable
Long
id
){
serviceUzyTavDetComca
.
eliminar
(
id
);
boolean
eliminado
=
serviceUzyTavDetComca
.
eliminar
(
id
);
return
ResponseEntity
.
ok
().
build
();
if
(
eliminado
)
{
return
ResponseEntity
.
ok
(
"El registro se eliminó exitosamente."
);
}
else
{
return
ResponseEntity
.
notFound
().
build
();
}
}
}
}
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Dao/DaoUzyTavDetComca.java
View file @
f236fb1b
...
@@ -12,9 +12,9 @@ import java.util.List;
...
@@ -12,9 +12,9 @@ import java.util.List;
public
interface
DaoUzyTavDetComca
extends
JpaRepository
<
ModelUzyTavDetComca
,
Long
>
{
public
interface
DaoUzyTavDetComca
extends
JpaRepository
<
ModelUzyTavDetComca
,
Long
>
{
//Obtener los datos relacionados con la tabla CabComca mediante un
id
//Obtener los datos relacionados con la tabla CabComca mediante un
ID
@Query
(
"SELECT p FROM ModelUzyTavDetComca p INNER JOIN p.uzytavcabcomca c WHERE c.uzytavcabcomca_id = :id"
)
@Query
(
"SELECT p FROM ModelUzyTavDetComca p INNER JOIN p.uzytavcabcomca c WHERE c.uzytavcabcomca_id = :id"
)
List
<
ModelUzyTavDetComca
>
findByIdconDatosCabComca
(
@Param
(
"id"
)
Long
id
);
List
<
Object
[]
>
findByIdconDatosCabComca
(
@Param
(
"id"
)
Long
id
);
}
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Dto/DtoUzyTavDetComca.java
0 → 100644
View file @
f236fb1b
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Dto
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
DtoUzyTavDetComca
{
private
Long
uzytavdetcomca_id
;
private
Long
uzytusuario_id_crea
;
private
Long
uzytusuario_id_asignado
;
private
Date
uzytavdetcomca_fech_crea
;
private
String
uzytavdetcomca_estado
;
private
Long
uzytavcabcomca_id
;
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Mapper/Components_Class/UzyTavDetComcaMapper.java
0 → 100644
View file @
f236fb1b
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Mapper
.
Components_Class
;
import
ec.edu.espe.movilidad.MovilidadWS.Dto.DtoUzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavCabComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavDetComca
;
import
org.modelmapper.ModelMapper
;
import
org.modelmapper.PropertyMap
;
import
org.springframework.stereotype.Component
;
import
javax.persistence.EntityManager
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Component
public
class
UzyTavDetComcaMapper
{
private
final
ModelMapper
modelMapper
;
private
final
EntityManager
entityManager
;
public
UzyTavDetComcaMapper
(
ModelMapper
modelMapper
,
EntityManager
entityManager
)
{
this
.
modelMapper
=
modelMapper
;
this
.
entityManager
=
entityManager
;
configureMappings
();
}
public
DtoUzyTavDetComca
entityToDto
(
ModelUzyTavDetComca
entity
)
{
return
modelMapper
.
map
(
entity
,
DtoUzyTavDetComca
.
class
);
}
public
ModelUzyTavDetComca
dtoToEntity
(
DtoUzyTavDetComca
dto
)
{
ModelUzyTavDetComca
entity
=
modelMapper
.
map
(
dto
,
ModelUzyTavDetComca
.
class
);
Long
cabcomcaID
=
dto
.
getUzytavcabcomca_id
();
ModelUzyTavCabComca
cabComca
=
entityManager
.
find
(
ModelUzyTavCabComca
.
class
,
cabcomcaID
);
entity
.
setUzytavcabcomca
(
cabComca
);
return
entity
;
}
public
List
<
DtoUzyTavDetComca
>
entitiesToDtos
(
List
<
ModelUzyTavDetComca
>
entities
)
{
return
entities
.
stream
()
.
map
(
this
::
entityToDto
)
.
collect
(
Collectors
.
toList
());
}
private
void
configureMappings
()
{
modelMapper
.
addMappings
(
new
PropertyMap
<
ModelUzyTavDetComca
,
DtoUzyTavDetComca
>()
{
@Override
protected
void
configure
()
{
map
().
setUzytavdetcomca_id
(
source
.
getUzytavdetcomca_id
());
map
().
setUzytavcabcomca_id
(
source
.
getUzytavcabcomca
().
getUzytavcabcomca_id
());
}
});
}
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Model/ModelUzyTavDetComca.java
View file @
f236fb1b
...
@@ -2,13 +2,15 @@ package ec.edu.espe.movilidad.MovilidadWS.Model;
...
@@ -2,13 +2,15 @@ package ec.edu.espe.movilidad.MovilidadWS.Model;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Set
;
import
java.util.Set
;
@Data
@Getter
@Setter
@Entity
@Entity
@Table
(
name
=
"uzytavdetcomca"
,
schema
=
"UTIC1"
)
@Table
(
name
=
"uzytavdetcomca"
,
schema
=
"UTIC1"
)
public
class
ModelUzyTavDetComca
{
public
class
ModelUzyTavDetComca
{
...
@@ -18,8 +20,6 @@ public class ModelUzyTavDetComca {
...
@@ -18,8 +20,6 @@ public class ModelUzyTavDetComca {
@Column
(
name
=
"uzytavdetcomca_id"
)
@Column
(
name
=
"uzytavdetcomca_id"
)
private
Long
uzytavdetcomca_id
;
private
Long
uzytavdetcomca_id
;
@Column
(
name
=
"uzytusuario_id_crea"
)
@Column
(
name
=
"uzytusuario_id_crea"
)
private
Long
uzytusuario_id_crea
;
private
Long
uzytusuario_id_crea
;
...
@@ -39,7 +39,6 @@ public class ModelUzyTavDetComca {
...
@@ -39,7 +39,6 @@ public class ModelUzyTavDetComca {
private
ModelUzyTavCabComca
uzytavcabcomca
;
private
ModelUzyTavCabComca
uzytavcabcomca
;
//RELACIÓN CON LA TABLA uzytavcabevalp- TABLA HIJA
//RELACIÓN CON LA TABLA uzytavcabevalp- TABLA HIJA
@JsonIgnore
@JsonIgnore
@OneToMany
(
mappedBy
=
"uzytavdetcomca"
,
cascade
=
CascadeType
.
ALL
)
@OneToMany
(
mappedBy
=
"uzytavdetcomca"
,
cascade
=
CascadeType
.
ALL
)
private
Set
<
ModelUzyTavCabeValp
>
modelUzyTavCabeValpSet
;
private
Set
<
ModelUzyTavCabeValp
>
modelUzyTavCabeValpSet
;
...
...
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Service/UzyTavDetComca/IServiceUzyTavDetComca.java
View file @
f236fb1b
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Service
.
UzyTavDetComca
;
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Service
.
UzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.
Model.Model
UzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.
Dto.Dto
UzyTavDetComca
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.data.repository.query.Param
;
import
java.util.List
;
import
java.util.List
;
public
interface
IServiceUzyTavDetComca
{
public
interface
IServiceUzyTavDetComca
{
public
Model
UzyTavDetComca
ListarPorID
(
Long
id
);
Dto
UzyTavDetComca
ListarPorID
(
Long
id
);
public
List
<
Model
UzyTavDetComca
>
ListarRegistros
();
List
<
Dto
UzyTavDetComca
>
ListarRegistros
();
public
ModelUzyTavDetComca
guardar
(
Long
uzytavcabcomca_id
,
ModelUzyTavDetComca
model
UzyTavDetComca
);
DtoUzyTavDetComca
guardar
(
DtoUzyTavDetComca
dto
UzyTavDetComca
);
List
<
ModelUzyTavDetComca
>
findByIdconDatosCabComca
(
@Param
(
"id"
)
Long
id
);
List
<
Object
[]
>
findByIdconDatosCabComca
(
@Param
(
"id"
)
Long
id
);
public
ModelUzyTavDetComca
editar
(
Long
id
,
ModelUzyTavDetComca
model
UzyTavDetComca
);
DtoUzyTavDetComca
editar
(
Long
id
,
DtoUzyTavDetComca
dto
UzyTavDetComca
);
void
eliminar
(
Long
id
);
boolean
eliminar
(
Long
id
);
}
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/Service/UzyTavDetComca/ServiceUzyTavDetComca.java
View file @
f236fb1b
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Service
.
UzyTavDetComca
;
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.Dao.DaoUzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavCabComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Dto.DtoUzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Exceptions.ResourceNotFoundException
;
import
ec.edu.espe.movilidad.MovilidadWS.Mapper.Components_Class.UzyTavDetComcaMapper
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavDetComca
;
import
ec.edu.espe.movilidad.MovilidadWS.Model.ModelUzyTavDetComca
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
javax.persistence.EntityNotFoundException
;
import
java.util.List
;
import
java.util.List
;
@Service
@Service
public
class
ServiceUzyTavDetComca
implements
IServiceUzyTavDetComca
{
public
class
ServiceUzyTavDetComca
implements
IServiceUzyTavDetComca
{
@Autowired
DaoUzyTavDetComca
daoUzyTavDetComca
;
private
final
DaoUzyTavDetComca
daoUzyTavDetComca
;
@Autowired
private
final
UzyTavDetComcaMapper
mapper
;
DaoUzyTavCabComca
daoUzyTavCabComca
;
public
ServiceUzyTavDetComca
(
DaoUzyTavDetComca
daoUzyTavDetComca
,
UzyTavDetComcaMapper
mapper
)
{
this
.
daoUzyTavDetComca
=
daoUzyTavDetComca
;
this
.
mapper
=
mapper
;
}
@Override
@Override
public
ModelUzyTavDetComca
ListarPorID
(
@PathVariable
Long
id
)
{
public
DtoUzyTavDetComca
ListarPorID
(
@PathVariable
Long
id
)
{
return
daoUzyTavDetComca
.
findById
(
id
).
get
();
ModelUzyTavDetComca
entity
=
daoUzyTavDetComca
.
findById
(
id
)
.
orElseThrow
(()
->
new
ResourceNotFoundException
(
"No se encontró el registro con ID: "
+
id
));
return
mapper
.
entityToDto
(
entity
);
}
}
@Override
@Override
public
List
<
ModelUzyTavDetComca
>
ListarRegistros
()
{
public
List
<
DtoUzyTavDetComca
>
ListarRegistros
()
{
return
daoUzyTavDetComca
.
findAll
();
List
<
ModelUzyTavDetComca
>
entities
=
daoUzyTavDetComca
.
findAll
();
return
mapper
.
entitiesToDtos
(
entities
);
}
}
@Override
@Override
public
ModelUzyTavDetComca
guardar
(
Long
uzytavcabcomca_id
,
ModelUzyTavDetComca
modelUzyTavDetComca
)
{
public
DtoUzyTavDetComca
guardar
(
DtoUzyTavDetComca
dtoUzyTavDetComca
)
{
ModelUzyTavCabComca
modelUzyTavCabComca
=
daoUzyTavCabComca
.
findById
(
uzytavcabcomca_id
)
ModelUzyTavDetComca
entity
=
mapper
.
dtoToEntity
(
dtoUzyTavDetComca
);
.
orElseThrow
(()
->
new
EntityNotFoundException
(
"No se encontró la entidad ModelUzyTavCabComca con el ID proporcionado"
));
ModelUzyTavDetComca
nuevoEntity
=
daoUzyTavDetComca
.
save
(
entity
);
modelUzyTavDetComca
.
setUzytavcabcomca
(
modelUzyTavCabComca
);
return
mapper
.
entityToDto
(
nuevoEntity
);
return
daoUzyTavDetComca
.
save
(
modelUzyTavDetComca
);
}
}
@Override
@Override
public
List
<
ModelUzyTavDetComca
>
findByIdconDatosCabComca
(
Long
id
)
{
public
List
<
Object
[]
>
findByIdconDatosCabComca
(
Long
id
)
{
return
daoUzyTavDetComca
.
findByIdconDatosCabComca
(
id
);
return
daoUzyTavDetComca
.
findByIdconDatosCabComca
(
id
);
}
}
@Override
@Override
public
ModelUzyTavDetComca
editar
(
@PathVariable
Long
id
,
ModelUzyTavDetComca
model
UzyTavDetComca
)
{
public
DtoUzyTavDetComca
editar
(
@PathVariable
Long
id
,
DtoUzyTavDetComca
dto
UzyTavDetComca
)
{
ModelUzyTavDetComca
dato
=
daoUzyTavDetComca
.
findById
(
id
).
get
();
try
{
//.orElseThrow(()->new ControlExcepciones("No existe el registro con el ID : " + id)
);
ModelUzyTavDetComca
entity
=
daoUzyTavDetComca
.
findById
(
id
).
get
(
);
//Seteamos los nuevos datos del registro
if
(
entity
!=
null
)
{
dato
.
setUzytavdetcomca_id
(
modelUzyTavDetComca
.
getUzytavdetcomca_id
());
dato
.
setUzytusuario_id_crea
(
modelUzyTavDetComca
.
getUzytusuario_id_crea
());
dato
.
setUzytusuario_id_asignado
(
modelUzyTavDetComca
.
getUzytusuario_id_asignado
());
dato
.
setUzytavdetcomca_fech_crea
(
modelUzyTavDetComca
.
getUzytavdetcomca_fech_crea
());
dato
.
setUzytavdetcomca_estado
(
modelUzyTavDetComca
.
getUzytavdetcomca_estado
());
ModelUzyTavDetComca
datoActualizado
=
daoUzyTavDetComca
.
save
(
dato
);
entity
.
setUzytusuario_id_crea
(
dtoUzyTavDetComca
.
getUzytusuario_id_crea
());
return
datoActualizado
;
entity
.
setUzytusuario_id_asignado
(
dtoUzyTavDetComca
.
getUzytusuario_id_asignado
());
entity
.
setUzytavdetcomca_fech_crea
(
dtoUzyTavDetComca
.
getUzytavdetcomca_fech_crea
());
entity
.
setUzytavdetcomca_estado
(
dtoUzyTavDetComca
.
getUzytavdetcomca_estado
());
ModelUzyTavDetComca
updatedEntity
=
daoUzyTavDetComca
.
save
(
entity
);
return
mapper
.
entityToDto
(
updatedEntity
);
}
else
{
throw
new
ResourceNotFoundException
(
"No se encontró el registro con ID: "
+
id
);
}
}
catch
(
Exception
e
)
{
throw
new
ResourceNotFoundException
(
"Error al editar el registro: "
+
e
.
getMessage
());
}
}
}
@Override
@Override
public
void
eliminar
(
@PathVariable
Long
id
)
{
public
boolean
eliminar
(
Long
id
)
{
ModelUzyTavDetComca
dato
=
daoUzyTavDetComca
.
findById
(
id
).
get
();
ModelUzyTavDetComca
entity
=
daoUzyTavDetComca
.
findById
(
id
).
orElse
(
null
);
//.orElseThrow(() -> new ControlExcepciones("No existe el registro con el ID : " + id));
if
(
entity
!=
null
)
{
daoUzyTavDetComca
.
delete
(
dato
);
daoUzyTavDetComca
.
delete
(
entity
);
return
true
;
}
return
false
;
}
}
}
}
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