Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
BackEnd-V1-JasperReport
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
Anderson Zambrano
BackEnd-V1-JasperReport
Commits
e4b94072
Commit
e4b94072
authored
May 17, 2023
by
Joel Andres Molina Velez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backed-v2-TablaParameters
parent
b8e52052
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
169 additions
and
0 deletions
+169
-0
ParametersController.java
...ovilidad/MovilidadWS/controller/ParametersController.java
+65
-0
DaoParameters.java
.../ec/edu/espe/movilidad/MovilidadWS/dao/DaoParameters.java
+8
-0
ModelParameters.java
...edu/espe/movilidad/MovilidadWS/model/ModelParameters.java
+28
-0
IServiceParameters.java
...spe/movilidad/MovilidadWS/service/IServiceParameters.java
+19
-0
ServiceParameters.java
...espe/movilidad/MovilidadWS/service/ServiceParameters.java
+49
-0
No files found.
src/main/java/ec/edu/espe/movilidad/MovilidadWS/controller/ParametersController.java
0 → 100644
View file @
e4b94072
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
controller
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelExample
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelParameters
;
import
ec.edu.espe.movilidad.MovilidadWS.service.IServiceExample
;
import
ec.edu.espe.movilidad.MovilidadWS.service.IServiceParameters
;
import
ec.edu.espe.movilidad.MovilidadWS.service.ReportService
;
import
net.sf.jasperreports.engine.JRException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.FileNotFoundException
;
import
java.util.List
;
import
static
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
Constant
.
GlobalConstants
.
V1_API_VERSION
;
@RestController
@CrossOrigin
(
origins
=
"*"
)
@RequestMapping
(
V1_API_VERSION
+
"/parameters"
)
public
class
ParametersController
{
@Autowired
private
IServiceParameters
serviceParameters
;
@Autowired
private
ReportService
service
;
@GetMapping
(
"/exampleFindId/{id}"
)
public
ResponseEntity
<
ModelParameters
>
ListarPorID
(
@PathVariable
Long
id
)
{
return
new
ResponseEntity
<>(
serviceParameters
.
ListarPorID
(
id
),
HttpStatus
.
OK
);
}
@GetMapping
(
"/report/{format}"
)
public
String
generateReport
(
@PathVariable
String
format
)
throws
JRException
,
FileNotFoundException
{
return
service
.
exportReport
(
format
);
}
@GetMapping
(
"/getAll"
)
public
ResponseEntity
<
List
<
ModelParameters
>>
ListarRegistros
()
{
return
new
ResponseEntity
<>(
serviceParameters
.
ListarRegistros
(),
HttpStatus
.
OK
);
}
@PostMapping
(
"/guardar"
)
public
ResponseEntity
<
ModelParameters
>
guardar
(
@RequestBody
ModelParameters
modelParameters
)
{
return
new
ResponseEntity
<>(
serviceParameters
.
guardar
(
modelParameters
),
HttpStatus
.
OK
);
}
@PutMapping
(
"/editar/{id}"
)
public
ResponseEntity
<
ModelParameters
>
editar
(
@PathVariable
Long
id
,
@RequestBody
ModelParameters
modelParameters
)
{
return
new
ResponseEntity
<>(
serviceParameters
.
editar
(
id
,
modelParameters
),
HttpStatus
.
OK
);
}
@DeleteMapping
(
"/eliminar/{id}"
)
public
ResponseEntity
<
Void
>
eliminar
(
@PathVariable
Long
id
)
{
serviceParameters
.
eliminar
(
id
);
return
ResponseEntity
.
ok
().
build
();
}
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/dao/DaoParameters.java
0 → 100644
View file @
e4b94072
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
dao
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelExample
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelParameters
;
import
org.springframework.data.repository.CrudRepository
;
public
interface
DaoParameters
extends
CrudRepository
<
ModelParameters
,
Long
>
{
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/model/ModelParameters.java
0 → 100644
View file @
e4b94072
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
model
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
@Data
@Entity
@Table
(
name
=
"Parametros"
)
public
class
ModelParameters
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
@Column
(
name
=
"num"
)
private
Long
id
;
@Column
(
name
=
"Fecha"
,
nullable
=
false
)
private
String
fecha
;
@Column
(
name
=
"Descripcion"
,
nullable
=
false
)
private
String
descripcion
;
@Column
(
name
=
"Puntaje"
,
nullable
=
false
)
private
Integer
puntaje
;
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/service/IServiceParameters.java
0 → 100644
View file @
e4b94072
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
service
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelExample
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelParameters
;
import
java.util.List
;
public
interface
IServiceParameters
{
public
ModelParameters
ListarPorID
(
Long
id
);
public
List
<
ModelParameters
>
ListarRegistros
();
public
ModelParameters
guardar
(
ModelParameters
modelParameters
);
public
ModelParameters
editar
(
Long
id
,
ModelParameters
modelParameters
);
void
eliminar
(
Long
id
);
}
src/main/java/ec/edu/espe/movilidad/MovilidadWS/service/ServiceParameters.java
0 → 100644
View file @
e4b94072
package
ec
.
edu
.
espe
.
movilidad
.
MovilidadWS
.
service
;
import
ec.edu.espe.movilidad.MovilidadWS.dao.DaoExample
;
import
ec.edu.espe.movilidad.MovilidadWS.dao.DaoParameters
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelExample
;
import
ec.edu.espe.movilidad.MovilidadWS.model.ModelParameters
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Service
public
class
ServiceParameters
implements
IServiceParameters
{
@Autowired
private
DaoParameters
daoParameters
;
@Override
public
ModelParameters
ListarPorID
(
Long
id
)
{
return
daoParameters
.
findById
(
id
).
get
();
}
@Override
public
List
<
ModelParameters
>
ListarRegistros
()
{
return
(
List
<
ModelParameters
>)
daoParameters
.
findAll
();
}
@Override
public
ModelParameters
guardar
(
ModelParameters
modelParameters
)
{
return
daoParameters
.
save
(
modelParameters
);
}
@Override
public
ModelParameters
editar
(
Long
id
,
ModelParameters
modelParameters
)
{
ModelParameters
parameters
=
daoParameters
.
findById
(
id
).
get
();
//.orElseThrow(()->new ControlExcepciones("No existe el registro con el ID : " + id));
//Seteamos los nuevos datos del registro
parameters
.
setPuntaje
(
modelParameters
.
getPuntaje
());
ModelParameters
parametersActualizado
=
daoParameters
.
save
(
parameters
);
return
parametersActualizado
;
}
@Override
public
void
eliminar
(
Long
id
)
{
ModelParameters
parameters
=
daoParameters
.
findById
(
id
).
get
();
//.orElseThrow(() -> new ControlExcepciones("No existe el registro con el ID : " + id));
daoParameters
.
delete
(
parameters
);
}
}
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