|
@@ -34,8 +34,8 @@ public class CourseSpeciatlyService {
|
|
|
*/
|
|
|
public List<Course> getAllCoursesBySpeciatlyId(String speciatlyId) {
|
|
|
|
|
|
- List<CourseSpeciatly> list = courseSpeciatlyRepo.findBySpecialtyId(Long
|
|
|
- .parseLong(speciatlyId));
|
|
|
+ List<CourseSpeciatly> list = courseSpeciatlyRepo
|
|
|
+ .findBySpecialtyId(Long.parseLong(speciatlyId));
|
|
|
List<Course> courses = new ArrayList<Course>();
|
|
|
if (list == null) {
|
|
|
return null;
|
|
@@ -74,11 +74,10 @@ public class CourseSpeciatlyService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- public void addCourseSpecialty(Long userId, List<String> courseIds,
|
|
|
- String speciallyId) {
|
|
|
+ public void addCourseSpecialty(Long userId, List<String> courseIds, String speciallyId) {
|
|
|
|
|
|
- List<CourseSpeciatly> list = courseSpeciatlyRepo.findBySpecialtyId(Long
|
|
|
- .parseLong(speciallyId));
|
|
|
+ List<CourseSpeciatly> list = courseSpeciatlyRepo
|
|
|
+ .findBySpecialtyId(Long.parseLong(speciallyId));
|
|
|
if (list != null || list.size() > 0) {
|
|
|
for (CourseSpeciatly courseSpeciatly : list) {
|
|
|
courseSpeciatlyRepo.delete(courseSpeciatly);
|
|
@@ -99,7 +98,10 @@ public class CourseSpeciatlyService {
|
|
|
List<CourseSpeciatly> list = courseSpeciatlyRepo.findByCourseId(courseId);
|
|
|
List<Specialty> specialties = new ArrayList<Specialty>();
|
|
|
for (CourseSpeciatly courseSpeciatly : list) {
|
|
|
- specialties.add(specialtyRepo.findOne(courseSpeciatly.getSpecialtyId()));
|
|
|
+ Specialty one = specialtyRepo.findOne(courseSpeciatly.getSpecialtyId());
|
|
|
+ if (null != one) {
|
|
|
+ specialties.add(one);
|
|
|
+ }
|
|
|
}
|
|
|
return specialties;
|
|
|
}
|