1. 修复回滚父子角色功能时错误的代码逻辑,补全单元测试用例

2. 新增支持切换后业务菜单查询需限定只查询该公司业务数据能力
This commit is contained in:
chenbowen
2025-07-10 19:05:58 +08:00
parent 92959efdc6
commit 7f0957d9c4
60 changed files with 1749 additions and 64 deletions

View File

@@ -38,4 +38,7 @@ public interface GlobalErrorCodeConstants {
ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");
// ========== 业务错误段 ==========
// 用户未设置公司信息,无法办理当前业务
ErrorCode USER_NOT_SET_DEPT = new ErrorCode(1000, "用户未设置有效的公司或部门信息,无法办理当前业务");
}

View File

@@ -49,6 +49,33 @@ public class CommonResult<T> implements Serializable {
return error(result.getCode(), result.getMsg());
}
/**
* 自定义的中间返回
* @param data
* @param code
* @return
* @param <T>
*/
public static <T> CommonResult<T> customize(T data, int code, String msg) {
CommonResult<T> result = new CommonResult<>();
result.code = code;
result.data = data;
result.msg = msg;
return result;
}
/**
* 自定义的中间返回
*/
public static <T> CommonResult<T> customize(T data, CommonResultCodeEnum commonResultCodeEnum) {
CommonResult<T> result = new CommonResult<>();
result.code = commonResultCodeEnum.getCode();
result.data = data;
result.msg = commonResultCodeEnum.getMessage();
return result;
}
public static <T> CommonResult<T> error(Integer code, String message) {
Assert.notEquals(GlobalErrorCodeConstants.SUCCESS.getCode(), code, "code 必须是错误的!");
CommonResult<T> result = new CommonResult<>();

View File

@@ -0,0 +1,32 @@
package cn.iocoder.yudao.framework.common.pojo;
/**
* @author chenbowen
*/
public enum CommonResultCodeEnum {
// 成功
SUCCESS(0, "成功"),
// 根据返回重试
NEED_ADJUST(400, "需要根据返回二次重新请求"),
//
ERROR(500, "错误");
private final int code;
private final String message;
CommonResultCodeEnum(int code, String message) {
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,27 @@
package cn.iocoder.yudao.framework.common.pojo;
import lombok.Data;
/**
* 登录用户信息
*
* @author chenbowen
*/
@Data
public class CompanyDeptInfo {
/**
* 公司Id
*/
private Long companyId;
/**
* 公司名称
*/
private String companyName;
/**
* 部门Id
*/
private Long deptId;
/**
* 部门名称
*/
private String deptName;
}