From 3ecb50cec883904916a4182946ade93d390e243b Mon Sep 17 00:00:00 2001 From: ArtemEmelyanov Date: Sat, 15 Apr 2023 17:09:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=81=D0=B5=20=D0=B4=D0=BE=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=BE,=20=D0=BE=D1=81=D1=82=D0=B0=D0=BB?= =?UTF-8?q?=D0=BE=D1=81=D1=8C=20=D0=BD=D0=B0=D0=BB=D0=B0=D0=B4=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D1=81=D0=B2=D1=8F=D0=B7=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data.mv.db | Bin 49152 -> 69632 bytes .../IP/University/Model/Group.java | 16 +++--- .../IP/University/Model/Subject.java | 7 ++- .../IP/University/Service/GroupService.java | 36 ++++++++----- .../IP/University/Service/SubjectService.java | 30 +++++++++++ .../ru/IP_LabWorks/IP/GroupServiceTests.java | 5 +- .../IP_LabWorks/IP/SubjectServiceTests.java | 49 ++++++++++++++++-- 7 files changed, 114 insertions(+), 29 deletions(-) diff --git a/data.mv.db b/data.mv.db index 959c296d0f7f22da8db8f4d6097b25e1b2ccef2f..cafadad2086fe63fad49c6450f2b96fabe7dbc24 100644 GIT binary patch literal 69632 zcmeHQ+jAV*S??LCrLkK1!?bBFp4A3558Y+&%2;o^Jb+t~ioeGhIhj ze6?=Y6vx+eTUBaxRWW_Vb$mmXEW^>S> zEzQkL6vhfu%ZsZ^)xy<2glA!9vXC#$OwBB;(!O={06(SQ8ZLj(ku3cQn8f{O_wG&Y^|bg$Wqa)XeC{$ z*j52!v#>fhH%eq!D9)D)`HAV`a&ck>(7Rn+UY}W*x~k~!`;%PaXiGb_`1Ilo+vL{%kUD$gx0OjS2l7B?_>m-82nR;UC^%QN#JUVgT`9ub0` z-GH+jW+A`05V^+iMo^DDpTB(cA!q`;WlFg~K~Cl;78j~3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b}d2#|VgH(k? z266)kxtDQ@z>>=l2gzy3Wxz?Z0|*^0A0Tm6OZJkX;r}3c%%I)wG4*D**I!wn;s0p( zzd3v=X!yTM&i1OH{Qtd!f{2q9>-aEoQx{YIKZ|H4<5xx2PraO!$vC)f38jj*g9(OH zFC&tA+0A&zalzEf1}BG7FY|iLB3AMju_9i?TJU6H&$a*i_V(); - students.add(student); + public void setStudents(List students) { + this.students = students; } - public List getSubjects() { return subjects; } + public List getSubjects(){ + return subjects; + } - public void addSubject(Subject subject){ - if (subjects == null) - subjects = new ArrayList<>(); - subjects.add(subject); + public void setSubjects(List subjects) { + this.subjects = subjects; } } diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Model/Subject.java b/src/main/java/ru/IP_LabWorks/IP/University/Model/Subject.java index 3c62ff4..b7d45a2 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Model/Subject.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Model/Subject.java @@ -12,7 +12,7 @@ public class Subject { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; - @ManyToMany + @ManyToMany(fetch = FetchType.EAGER) private List groups; public Subject() { @@ -47,8 +47,11 @@ public class Subject { '}'; } - public List getGroups() { + public List getGroups(){ return groups; } + public void setGroups(List groups) { + this.groups = groups; + } } diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java b/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java index e2c650f..cb34b52 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Service/GroupService.java @@ -64,21 +64,33 @@ public class GroupService { } @Transactional - public Group deleteStudentInGroup(Long id, Student student) { - final Group currentGroup = findGroup(id); - final Student currentStudent = em.find(Student.class, student.getId()); - currentGroup.getStudents().remove(currentStudent); - em.merge(currentStudent); - return em.merge(currentGroup); + public void addStudentToGroup(Long groupId, Long studentId) { + Group group = findGroup(groupId); + Student student = em.find(Student.class, studentId); + if (group == null || student == null) { + throw new EntityNotFoundException("Group or Student not found"); + } + List students = group.getStudents(); + if (!students.contains(student)) { + students.add(student); + } + group.setStudents(students); + em.merge(group); } - public List findStudentsInGroup(Long id){ - final Group findGroup = findGroup(id); - return findGroup.getStudents(); + @Transactional + public void removeStudentFromGroup(Long groupId, Long studentId) { + Group group = findGroup(groupId); + Student student = em.find(Student.class, studentId); + group.getStudents().remove(student); } - public List findSubjectsInGroup(Long id){ - final Group findGroup = findGroup(id); - return findGroup.getSubjects(); + @Transactional(readOnly = true) + public List findStudentsInGroup(Long groupId) { + Group group = findGroup(groupId); + if (group == null) { + throw new EntityNotFoundException("Group not found"); + } + return group.getStudents(); } } diff --git a/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java b/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java index 181351a..73770d8 100644 --- a/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java +++ b/src/main/java/ru/IP_LabWorks/IP/University/Service/SubjectService.java @@ -3,6 +3,7 @@ package ru.IP_LabWorks.IP.University.Service; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityNotFoundException; import jakarta.persistence.PersistenceContext; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; @@ -16,6 +17,9 @@ public class SubjectService { @PersistenceContext private EntityManager em; + @Autowired + private GroupService groupService; + @Transactional public Subject addSubject(String name){ if (!StringUtils.hasText(name)) { @@ -61,4 +65,30 @@ public class SubjectService { public void deleteAllSubjects() { em.createQuery("delete from Subject").executeUpdate(); } + + @Transactional + public void addGroupToSubject(Long subjectId, Long groupId) { + Subject subject = findSubject(subjectId); + Group group = groupService.findGroup(groupId); + subject.getGroups().add(group); + group.getSubjects().add(subject); + em.merge(subject); + em.merge(group); + } + + @Transactional + public void removeGroupFromSubject(Long subjectId, Long groupId) { + Subject subject = findSubject(subjectId); + Group group = groupService.findGroup(groupId); + subject.getGroups().remove(group); + group.getSubjects().remove(subject); + em.merge(subject); + em.merge(group); + } + + @Transactional(readOnly = true) + public List findGroupsBySubject(Long subjectId) { + Subject subject = findSubject(subjectId); + return subject.getGroups(); + } } diff --git a/src/test/java/ru/IP_LabWorks/IP/GroupServiceTests.java b/src/test/java/ru/IP_LabWorks/IP/GroupServiceTests.java index 18b9583..b7b8470 100644 --- a/src/test/java/ru/IP_LabWorks/IP/GroupServiceTests.java +++ b/src/test/java/ru/IP_LabWorks/IP/GroupServiceTests.java @@ -71,10 +71,9 @@ public class GroupServiceTests { Student student1 = studentService.addStudent("Марков Данил Павлович", 19); Student student2 = studentService.addStudent("Емельянов Артём Сергеевич", 19); Group group = groupService.addGroup("ПИбд-21"); - group.addStudent(student1); - group.addStudent(student2); + groupService.addStudentToGroup(group.getId(), student1.getId()); + groupService.addStudentToGroup(group.getId(), student2.getId()); final List students = groupService.findStudentsInGroup(group.getId()); - System.out.println("DFGSDFGSDFGSDFG" + students.size()); Assertions.assertEquals(students.size(), 2); } } diff --git a/src/test/java/ru/IP_LabWorks/IP/SubjectServiceTests.java b/src/test/java/ru/IP_LabWorks/IP/SubjectServiceTests.java index 40f100e..da570c1 100644 --- a/src/test/java/ru/IP_LabWorks/IP/SubjectServiceTests.java +++ b/src/test/java/ru/IP_LabWorks/IP/SubjectServiceTests.java @@ -5,16 +5,24 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import ru.IP_LabWorks.IP.University.Model.Group; import ru.IP_LabWorks.IP.University.Model.Subject; +import ru.IP_LabWorks.IP.University.Service.GroupService; import ru.IP_LabWorks.IP.University.Service.SubjectService; import java.util.List; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + @SpringBootTest public class SubjectServiceTests { @Autowired private SubjectService subjectService; + @Autowired + private GroupService groupService; + @Test void TestAddSubject(){ subjectService.deleteAllSubjects(); @@ -28,7 +36,7 @@ public class SubjectServiceTests { final Subject subject = subjectService.addSubject("Философия"); final Subject findSubject = subjectService.findSubject(subject.getId()); - Assertions.assertEquals(subject, findSubject); + assertEquals(subject, findSubject); } @Test @@ -38,7 +46,7 @@ public class SubjectServiceTests { final Subject subject2 = subjectService.addSubject("Математика"); final List subjects = subjectService.findAllSubjects(); - Assertions.assertEquals(subjects.size(), 2); + assertEquals(subjects.size(), 2); } @Test @@ -47,7 +55,7 @@ public class SubjectServiceTests { Subject subject = subjectService.addSubject("Философия"); subject = subjectService.updateSubject(subject.getId(), "Математика"); - Assertions.assertEquals(subject.getName(), "Математика"); + assertEquals(subject.getName(), "Математика"); } @Test @@ -59,4 +67,39 @@ public class SubjectServiceTests { subjectService.findSubject(subject.getId()); }); } + + @Test + void testAddAndFindGroupsInSubject() { + Subject subject = subjectService.addSubject("Math"); + Group group1 = groupService.addGroup("PIBD-21"); + Group group2 = groupService.addGroup("PIBD-22"); + + subjectService.addGroupToSubject(subject.getId(), group1.getId()); + subjectService.addGroupToSubject(subject.getId(), group2.getId()); + + List groups = subjectService.findGroupsBySubject(subject.getId()); + + assertEquals(2, groups.size()); + assertTrue(groups.contains(group1)); + assertTrue(groups.contains(group2)); + } + + @Test + void testRemoveGroupFromSubject() { + Subject subject = subjectService.addSubject("Math"); + Group group1 = groupService.addGroup("PIBD-21"); + Group group2 = groupService.addGroup("PIBD-22"); + + subjectService.addGroupToSubject(subject.getId(), group1.getId()); + subjectService.addGroupToSubject(subject.getId(), group2.getId()); + + List groupsBeforeRemove = subjectService.findGroupsBySubject(subject.getId()); + assertEquals(2, groupsBeforeRemove.size()); + + subjectService.removeGroupFromSubject(subject.getId(), group1.getId()); + + List groupsAfterRemove = subjectService.findGroupsBySubject(subject.getId()); + assertEquals(1, groupsAfterRemove.size()); + assertTrue(groupsAfterRemove.contains(group2)); + } }