feat: 修复权限模块兼容性问题

This commit is contained in:
ennian001
2024-01-11 03:25:30 +08:00
parent 6580da1b6a
commit 51185ccb95
11 changed files with 39 additions and 38 deletions
@@ -79,9 +79,9 @@ public class LimitedIpController implements BaseController {
* @return R of String
*/
@PostMapping("/delete/{id}")
public R<String> delete(@NotNull @PathVariable(value = "id") String id) {
public R<String> delete(@NotNull @PathVariable(value = "id") Long id) {
try {
limitedIpService.remove(Long.parseLong(id));
limitedIpService.remove(id);
return R.ok(ResponseEnum.DELETE_SUCCESS);
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -118,9 +118,9 @@ public class LimitedIpController implements BaseController {
* @return LimitedIpVO {@link LimitedIpVO}
*/
@GetMapping("/id/{id}")
public R<LimitedIpVO> selectById(@NotNull @PathVariable(value = "id") String id) {
public R<LimitedIpVO> selectById(@NotNull @PathVariable(value = "id") Long id) {
try {
LimitedIpBO entityBO = limitedIpService.selectById(Long.parseLong(id));
LimitedIpBO entityBO = limitedIpService.selectById(id);
LimitedIpVO entityVO = limitedIpBuilder.buildVOByBO(entityBO);
return R.ok(entityVO);
} catch (Exception e) {
@@ -78,9 +78,9 @@ public class TenantController implements BaseController {
* @return R of String
*/
@PostMapping("/delete/{id}")
public R<String> delete(@NotNull @PathVariable(value = "id") String id) {
public R<String> delete(@NotNull @PathVariable(value = "id") Long id) {
try {
tenantService.remove(Long.parseLong(id));
tenantService.remove(id);
return R.ok(ResponseEnum.DELETE_SUCCESS);
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -117,9 +117,9 @@ public class TenantController implements BaseController {
* @return TenantVO {@link TenantVO}
*/
@GetMapping("/id/{id}")
public R<TenantVO> selectById(@NotNull @PathVariable(value = "id") String id) {
public R<TenantVO> selectById(@NotNull @PathVariable(value = "id") Long id) {
try {
TenantBO entityBO = tenantService.selectById(Long.parseLong(id));
TenantBO entityBO = tenantService.selectById(id);
TenantVO entityVO = tenantBuilder.buildVOByBO(entityBO);
return R.ok(entityVO);
} catch (Exception e) {
@@ -81,9 +81,9 @@ public class UserLoginController implements BaseController {
* @return R of String
*/
@PostMapping("/delete/{id}")
public R<String> delete(@NotNull @PathVariable(value = "id") String id) {
public R<String> delete(@NotNull @PathVariable(value = "id") Long id) {
try {
userLoginService.remove(Long.parseLong(id));
userLoginService.remove(id);
return R.ok(ResponseEnum.DELETE_SUCCESS);
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -120,9 +120,9 @@ public class UserLoginController implements BaseController {
* @return 是否重置
*/
@PostMapping("/reset/{id}")
public R<Boolean> restPassword(@NotNull @PathVariable(value = "id") String id) {
public R<Boolean> restPassword(@NotNull @PathVariable(value = "id") Long id) {
try {
userPasswordService.restPassword(Long.parseLong(id));
userPasswordService.restPassword(id);
return R.ok();
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -137,9 +137,9 @@ public class UserLoginController implements BaseController {
* @return UserLoginVO {@link UserLoginVO}
*/
@GetMapping("/id/{id}")
public R<UserLoginVO> selectById(@NotNull @PathVariable(value = "id") String id) {
public R<UserLoginVO> selectById(@NotNull @PathVariable(value = "id") Long id) {
try {
UserLoginBO entityBO = userLoginService.selectById(Long.parseLong(id));
UserLoginBO entityBO = userLoginService.selectById(id);
UserLoginVO entityVO = userLoginBuilder.buildVOByBO(entityBO);
return R.ok(entityVO);
} catch (Exception e) {
@@ -41,7 +41,7 @@ public class ResourceBO extends BaseBO {
/**
* 权限资源父级ID
*/
private String parentResourceId;
private Long parentResourceId;
/**
* 权限资源名称
@@ -73,7 +73,7 @@ public class ResourceBO extends BaseBO {
/**
* 权限资源实体ID
*/
private String entityId;
private Long entityId;
/**
* 资源拓展信息
@@ -52,11 +52,11 @@ public class LabelBindQuery implements Serializable {
* 标签ID
*/
@Schema(description = "标签ID")
private String labelId;
private Long labelId;
/**
* 实体ID
*/
@Schema(description = "实体ID")
private String entityId;
private Long entityId;
}
@@ -32,6 +32,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
@@ -54,7 +55,7 @@ public class ResourceVO extends BaseVO {
@Schema(description = "权限资源父级ID")
@NotBlank(message = "Resource parent id can't be empty",
groups = {Add.class, Update.class})
private String parentResourceId;
private Long parentResourceId;
/**
* 权限资源名称
@@ -96,9 +97,9 @@ public class ResourceVO extends BaseVO {
* 权限资源实体ID
*/
@Schema(description = "权限资源实体ID")
@NotBlank(message = "实体ID不能为空",
@NotNull(message = "实体ID不能为空",
groups = {Add.class, Update.class})
private String entityId;
private Long entityId;
/**
* 资源拓展信息
@@ -26,7 +26,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* RoleResourceBind VO
@@ -46,15 +46,15 @@ public class RoleResourceBindVO extends BaseVO {
* 角色ID
*/
@Schema(description = "角色ID")
@NotBlank(message = "Role id can't be empty",
@NotNull(message = "Role id can't be empty",
groups = {Add.class, Update.class})
private String roleId;
private Long roleId;
/**
* 权限资源ID
*/
@Schema(description = "权限资源ID")
@NotBlank(message = "Resource id can't be empty",
@NotNull(message = "Resource id can't be empty",
groups = {Add.class, Update.class})
private String resourceId;
private Long resourceId;
}
@@ -26,7 +26,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* RoleUserBind VO
@@ -46,15 +46,15 @@ public class RoleUserBindVO extends BaseVO {
* 角色ID
*/
@Schema(description = "角色ID")
@NotBlank(message = "Role id can't be empty",
@NotNull(message = "Role id can't be empty",
groups = {Add.class, Update.class})
private String roleId;
private Long roleId;
/**
* 用户ID
*/
@Schema(description = "用户ID")
@NotBlank(message = "User id can't be empty",
@NotNull(message = "User id can't be empty",
groups = {Add.class, Update.class})
private Long userId;
}
@@ -30,6 +30,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
/**
@@ -50,9 +51,9 @@ public class RoleVO extends BaseVO {
* 角色父级ID
*/
@Schema(description = "角色父级ID")
@NotBlank(message = "Role parent id can't be empty",
@NotNull(message = "Role parent id can't be empty",
groups = {Add.class, Update.class})
private String parentRoleId;
private Long parentRoleId;
/**
* 角色名称
@@ -26,7 +26,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* TenantBind VO
@@ -46,7 +46,7 @@ public class TenantBindVO extends BaseVO {
* 租户ID
*/
@Schema(description = "租户ID")
@NotBlank(message = "Tenant id can't be empty",
@NotNull(message = "Tenant id can't be empty",
groups = {Add.class, Update.class})
private Long tenantId;
@@ -54,7 +54,7 @@ public class TenantBindVO extends BaseVO {
* 用户ID
*/
@Schema(description = "用户ID")
@NotBlank(message = "User id can't be empty",
@NotNull(message = "User id can't be empty",
groups = {Add.class, Update.class})
private Long userId;
}
@@ -16,7 +16,6 @@
package io.github.pnoker.center.auth.service.impl;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -111,8 +110,8 @@ public class LabelBindServiceImpl implements LabelBindService {
*/
private LambdaQueryWrapper<LabelBindDO> fuzzyQuery(LabelBindQuery entityQuery) {
LambdaQueryWrapper<LabelBindDO> wrapper = Wrappers.<LabelBindDO>query().lambda();
wrapper.eq(CharSequenceUtil.isNotEmpty(entityQuery.getLabelId()), LabelBindDO::getLabelId, entityQuery.getLabelId());
wrapper.eq(CharSequenceUtil.isNotEmpty(entityQuery.getEntityId()), LabelBindDO::getEntityId, entityQuery.getEntityId());
wrapper.eq(ObjectUtil.isNotEmpty(entityQuery.getLabelId()), LabelBindDO::getLabelId, entityQuery.getLabelId());
wrapper.eq(ObjectUtil.isNotEmpty(entityQuery.getEntityId()), LabelBindDO::getEntityId, entityQuery.getEntityId());
return wrapper;
}