异常拦截
This commit is contained in:
GYJ
2025-02-10 10:44:46 +08:00
parent d99b538fd0
commit a10a934b40
7 changed files with 145 additions and 3 deletions

View File

@@ -1,5 +1,9 @@
package com.czg.service.system.dto;
import com.czg.group.InsertGroup;
import com.czg.group.UpdateGroup;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
@@ -7,9 +11,16 @@ import lombok.Data;
*/
@Data
public class SysParamsDTO {
@NotNull(message = "id不能为空", groups = {UpdateGroup.class})
private Long id;
@NotBlank(message = "参数编码不能为空", groups = {UpdateGroup.class, InsertGroup.class})
private String paramCode;
@NotBlank(message = "参数值不能为空", groups = {UpdateGroup.class, InsertGroup.class})
private String paramValue;
@NotNull(message = "参数类型不能为空", groups = {UpdateGroup.class, InsertGroup.class})
private Integer paramType;
private String remark;
}

View File

@@ -1,14 +1,13 @@
package com.czg.service.system.service.impl;
import cn.dev33.satoken.session.SaSession;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.service.system.dto.SysParamsDTO;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.service.system.entity.SysParams;
import com.czg.service.system.mapper.SysParamsMapper;
import com.czg.service.system.service.SysParamsService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
@@ -61,6 +60,8 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
.setParamType(paramsDTO.getParamType())
.setUpdateUserId(userId);
updateById(sysParams);
return CzgResult.success(sysParams.getId());
}
}