|
|
@@ -0,0 +1,45 @@
|
|
|
+package com.usoftchina.smartschool.school.basic.service.impl;
|
|
|
+
|
|
|
+import com.usoftchina.smartschool.context.BaseContextHolder;
|
|
|
+import com.usoftchina.smartschool.exception.BizException;
|
|
|
+import com.usoftchina.smartschool.school.basic.service.ClassService;
|
|
|
+import com.usoftchina.smartschool.school.exception.BizExceptionCode;
|
|
|
+import com.usoftchina.smartschool.school.mapper.SysClazzMapper;
|
|
|
+import com.usoftchina.smartschool.school.mapper.SysStudentMapper;
|
|
|
+import com.usoftchina.smartschool.school.po.ClassForm;
|
|
|
+import com.usoftchina.smartschool.school.po.SysClazz;
|
|
|
+import com.usoftchina.smartschool.school.po.SysStudent;
|
|
|
+import com.usoftchina.smartschool.school.po.TeacherDetail;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author: guq
|
|
|
+ * @create: 2019-01-23 16:57
|
|
|
+ **/
|
|
|
+@Service
|
|
|
+public class ClassServiceImpl implements ClassService{
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysClazzMapper sysClazzMapper;
|
|
|
+ @Autowired
|
|
|
+ private SysStudentMapper sysStudentMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ClassForm getFormdata(Long id) {
|
|
|
+ if (null == id || "0".equals(id)) {
|
|
|
+ throw new BizException(BizExceptionCode.USELESS_DATA);
|
|
|
+ }
|
|
|
+ Long school_id = BaseContextHolder.getSchoolId();
|
|
|
+ ClassForm cf = new ClassForm();
|
|
|
+ SysClazz clazz = sysClazzMapper.selectByPrimaryKey(id);
|
|
|
+ List<SysStudent> students = sysStudentMapper.selectByConditon("clazz_id=" + id, school_id);
|
|
|
+ List<TeacherDetail> teacherDetails = sysClazzMapper.selectTeacher(id);
|
|
|
+ cf.setMain(clazz);
|
|
|
+ cf.setItems1(students);
|
|
|
+ cf.setItems2(teacherDetails);
|
|
|
+ return cf;
|
|
|
+ }
|
|
|
+}
|