mirror of
https://github.com/suyiiyii/SIMS.git
synced 2025-06-03 12:56:10 +08:00
定义对象
This commit is contained in:
parent
2b3f5ccbd7
commit
9209413483
@ -3,6 +3,7 @@ package top.suyiiyii.sims.controller;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
import lombok.Data;
|
||||||
import org.modelmapper.ModelMapper;
|
import org.modelmapper.ModelMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -120,13 +121,16 @@ RecordController {
|
|||||||
public Result<List<RecordDto>> searchRecords(
|
public Result<List<RecordDto>> searchRecords(
|
||||||
@RequestParam(defaultValue = "0") int page,
|
@RequestParam(defaultValue = "0") int page,
|
||||||
@RequestParam(defaultValue = "10") int size,
|
@RequestParam(defaultValue = "10") int size,
|
||||||
String username,Integer studentId, String userGroup, String grade,String roleName) {
|
SearchRequest searchRequest) {
|
||||||
|
|
||||||
Integer s1;
|
Integer s1;
|
||||||
List<Integer> studentIds = new ArrayList<>();
|
List<Integer> studentIds = new ArrayList<>();
|
||||||
List<Record> records=new ArrayList<>();
|
List<Record> records=new ArrayList<>();
|
||||||
|
Integer studentId = searchRequest.getStudentId();
|
||||||
if(studentId!=null) {
|
if(studentId!=null) {
|
||||||
studentIds.add(studentId);
|
studentIds.add(studentId);
|
||||||
}
|
}
|
||||||
|
String roleName = searchRequest.getRoleName();
|
||||||
if(roleName!="") {
|
if(roleName!="") {
|
||||||
//rolename查用户id
|
//rolename查用户id
|
||||||
Integer userId = roleService.getIdByrolename(roleName);
|
Integer userId = roleService.getIdByrolename(roleName);
|
||||||
@ -134,13 +138,14 @@ RecordController {
|
|||||||
s1 = userService.getStudentIdByUserId(userId);
|
s1 = userService.getStudentIdByUserId(userId);
|
||||||
studentIds.add(s1);
|
studentIds.add(s1);
|
||||||
}
|
}
|
||||||
|
String username = searchRequest.getUsername();
|
||||||
if(username!="") {
|
if(username!="") {
|
||||||
//username查用户StudentId
|
//username查用户StudentId
|
||||||
s1= roleService.getStudentIdByUsername(username);
|
s1= roleService.getStudentIdByUsername(username);
|
||||||
studentIds.add(s1);
|
studentIds.add(s1);
|
||||||
}
|
}
|
||||||
for (Integer Sid : studentIds) {
|
for (Integer Sid : studentIds) {
|
||||||
records.addAll(recordService.getRecordsLike(page,size,Sid,userGroup,grade));
|
records.addAll(recordService.getRecordsLike(page,size,Sid,searchRequest.getUserGroup(),searchRequest.getGrade()));
|
||||||
}
|
}
|
||||||
List<RecordDto> RecordDtos = new ArrayList<>();
|
List<RecordDto> RecordDtos = new ArrayList<>();
|
||||||
for (Record record : records) {
|
for (Record record : records) {
|
||||||
@ -229,4 +234,12 @@ RecordController {
|
|||||||
}
|
}
|
||||||
return Result.success(RecordDtos);
|
return Result.success(RecordDtos);
|
||||||
}
|
}
|
||||||
|
@Data
|
||||||
|
public static class SearchRequest {
|
||||||
|
private String username;
|
||||||
|
private Integer studentId;
|
||||||
|
private String grade;
|
||||||
|
private String userGroup;
|
||||||
|
private String roleName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user