From ca5b3d06f18f2f0583818ac55bc399ba9b73dc95 Mon Sep 17 00:00:00 2001 From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com> Date: Mon, 20 May 2024 20:50:40 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=B4=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B8=20=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data.mv.db | Bin 507904 -> 753664 bytes .../directions/api/DirectionsController.java | 2 +- .../directions/service/DirectionsService.java | 6 +- .../example/demo/news/api/NewsController.java | 62 +++++++++++------- src/main/resources/public/css/style.css | 2 +- src/main/resources/templates/new-edit.html | 45 +++++++++++++ src/main/resources/templates/news.html | 59 ++++++++++------- 7 files changed, 125 insertions(+), 51 deletions(-) diff --git a/data.mv.db b/data.mv.db index f725e335c490ec2d9b3a5aad1b5dce79367cdbcf..3a72557059652c1bfeb662fb37f70a6289ecf3e2 100644 GIT binary patch delta 58358 zcmeHw3zQvYm2Op?N1g6Y(w%e?`jvj<3878uU3FS89T^_OD1y8ZA@!69c?dz_I@-

0l{m0fI8O)jAKMDgTPwq^(so#Su@UEGu-_@>#x(NJKag3 z$#BkE$$#pc)2H_N>#u)*d+%@WJw84#KE7_%X(PsPaK*Op@)6%APtM-_-{KKn)3o96 zva7ek>xq5Ksx^xfdpNlw-Vt6FUpb=Nn(Mk@bz;*!?Y)Qach_&~xM5R=4F44PSEz03 zDBiu{(l{BuBHjw}Z1>+4Uo~P5Z}G1g(PLACC)-EtL>sO%Xb$h# zyd@q9szws)VKV&Q_{ys`Z`(TJ!*^|suh}tT+rvAyg(JF`ggYn3PN}p?Qt21%cS-5Q zdgc8saiYRkud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x$ov~Q%P+-KWK8^0 nJZ<}>c+T!8hTxac$$7&%uNAtY*hr~jBZbwlriY4+M2Y_ZM6DQM diff --git a/src/main/java/com/example/demo/directions/api/DirectionsController.java b/src/main/java/com/example/demo/directions/api/DirectionsController.java index 4803438..19f2106 100644 --- a/src/main/java/com/example/demo/directions/api/DirectionsController.java +++ b/src/main/java/com/example/demo/directions/api/DirectionsController.java @@ -51,7 +51,7 @@ public class DirectionsController { @GetMapping public String getAllWithDepartment( - @RequestParam(name="PAGE_ATTRIBUTE", defaultValue = "0") int page, + @RequestParam(name=PAGE_ATTRIBUTE, defaultValue = "0") int page, Model model) { final Map attributes = PageAttributesMapper. toAttributes(directionsService.getAllWithDepartment(page, Constants.DEFAULT_PAGE_SIZE), this::toGroupedDto); diff --git a/src/main/java/com/example/demo/directions/service/DirectionsService.java b/src/main/java/com/example/demo/directions/service/DirectionsService.java index f45ffa4..eecafc3 100644 --- a/src/main/java/com/example/demo/directions/service/DirectionsService.java +++ b/src/main/java/com/example/demo/directions/service/DirectionsService.java @@ -6,6 +6,7 @@ import java.util.stream.StreamSupport; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -81,9 +82,8 @@ public class DirectionsService { return existsEntity; } - @Transactional + @Transactional(readOnly = true) public Page getAllWithDepartment(int page, int size) { - final Pageable pageRequest = PageRequest.of(page, size); - return repository.findAllWithDepartment(pageRequest); + return repository.findAllWithDepartment(PageRequest.of(page, size, Sort.by("id"))); } } diff --git a/src/main/java/com/example/demo/news/api/NewsController.java b/src/main/java/com/example/demo/news/api/NewsController.java index e6bb797..2b08ead 100644 --- a/src/main/java/com/example/demo/news/api/NewsController.java +++ b/src/main/java/com/example/demo/news/api/NewsController.java @@ -1,15 +1,20 @@ package com.example.demo.news.api; +import java.util.List; + import org.modelmapper.ModelMapper; +import org.modelmapper.TypeToken; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; 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.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import com.example.demo.core.configuration.Constants; +import com.example.demo.department.api.DepartmentDto; import com.example.demo.department.service.DepartmentService; import com.example.demo.news.model.NewsEntity; import com.example.demo.news.service.NewsService; @@ -23,6 +28,7 @@ public class NewsController { private static final String NEWS_VIEW = "news"; private static final String NEWS_EDIT_VIEW = "new-edit"; private static final String NEWS_ATTRIBUTE = "news"; + private static final String DEPARTMENT_ATTRIBUTE = "departments"; private final NewsService newsService; private final ModelMapper modelMapper; private final DepartmentService departmentService; @@ -43,11 +49,9 @@ public class NewsController { return entity; } - // @GetMapping - // public List getAll(@RequestParam(name = "departmentId", defaultValue - // = "0") Long departmentId) { - // return newsService.getAll(departmentId).stream().map(this::toDto).toList(); - // } + private List getDepartments(){ + return modelMapper.map(departmentService.getAll(), new TypeToken>(){}.getType()); + } @GetMapping public String getAll(Model model) { @@ -56,14 +60,22 @@ public class NewsController { return NEWS_VIEW; } - @GetMapping("/{id}") - public NewsDto get(@PathVariable(name = "id") Long id) { - return toDto(newsService.get(id)); + @GetMapping("/edit/") + public String create(Model model) { + model.addAttribute(NEWS_ATTRIBUTE, new NewsDto()); + return NEWS_EDIT_VIEW; } - @PostMapping - public NewsDto create(@RequestBody @Valid NewsDto dto) { - return toDto(newsService.create(toEntity(dto))); + @PostMapping("/edit/") + public String create( + @ModelAttribute(name = NEWS_ATTRIBUTE) @Valid NewsDto newItem, + BindingResult bindingResult, + Model model) { + if (bindingResult.hasErrors()) { + return NEWS_EDIT_VIEW; + } + newsService.create(toEntity(newItem)); + return Constants.REDIRECT_VIEW + URL; } @PostMapping("/delete/{id}") @@ -81,17 +93,23 @@ public class NewsController { throw new IllegalArgumentException(); } model.addAttribute(NEWS_ATTRIBUTE, toDto(newsService.get(id))); + model.addAttribute(DEPARTMENT_ATTRIBUTE, getDepartments()); return NEWS_EDIT_VIEW; } - // @PutMapping("/{id}") - // public NewsDto update(@PathVariable(name = "id") Long id, @RequestBody - // NewsDto dto) { - // return toDto(newsService.update(id, toEntity(dto))); - // } - - // @DeleteMapping("/{id}") - // public NewsDto delete(@PathVariable(name = "id") Long id) { - // return toDto(newsService.delete(id)); - // } + @PostMapping("/edit/{id}") + public String update( + @PathVariable(name = "id") Long id, + @ModelAttribute(name = NEWS_ATTRIBUTE) @Valid NewsDto newItem, + BindingResult bindingResult, + Model model) { + if (bindingResult.hasErrors()) { + return NEWS_EDIT_VIEW; + } + if (id <= 0) { + throw new IllegalArgumentException(); + } + newsService.update(id, toEntity(newItem)); + return Constants.REDIRECT_VIEW + URL; + } } diff --git a/src/main/resources/public/css/style.css b/src/main/resources/public/css/style.css index ba7619b..bd6781f 100644 --- a/src/main/resources/public/css/style.css +++ b/src/main/resources/public/css/style.css @@ -86,7 +86,7 @@ td form { } .mainSt { - color: #060647; + color: #008B8B; font-size: 50px; } diff --git a/src/main/resources/templates/new-edit.html b/src/main/resources/templates/new-edit.html index e69de29..362f8e6 100644 --- a/src/main/resources/templates/new-edit.html +++ b/src/main/resources/templates/new-edit.html @@ -0,0 +1,45 @@ + + + + + Редактировать новость + + + +

+
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ + +
+
+
+ + Отмена +
+
+
+ + + \ No newline at end of file diff --git a/src/main/resources/templates/news.html b/src/main/resources/templates/news.html index 54852d0..838eeff 100644 --- a/src/main/resources/templates/news.html +++ b/src/main/resources/templates/news.html @@ -13,31 +13,42 @@ Новости
- Добавить новость -
-
-
-
- -
- - -
- - - -
-
- - - -
-
-
-
-
+ Добавить новость
+ + + + + + + + + + + + + + + + + + + + +
IDЗаголовокОписание
+
+ +
+
+
+ +
+