esoe
6 months ago
12 changed files with 560 additions and 12 deletions
@ -0,0 +1,201 @@ |
|||||||
|
package ru.molokoin.clientserviceteachers.controllers; |
||||||
|
|
||||||
|
import java.time.Duration; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.core.ParameterizedTypeReference; |
||||||
|
import org.springframework.http.HttpMethod; |
||||||
|
import org.springframework.http.MediaType; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.ui.Model; |
||||||
|
import org.springframework.validation.annotation.Validated; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute; |
||||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.reactive.function.client.WebClient; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||||
|
import com.fasterxml.jackson.databind.JsonMappingException; |
||||||
|
|
||||||
|
import reactor.core.publisher.Mono; |
||||||
|
import ru.molokoin.clientserviceteachers.entities.Building; |
||||||
|
import ru.molokoin.clientserviceteachers.entities.Course; |
||||||
|
import ru.molokoin.clientserviceteachers.entities.Program; |
||||||
|
import ru.molokoin.clientserviceteachers.entities.ProgramCretarea; |
||||||
|
import ru.molokoin.clientserviceteachers.entities.Teacher; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(path = "/") |
||||||
|
public class CourseController { |
||||||
|
@Autowired |
||||||
|
private WebClient client; |
||||||
|
|
||||||
|
@GetMapping("/courses") |
||||||
|
public String courseList(Model model) throws JsonMappingException, JsonProcessingException{ |
||||||
|
List<Course> courses = client.method(HttpMethod.GET) |
||||||
|
.uri("/course/list") |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <List<Course>>(){}) |
||||||
|
.block(); |
||||||
|
|
||||||
|
model.addAttribute("courses", courses); |
||||||
|
model.addAttribute("cs", new Course()); |
||||||
|
System.out.println("COURCES:" + courses.toString()); |
||||||
|
return "courses"; |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/course-edit/{id}") |
||||||
|
public String courseById(Model model, @PathVariable Long id) { |
||||||
|
/** |
||||||
|
* получение списка преподавателей (Class.Teacher) из ресурсов |
||||||
|
* - для select поля формы |
||||||
|
*/ |
||||||
|
List<Teacher> teachers = client.get() |
||||||
|
.uri("/teacher/list") |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <List<Teacher>>(){}) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
model.addAttribute("teachers", teachers); |
||||||
|
|
||||||
|
/** |
||||||
|
* получение списка программ обучения (Class.Program) из ресурсов |
||||||
|
* - для select поля формы |
||||||
|
*/ |
||||||
|
List<Program> programs = client.get() |
||||||
|
.uri("/program/list") |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <List<Program>>(){}) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
model.addAttribute("programs", programs); |
||||||
|
|
||||||
|
/** |
||||||
|
* получение списка объектов строительства (Class.Building) из ресурсов |
||||||
|
* - для select поля формы |
||||||
|
*/ |
||||||
|
List<Building> buildings = client.get() |
||||||
|
.uri("/building/list") |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <List<Building>>(){}) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
model.addAttribute("buildings", buildings); |
||||||
|
|
||||||
|
/** |
||||||
|
* Получение сведений о курсе (Class.Course) из ресурсов |
||||||
|
* - для отображения на редактирование в форме course-edit |
||||||
|
*/ |
||||||
|
Course course = client.get() |
||||||
|
.uri("/course/" + id) |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(Course.class) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
model.addAttribute("course", course); |
||||||
|
return "course-edit"; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Отправка данных заполненной формы курса на сервер |
||||||
|
* @param model |
||||||
|
* @param course |
||||||
|
* @return |
||||||
|
* @throws JsonMappingException |
||||||
|
* @throws JsonProcessingException |
||||||
|
*/ |
||||||
|
@PostMapping( |
||||||
|
path = "/course/add", |
||||||
|
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, |
||||||
|
produces = { |
||||||
|
MediaType.APPLICATION_JSON_VALUE |
||||||
|
}) |
||||||
|
public String addCourse(Model model, @ModelAttribute("course") @Validated Course course) throws JsonMappingException, JsonProcessingException{ |
||||||
|
client.post() |
||||||
|
.uri("/course/create") |
||||||
|
.body(Mono.just(course), Course.class) |
||||||
|
.retrieve() |
||||||
|
.toBodilessEntity() |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
return "redirect:/courses"; |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping(path = "/course/add") |
||||||
|
public String addCourseFrame(Model model){ |
||||||
|
/** |
||||||
|
* получение списка преподавателей (Class.Teacher) из ресурсов |
||||||
|
* - для select поля формы |
||||||
|
*/ |
||||||
|
List<Teacher> teachers = client.get() |
||||||
|
.uri("/teacher/list") |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <List<Teacher>>(){}) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
model.addAttribute("teachers", teachers); |
||||||
|
|
||||||
|
/** |
||||||
|
* получение списка программ обучения (Class.Program) из ресурсов |
||||||
|
* - для select поля формы |
||||||
|
*/ |
||||||
|
List<Program> programs = client.get() |
||||||
|
.uri("/program/list") |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <List<Program>>(){}) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
model.addAttribute("programs", programs); |
||||||
|
|
||||||
|
/** |
||||||
|
* получение списка объектов строительства (Class.Building) из ресурсов |
||||||
|
* - для select поля формы |
||||||
|
*/ |
||||||
|
List<Building> buildings = client.get() |
||||||
|
.uri("/building/list") |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(new ParameterizedTypeReference <List<Building>>(){}) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
model.addAttribute("buildings", buildings); |
||||||
|
|
||||||
|
Course course = new Course(); |
||||||
|
model.addAttribute("newCourse", course); |
||||||
|
return "course-add"; |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping(path = "/course/delete/{id}") |
||||||
|
public String deleteCourse(@PathVariable Long id) throws JsonMappingException, JsonProcessingException{ |
||||||
|
client.delete() |
||||||
|
.uri("/course/delete/" + id) |
||||||
|
.retrieve() |
||||||
|
.bodyToMono(String.class) |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
return "redirect:/courses"; |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping( |
||||||
|
path = "/course/update/{id}", |
||||||
|
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, |
||||||
|
produces = { |
||||||
|
MediaType.APPLICATION_JSON_VALUE |
||||||
|
}) |
||||||
|
public String updateCourse(@PathVariable Long id |
||||||
|
, @ModelAttribute("cs") @Validated Course course) throws JsonMappingException, JsonProcessingException{ |
||||||
|
client.post() |
||||||
|
.uri("/course/update/" + course.getId()) |
||||||
|
.body(Mono.just(course), Course.class) |
||||||
|
.retrieve() |
||||||
|
.toBodilessEntity() |
||||||
|
.timeout(Duration.ofSeconds(1)) |
||||||
|
.block(); |
||||||
|
return "redirect:/courses"; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
package ru.molokoin.clientserviceteachers.entities; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Data |
||||||
|
public class Course { |
||||||
|
private long id;//уникальный идентификатор курса
|
||||||
|
private String place;//место проведения занятий
|
||||||
|
private Date start_date;//дата начала курса
|
||||||
|
private Date protocol_date;//дата протокола
|
||||||
|
private String protocol_number;//номер протоколаssss
|
||||||
|
private String report_period;//отчетный период (наименование месяца)
|
||||||
|
private Teacher teacher;//сведения о преподаватле
|
||||||
|
private Program program;//сведения о программе обучения
|
||||||
|
private Building building;//сведения об объекте строительства
|
||||||
|
|
||||||
|
/** |
||||||
|
* Конструктор без id |
||||||
|
* @param place |
||||||
|
* @param start_date |
||||||
|
* @param protocol_date |
||||||
|
* @param protocol_number |
||||||
|
* @param report_period |
||||||
|
* @param teacher |
||||||
|
* @param program |
||||||
|
* @param building |
||||||
|
*/ |
||||||
|
public Course(String place, Date start_date, Date protocol_date, String protocol_number, String report_period, |
||||||
|
Teacher teacher, Program program, Building building) { |
||||||
|
this.place = place; |
||||||
|
this.start_date = start_date; |
||||||
|
this.protocol_date = protocol_date; |
||||||
|
this.protocol_number = protocol_number; |
||||||
|
this.report_period = report_period; |
||||||
|
this.teacher = teacher; |
||||||
|
this.program = program; |
||||||
|
this.building = building; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
<!DOCTYPE HTML> |
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" |
||||||
|
xmlns:th="http://www.thymeleaf.org"> |
||||||
|
<head> |
||||||
|
<meta charset="utf-8"> |
||||||
|
<title>Course-add</title> |
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js"></script> |
||||||
|
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script> |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<header> |
||||||
|
add : course |
||||||
|
</header> |
||||||
|
<main> |
||||||
|
<h2>Добавление нового курса:</h2> |
||||||
|
<form th:action="@{/course/add}" method="post" th:object="${newCourse}"> |
||||||
|
<div> |
||||||
|
<label>id: </label> |
||||||
|
<input type="text" th:field="${newCourse.id}" placeholder="" readonly /> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Место занятий: </label> |
||||||
|
<input type="text" th:field="${newCourse.place}" placeholder="" /> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Дата начала занятий: </label> |
||||||
|
<input type="date" th:field="${newCourse.start_date}" placeholder="" /> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Дата протокола: </label> |
||||||
|
<input type="date" th:field="${newCourse.protocol_date}" placeholder="" /> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Номер протокола: </label> |
||||||
|
<input type="text" th:field="${newCourse.protocol_number}" placeholder="" /> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Отчетный период: </label> |
||||||
|
<input type="text" th:field="${newCourse.report_period}" placeholder="" /> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Преподаватель: </label> |
||||||
|
<select th:field="${newCourse.teacher.id}"> |
||||||
|
<option value="0" disabled >выберите преподавателя</option> |
||||||
|
<option th:each="option : ${teachers}" th:value="${option.id}" th:text="${option.second_name}"></option> |
||||||
|
</select> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Программа: </label> |
||||||
|
<select th:field="${newCourse.program.id}"> |
||||||
|
<option value="0" disabled >выберите программу</option> |
||||||
|
<option th:each="option : ${programs}" th:value="${option.id}" th:text="${option.name}"></option> |
||||||
|
</select> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<label>Объект строительства: </label> |
||||||
|
<select th:field="${newCourse.building.id}"> |
||||||
|
<option value="0" disabled >выберите объект строительства</option> |
||||||
|
<option th:each="option : ${buildings}" th:value="${option.id}" th:text="${option.name_short}"></option> |
||||||
|
</select> |
||||||
|
</div> |
||||||
|
<br> |
||||||
|
<input type="submit" value="СОХРАНИТЬ И ВЕРНУТЬСЯ"/> |
||||||
|
</form> |
||||||
|
<br> |
||||||
|
<form th:action="@{/courses}" th:method="get"> |
||||||
|
<input type="submit" value="ВЕРНУТЬСЯ"/> |
||||||
|
</form> |
||||||
|
</main> |
||||||
|
</body> |
@ -0,0 +1,85 @@ |
|||||||
|
<!DOCTYPE HTML> |
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" |
||||||
|
xmlns:th="http://www.thymeleaf.org"> |
||||||
|
<head> |
||||||
|
<meta charset="utf-8"> |
||||||
|
<title>Courses</title> |
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js"></script> |
||||||
|
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script> |
||||||
|
</head> |
||||||
|
|
||||||
|
<body> |
||||||
|
<header> |
||||||
|
<h1>COURSES</h1> |
||||||
|
menu : auth : courses |
||||||
|
<br> |
||||||
|
</header> |
||||||
|
<main> |
||||||
|
<div class="main-wraper"> |
||||||
|
<h2>Перечень курсов:</h2> |
||||||
|
<form th:action="@{/courses}" method="get" th:object="${cs}"></form> |
||||||
|
<table> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>id</th> |
||||||
|
<th>place</th> |
||||||
|
<th>start_date</th> |
||||||
|
<th>protocol_date</th> |
||||||
|
<th>protocol_number</th> |
||||||
|
<th>report_period</th> |
||||||
|
<th>teacher</th> |
||||||
|
<th>program</th> |
||||||
|
<th>building</th> |
||||||
|
<th> |
||||||
|
<!-- Переход на страницу добавления нового курса --> |
||||||
|
<form th:action="@{/course/add}" th:method="get"> |
||||||
|
<input type="submit" value="ADD --|>"/> |
||||||
|
</form> |
||||||
|
</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr th:each="c: ${courses}"> |
||||||
|
<td> |
||||||
|
<input type="text" id="id" name="id" th:value="${c.id}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="place" name="place" th:value="${c.place}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="start_date" name="start_date" th:value="${c.start_date}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="protocol_date" name="protocol_date" th:value="${c.protocol_date}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="protocol_number" name="protocol_number" th:value="${c.protocol_number}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="report_period" name="report_period" th:value="${c.report_period}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="teacher" name="teacher" th:value="${c.teacher.second_name}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="program" name="program" th:value="${c.program.name}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<input type="text" id="building" name="building" th:value="${c.building.name_short}" readonly /> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<form th:action="@{course-edit/{id}(id=${c.id})}" th:method="get"> |
||||||
|
<input type="submit" value="--|>"/> |
||||||
|
</form> |
||||||
|
<form th:action="@{/course/delete/{id}(id=${c.id})}" th:method="get"> |
||||||
|
<input type="submit" value="X"/> |
||||||
|
</form> |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</main> |
||||||
|
</body> |
||||||
|
</html> |
@ -0,0 +1,89 @@ |
|||||||
|
package ru.molokoin.resourceserviceapi.controllers; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.http.HttpStatus; |
||||||
|
import org.springframework.http.MediaType; |
||||||
|
import org.springframework.http.ResponseEntity; |
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import ru.molokoin.resourceserviceapi.entities.Organization; |
||||||
|
import ru.molokoin.resourceserviceapi.repositories.OrganizationFace; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequestMapping(path = "/", consumes = {"*/*"}) |
||||||
|
public class OrganizationController { |
||||||
|
@Autowired |
||||||
|
private OrganizationFace repo; |
||||||
|
|
||||||
|
/** |
||||||
|
* Получение списа организаций |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/organization/list") |
||||||
|
public ResponseEntity<List<Organization>> getOrganizations(){ |
||||||
|
return new ResponseEntity<>(repo.findAll(), HttpStatus.OK); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Получение сведений об организации по id |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("/organization/{id}") |
||||||
|
public ResponseEntity<?> getOrganizationByID(@PathVariable Integer id){ |
||||||
|
return new ResponseEntity<>(repo.findOrganizationById(id), HttpStatus.OK); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Создание записи об организации |
||||||
|
* @param organization |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@PostMapping(path = "/organization/create", |
||||||
|
consumes = MediaType.APPLICATION_JSON_VALUE, |
||||||
|
produces = MediaType.APPLICATION_JSON_VALUE) |
||||||
|
public ResponseEntity<?> saveOrganization(@RequestBody Organization organization) { |
||||||
|
repo.save(organization); |
||||||
|
return new ResponseEntity<>(organization, HttpStatus.CREATED); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Обновление вседений об организации |
||||||
|
* @param id |
||||||
|
* @param organization |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@PostMapping(path = "/organization/update/{id}", |
||||||
|
consumes = MediaType.APPLICATION_JSON_VALUE, |
||||||
|
produces = MediaType.APPLICATION_JSON_VALUE) |
||||||
|
public ResponseEntity<?> updateOrganization(@PathVariable Integer id, @RequestBody Organization organization) { |
||||||
|
Organization org = repo.findOrganizationById(id); |
||||||
|
org.setOwnership(organization.getOwnership()); |
||||||
|
org.setName_short(organization.getName_short()); |
||||||
|
org.setName_full(organization.getName_full()); |
||||||
|
org.setType(organization.getType()); |
||||||
|
org.setInn(organization.getInn()); |
||||||
|
repo.save(org); |
||||||
|
return new ResponseEntity<>(repo.findOrganizationById(id), HttpStatus.CREATED); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Удаление записи об организации |
||||||
|
* @param id |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@DeleteMapping("/organization/delete/{id}") |
||||||
|
public ResponseEntity<String> deleteOrganization(@PathVariable Long id){ |
||||||
|
Organization org = repo.findOrganizationById(id); |
||||||
|
repo.delete(org); |
||||||
|
return new ResponseEntity<>("Запись id#" + id + " удалена ... ", HttpStatus.OK); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
package ru.molokoin.resourceserviceapi.entities; |
||||||
|
|
||||||
|
import jakarta.persistence.Entity; |
||||||
|
import jakarta.persistence.GeneratedValue; |
||||||
|
import jakarta.persistence.GenerationType; |
||||||
|
import jakarta.persistence.Id; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.NoArgsConstructor; |
||||||
|
|
||||||
|
/** |
||||||
|
* Сущность для хранения сведений об организации - контрагенте |
||||||
|
* - ПСК |
||||||
|
*/ |
||||||
|
@NoArgsConstructor |
||||||
|
@AllArgsConstructor |
||||||
|
@Entity |
||||||
|
@Data |
||||||
|
public class Organization { |
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO) |
||||||
|
private long id; |
||||||
|
private String ownership; |
||||||
|
private String name_short;//Сокращенное наименование
|
||||||
|
private String name_full;//Полное наименование
|
||||||
|
private String type; |
||||||
|
private String inn; |
||||||
|
|
||||||
|
/** |
||||||
|
* подготовить конструкторы на все варианты внесения информации о преподавателях |
||||||
|
* @param ownership |
||||||
|
* @param name_short |
||||||
|
* @param name_full |
||||||
|
* @param type |
||||||
|
* @param inn |
||||||
|
*/ |
||||||
|
public Organization(String ownership, String name_short, String name_full, String type, String inn) { |
||||||
|
this.ownership = ownership; |
||||||
|
this.name_short = name_short; |
||||||
|
this.name_full = name_full; |
||||||
|
this.type = type; |
||||||
|
this.inn = inn; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package ru.molokoin.resourceserviceapi.repositories; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import org.springframework.data.repository.ListCrudRepository; |
||||||
|
import org.springframework.stereotype.Repository; |
||||||
|
|
||||||
|
|
||||||
|
import ru.molokoin.resourceserviceapi.entities.Organization; |
||||||
|
|
||||||
|
@Repository |
||||||
|
public interface OrganizationFace extends ListCrudRepository<Organization, Long>{ |
||||||
|
List<Organization> findAll(); |
||||||
|
Organization findOrganizationById(long id); |
||||||
|
} |
Loading…
Reference in new issue