| | |
| | | |
| | | import com.qxueyou.scc.admin.studentFiles.StudentFilesService; |
| | | import com.qxueyou.scc.base.model.Pager; |
| | | import com.qxueyou.scc.base.model.Result; |
| | | import com.qxueyou.scc.base.service.impl.CommonAppService; |
| | | import com.qxueyou.scc.base.util.CollectionUtils; |
| | | import com.qxueyou.scc.teach.student.model.QStuStudent; |
| | | import com.qxueyou.scc.teach.student.model.StuStudent; |
| | | import com.qxueyou.scc.user.model.QUser; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class StudentFilesServiceImpl extends CommonAppService implements StudentFilesService { |
| | | @Override |
| | | public List<Map<String, Object>> getStudentLst(String classId, String keyword, Pager pager) { |
| | | QUser qUser = QUser.user; |
| | | QStuStudent qStuStudent = QStuStudent.stuStudent; |
| | | return this.getQueryFactory() |
| | | .select(qStuStudent.studentId, qStuStudent.name, qStuStudent.studentNo, qStuStudent.sex, |
| | | qStuStudent.mobilePhone, qStuStudent.status, qStuStudent.studyDuration, qStuStudent.tenantId, qStuStudent.score,qStuStudent.attendanceStatus, qStuStudent.graduationText,qStuStudent.comment, |
| | | qUser.imgPath) |
| | | .from(qUser, qStuStudent) |
| | | .where(qUser.deleteFlag.isFalse().and(qUser.userId.eq(qStuStudent.userId)) |
| | | .and(qStuStudent.classId.eq(classId)).and(qStuStudent.name.like("%" + keyword + "%")).and(qStuStudent.deleteFlag.isFalse())) |
| | | .limit(pager.getPageSize()).offset(pager.getOffset()).orderBy(qStuStudent.createTime.desc()).fetch().stream().map(tuple -> { |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("studentId", tuple.get(qStuStudent.studentId)); |
| | | map.put("name", tuple.get(qStuStudent.name)); |
| | | map.put("studentNo", tuple.get(qStuStudent.studentNo)); |
| | | map.put("studentNumber", tuple.get(qStuStudent.studentNo)); |
| | | map.put("sex", tuple.get(qStuStudent.sex)); |
| | | map.put("mobilePhone", tuple.get(qStuStudent.mobilePhone)); |
| | | map.put("status", tuple.get(qStuStudent.status)); |
| | | map.put("studyDuration", tuple.get(qStuStudent.studyDuration)); |
| | | map.put("tenantId", tuple.get(qStuStudent.tenantId)); |
| | | map.put("score", tuple.get(qStuStudent.score)); |
| | | map.put("graduationText", tuple.get(qStuStudent.graduationText)); |
| | | map.put("attendanceStatus", tuple.get(qStuStudent.attendanceStatus)); |
| | | map.put("comment", tuple.get(qStuStudent.comment)); |
| | | map.put("imgPath", tuple.get(qUser.imgPath)); |
| | | return map; |
| | | }).collect(Collectors.toList()); |
| | | public List<StuStudent> findStudentFiles(Integer limit, Integer pageNum, String keyword, String classId) { |
| | | StringBuffer hql=new StringBuffer("from StuStudent where name like ? and classId = ? and deleteFlag is false"); |
| | | |
| | | List<Object> args = CollectionUtils.newList(keyword + "%",classId); |
| | | |
| | | hql.append(" order by createTime desc"); |
| | | |
| | | List<StuStudent> list = findList(hql.toString(), new Pager(limit, pageNum), args, StuStudent.class); |
| | | |
| | | return list; |
| | | } |
| | | @Override |
| | | public int getStudentsCount(String classId, String keyword) { |
| | | // //TODO 判断是否为补考分组 |
| | | // ClsClass cls = clsService.read(classId); |
| | | // String hql=null; |
| | | // if(cls!=null && cls.getClassTypes()!=null && "1".equals(cls.getClassTypes())){ |
| | | // //TODO 补考分组需要另一种查询学员 stu.tenantId = class.classId |
| | | // hql = "from StuStudent where tenantId=:classId and name like :keyword and deleteFlag is false"; |
| | | // }else { |
| | | String hql = "from StuStudent where classId=:classId and name like :keyword and deleteFlag is false"; |
| | | // } |
| | | return findCountByComplexHql(hql, CollectionUtils.newObjectMap("classId", classId, "keyword", "%" + keyword + "%" )); |
| | | public int findfindStudentFilesListCount(String keyword, String classId) { |
| | | StringBuffer hql=new StringBuffer("from StuStudent where name like ? and subjectId = ? and deleteFlag is false"); |
| | | |
| | | } |
| | | List<Object> args = CollectionUtils.newList(keyword + "%",classId); |
| | | |
| | | @Override |
| | | public String studentCommentAddAndUp(String[] studentIds,String comment) { |
| | | StringBuffer hql=new StringBuffer("from StuStudent where studentId=? and deleteFlag is false"); |
| | | |
| | | List<Object> args = CollectionUtils.newList(studentIds); |
| | | |
| | | StuStudent stuStudent = findUnique(hql.toString(), args, StuStudent.class); |
| | | |
| | | stuStudent.setComment(comment); |
| | | |
| | | save(stuStudent); |
| | | return ""; |
| | | return findCount(hql.toString(),args); |
| | | } |
| | | } |