|
@@ -0,0 +1,101 @@
|
|
|
|
|
+package com.xjrsoft.module.outint.controller;
|
|
|
|
|
+
|
|
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.xjrsoft.common.model.result.RT;
|
|
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
|
|
+import com.xjrsoft.common.page.PageOutput;
|
|
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
|
|
+import com.xjrsoft.module.outint.dto.AddStudentOutInRecordDto;
|
|
|
|
|
+import com.xjrsoft.module.outint.dto.StudentOutInRecordPageDto;
|
|
|
|
|
+import com.xjrsoft.module.outint.dto.UpdateStudentOutInRecordDto;
|
|
|
|
|
+import com.xjrsoft.module.outint.entity.StudentOutInRecord;
|
|
|
|
|
+import com.xjrsoft.module.outint.service.IStudentOutInRecordService;
|
|
|
|
|
+import com.xjrsoft.module.outint.vo.StudentOutInRecordPageVo;
|
|
|
|
|
+import com.xjrsoft.module.outint.vo.StudentOutInRecordVo;
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+* @title: 学生出入记录
|
|
|
|
|
+* @Author dzx
|
|
|
|
|
+* @Date: 2024-05-14
|
|
|
|
|
+* @Version 1.0
|
|
|
|
|
+*/
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/outint" + "/studentOutInRecord")
|
|
|
|
|
+@Api(value = "/outint" + "/studentOutInRecord",tags = "学生出入记录代码")
|
|
|
|
|
+@AllArgsConstructor
|
|
|
|
|
+public class StudentOutInRecordController {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ private final IStudentOutInRecordService studentOutInRecordService;
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping(value = "/page")
|
|
|
|
|
+ @ApiOperation(value="学生出入记录列表(分页)")
|
|
|
|
|
+ @SaCheckPermission("studentoutinrecord:detail")
|
|
|
|
|
+ public RT<PageOutput<StudentOutInRecordPageVo>> page(@Valid StudentOutInRecordPageDto dto){
|
|
|
|
|
+
|
|
|
|
|
+ LambdaQueryWrapper<StudentOutInRecord> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ queryWrapper
|
|
|
|
|
+ .orderByDesc(StudentOutInRecord::getId)
|
|
|
|
|
+ .select(StudentOutInRecord.class,x -> VoToColumnUtil.fieldsToColumns(StudentOutInRecordPageVo.class).contains(x.getProperty()));
|
|
|
|
|
+ IPage<StudentOutInRecord> page = studentOutInRecordService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
|
|
+ PageOutput<StudentOutInRecordPageVo> pageOutput = ConventPage.getPageOutput(page, StudentOutInRecordPageVo.class);
|
|
|
|
|
+ return RT.ok(pageOutput);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping(value = "/info")
|
|
|
|
|
+ @ApiOperation(value="根据id查询学生出入记录信息")
|
|
|
|
|
+ @SaCheckPermission("studentoutinrecord:detail")
|
|
|
|
|
+ public RT<StudentOutInRecordVo> info(@RequestParam Long id){
|
|
|
|
|
+ StudentOutInRecord studentOutInRecord = studentOutInRecordService.getById(id);
|
|
|
|
|
+ if (studentOutInRecord == null) {
|
|
|
|
|
+ return RT.error("找不到此数据!");
|
|
|
|
|
+ }
|
|
|
|
|
+ return RT.ok(BeanUtil.toBean(studentOutInRecord, StudentOutInRecordVo.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping
|
|
|
|
|
+ @ApiOperation(value = "新增学生出入记录")
|
|
|
|
|
+ @SaCheckPermission("studentoutinrecord:add")
|
|
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody AddStudentOutInRecordDto dto){
|
|
|
|
|
+ StudentOutInRecord studentOutInRecord = BeanUtil.toBean(dto, StudentOutInRecord.class);
|
|
|
|
|
+ boolean isSuccess = studentOutInRecordService.save(studentOutInRecord);
|
|
|
|
|
+ return RT.ok(isSuccess);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping
|
|
|
|
|
+ @ApiOperation(value = "修改学生出入记录")
|
|
|
|
|
+ @SaCheckPermission("studentoutinrecord:edit")
|
|
|
|
|
+ public RT<Boolean> update(@Valid @RequestBody UpdateStudentOutInRecordDto dto){
|
|
|
|
|
+
|
|
|
|
|
+ StudentOutInRecord studentOutInRecord = BeanUtil.toBean(dto, StudentOutInRecord.class);
|
|
|
|
|
+ return RT.ok(studentOutInRecordService.updateById(studentOutInRecord));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping
|
|
|
|
|
+ @ApiOperation(value = "删除学生出入记录")
|
|
|
|
|
+ @SaCheckPermission("studentoutinrecord:delete")
|
|
|
|
|
+ public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
|
|
|
|
|
+ return RT.ok(studentOutInRecordService.removeBatchByIds(ids));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|