mirror of
https://github.com/suyiiyii/SIMS.git
synced 2025-06-02 00:16:11 +08:00
筛选查询
This commit is contained in:
parent
e48adf67c3
commit
2b3f5ccbd7
@ -77,6 +77,10 @@ RecordController {
|
||||
@PutMapping("/admin/record/{id}")
|
||||
public Result<CommonResponse> adminUpdateRecord(@PathVariable Integer id, @RequestBody RecordDto recordDto) {
|
||||
Record record = modelMapper.map(recordDto, Record.class);
|
||||
Integer i = recordService.IsRecord(id);
|
||||
if(i==null) {
|
||||
throw new RuntimeException("该记录不存在");
|
||||
}
|
||||
recordService.updateRecord(record, id);
|
||||
return Result.msg("修改成功");
|
||||
}
|
||||
@ -85,6 +89,10 @@ RecordController {
|
||||
@Operation(summary = "删除单个奖惩记录")
|
||||
@DeleteMapping("/admin/record/{id}")
|
||||
public Result<CommonResponse> adminDeleteRecord(@PathVariable Integer id) {
|
||||
Integer i = recordService.IsRecord(id);
|
||||
if(i==null) {
|
||||
throw new RuntimeException("该记录不存在");
|
||||
}
|
||||
recordService.deleteRecord(id);
|
||||
return Result.msg("删除成功");
|
||||
}
|
||||
|
@ -79,4 +79,6 @@ public interface RecordMapper {
|
||||
Integer getSidByCategoryId(Integer i);
|
||||
@Select("SELECT * FROM record WHERE student_id = #{sid} LIMIT #{page},#{size}")
|
||||
List<Record> getRecordsById(int page, int size, Integer sid);
|
||||
@Select("SELECT id FROM record WHERE id = #{id}")
|
||||
Integer IsRecord(Integer id);
|
||||
}
|
||||
|
@ -80,4 +80,8 @@ public class RecordService {
|
||||
public List<Record> getRecordsById(int page, int size, Integer sid) {
|
||||
return recordMapper.getRecordsById(page, size, sid);
|
||||
}
|
||||
|
||||
public Integer IsRecord(Integer id) {
|
||||
return recordMapper.IsRecord(id);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user