Add report models and controller
This commit is contained in:
parent
5155da2542
commit
1ac50fdd54
@ -4,6 +4,7 @@ import org.springframework.stereotype.Controller;
|
|||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import ru.ulstu.aspirant.model.Report;
|
||||||
import ru.ulstu.aspirant.service.AspirantService;
|
import ru.ulstu.aspirant.service.AspirantService;
|
||||||
import ru.ulstu.indicator.model.Indicator;
|
import ru.ulstu.indicator.model.Indicator;
|
||||||
|
|
||||||
@ -21,6 +22,8 @@ public class AspirantController {
|
|||||||
@GetMapping("aspirantReport")
|
@GetMapping("aspirantReport")
|
||||||
public String createReport(Model model) {
|
public String createReport(Model model) {
|
||||||
List<Indicator> indicators = aspirantService.getIndicatorsByCourse();
|
List<Indicator> indicators = aspirantService.getIndicatorsByCourse();
|
||||||
|
model.addAttribute("indicators", indicators);
|
||||||
|
model.addAttribute("report", new Report());
|
||||||
return "aspirant/editReport";
|
return "aspirant/editReport";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
36
src/main/java/ru/ulstu/aspirant/model/Report.java
Normal file
36
src/main/java/ru/ulstu/aspirant/model/Report.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package ru.ulstu.aspirant.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.OneToMany;
|
||||||
|
import jakarta.persistence.Temporal;
|
||||||
|
import jakarta.persistence.TemporalType;
|
||||||
|
import ru.ulstu.model.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Report extends BaseEntity {
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date createDate = new Date();
|
||||||
|
|
||||||
|
@OneToMany
|
||||||
|
private List<ReportValue> values = new ArrayList<>();
|
||||||
|
|
||||||
|
public List<ReportValue> getValues() {
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValues(List<ReportValue> values) {
|
||||||
|
this.values = values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateDate() {
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDate(Date createDate) {
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
}
|
30
src/main/java/ru/ulstu/aspirant/model/ReportValue.java
Normal file
30
src/main/java/ru/ulstu/aspirant/model/ReportValue.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package ru.ulstu.aspirant.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import ru.ulstu.indicator.model.Indicator;
|
||||||
|
import ru.ulstu.model.BaseEntity;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class ReportValue extends BaseEntity {
|
||||||
|
@ManyToOne
|
||||||
|
private Indicator indicator;
|
||||||
|
|
||||||
|
private int indicatorValue;
|
||||||
|
|
||||||
|
public Indicator getIndicator() {
|
||||||
|
return indicator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndicator(Indicator indicator) {
|
||||||
|
this.indicator = indicator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndicatorValue() {
|
||||||
|
return indicatorValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndicatorValue(int indicatorValue) {
|
||||||
|
this.indicatorValue = indicatorValue;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user