首次提交

This commit is contained in:
2026-05-26 10:08:21 +08:00
commit 3b70da2f0b
92 changed files with 7237 additions and 0 deletions
@@ -0,0 +1,49 @@
package com.nbport.zgwl.controller;
import com.nbport.zgwl.common.R;
import com.nbport.zgwl.exception.ServiceException;
import com.nbport.zgwl.service.LocalFileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map;
@RestController
@RequestMapping("/trans/minio/file")
@Slf4j
@RequiredArgsConstructor
@Validated
public class MinioFileController {
private final LocalFileService localFileService;
@PostMapping(value = "/uploadOutie", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<String> uploadOutie(MultipartHttpServletRequest request) {
Map<String, MultipartFile> fileMap = request.getFileMap();
if (CollectionUtils.isEmpty(fileMap)) {
throw new ServiceException("请上传文件");
}
MultipartFile file = fileMap.values().iterator().next();
log.info("接收到上传文件请求,fileName={}", file.getOriginalFilename());
String relativePath = localFileService.upload(file);
return R.success(relativePath);
}
@GetMapping("/download")
public ResponseEntity<ByteArrayResource> download(@RequestParam("fileName") String fileName) {
log.info("接收到文件下载请求,fileName={}", fileName);
return localFileService.download(fileName);
}
}
@@ -0,0 +1,65 @@
package com.nbport.zgwl.controller;
import com.nbport.zgwl.common.PageResult;
import com.nbport.zgwl.common.R;
import com.nbport.zgwl.dto.StudentQueryDto;
import com.nbport.zgwl.dto.StudentSaveDto;
import com.nbport.zgwl.entity.StudentEntity;
import com.nbport.zgwl.entity.SysUserEntity;
import com.nbport.zgwl.service.StudentService;
import com.nbport.zgwl.utils.MockSecurityManager;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/student")
@Slf4j
@RequiredArgsConstructor
@Validated
public class StudentController {
private final StudentService studentService;
private final MockSecurityManager securityManager;
@PostMapping("/list")
public R<PageResult<Map<String, Object>>> queryList(@RequestBody StudentQueryDto queryDto) {
SysUserEntity user = securityManager.getLoginUser();
PageResult<Map<String, Object>> pageResult = studentService.queryList(queryDto, user);
return R.success(pageResult);
}
@GetMapping("/detail/{id}")
public R<StudentEntity> detail(@PathVariable("id") Long id) {
return R.success(studentService.detail(id));
}
@PostMapping("/add")
public R<String> add(@RequestBody @Valid StudentSaveDto dto) {
log.info("新增学生请求:{}", dto);
studentService.add(dto);
return R.success("新增成功");
}
@PostMapping("/update")
public R<String> update(@RequestBody @Valid StudentSaveDto dto) {
log.info("修改学生请求:{}", dto);
studentService.update(dto);
return R.success("修改成功");
}
@PostMapping("/delete/{id}")
public R<String> delete(@PathVariable("id") Long id) {
studentService.delete(id);
return R.success("删除成功");
}
}