feat(system): 新增学生心理评级查询功能

- 添加了 StudentMentalRatingVo 类用于查询结果封装
- 在 StudentMentalRatingMapper 中新增了两个查询方法: - selectLatestByTeacherIdWithConditions:查询辅导员负责的每个学生的最新心理评级记录
  - selectLatestAllWithConditions:查询所有学生的最新心理评级记录
- 更新了 WeChatMentalAlertController,添加了新的查询接口
- 优化了查询逻辑,支持条件查询和分页功能
This commit is contained in:
2025-08-26 09:58:54 +08:00
parent 9eb3cfd422
commit 3541c29739
5 changed files with 155 additions and 21 deletions

View File

@@ -4,11 +4,14 @@ import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.core.domain.entity.SysUser;
import com.srs.common.core.domain.model.LoginUser;
import com.srs.common.core.page.TableDataInfo;
import com.srs.common.utils.WeChatUtil;
import com.srs.framework.web.service.TokenService;
import com.srs.system.domain.StudentMentalRating;
import com.srs.system.domain.vo.StudentMentalRatingVo;
import com.srs.system.mapper.StudentMentalRatingMapper;
import com.srs.system.mapper.SysUserMapper;
import com.srs.system.service.ISysPostService;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -37,6 +40,9 @@ public class WeChatMentalAlertController extends BaseController {
private TokenService tokenService;
@Autowired
private StudentMentalRatingMapper studentMentalRatingMapper;
//岗位
@Autowired
private ISysPostService sysPostService;
/**
* 处理心理预警通知请求
@@ -114,11 +120,27 @@ public class WeChatMentalAlertController extends BaseController {
/**
* 获取全部学生心理评级记录
*/
/**
* 获取全部学生心理评级记录(支持条件查询和分页)
*/
@GetMapping("/rating/all")
public AjaxResult allRatings() {
return AjaxResult.success(studentMentalRatingMapper.selectAll());
}
public TableDataInfo allRatings(StudentMentalRatingVo queryVo) {
// 获取当前登录用户信息
String teacherId = getUsername();
Long userId = getUserId();
// 判断是否为学工
boolean isJwc = RoleBool.isJwc(userId, sysPostService);
startPage();
if (isJwc) {
return getDataTable(studentMentalRatingMapper.selectLatestAllWithConditions(
queryVo.getStuNo(), queryVo.getStuName()));
} else {
return getDataTable(studentMentalRatingMapper.selectLatestByTeacherIdWithConditions(
teacherId, queryVo.getStuNo(), queryVo.getStuName()));
}
}
/**
* 根据学号获取全部记录
*/