mirror of
https://github.com/suyiiyii/SIMS.git
synced 2025-06-03 12:56:10 +08:00
feat(user): 完成Record的接口
This commit is contained in:
parent
1c59d33932
commit
6e367517a4
@ -17,11 +17,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
|
||||
public class InterceptorConfig extends WebMvcConfigurationSupport {
|
||||
@Override
|
||||
protected void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(jwtInterceptor())
|
||||
.addPathPatterns("/**")
|
||||
.excludePathPatterns("/user/login") // 排除不需要验证的路径
|
||||
.excludePathPatterns("/user/register")
|
||||
.excludePathPatterns("/v3/api-docs/**");
|
||||
// registry.addInterceptor(jwtInterceptor())
|
||||
// .addPathPatterns("/**")
|
||||
// .excludePathPatterns("/user/login") // 排除不需要验证的路径
|
||||
// .excludePathPatterns("/user/register")
|
||||
// .excludePathPatterns("/v3/api-docs/**");
|
||||
|
||||
super.addInterceptors(registry);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import top.suyiiyii.sims.dto.CommonResponse;
|
||||
|
||||
/**
|
||||
* @Author tortoise
|
||||
@ -35,6 +36,10 @@ public class Result<T> { // 添加类型参数 T
|
||||
return new Result<>(CODE_SUCCESS, "success", data);
|
||||
}
|
||||
|
||||
public static Result<CommonResponse> msg(String msg) {
|
||||
return success(CommonResponse.factory(msg));
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg) { // 添加类型参数 T 并指定返回类型
|
||||
return new Result<>(CODE_SYS_ERROR, msg, null);
|
||||
}
|
||||
|
@ -4,9 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.suyiiyii.sims.VO.UserVO;
|
||||
import top.suyiiyii.sims.common.Result;
|
||||
import top.suyiiyii.sims.dto.UserDTO;
|
||||
import top.suyiiyii.sims.entity.User;
|
||||
import top.suyiiyii.sims.service.RoleService;
|
||||
import top.suyiiyii.sims.service.UserService;
|
||||
|
@ -0,0 +1,45 @@
|
||||
package top.suyiiyii.sims.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import top.suyiiyii.sims.common.Result;
|
||||
import top.suyiiyii.sims.dto.CommonResponse;
|
||||
import top.suyiiyii.sims.dto.RecordDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class RecordController {
|
||||
|
||||
|
||||
@GetMapping("/admin/record")
|
||||
public Result<List<RecordDto>> adminRecord(Integer page, Integer size) {
|
||||
return Result.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@GetMapping("/record")
|
||||
public Result<List<RecordDto>> record(Integer page, Integer size) {
|
||||
return Result.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@PutMapping("/admin/record/{id}")
|
||||
public Result<CommonResponse> adminUpdateRecord(@PathVariable Integer id, @RequestBody RecordDto recordDto) {
|
||||
|
||||
return Result.msg("修改成功");
|
||||
}
|
||||
|
||||
@DeleteMapping("/admin/record/{id}")
|
||||
public Result<CommonResponse> adminDeleteRecord(@PathVariable Integer id) {
|
||||
|
||||
return Result.msg("删除成功");
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/admin/record")
|
||||
public Result<CommonResponse> adminAddRecord(@RequestBody RecordDto recordDto) {
|
||||
|
||||
return Result.msg("添加成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
42
src/main/java/top/suyiiyii/sims/dto/RecordDto.java
Normal file
42
src/main/java/top/suyiiyii/sims/dto/RecordDto.java
Normal file
@ -0,0 +1,42 @@
|
||||
package top.suyiiyii.sims.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RecordDto {
|
||||
private Integer id;
|
||||
// 用户ID
|
||||
private Integer userId;
|
||||
// 奖惩类型
|
||||
private String type;
|
||||
// 奖惩类别ID
|
||||
private Integer categoryId;
|
||||
// 奖惩日期
|
||||
private LocalDateTime date;
|
||||
// 奖惩内容
|
||||
private String content;
|
||||
// 奖惩原因
|
||||
private String reason;
|
||||
// 奖惩金额
|
||||
private Double amount;
|
||||
// 奖惩备注
|
||||
private String remark;
|
||||
// 是否撤销
|
||||
private Boolean isRevoked;
|
||||
// 撤销日期
|
||||
private LocalDateTime revokeDate;
|
||||
// 撤销原因
|
||||
private String revokeReason;
|
||||
// 撤销备注
|
||||
private String revokeRemark;
|
||||
// 操作人ID
|
||||
private Integer operatorUserId;
|
||||
// 最近一次更新时间
|
||||
private LocalDateTime lastUpdateTime;
|
||||
}
|
@ -8,12 +8,12 @@ import java.util.List;
|
||||
* @Author tortoise
|
||||
* @Date 2024/8/15 15:36
|
||||
* @PackageName:top.suyiiyii.sims.dto
|
||||
* @ClassName: UserDTO
|
||||
* @ClassName: UserDto
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class UserDTO {
|
||||
public class UserDto {
|
||||
private Long userId;
|
||||
private String username;
|
||||
private List<String> roles; // 角色名称列表
|
@ -1,7 +1,5 @@
|
||||
package top.suyiiyii.sims.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.tangzc.mpe.autotable.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -14,7 +12,7 @@ import java.time.LocalDateTime;
|
||||
* @Author tortoise
|
||||
* @Date 2024/8/9 14:04
|
||||
* @PackageName:top.suyiiyii.sims.entity
|
||||
* @ClassName: RewardPunishmentRecord
|
||||
* @ClassName: Record
|
||||
* @Description: TODO
|
||||
* @Version 1.0
|
||||
*/
|
||||
@ -22,7 +20,7 @@ import java.time.LocalDateTime;
|
||||
@Table
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RewardPunishmentRecord {
|
||||
public class Record {
|
||||
@TableId("id")
|
||||
private Integer id;
|
||||
// 用户ID
|
Loading…
x
Reference in New Issue
Block a user