Browse Source

int型主键改为long,全面采用snowflake算法

test
smallchill 6 years ago
parent
commit
329c8bff84
  1. 4
      blade-auth/src/main/java/org/springblade/auth/service/BladeUserDetails.java
  2. 2
      blade-common/src/main/java/org/springblade/common/constant/CommonConstant.java
  3. 4
      blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/utils/TaskUtil.java
  4. 4
      blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java
  5. 7
      blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Code.java
  6. 10
      blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/Dict.java
  7. 8
      blade-service-api/blade-dict-api/src/main/java/org/springblade/system/vo/DictVO.java
  8. 10
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java
  9. 10
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Menu.java
  10. 10
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java
  11. 13
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleMenu.java
  12. 10
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
  13. 10
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java
  14. 8
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DeptVO.java
  15. 8
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/MenuVO.java
  16. 8
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleVO.java
  17. 4
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/cache/UserCache.java
  18. 2
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java
  19. 5
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserVO.java
  20. 2
      blade-service/blade-desk/src/main/java/org/springblade/desk/controller/LeaveController.java
  21. 2
      blade-service/blade-desk/src/main/java/org/springblade/desk/controller/NoticeController.java
  22. 2
      blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java
  23. 2
      blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java
  24. 2
      blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java
  25. 2
      blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java
  26. 2
      blade-service/blade-system/src/main/java/org/springblade/system/controller/ParamController.java
  27. 4
      blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java
  28. 2
      blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java
  29. 10
      blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java
  30. 10
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.java
  31. 2
      blade-service/blade-system/src/main/java/org/springblade/system/service/IRoleService.java
  32. 10
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/MenuServiceImpl.java
  33. 2
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java
  34. 5
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java
  35. 4
      blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java
  36. 2
      blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java
  37. 4
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java
  38. 104
      doc/sql/bladex-sword-mysql.sql
  39. 60
      doc/sql/bladex-update-RC9.sql

4
blade-auth/src/main/java/org/springblade/auth/service/BladeUserDetails.java

@ -33,7 +33,7 @@ public class BladeUserDetails extends User {
/**
* 用户id
*/
private Integer userId;
private Long userId;
/**
* 租户编号
*/
@ -59,7 +59,7 @@ public class BladeUserDetails extends User {
*/
private String avatar;
BladeUserDetails(Integer userId, String tenantCode, String name, String roleId, String roleName, String avatar, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
BladeUserDetails(Long userId, String tenantCode, String name, String roleId, String roleName, String avatar, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
this.userId = userId;
this.tenantCode = tenantCode;

2
blade-common/src/main/java/org/springblade/common/constant/CommonConstant.java

@ -68,7 +68,7 @@ public interface CommonConstant {
/**
* 顶级父节点id
*/
Integer TOP_PARENT_ID = 0;
Long TOP_PARENT_ID = 0L;
/**
* 顶级父节点名称

4
blade-ops-api/blade-flow-api/src/main/java/org/springblade/flow/core/utils/TaskUtil.java

@ -55,8 +55,8 @@ public class TaskUtil {
* @param taskUser 任务用户
* @return userId
*/
public static Integer getUserId(String taskUser) {
return Func.toInt(StringUtil.removePrefix(taskUser, TASK_USR_PREFIX));
public static Long getUserId(String taskUser) {
return Func.toLong(StringUtil.removePrefix(taskUser, TASK_USR_PREFIX));
}
/**

4
blade-ops/blade-develop/src/main/java/org/springblade/develop/controller/CodeController.java

@ -91,7 +91,7 @@ public class CodeController extends BladeController {
@PostMapping("/remove")
@ApiOperation(value = "删除", notes = "传入ids", position = 7)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(codeService.removeByIds(Func.toIntList(ids)));
return R.status(codeService.removeByIds(Func.toLongList(ids)));
}
/**
@ -100,7 +100,7 @@ public class CodeController extends BladeController {
@PostMapping("/gen-code")
@ApiOperation(value = "代码生成", notes = "传入ids", position = 8)
public R genCode(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) {
Collection<Code> codes = codeService.listByIds(Func.toIntList(ids));
Collection<Code> codes = codeService.listByIds(Func.toLongList(ids));
codes.forEach(code -> {
BladeCodeGenerator generator = new BladeCodeGenerator();
generator.setSystemName(system);

7
blade-ops/blade-develop/src/main/java/org/springblade/develop/entity/Code.java

@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -41,9 +43,10 @@ public class Code implements Serializable {
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 模块名称

10
blade-service-api/blade-dict-api/src/main/java/org/springblade/system/entity/Dict.java

@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -41,15 +43,17 @@ public class Dict implements Serializable {
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 父主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "父主键")
private Integer parentId;
private Long parentId;
/**
* 字典码

8
blade-service-api/blade-dict-api/src/main/java/org/springblade/system/vo/DictVO.java

@ -17,6 +17,8 @@
package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -39,12 +41,14 @@ public class DictVO extends Dict implements INode {
/**
* 主键ID
*/
private Integer id;
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 父节点ID
*/
private Integer parentId;
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 子孙节点

10
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java

@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -41,9 +43,10 @@ public class Dept implements Serializable {
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 租户编号
@ -54,8 +57,9 @@ public class Dept implements Serializable {
/**
* 父主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "父主键")
private Integer parentId;
private Long parentId;
/**
* 部门名

10
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Menu.java

@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -42,15 +44,17 @@ public class Menu implements Serializable {
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 菜单父主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "菜单父主键")
private Integer parentId;
private Long parentId;
/**
* 菜单编号

10
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Role.java

@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -41,9 +43,10 @@ public class Role implements Serializable {
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 租户编号
@ -54,8 +57,9 @@ public class Role implements Serializable {
/**
* 父主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "父主键")
private Integer parentId;
private Long parentId;
/**
* 角色名

13
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/RoleMenu.java

@ -19,6 +19,8 @@ package org.springblade.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -40,21 +42,24 @@ public class RoleMenu implements Serializable {
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 菜单id
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "菜单id")
private Integer menuId;
private Long menuId;
/**
* 角色id
*/
@JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty(value = "角色id")
private Integer roleId;
private Long roleId;
}

10
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java

@ -48,7 +48,7 @@ public interface ISysClient {
* @return Dept
*/
@GetMapping(DEPT)
Dept getDept(@RequestParam("id") Integer id);
Dept getDept(@RequestParam("id") Long id);
/**
* 获取部门名
@ -57,7 +57,7 @@ public interface ISysClient {
* @return 部门名
*/
@GetMapping(DEPT_NAME)
String getDeptName(@RequestParam("id") Integer id);
String getDeptName(@RequestParam("id") Long id);
/**
* 获取角色
@ -66,7 +66,7 @@ public interface ISysClient {
* @return Role
*/
@GetMapping(ROLE)
Role getRole(@RequestParam("id") Integer id);
Role getRole(@RequestParam("id") Long id);
/**
* 获取角色名
@ -75,7 +75,7 @@ public interface ISysClient {
* @return 角色名
*/
@GetMapping(ROLE_NAME)
String getRoleName(@RequestParam("id") Integer id);
String getRoleName(@RequestParam("id") Long id);
/**
* 获取角色别名
@ -84,6 +84,6 @@ public interface ISysClient {
* @return 角色别名
*/
@GetMapping(ROLE_ALIAS)
String getRoleAlias(@RequestParam("id") Integer id);
String getRoleAlias(@RequestParam("id") Long id);
}

10
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClientFallback.java

@ -29,27 +29,27 @@ import org.springframework.stereotype.Component;
public class ISysClientFallback implements ISysClient {
@Override
public Dept getDept(Integer id) {
public Dept getDept(Long id) {
return null;
}
@Override
public String getDeptName(Integer id) {
public String getDeptName(Long id) {
return null;
}
@Override
public Role getRole(Integer id) {
public Role getRole(Long id) {
return null;
}
@Override
public String getRoleName(Integer id) {
public String getRoleName(Long id) {
return null;
}
@Override
public String getRoleAlias(Integer id) {
public String getRoleAlias(Long id) {
return null;
}
}

8
blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/DeptVO.java

@ -17,6 +17,8 @@
package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -40,12 +42,14 @@ public class DeptVO extends Dept implements INode {
/**
* 主键ID
*/
private Integer id;
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 父节点ID
*/
private Integer parentId;
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 子孙节点

8
blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/MenuVO.java

@ -17,6 +17,8 @@
package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -40,12 +42,14 @@ public class MenuVO extends Menu implements INode {
/**
* 主键ID
*/
private Integer id;
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 父节点ID
*/
private Integer parentId;
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 子孙节点

8
blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/RoleVO.java

@ -17,6 +17,8 @@
package org.springblade.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -40,12 +42,14 @@ public class RoleVO extends Role implements INode {
/**
* 主键ID
*/
private Integer id;
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 父节点ID
*/
private Integer parentId;
@JsonSerialize(using = ToStringSerializer.class)
private Long parentId;
/**
* 子孙节点

4
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/cache/UserCache.java vendored

@ -49,7 +49,7 @@ public class UserCache {
* @return
*/
public static User getUserByTaskUser(String taskUserId) {
int userId = Func.toInt(StringUtil.removePrefix(taskUserId, TASK_USR_PREFIX));
Long userId = Func.toLong(StringUtil.removePrefix(taskUserId, TASK_USR_PREFIX));
return getUser(userId);
}
@ -59,7 +59,7 @@ public class UserCache {
* @param userId 用户id
* @return
*/
public static User getUser(Integer userId) {
public static User getUser(Long userId) {
User user = CacheUtil.get(USER_CACHE, USER_CACHE_ID_ + userId, User.class);
if (Func.isEmpty(user)) {
R<User> result = userClient.userInfoById(userId);

2
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java

@ -46,7 +46,7 @@ public interface IUserClient {
* @return
*/
@GetMapping(USER_INFO_BY_ID)
R<User> userInfoById(@RequestParam("userId") Integer userId);
R<User> userInfoById(@RequestParam("userId") Long userId);
/**
* 获取用户信息

5
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/vo/UserVO.java

@ -16,6 +16,8 @@
*/
package org.springblade.system.user.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -35,7 +37,8 @@ public class UserVO extends User {
/**
* 主键ID
*/
private Integer id;
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 角色名

2
blade-service/blade-desk/src/main/java/org/springblade/desk/controller/LeaveController.java

@ -45,7 +45,7 @@ public class LeaveController extends BladeController implements CacheNames {
* @param businessId 主键
*/
@GetMapping("detail")
public R<ProcessLeave> detail(Integer businessId) {
public R<ProcessLeave> detail(Long businessId) {
ProcessLeave detail = leaveService.getById(businessId);
detail.getFlow().setAssigneeName(UserCache.getUser(detail.getCreateUser()).getName());
return R.data(detail);

2
blade-service/blade-desk/src/main/java/org/springblade/desk/controller/NoticeController.java

@ -112,7 +112,7 @@ public class NoticeController extends BladeController implements CacheNames {
@PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入notice", position = 7)
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
boolean temp = noticeService.deleteLogic(Func.toIntList(ids));
boolean temp = noticeService.deleteLogic(Func.toLongList(ids));
return R.status(temp);
}

2
blade-service/blade-system/src/main/java/org/springblade/system/controller/AuthClientController.java

@ -104,7 +104,7 @@ public class AuthClientController extends BladeController {
@PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(clientService.deleteLogic(Func.toIntList(ids)));
return R.status(clientService.deleteLogic(Func.toLongList(ids)));
}

2
blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java

@ -110,7 +110,7 @@ public class DeptController extends BladeController {
@PostMapping("/remove")
@ApiOperation(value = "删除", notes = "传入ids", position = 5)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(deptService.removeByIds(Func.toIntList(ids)));
return R.status(deptService.removeByIds(Func.toLongList(ids)));
}

2
blade-service/blade-system/src/main/java/org/springblade/system/controller/DictController.java

@ -108,7 +108,7 @@ public class DictController extends BladeController {
@CacheEvict(cacheNames = {DICT_LIST, DICT_VALUE}, allEntries = true)
@ApiOperation(value = "删除", notes = "传入ids", position = 7)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(dictService.removeByIds(Func.toIntList(ids)));
return R.status(dictService.removeByIds(Func.toLongList(ids)));
}
/**

2
blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java

@ -106,7 +106,7 @@ public class MenuController extends BladeController {
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
@ApiOperation(value = "删除", notes = "传入ids", position = 9)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(menuService.removeByIds(Func.toIntList(ids)));
return R.status(menuService.removeByIds(Func.toLongList(ids)));
}
/**

2
blade-service/blade-system/src/main/java/org/springblade/system/controller/ParamController.java

@ -93,7 +93,7 @@ public class ParamController extends BladeController {
@PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 7)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(paramService.deleteLogic(Func.toIntList(ids)));
return R.status(paramService.deleteLogic(Func.toLongList(ids)));
}

4
blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java

@ -109,7 +109,7 @@ public class RoleController extends BladeController {
@PostMapping("/remove")
@ApiOperation(value = "删除", notes = "传入ids", position = 5)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(roleService.removeByIds(Func.toIntList(ids)));
return R.status(roleService.removeByIds(Func.toLongList(ids)));
}
/**
@ -123,7 +123,7 @@ public class RoleController extends BladeController {
@ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合", position = 6)
public R grant(@ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds,
@ApiParam(value = "menuId集合", required = true) @RequestParam String menuIds) {
boolean temp = roleService.grant(Func.toIntList(roleIds), Func.toIntList(menuIds));
boolean temp = roleService.grant(Func.toLongList(roleIds), Func.toLongList(menuIds));
return R.status(temp);
}

2
blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java

@ -113,7 +113,7 @@ public class TenantController extends BladeController {
@PostMapping("/remove")
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 8)
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
return R.status(tenantService.deleteLogic(Func.toIntList(ids)));
return R.status(tenantService.deleteLogic(Func.toLongList(ids)));
}

10
blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java

@ -44,31 +44,31 @@ public class SysClient implements ISysClient {
@Override
@GetMapping(DEPT)
public Dept getDept(Integer id) {
public Dept getDept(Long id) {
return deptService.getById(id);
}
@Override
@GetMapping(DEPT_NAME)
public String getDeptName(Integer id) {
public String getDeptName(Long id) {
return deptService.getById(id).getDeptName();
}
@Override
@GetMapping(ROLE)
public Role getRole(Integer id) {
public Role getRole(Long id) {
return roleService.getById(id);
}
@Override
@GetMapping(ROLE_NAME)
public String getRoleName(Integer id) {
public String getRoleName(Long id) {
return roleService.getById(id).getRoleName();
}
@Override
@GetMapping(ROLE_ALIAS)
public String getRoleAlias(Integer id) {
public String getRoleAlias(Long id) {
return roleService.getById(id).getRoleAlias();
}

10
blade-service/blade-system/src/main/java/org/springblade/system/mapper/MenuMapper.java

@ -60,7 +60,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId
* @return
*/
List<MenuVO> grantTreeByRole(List<Integer> roleId);
List<MenuVO> grantTreeByRole(List<Long> roleId);
/**
* 所有菜单
@ -75,7 +75,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId
* @return
*/
List<Menu> roleMenu(List<Integer> roleId);
List<Menu> roleMenu(List<Long> roleId);
/**
* 菜单树形结构
@ -83,7 +83,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId
* @return
*/
List<Menu> routes(List<Integer> roleId);
List<Menu> routes(List<Long> roleId);
/**
* 按钮树形结构
@ -91,7 +91,7 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleId
* @return
*/
List<Menu> buttons(List<Integer> roleId);
List<Menu> buttons(List<Long> roleId);
/**
* 获取配置的角色权限
@ -99,5 +99,5 @@ public interface MenuMapper extends BaseMapper<Menu> {
* @param roleIds
* @return
*/
List<MenuDTO> authRoutes(List<Integer> roleIds);
List<MenuDTO> authRoutes(List<Long> roleIds);
}

2
blade-service/blade-system/src/main/java/org/springblade/system/service/IRoleService.java

@ -55,6 +55,6 @@ public interface IRoleService extends IService<Role> {
* @param menuIds 菜单id集合
* @return 是否成功
*/
boolean grant(@NotEmpty List<Integer> roleIds, @NotEmpty List<Integer> menuIds);
boolean grant(@NotEmpty List<Long> roleIds, @NotEmpty List<Long> menuIds);
}

10
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/MenuServiceImpl.java

@ -60,7 +60,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override
public List<MenuVO> routes(String roleId) {
List<Menu> allMenus = baseMapper.allMenu();
List<Menu> roleMenus = baseMapper.roleMenu(Func.toIntList(roleId));
List<Menu> roleMenus = baseMapper.roleMenu(Func.toLongList(roleId));
List<Menu> routes = new LinkedList<>(roleMenus);
roleMenus.forEach(roleMenu -> recursion(allMenus, routes, roleMenu));
routes.sort(Comparator.comparing(Menu::getSort));
@ -79,7 +79,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override
public List<MenuVO> buttons(String roleId) {
List<Menu> buttons = baseMapper.buttons(Func.toIntList(roleId));
List<Menu> buttons = baseMapper.buttons(Func.toLongList(roleId));
MenuWrapper menuWrapper = new MenuWrapper();
return menuWrapper.listNodeVO(buttons);
}
@ -91,19 +91,19 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
@Override
public List<MenuVO> grantTree(BladeUser user) {
return ForestNodeMerger.merge(user.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE) ? baseMapper.grantTree() : baseMapper.grantTreeByRole(Func.toIntList(user.getRoleId())));
return ForestNodeMerger.merge(user.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE) ? baseMapper.grantTree() : baseMapper.grantTreeByRole(Func.toLongList(user.getRoleId())));
}
@Override
public List<String> roleTreeKeys(String roleIds) {
List<RoleMenu> roleMenus = roleMenuService.list(Wrappers.<RoleMenu>query().lambda().in(RoleMenu::getRoleId, Func.toIntList(roleIds)));
List<RoleMenu> roleMenus = roleMenuService.list(Wrappers.<RoleMenu>query().lambda().in(RoleMenu::getRoleId, Func.toLongList(roleIds)));
return roleMenus.stream().map(roleMenu -> Func.toStr(roleMenu.getMenuId())).collect(Collectors.toList());
}
@Override
@Cacheable(cacheNames = AUTH_ROUTES, key = "#user.roleId")
public List<Kv> authRoutes(BladeUser user) {
List<MenuDTO> routes = baseMapper.authRoutes(Func.toIntList(user.getRoleId()));
List<MenuDTO> routes = baseMapper.authRoutes(Func.toLongList(user.getRoleId()));
List<Kv> list = new ArrayList<>();
routes.forEach(route -> list.add(Kv.create().set(route.getPath(), Kv.create().set("authority", Func.toStrArray(route.getAlias())))));
return list;

2
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java

@ -66,7 +66,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
}
@Override
public boolean grant(@NotEmpty List<Integer> roleIds, @NotEmpty List<Integer> menuIds) {
public boolean grant(@NotEmpty List<Long> roleIds, @NotEmpty List<Long> menuIds) {
// 删除角色配置的菜单集合
roleMenuService.remove(Wrappers.<RoleMenu>update().lambda().in(RoleMenu::getRoleId, roleIds));
// 组装配置

5
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java

@ -19,6 +19,7 @@ package org.springblade.system.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.common.constant.CommonConstant;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tenant.TenantId;
import org.springblade.core.tool.constant.BladeConstant;
@ -65,7 +66,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
// 新建租户对应的默认角色
Role role = new Role();
role.setTenantCode(tenantCode);
role.setParentId(0);
role.setParentId(CommonConstant.TOP_PARENT_ID);
role.setRoleName("管理员");
role.setRoleAlias("admin");
role.setSort(2);
@ -74,7 +75,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
// 新建租户对应的默认部门
Dept dept = new Dept();
dept.setTenantCode(tenantCode);
dept.setParentId(0);
dept.setParentId(CommonConstant.TOP_PARENT_ID);
dept.setDeptName(tenant.getTenantName());
dept.setFullName(tenant.getTenantName());
dept.setSort(2);

4
blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java

@ -111,10 +111,10 @@ public class UserController {
* 删除
*/
@PostMapping("/remove")
@ApiOperation(value = "删除", notes = "传入地基和", position = 5)
@ApiOperation(value = "删除", notes = "传入id集合", position = 5)
@PreAuth(RoleConstant.HAS_ROLE_ADMIN)
public R remove(@RequestParam String ids) {
return R.status(userService.deleteLogic(Func.toIntList(ids)));
return R.status(userService.deleteLogic(Func.toLongList(ids)));
}
/**

2
blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java

@ -37,7 +37,7 @@ public class UserClient implements IUserClient {
@Override
@GetMapping(USER_INFO_BY_ID)
public R<User> userInfoById(Integer userId) {
public R<User> userInfoById(Long userId) {
return R.data(service.getById(userId));
}

4
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@ -75,7 +75,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
public boolean grant(String userIds, String roleIds) {
User user = new User();
user.setRoleId(roleIds);
return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toIntList(userIds)));
return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toLongList(userIds)));
}
@Override
@ -83,7 +83,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
User user = new User();
user.setPassword(DigestUtil.encrypt(CommonConstant.DEFAULT_PASSWORD));
user.setUpdateTime(LocalDateTime.now());
return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toIntList(userIds)));
return this.update(user, Wrappers.<User>update().lambda().in(User::getId, Func.toLongList(userIds)));
}
@Override

104
doc/sql/bladex-sword-mysql.sql

File diff suppressed because one or more lines are too long

60
doc/sql/bladex-update-RC9.sql

@ -98,24 +98,24 @@ UPDATE `blade_menu` set `sort` = 99 WHERE `code` = 'system';
INSERT INTO `blade_dict`(`parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (0, 'flow', -1, '流程类型', 5, NULL, 0);
set @dictid = (SELECT LAST_INSERT_ID());
INSERT INTO `bladex`.`blade_dict`(`parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
INSERT INTO `blade_dict`(`parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (@dictid, 'flow', 1, '请假流程', 1, NULL, 0);
INSERT INTO `bladex`.`blade_dict`(`parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
INSERT INTO `blade_dict`(`parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_deleted`)
VALUES (@dictid, 'flow', 2, '报销流程', 2, NULL, 0);
-- ----------------------------
-- 用户数据增加
-- ----------------------------
INSERT INTO `bladex`.`blade_user`(`tenant_code`, `account`, `password`, `name`, `real_name`, `email`, `phone`, `birthday`, `sex`, `role_id`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES ('000000', 'hr', '5e79b90f7bba52d54115f086e48f539016a27ec6', '人事', '人事', NULL, NULL, NULL, NULL, '3', '1', 1, '2019-04-27 17:03:10', 1, '2019-04-27 17:03:10', 1, 0);
INSERT INTO `bladex`.`blade_user`(`tenant_code`, `account`, `password`, `name`, `real_name`, `email`, `phone`, `birthday`, `sex`, `role_id`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES ('000000', 'manager', 'dfbaa3b61caa3a319f463cc165085aa8c822d2ce', '经理', '经理', NULL, NULL, NULL, NULL, '4', '1', 1, '2019-04-27 17:03:38', 1, '2019-04-27 17:03:38', 1, 0);
INSERT INTO `bladex`.`blade_user`(`tenant_code`, `account`, `password`, `name`, `real_name`, `email`, `phone`, `birthday`, `sex`, `role_id`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES ('000000', 'boss', 'abe57d23e18f7ad8ea99c86e430c90a05119a9d3', '老板', '老板', NULL, NULL, NULL, NULL, '5', '1', 1, '2019-04-27 17:03:55', 1, '2019-04-27 17:03:55', 1, 0);
INSERT INTO `blade_user`(`tenant_code`, `account`, `password`, `name`, `real_name`, `email`, `phone`, `birthday`, `sex`, `role_id`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES ('000000', 'hr', '5e79b90f7bba52d54115f086e48f539016a27ec6', '人事', '人事', NULL, NULL, NULL, NULL, '3', '1', 1, '2019-04-27 17:03:10', 1, '2019-04-27 17:03:10', 1, 0);
INSERT INTO `blade_user`(`tenant_code`, `account`, `password`, `name`, `real_name`, `email`, `phone`, `birthday`, `sex`, `role_id`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES ('000000', 'manager', 'dfbaa3b61caa3a319f463cc165085aa8c822d2ce', '经理', '经理', NULL, NULL, NULL, NULL, '4', '1', 1, '2019-04-27 17:03:38', 1, '2019-04-27 17:03:38', 1, 0);
INSERT INTO `blade_user`(`tenant_code`, `account`, `password`, `name`, `real_name`, `email`, `phone`, `birthday`, `sex`, `role_id`, `dept_id`, `create_user`, `create_time`, `update_user`, `update_time`, `status`, `is_deleted`) VALUES ('000000', 'boss', 'abe57d23e18f7ad8ea99c86e430c90a05119a9d3', '老板', '老板', NULL, NULL, NULL, NULL, '5', '1', 1, '2019-04-27 17:03:55', 1, '2019-04-27 17:03:55', 1, 0);
-- ----------------------------
-- 角色数据增加
-- ----------------------------
INSERT INTO `bladex`.`blade_role`(`tenant_code`, `parent_id`, `role_name`, `sort`, `role_alias`, `is_deleted`) VALUES ('000000', 2, '人事', 1, 'hr', 0);
INSERT INTO `bladex`.`blade_role`(`tenant_code`, `parent_id`, `role_name`, `sort`, `role_alias`, `is_deleted`) VALUES ('000000', 2, '经理', 2, 'manager', 0);
INSERT INTO `bladex`.`blade_role`(`tenant_code`, `parent_id`, `role_name`, `sort`, `role_alias`, `is_deleted`) VALUES ('000000', 2, '老板', 3, 'boss', 0);
INSERT INTO `blade_role`(`tenant_code`, `parent_id`, `role_name`, `sort`, `role_alias`, `is_deleted`) VALUES ('000000', 2, '人事', 1, 'hr', 0);
INSERT INTO `blade_role`(`tenant_code`, `parent_id`, `role_name`, `sort`, `role_alias`, `is_deleted`) VALUES ('000000', 2, '经理', 2, 'manager', 0);
INSERT INTO `blade_role`(`tenant_code`, `parent_id`, `role_name`, `sort`, `role_alias`, `is_deleted`) VALUES ('000000', 2, '老板', 3, 'boss', 0);
-- ----------------------------
-- 增加业务流程表
@ -140,3 +140,47 @@ PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci;
SET FOREIGN_KEY_CHECKS = 1;
-- ----------------------------
-- 修改表主键为long类型
-- ----------------------------
ALTER TABLE `blade_notice`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `content`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_client`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `autoapprove`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_code`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST;
ALTER TABLE `blade_dept`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父主键' AFTER `tenant_code`;
ALTER TABLE `blade_dict`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父主键' AFTER `id`;
ALTER TABLE `blade_menu`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父级菜单' AFTER `id`;
ALTER TABLE `blade_param`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `remark`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_process_leave`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '编号' FIRST;
ALTER TABLE `blade_role`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `parent_id` bigint(64) NULL DEFAULT 0 COMMENT '父主键' AFTER `tenant_code`;
ALTER TABLE `blade_role_menu`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `menu_id` bigint(64) NULL DEFAULT NULL COMMENT '菜单id' AFTER `id`,
MODIFY COLUMN `role_id` bigint(64) NULL DEFAULT NULL COMMENT '角色id' AFTER `menu_id`;
ALTER TABLE `blade_tenant`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `address`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;
ALTER TABLE `blade_user`
MODIFY COLUMN `id` bigint(64) NOT NULL COMMENT '主键' FIRST,
MODIFY COLUMN `create_user` bigint(64) NULL DEFAULT NULL COMMENT '创建人' AFTER `dept_id`,
MODIFY COLUMN `update_user` bigint(64) NULL DEFAULT NULL COMMENT '修改人' AFTER `create_time`;

Loading…
Cancel
Save