后端代码

This commit is contained in:
liumengyu
2026-08-24 17:48:55 +08:00
parent e0485f7366
commit aa4145fd33
419 changed files with 3684 additions and 53031 deletions
@@ -9,9 +9,11 @@ import com.roomroot.common.exception.ServiceException;
import com.roomroot.common.utils.SecurityUtils;
import com.roomroot.common.utils.StringUtils;
import com.roomroot.jwgl.entity.JYB;
import com.roomroot.jwgl.entity.XYDQB;
import com.roomroot.jwgl.entity.XYXX;
import com.roomroot.jwgl.mapper.JYBMapper;
import com.roomroot.jwgl.mapper.JYSDLBMapper;
import com.roomroot.jwgl.mapper.XYDQBMapper;
import com.roomroot.jwgl.mapper.XYXXMapper;
import org.springframework.stereotype.Component;
@@ -40,6 +42,9 @@ public class JwglRoleHelper {
@Resource
private JYSDLBMapper jysdlbMapper;
@Resource
private XYDQBMapper xydqbMapper;
public boolean isAdmin() {
try {
if (SecurityUtils.isAdmin()) {
@@ -112,6 +117,34 @@ public class JwglRoleHelper {
return studentId;
}
/**
* 当前学员所属学员队编号。课表按班次过滤时使用。
*/
public String requireStudentTeamId() {
String teamId = findStudentTeamId();
if (StringUtils.isEmpty(teamId)) {
throw new ServiceException("当前学员未分班,无法查看课表", FORBIDDEN);
}
return teamId;
}
public String findStudentTeamId() {
try {
String studentId = findStudentId();
if (StringUtils.isEmpty(studentId)) {
return null;
}
XYXX student = xyxxMapper.selectById(studentId);
if (student == null || StringUtils.isEmpty(student.getXydqbh())) {
return null;
}
XYDQB period = xydqbMapper.selectById(student.getXydqbh());
return period == null ? null : period.getXydbh();
} catch (Exception ignored) {
return null;
}
}
public String findTeacherId() {
try {
String username = SecurityUtils.getUsername();