Quellcode durchsuchen

新生分班报错修复

dzx vor 5 Monaten
Ursprung
Commit
627498e0a0

+ 2 - 2
src/main/java/com/xjrsoft/module/internship/controller/InternshipPlanTeacherController.java

@@ -60,11 +60,11 @@ public class InternshipPlanTeacherController {
     @SaCheckPermission("internshipplanteacher:detail")
     @XjrLog(value = "根据id查询实习计划带队老师表信息")
     public RT<InternshipPlanTeacherVo> info(@RequestParam Long id){
-        InternshipPlanTeacher internshipPlanTeacher = internshipPlanTeacherService.getById(id);
+        InternshipPlanTeacherVo internshipPlanTeacher = internshipPlanTeacherService.getInfoById(id);
         if (internshipPlanTeacher == null) {
            return RT.error("找不到此数据!");
         }
-        return RT.ok(BeanUtil.toBean(internshipPlanTeacher, InternshipPlanTeacherVo.class));
+        return RT.ok(internshipPlanTeacher);
     }
 
 

+ 3 - 0
src/main/java/com/xjrsoft/module/internship/service/IInternshipPlanTeacherService.java

@@ -7,6 +7,7 @@ import com.xjrsoft.module.internship.dto.InternshipPlanTeacherPageDto;
 import com.xjrsoft.module.internship.dto.UpdateInternshipPlanTeacherDto;
 import com.xjrsoft.module.internship.entity.InternshipPlanTeacher;
 import com.xjrsoft.module.internship.vo.InternshipPlanTeacherPageVo;
+import com.xjrsoft.module.internship.vo.InternshipPlanTeacherVo;
 
 /**
 * @title: 实习计划带队老师表
@@ -22,4 +23,6 @@ public interface IInternshipPlanTeacherService extends MPJBaseService<Internship
     Boolean add(AddInternshipPlanTeacherDto dto);
 
     Boolean update(UpdateInternshipPlanTeacherDto dto);
+
+    InternshipPlanTeacherVo getInfoById(Long id);
 }

+ 22 - 0
src/main/java/com/xjrsoft/module/internship/service/impl/InternshipPlanTeacherServiceImpl.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.internship.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.xjrsoft.module.internship.dto.AddInternshipPlanTeacherDto;
@@ -12,10 +13,14 @@ import com.xjrsoft.module.internship.mapper.InternshipPlanClassMapper;
 import com.xjrsoft.module.internship.mapper.InternshipPlanTeacherMapper;
 import com.xjrsoft.module.internship.service.IInternshipPlanTeacherService;
 import com.xjrsoft.module.internship.vo.InternshipPlanTeacherPageVo;
+import com.xjrsoft.module.internship.vo.InternshipPlanTeacherVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
 * @title: 实习计划带队老师表
 * @Author dzx
@@ -66,4 +71,21 @@ public class InternshipPlanTeacherServiceImpl extends MPJBaseServiceImpl<Interns
 
         return true;
     }
+
+
+
+    @Override
+    public InternshipPlanTeacherVo getInfoById(Long id) {
+        InternshipPlanTeacher planTeacher = this.getById(id);
+
+        List<InternshipPlanClass> classList = internshipPlanClassMapper.selectList(
+                new QueryWrapper<InternshipPlanClass>().lambda()
+                        .eq(InternshipPlanClass::getInternshipPlanTeacherId, id)
+        );
+        InternshipPlanTeacherVo result = BeanUtil.toBean(planTeacher, InternshipPlanTeacherVo.class);
+
+        result.setClassIds(classList.stream().map(InternshipPlanClass::getClassId).collect(Collectors.toList()));
+
+        return result;
+    }
 }

+ 4 - 1
src/main/java/com/xjrsoft/module/internship/vo/InternshipPlanTeacherVo.java

@@ -3,6 +3,8 @@ package com.xjrsoft.module.internship.vo;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
 * @title: 实习计划带队老师表表单出参
 * @Author dzx
@@ -28,6 +30,7 @@ public class InternshipPlanTeacherVo {
     @ApiModelProperty("带队老师id(xjr_user)")
     private Long userId;
 
-
+    @ApiModelProperty("带领班级ids")
+    private List<Long> classIds;
 
 }