|
@@ -1,13 +1,26 @@
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import com.ruoyi.common.core.domain.entity.FormalParentsStudent;
|
|
|
+import com.ruoyi.common.core.domain.entity.FormalTeacherClass;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.system.domain.score.ScoreData;
|
|
|
+import com.ruoyi.system.mapper.FormalParentsStudentMapper;
|
|
|
+import com.ruoyi.system.mapper.FormalTeacherClassMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.ruoyi.system.mapper.RecordLeaveMapper;
|
|
|
import com.ruoyi.system.domain.RecordLeave;
|
|
|
import com.ruoyi.system.service.IRecordLeaveService;
|
|
|
|
|
|
+import static com.ruoyi.common.utils.PageUtils.startPage;
|
|
|
+
|
|
|
/**
|
|
|
* 请假记录信息Service业务层处理
|
|
|
*
|
|
@@ -20,6 +33,12 @@ public class RecordLeaveServiceImpl implements IRecordLeaveService
|
|
|
@Autowired
|
|
|
private RecordLeaveMapper recordLeaveMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FormalTeacherClassMapper formalTeacherClassMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FormalParentsStudentMapper formalParentsStudentMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询请假记录信息
|
|
|
*
|
|
@@ -41,7 +60,48 @@ public class RecordLeaveServiceImpl implements IRecordLeaveService
|
|
|
@Override
|
|
|
public List<RecordLeave> selectRecordLeaveList(RecordLeave recordLeave)
|
|
|
{
|
|
|
- return recordLeaveMapper.selectRecordLeaveList(recordLeave);
|
|
|
+ SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
+ StringBuilder classId = new StringBuilder("0,");
|
|
|
+ Map<String, Object> params = recordLeave.getParams();
|
|
|
+ String role = "admin";
|
|
|
+ if (params != null && params.size() > 0) {
|
|
|
+ role = (String) params.get("role");
|
|
|
+ }
|
|
|
+ List<RecordLeave> recordLeaveList = new ArrayList<>();
|
|
|
+ if ("teacher".equals(role)) {
|
|
|
+ FormalTeacherClass formalTeacherClass = new FormalTeacherClass();
|
|
|
+ formalTeacherClass.setTeacherId(user.getUserId());
|
|
|
+ List<FormalTeacherClass> formalTeacherClasses = formalTeacherClassMapper.selectFormalTeacherClassList(formalTeacherClass);
|
|
|
+ if (formalTeacherClasses != null && formalTeacherClasses.size() > 0) {
|
|
|
+ for (FormalTeacherClass teacherClass : formalTeacherClasses) {
|
|
|
+ classId.append(teacherClass.getClassId()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(classId.toString())) {
|
|
|
+ classId = new StringBuilder(classId.substring(0, classId.length() - 1));
|
|
|
+ }
|
|
|
+ startPage();
|
|
|
+ recordLeave.setClassId(classId.toString());
|
|
|
+ recordLeaveList = recordLeaveMapper.selectRecordLeaveList(recordLeave);
|
|
|
+ } else if ("parents".equals(role)) {
|
|
|
+ FormalParentsStudent formalParentsStudent = new FormalParentsStudent();
|
|
|
+ formalParentsStudent.setParentsId(user.getUserId());
|
|
|
+ List<FormalParentsStudent> formalParentsStudents = formalParentsStudentMapper.selectFormalParentsStudentList(formalParentsStudent);
|
|
|
+ for (FormalParentsStudent parentsStudent : formalParentsStudents) {
|
|
|
+ classId.append(parentsStudent.getClassId()).append(",");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(classId.toString())) {
|
|
|
+ classId = new StringBuilder(classId.substring(0, classId.length() - 1));
|
|
|
+ }
|
|
|
+ startPage();
|
|
|
+ recordLeave.setClassId(classId.toString());
|
|
|
+ recordLeaveList = recordLeaveMapper.selectRecordLeaveList(recordLeave);
|
|
|
+ } else if ("admin".equals(role)) {
|
|
|
+ startPage();
|
|
|
+ recordLeaveList = recordLeaveMapper.selectRecordLeaveList(recordLeave);
|
|
|
+ }
|
|
|
+
|
|
|
+ return recordLeaveList;
|
|
|
}
|
|
|
|
|
|
/**
|