1. 修复回滚父子角色功能时错误的代码逻辑,补全单元测试用例
2. 新增支持切换后业务菜单查询需限定只查询该公司业务数据能力
This commit is contained in:
@@ -38,4 +38,7 @@ public interface GlobalErrorCodeConstants {
|
||||
|
||||
ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");
|
||||
|
||||
// ========== 业务错误段 ==========
|
||||
// 用户未设置公司信息,无法办理当前业务
|
||||
ErrorCode USER_NOT_SET_DEPT = new ErrorCode(1000, "用户未设置有效的公司或部门信息,无法办理当前业务");
|
||||
}
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user