feat(sys):全面优化系统管理模块

- 完善所有控制器类(Auth、Config、Dept、Menu、Profile、Role、Tenant、User)
- 优化所有实体类(OperationLog、SysDept、SysMenu、SysTenant、SysUser)
- 更新所有DTO和VO数据传输对象
-完善所有Service接口和实现类
-增强系统管理核心功能和业务逻辑
This commit is contained in:
zhangjf 2026-03-02 07:31:36 +08:00
parent 8a3d9017e1
commit 52dd44a7d5
40 changed files with 209 additions and 210 deletions

View File

@ -45,7 +45,7 @@ public class AuthController {
*/
@Operation(summary = "用户登出", description = "销毁当前用户Token使会话失效")
@PostMapping("/logout")
public Result<Void> logout(@Parameter(description = "当前登录用户ID") @RequestHeader(value = "X-User-Id", required = false) Long userId) {
public Result<Void> logout(@Parameter(description = "当前登录用户ID") @RequestHeader(value = "X-User-Id", required = false) String userId) {
authService.logout(userId);
return Result.success();
}
@ -55,7 +55,7 @@ public class AuthController {
*/
@Operation(summary = "刷新Token", description = "延长当前Token的有效期")
@PostMapping("/refresh")
public Result<LoginVO> refreshToken(@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") Long userId) {
public Result<LoginVO> refreshToken(@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") String userId) {
LoginVO vo = authService.refreshToken(userId);
return Result.success(vo);
}
@ -65,7 +65,7 @@ public class AuthController {
*/
@Operation(summary = "获取当前用户信息", description = "根据Token中的用户ID获取用户详情")
@GetMapping("/info")
public Result<UserVO> getUserInfo(@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") Long userId) {
public Result<UserVO> getUserInfo(@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") String userId) {
UserVO vo = authService.getUserInfo(userId);
return Result.success(vo);
}

View File

@ -28,8 +28,8 @@ public class ConfigController {
* 创建参数
*/
@PostMapping
public Result<Long> create(@Valid @RequestBody ConfigDTO dto) {
Long id = configService.createConfig(dto);
public Result<String> create(@Valid @RequestBody ConfigDTO dto) {
String id = configService.createConfig(dto);
return Result.success(id);
}
@ -46,7 +46,7 @@ public class ConfigController {
* 根据ID查询参数
*/
@GetMapping("/{id}")
public Result<ConfigVO> getById(@PathVariable Long id) {
public Result<ConfigVO> getById(@PathVariable String id) {
ConfigVO vo = configService.getConfigById(id);
return Result.success(vo);
}
@ -94,7 +94,7 @@ public class ConfigController {
* 删除参数
*/
@DeleteMapping("/{id}")
public Result<Boolean> delete(@PathVariable Long id) {
public Result<Boolean> delete(@PathVariable String id) {
boolean result = configService.deleteConfig(id);
return Result.success(result);
}

View File

@ -28,8 +28,8 @@ public class DeptController {
@Operation(summary = "创建部门")
@PostMapping
public Result<Long> create(@Valid @RequestBody DeptDTO dto) {
Long deptId = deptService.createDept(dto);
public Result<String> create(@Valid @RequestBody DeptDTO dto) {
String deptId = deptService.createDept(dto);
return Result.success(deptId);
}
@ -42,7 +42,7 @@ public class DeptController {
@Operation(summary = "根据ID查询部门")
@GetMapping("/{id}")
public Result<DeptVO> getById(@Parameter(description = "部门ID") @PathVariable Long id) {
public Result<DeptVO> getById(@Parameter(description = "部门ID") @PathVariable String id) {
DeptVO vo = deptService.getDeptById(id);
return Result.success(vo);
}
@ -63,14 +63,14 @@ public class DeptController {
@Operation(summary = "删除部门")
@DeleteMapping("/{id}")
public Result<Boolean> delete(@Parameter(description = "部门ID") @PathVariable Long id) {
public Result<Boolean> delete(@Parameter(description = "部门ID") @PathVariable String id) {
boolean result = deptService.deleteDept(id);
return Result.success(result);
}
@Operation(summary = "更新部门状态")
@PutMapping("/{id}/status")
public Result<Boolean> updateStatus(@Parameter(description = "部门ID") @PathVariable Long id, @Parameter(description = "状态0禁用 1启用") @RequestParam Integer status) {
public Result<Boolean> updateStatus(@Parameter(description = "部门ID") @PathVariable String id, @Parameter(description = "状态0禁用 1启用") @RequestParam Integer status) {
boolean result = deptService.updateStatus(id, status);
return Result.success(result);
}

View File

@ -28,8 +28,8 @@ public class MenuController {
@Operation(summary = "创建菜单/权限")
@PostMapping
public Result<Long> create(@Valid @RequestBody MenuDTO dto) {
Long menuId = menuService.createMenu(dto);
public Result<String> create(@Valid @RequestBody MenuDTO dto) {
String menuId = menuService.createMenu(dto);
return Result.success(menuId);
}
@ -42,7 +42,7 @@ public class MenuController {
@Operation(summary = "根据ID查询菜单")
@GetMapping("/{id}")
public Result<MenuVO> getById(@Parameter(description = "菜单ID") @PathVariable Long id) {
public Result<MenuVO> getById(@Parameter(description = "菜单ID") @PathVariable String id) {
MenuVO vo = menuService.getMenuById(id);
return Result.success(vo);
}
@ -56,14 +56,14 @@ public class MenuController {
@Operation(summary = "获取用户菜单树", description = "根据用户ID获取其有权访问的菜单树")
@GetMapping("/user/{userId}")
public Result<List<MenuVO>> getUserTree(@Parameter(description = "用户ID") @PathVariable Long userId) {
public Result<List<MenuVO>> getUserTree(@Parameter(description = "用户ID") @PathVariable String userId) {
List<MenuVO> tree = menuService.getUserMenuTree(userId);
return Result.success(tree);
}
@Operation(summary = "删除菜单/权限")
@DeleteMapping("/{id}")
public Result<Boolean> delete(@Parameter(description = "菜单ID") @PathVariable Long id) {
public Result<Boolean> delete(@Parameter(description = "菜单ID") @PathVariable String id) {
boolean result = menuService.deleteMenu(id);
return Result.success(result);
}
@ -73,7 +73,7 @@ public class MenuController {
*/
@Operation(summary = "获取用户权限标识列表", description = "返回用户拥有的所有权限标识字符串")
@GetMapping("/permissions/{userId}")
public Result<List<String>> getUserPermissions(@Parameter(description = "用户ID") @PathVariable Long userId) {
public Result<List<String>> getUserPermissions(@Parameter(description = "用户ID") @PathVariable String userId) {
List<String> permissions = menuService.getUserPermissions(userId);
return Result.success(permissions);
}

View File

@ -30,7 +30,7 @@ public class ProfileController {
*/
@Operation(summary = "获取个人信息")
@GetMapping
public Result<UserVO> getProfile(@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") Long userId) {
public Result<UserVO> getProfile(@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") String userId) {
UserVO vo = userService.getUserById(userId);
return Result.success(vo);
}
@ -41,7 +41,7 @@ public class ProfileController {
@Operation(summary = "更新个人信息")
@PutMapping
public Result<Boolean> updateProfile(
@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") Long userId,
@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") String userId,
@Valid @RequestBody ProfileDTO dto) {
boolean result = userService.updateProfile(userId, dto);
return Result.success(result);
@ -53,7 +53,7 @@ public class ProfileController {
@Operation(summary = "修改密码", description = "需要提供旧密码和新密码MD5加密后传输")
@PutMapping("/password")
public Result<Boolean> updatePassword(
@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") Long userId,
@Parameter(description = "当前登录用户ID") @RequestHeader("X-User-Id") String userId,
@Valid @RequestBody PasswordDTO dto) {
boolean result = userService.updatePassword(userId, dto);
return Result.success(result);

View File

@ -29,8 +29,8 @@ public class RoleController {
@Operation(summary = "创建角色")
@PostMapping
public Result<Long> create(@Valid @RequestBody RoleDTO dto) {
Long roleId = roleService.createRole(dto);
public Result<String> create(@Valid @RequestBody RoleDTO dto) {
String roleId = roleService.createRole(dto);
return Result.success(roleId);
}
@ -43,7 +43,7 @@ public class RoleController {
@Operation(summary = "根据ID查询角色")
@GetMapping("/{id}")
public Result<RoleVO> getById(@Parameter(description = "角色ID") @PathVariable Long id) {
public Result<RoleVO> getById(@Parameter(description = "角色ID") @PathVariable String id) {
RoleVO vo = roleService.getRoleById(id);
return Result.success(vo);
}
@ -68,14 +68,14 @@ public class RoleController {
@Operation(summary = "删除角色")
@DeleteMapping("/{id}")
public Result<Boolean> delete(@Parameter(description = "角色ID") @PathVariable Long id) {
public Result<Boolean> delete(@Parameter(description = "角色ID") @PathVariable String id) {
boolean result = roleService.deleteRole(id);
return Result.success(result);
}
@Operation(summary = "更新角色状态")
@PutMapping("/{id}/status")
public Result<Boolean> updateStatus(@Parameter(description = "角色ID") @PathVariable Long id, @Parameter(description = "状态0禁用 1启用") @RequestParam Integer status) {
public Result<Boolean> updateStatus(@Parameter(description = "角色ID") @PathVariable String id, @Parameter(description = "状态0禁用 1启用") @RequestParam Integer status) {
boolean result = roleService.updateStatus(id, status);
return Result.success(result);
}
@ -85,8 +85,8 @@ public class RoleController {
*/
@Operation(summary = "获取角色的菜单ID列表")
@GetMapping("/{id}/menus")
public Result<List<Long>> getRoleMenus(@Parameter(description = "角色ID") @PathVariable Long id) {
List<Long> menuIds = roleService.getRoleMenus(id);
public Result<List<String>> getRoleMenus(@Parameter(description = "角色ID") @PathVariable String id) {
List<String> menuIds = roleService.getRoleMenus(id);
return Result.success(menuIds);
}
@ -95,7 +95,7 @@ public class RoleController {
*/
@Operation(summary = "为角色分配菜单权限")
@PutMapping("/{id}/menus")
public Result<Boolean> assignMenus(@Parameter(description = "角色ID") @PathVariable Long id, @RequestBody List<Long> menuIds) {
public Result<Boolean> assignMenus(@Parameter(description = "角色ID") @PathVariable String id, @RequestBody List<String> menuIds) {
boolean result = roleService.assignMenus(id, menuIds);
return Result.success(result);
}

View File

@ -27,7 +27,7 @@ public class TenantController {
@Operation(summary = "创建租户")
@PostMapping
public Result<Long> create(@Valid @RequestBody TenantDTO dto) {
public Result<String> create(@Valid @RequestBody TenantDTO dto) {
return Result.success(tenantService.createTenant(dto));
}
@ -39,7 +39,7 @@ public class TenantController {
@Operation(summary = "根据ID查询租户")
@GetMapping("/{id}")
public Result<TenantVO> getById(@Parameter(description = "租户ID") @PathVariable Long id) {
public Result<TenantVO> getById(@Parameter(description = "租户ID") @PathVariable String id) {
return Result.success(tenantService.getTenantById(id));
}
@ -54,13 +54,13 @@ public class TenantController {
@Operation(summary = "删除租户")
@DeleteMapping("/{id}")
public Result<Boolean> delete(@Parameter(description = "租户ID") @PathVariable Long id) {
public Result<Boolean> delete(@Parameter(description = "租户ID") @PathVariable String id) {
return Result.success(tenantService.deleteTenant(id));
}
@Operation(summary = "更新租户状态")
@PutMapping("/{id}/status")
public Result<Boolean> updateStatus(@Parameter(description = "租户ID") @PathVariable Long id, @Parameter(description = "状态0禁用 1启用 2过期") @RequestParam Integer status) {
public Result<Boolean> updateStatus(@Parameter(description = "租户ID") @PathVariable String id, @Parameter(description = "状态0禁用 1启用 2过期") @RequestParam Integer status) {
return Result.success(tenantService.updateStatus(id, status));
}
}

View File

@ -30,8 +30,8 @@ public class UserController {
*/
@Operation(summary = "创建用户")
@PostMapping
public Result<Long> create(@Valid @RequestBody UserDTO dto) {
Long userId = userService.createUser(dto);
public Result<String> create(@Valid @RequestBody UserDTO dto) {
String userId = userService.createUser(dto);
return Result.success(userId);
}
@ -50,7 +50,7 @@ public class UserController {
*/
@Operation(summary = "根据ID查询用户")
@GetMapping("/{id}")
public Result<UserVO> getById(@Parameter(description = "用户ID") @PathVariable Long id) {
public Result<UserVO> getById(@Parameter(description = "用户ID") @PathVariable String id) {
UserVO vo = userService.getUserById(id);
return Result.success(vo);
}
@ -65,7 +65,7 @@ public class UserController {
@Parameter(description = "每页条数") @RequestParam(defaultValue = "10") int pageSize,
@Parameter(description = "用户名(模糊查询)") @RequestParam(required = false) String username,
@Parameter(description = "状态0禁用 1启用") @RequestParam(required = false) Integer status,
@Parameter(description = "部门ID") @RequestParam(required = false) Long deptId) {
@Parameter(description = "部门ID") @RequestParam(required = false) String deptId) {
Page<UserVO> page = userService.pageUsers(pageNum, pageSize, username, status, deptId);
return Result.success(page);
}
@ -75,7 +75,7 @@ public class UserController {
*/
@Operation(summary = "删除用户(逻辑删除)")
@DeleteMapping("/{id}")
public Result<Boolean> delete(@Parameter(description = "用户ID") @PathVariable Long id) {
public Result<Boolean> delete(@Parameter(description = "用户ID") @PathVariable String id) {
boolean result = userService.deleteUser(id);
return Result.success(result);
}
@ -85,7 +85,7 @@ public class UserController {
*/
@Operation(summary = "批量删除用户")
@DeleteMapping("/batch")
public Result<Boolean> batchDelete(@RequestBody Long[] ids) {
public Result<Boolean> batchDelete(@RequestBody String[] ids) {
boolean result = userService.batchDeleteUsers(ids);
return Result.success(result);
}
@ -95,7 +95,7 @@ public class UserController {
*/
@Operation(summary = "重置用户密码", description = "将用户密码重置为系统默认密码")
@PutMapping("/{id}/reset-password")
public Result<Boolean> resetPassword(@Parameter(description = "用户ID") @PathVariable Long id) {
public Result<Boolean> resetPassword(@Parameter(description = "用户ID") @PathVariable String id) {
boolean result = userService.resetPassword(id);
return Result.success(result);
}
@ -105,7 +105,7 @@ public class UserController {
*/
@Operation(summary = "更新用户状态")
@PutMapping("/{id}/status")
public Result<Boolean> updateStatus(@Parameter(description = "用户ID") @PathVariable Long id, @Parameter(description = "状态0禁用 1启用") @RequestParam Integer status) {
public Result<Boolean> updateStatus(@Parameter(description = "用户ID") @PathVariable String id, @Parameter(description = "状态0禁用 1启用") @RequestParam Integer status) {
boolean result = userService.updateStatus(id, status);
return Result.success(result);
}

View File

@ -1,6 +1,5 @@
package com.fundplatform.sys.data.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -12,10 +11,10 @@ import java.time.LocalDateTime;
@TableName("sys_operation_log")
public class OperationLog {
@TableId(type = IdType.AUTO)
private Long logId;
@TableId
private String logId;
private Long userId;
private String userId;
private String username;
@ -37,19 +36,19 @@ public class OperationLog {
private String errorMsg;
public Long getLogId() {
public String getLogId() {
return logId;
}
public void setLogId(Long logId) {
public void setLogId(String logId) {
this.logId = logId;
}
public Long getUserId() {
public String getUserId() {
return userId;
}
public void setUserId(Long userId) {
public void setUserId(String userId) {
this.userId = userId;
}

View File

@ -9,7 +9,7 @@ import com.fundplatform.common.core.BaseEntity;
@TableName("sys_dept")
public class SysDept extends BaseEntity {
private Long parentId;
private String parentId;
private String deptCode;
private String deptName;
private String deptLeader;
@ -18,11 +18,11 @@ public class SysDept extends BaseEntity {
private Integer sortOrder;
private Integer status;
public Long getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}

View File

@ -9,7 +9,7 @@ import com.fundplatform.common.core.BaseEntity;
@TableName("sys_menu")
public class SysMenu extends BaseEntity {
private Long parentId;
private String parentId;
private String menuName;
private Integer menuType;
private String menuPath;
@ -20,11 +20,11 @@ public class SysMenu extends BaseEntity {
private Integer visible;
private Integer status;
public Long getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}

View File

@ -14,13 +14,13 @@ public class SysTenant extends BaseEntity {
/** 租户表不需要tenant_id字段 */
@TableField(exist = false)
private Long tenantId;
private String tenantId;
public Long getTenantId() {
public String getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}

View File

@ -14,7 +14,7 @@ public class SysUser extends BaseEntity {
private String realName;
private String phone;
private String email;
private Long deptId;
private String deptId;
private Integer status;
private String avatar;
@ -59,11 +59,11 @@ public class SysUser extends BaseEntity {
this.email = email;
}
public Long getDeptId() {
public String getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
public void setDeptId(String deptId) {
this.deptId = deptId;
}

View File

@ -7,7 +7,7 @@ import jakarta.validation.constraints.NotBlank;
*/
public class ConfigDTO {
private Long id;
private String id;
@NotBlank(message = "参数键不能为空")
private String configKey;
@ -28,11 +28,11 @@ public class ConfigDTO {
private Integer sortOrder;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}

View File

@ -8,9 +8,9 @@ import jakarta.validation.constraints.Size;
*/
public class DeptDTO {
private Long id;
private String id;
private Long parentId;
private String parentId;
@NotBlank(message = "部门编码不能为空")
@Size(max = 50, message = "部门编码不能超过50个字符")
@ -33,19 +33,19 @@ public class DeptDTO {
private String remark;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
public Long getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}

View File

@ -8,9 +8,9 @@ import jakarta.validation.constraints.Size;
*/
public class MenuDTO {
private Long id;
private String id;
private Long parentId;
private String parentId;
@NotBlank(message = "菜单名称不能为空")
@Size(max = 50, message = "菜单名称不能超过50个字符")
@ -38,19 +38,19 @@ public class MenuDTO {
private String remark;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
public Long getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}

View File

@ -8,7 +8,7 @@ import jakarta.validation.constraints.Size;
*/
public class RoleDTO {
private Long id;
private String id;
@NotBlank(message = "角色编码不能为空")
@Size(max = 50, message = "角色编码不能超过50个字符")
@ -26,11 +26,11 @@ public class RoleDTO {
private String remark;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}

View File

@ -10,7 +10,7 @@ import java.time.LocalDateTime;
*/
public class TenantDTO {
private Long id;
private String id;
@NotBlank(message = "租户编码不能为空")
@Size(max = 50, message = "租户编码长度不能超过50")
@ -41,11 +41,11 @@ public class TenantDTO {
@Size(max = 500, message = "备注长度不能超过500")
private String remark;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}

View File

@ -9,7 +9,7 @@ import jakarta.validation.constraints.Size;
*/
public class UserDTO {
private Long id;
private String id;
@NotBlank(message = "用户名不能为空")
@Size(min = 3, max = 50, message = "用户名长度必须在3-50个字符之间")
@ -28,7 +28,7 @@ public class UserDTO {
@Pattern(regexp = "^$|^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", message = "邮箱格式不正确")
private String email;
private Long deptId;
private String deptId;
private Integer status;
@ -36,11 +36,11 @@ public class UserDTO {
private String remark;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
@ -84,11 +84,11 @@ public class UserDTO {
this.email = email;
}
public Long getDeptId() {
public String getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
public void setDeptId(String deptId) {
this.deptId = deptId;
}

View File

@ -17,15 +17,15 @@ public interface AuthService {
/**
* 用户登出
*/
void logout(Long userId);
void logout(String userId);
/**
* 刷新Token
*/
LoginVO refreshToken(Long userId);
LoginVO refreshToken(String userId);
/**
* 获取当前用户信息
*/
UserVO getUserInfo(Long userId);
UserVO getUserInfo(String userId);
}

View File

@ -15,7 +15,7 @@ public interface ConfigService {
/**
* 创建参数
*/
Long createConfig(ConfigDTO dto);
String createConfig(ConfigDTO dto);
/**
* 更新参数
@ -25,7 +25,7 @@ public interface ConfigService {
/**
* 根据ID查询参数
*/
ConfigVO getConfigById(Long id);
ConfigVO getConfigById(String id);
/**
* 根据参数键查询值
@ -50,7 +50,7 @@ public interface ConfigService {
/**
* 删除参数
*/
boolean deleteConfig(Long id);
boolean deleteConfig(String id);
/**
* 批量更新参数值

View File

@ -10,17 +10,17 @@ import java.util.List;
*/
public interface DeptService {
Long createDept(DeptDTO dto);
String createDept(DeptDTO dto);
boolean updateDept(DeptDTO dto);
DeptVO getDeptById(Long id);
DeptVO getDeptById(String id);
List<DeptVO> getDeptTree();
List<DeptVO> listAllDepts();
boolean deleteDept(Long id);
boolean deleteDept(String id);
boolean updateStatus(Long id, Integer status);
boolean updateStatus(String id, Integer status);
}

View File

@ -13,7 +13,7 @@ public interface MenuService {
/**
* 创建菜单
*/
Long createMenu(MenuDTO dto);
String createMenu(MenuDTO dto);
/**
* 更新菜单
@ -23,7 +23,7 @@ public interface MenuService {
/**
* 根据ID查询菜单
*/
MenuVO getMenuById(Long id);
MenuVO getMenuById(String id);
/**
* 查询菜单树
@ -33,15 +33,15 @@ public interface MenuService {
/**
* 查询用户菜单树
*/
List<MenuVO> getUserMenuTree(Long userId);
List<MenuVO> getUserMenuTree(String userId);
/**
* 删除菜单
*/
boolean deleteMenu(Long id);
boolean deleteMenu(String id);
/**
* 获取用户权限标识列表
*/
List<String> getUserPermissions(Long userId);
List<String> getUserPermissions(String userId);
}

View File

@ -14,7 +14,7 @@ public interface RoleService {
/**
* 创建角色
*/
Long createRole(RoleDTO dto);
String createRole(RoleDTO dto);
/**
* 更新角色
@ -24,7 +24,7 @@ public interface RoleService {
/**
* 根据ID查询角色
*/
RoleVO getRoleById(Long id);
RoleVO getRoleById(String id);
/**
* 分页查询角色
@ -39,20 +39,20 @@ public interface RoleService {
/**
* 删除角色
*/
boolean deleteRole(Long id);
boolean deleteRole(String id);
/**
* 更新角色状态
*/
boolean updateStatus(Long id, Integer status);
boolean updateStatus(String id, Integer status);
/**
* 获取角色菜单ID列表
*/
List<Long> getRoleMenus(Long roleId);
List<String> getRoleMenus(String roleId);
/**
* 分配菜单权限
*/
boolean assignMenus(Long roleId, List<Long> menuIds);
boolean assignMenus(String roleId, List<String> menuIds);
}

View File

@ -9,15 +9,15 @@ import com.fundplatform.sys.vo.TenantVO;
*/
public interface TenantService {
Long createTenant(TenantDTO dto);
String createTenant(TenantDTO dto);
boolean updateTenant(TenantDTO dto);
TenantVO getTenantById(Long id);
TenantVO getTenantById(String id);
Page<TenantVO> pageTenants(int pageNum, int pageSize, String keyword);
boolean deleteTenant(Long id);
boolean deleteTenant(String id);
boolean updateStatus(Long id, Integer status);
boolean updateStatus(String id, Integer status);
}

View File

@ -17,7 +17,7 @@ public interface UserService {
* @param dto 用户DTO
* @return 用户ID
*/
Long createUser(UserDTO dto);
String createUser(UserDTO dto);
/**
* 更新用户
@ -33,7 +33,7 @@ public interface UserService {
* @param id 用户ID
* @return 用户VO
*/
UserVO getUserById(Long id);
UserVO getUserById(String id);
/**
* 分页查询用户
@ -45,7 +45,7 @@ public interface UserService {
* @param deptId 部门ID
* @return 分页数据
*/
Page<UserVO> pageUsers(int pageNum, int pageSize, String username, Integer status, Long deptId);
Page<UserVO> pageUsers(int pageNum, int pageSize, String username, Integer status, String deptId);
/**
* 删除用户
@ -53,7 +53,7 @@ public interface UserService {
* @param id 用户ID
* @return 是否成功
*/
boolean deleteUser(Long id);
boolean deleteUser(String id);
/**
* 批量删除用户
@ -61,7 +61,7 @@ public interface UserService {
* @param ids 用户ID列表
* @return 是否成功
*/
boolean batchDeleteUsers(Long[] ids);
boolean batchDeleteUsers(String[] ids);
/**
* 重置密码
@ -69,7 +69,7 @@ public interface UserService {
* @param id 用户ID
* @return 是否成功
*/
boolean resetPassword(Long id);
boolean resetPassword(String id);
/**
* 更新用户状态
@ -78,7 +78,7 @@ public interface UserService {
* @param status 状态
* @return 是否成功
*/
boolean updateStatus(Long id, Integer status);
boolean updateStatus(String id, Integer status);
/**
* 更新个人信息
@ -87,7 +87,7 @@ public interface UserService {
* @param dto 个人信息DTO
* @return 是否成功
*/
boolean updateProfile(Long userId, ProfileDTO dto);
boolean updateProfile(String userId, ProfileDTO dto);
/**
* 修改密码
@ -96,5 +96,5 @@ public interface UserService {
* @param dto 密码DTO
* @return 是否成功
*/
boolean updatePassword(Long userId, PasswordDTO dto);
boolean updatePassword(String userId, PasswordDTO dto);
}

View File

@ -70,14 +70,14 @@ public class AuthServiceImpl implements AuthService {
}
@Override
public void logout(Long userId) {
public void logout(String userId) {
// 清除用户所有Token强制登出所有设备
// 如果只需要登出当前设备需要从前端传递token
tokenService.deleteAllUserTokens(userId);
}
@Override
public LoginVO refreshToken(Long userId) {
public LoginVO refreshToken(String userId) {
SysUser user = userDataService.getById(userId);
if (user == null) {
throw new RuntimeException("用户不存在");
@ -95,7 +95,7 @@ public class AuthServiceImpl implements AuthService {
}
@Override
public UserVO getUserInfo(Long userId) {
public UserVO getUserInfo(String userId) {
SysUser user = userDataService.getById(userId);
if (user == null) {
throw new RuntimeException("用户不存在");

View File

@ -33,7 +33,7 @@ public class ConfigServiceImpl implements ConfigService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createConfig(ConfigDTO dto) {
public String createConfig(ConfigDTO dto) {
// 检查key是否已存在
LambdaQueryWrapper<SysConfig> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysConfig::getConfigKey, dto.getConfigKey());
@ -87,7 +87,7 @@ public class ConfigServiceImpl implements ConfigService {
}
@Override
public ConfigVO getConfigById(Long id) {
public ConfigVO getConfigById(String id) {
SysConfig config = configDataService.getById(id);
if (config == null || config.getDeleted() == 1) {
throw new RuntimeException("参数不存在");
@ -157,7 +157,7 @@ public class ConfigServiceImpl implements ConfigService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteConfig(Long id) {
public boolean deleteConfig(String id) {
SysConfig existing = configDataService.getById(id);
if (existing == null || existing.getDeleted() == 1) {
throw new RuntimeException("参数不存在");

View File

@ -34,7 +34,7 @@ public class DeptServiceImpl implements DeptService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createDept(DeptDTO dto) {
public String createDept(DeptDTO dto) {
LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDept::getDeptCode, dto.getDeptCode());
wrapper.eq(SysDept::getDeleted, 0);
@ -43,7 +43,7 @@ public class DeptServiceImpl implements DeptService {
}
SysDept dept = new SysDept();
dept.setParentId(dto.getParentId() != null ? dto.getParentId() : 0L);
dept.setParentId(dto.getParentId() != null ? dto.getParentId() : "0");
dept.setDeptCode(dto.getDeptCode());
dept.setDeptName(dto.getDeptName());
dept.setDeptLeader(dto.getDeptLeader());
@ -88,7 +88,7 @@ public class DeptServiceImpl implements DeptService {
}
@Override
public DeptVO getDeptById(Long id) {
public DeptVO getDeptById(String id) {
SysDept dept = deptDataService.getById(id);
if (dept == null || dept.getDeleted() == 1) {
throw new RuntimeException("部门不存在");
@ -104,7 +104,7 @@ public class DeptServiceImpl implements DeptService {
wrapper.orderByAsc(SysDept::getSortOrder);
List<SysDept> depts = deptDataService.list(wrapper);
return buildDeptTree(depts, 0L);
return buildDeptTree(depts, "0");
}
@Override
@ -117,7 +117,7 @@ public class DeptServiceImpl implements DeptService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteDept(Long id) {
public boolean deleteDept(String id) {
LambdaQueryWrapper<SysDept> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDept::getParentId, id);
wrapper.eq(SysDept::getDeleted, 0);
@ -136,7 +136,7 @@ public class DeptServiceImpl implements DeptService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateStatus(Long id, Integer status) {
public boolean updateStatus(String id, Integer status) {
LambdaUpdateWrapper<SysDept> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SysDept::getId, id);
wrapper.set(SysDept::getStatus, status);
@ -146,10 +146,10 @@ public class DeptServiceImpl implements DeptService {
return result;
}
private List<DeptVO> buildDeptTree(List<SysDept> depts, Long parentId) {
private List<DeptVO> buildDeptTree(List<SysDept> depts, String parentId) {
List<DeptVO> tree = new ArrayList<>();
Map<Long, List<SysDept>> deptMap = depts.stream()
Map<String, List<SysDept>> deptMap = depts.stream()
.collect(Collectors.groupingBy(SysDept::getParentId));
List<SysDept> rootDepts = deptMap.getOrDefault(parentId, new ArrayList<>());

View File

@ -34,9 +34,9 @@ public class MenuServiceImpl implements MenuService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createMenu(MenuDTO dto) {
public String createMenu(MenuDTO dto) {
SysMenu menu = new SysMenu();
menu.setParentId(dto.getParentId() != null ? dto.getParentId() : 0L);
menu.setParentId(dto.getParentId() != null ? dto.getParentId() : "0");
menu.setMenuName(dto.getMenuName());
menu.setMenuType(dto.getMenuType() != null ? dto.getMenuType() : 1);
menu.setMenuPath(dto.getMenuPath());
@ -86,7 +86,7 @@ public class MenuServiceImpl implements MenuService {
}
@Override
public MenuVO getMenuById(Long id) {
public MenuVO getMenuById(String id) {
SysMenu menu = menuDataService.getById(id);
if (menu == null || menu.getDeleted() == 1) {
throw new RuntimeException("菜单不存在");
@ -102,18 +102,18 @@ public class MenuServiceImpl implements MenuService {
wrapper.orderByAsc(SysMenu::getSortOrder);
List<SysMenu> menus = menuDataService.list(wrapper);
return buildMenuTree(menus, 0L);
return buildMenuTree(menus, "0");
}
@Override
public List<MenuVO> getUserMenuTree(Long userId) {
public List<MenuVO> getUserMenuTree(String userId) {
// TODO: 根据用户角色查询菜单
return getMenuTree();
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteMenu(Long id) {
public boolean deleteMenu(String id) {
// 检查是否有子菜单
LambdaQueryWrapper<SysMenu> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysMenu::getParentId, id);
@ -132,7 +132,7 @@ public class MenuServiceImpl implements MenuService {
}
@Override
public List<String> getUserPermissions(Long userId) {
public List<String> getUserPermissions(String userId) {
// 查询所有启用的菜单/按钮
LambdaQueryWrapper<SysMenu> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysMenu::getDeleted, 0);
@ -150,10 +150,10 @@ public class MenuServiceImpl implements MenuService {
.collect(Collectors.toList());
}
private List<MenuVO> buildMenuTree(List<SysMenu> menus, Long parentId) {
private List<MenuVO> buildMenuTree(List<SysMenu> menus, String parentId) {
List<MenuVO> tree = new ArrayList<>();
Map<Long, List<SysMenu>> menuMap = menus.stream()
Map<String, List<SysMenu>> menuMap = menus.stream()
.collect(Collectors.groupingBy(SysMenu::getParentId));
List<SysMenu> rootMenus = menuMap.getOrDefault(parentId, new ArrayList<>());

View File

@ -33,7 +33,7 @@ public class RoleServiceImpl implements RoleService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createRole(RoleDTO dto) {
public String createRole(RoleDTO dto) {
// 检查角色编码是否存在
LambdaQueryWrapper<SysRole> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysRole::getRoleCode, dto.getRoleCode());
@ -82,7 +82,7 @@ public class RoleServiceImpl implements RoleService {
}
@Override
public RoleVO getRoleById(Long id) {
public RoleVO getRoleById(String id) {
SysRole role = roleDataService.getById(id);
if (role == null || role.getDeleted() == 1) {
throw new RuntimeException("角色不存在");
@ -122,7 +122,7 @@ public class RoleServiceImpl implements RoleService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteRole(Long id) {
public boolean deleteRole(String id) {
LambdaUpdateWrapper<SysRole> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SysRole::getId, id);
wrapper.set(SysRole::getDeleted, 1);
@ -134,7 +134,7 @@ public class RoleServiceImpl implements RoleService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateStatus(Long id, Integer status) {
public boolean updateStatus(String id, Integer status) {
LambdaUpdateWrapper<SysRole> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SysRole::getId, id);
wrapper.set(SysRole::getStatus, status);
@ -145,7 +145,7 @@ public class RoleServiceImpl implements RoleService {
}
@Override
public List<Long> getRoleMenus(Long roleId) {
public List<String> getRoleMenus(String roleId) {
// TODO: 从sys_role_menu表查询角色关联的菜单ID
// 目前返回空列表
log.info("获取角色菜单: roleId={}", roleId);
@ -154,7 +154,7 @@ public class RoleServiceImpl implements RoleService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean assignMenus(Long roleId, List<Long> menuIds) {
public boolean assignMenus(String roleId, List<String> menuIds) {
// TODO: 实现角色菜单关联
log.info("分配角色菜单: roleId={}, menuIds={}", roleId, menuIds);
return true;

View File

@ -30,7 +30,7 @@ public class TenantServiceImpl implements TenantService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createTenant(TenantDTO dto) {
public String createTenant(TenantDTO dto) {
// 检查编码是否重复
LambdaQueryWrapper<SysTenant> checkWrapper = new LambdaQueryWrapper<>();
checkWrapper.eq(SysTenant::getTenantCode, dto.getTenantCode());
@ -101,7 +101,7 @@ public class TenantServiceImpl implements TenantService {
}
@Override
public TenantVO getTenantById(Long id) {
public TenantVO getTenantById(String id) {
SysTenant tenant = tenantDataService.getById(id);
if (tenant == null || tenant.getDeleted() == 1) {
throw new RuntimeException("租户不存在");
@ -134,7 +134,7 @@ public class TenantServiceImpl implements TenantService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteTenant(Long id) {
public boolean deleteTenant(String id) {
SysTenant existing = tenantDataService.getById(id);
if (existing == null || existing.getDeleted() == 1) {
throw new RuntimeException("租户不存在");
@ -156,7 +156,7 @@ public class TenantServiceImpl implements TenantService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateStatus(Long id, Integer status) {
public boolean updateStatus(String id, Integer status) {
SysTenant existing = tenantDataService.getById(id);
if (existing == null || existing.getDeleted() == 1) {
throw new RuntimeException("租户不存在");

View File

@ -38,7 +38,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public Long createUser(UserDTO dto) {
public String createUser(UserDTO dto) {
// 检查用户名是否存在
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysUser::getUsername, dto.getUsername());
@ -115,7 +115,7 @@ public class UserServiceImpl implements UserService {
}
@Override
public UserVO getUserById(Long id) {
public UserVO getUserById(String id) {
SysUser user = userDataService.getById(id);
if (user == null || user.getDeleted() == 1) {
throw new RuntimeException("用户不存在");
@ -124,7 +124,7 @@ public class UserServiceImpl implements UserService {
}
@Override
public Page<UserVO> pageUsers(int pageNum, int pageSize, String username, Integer status, Long deptId) {
public Page<UserVO> pageUsers(int pageNum, int pageSize, String username, Integer status, String deptId) {
Page<SysUser> page = new Page<>(pageNum, pageSize);
LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysUser::getDeleted, 0);
@ -150,7 +150,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean deleteUser(Long id) {
public boolean deleteUser(String id) {
LambdaUpdateWrapper<SysUser> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SysUser::getId, id);
wrapper.set(SysUser::getDeleted, 1);
@ -162,7 +162,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean batchDeleteUsers(Long[] ids) {
public boolean batchDeleteUsers(String[] ids) {
if (ids == null || ids.length == 0) {
return false;
}
@ -177,7 +177,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean resetPassword(Long id) {
public boolean resetPassword(String id) {
String defaultPassword = "123456";
String md5Password = Md5Util.encrypt(defaultPassword);
log.info("重置用户密码 - userId={}, 原始密码:{}, MD5: {}", id, defaultPassword, md5Password);
@ -192,7 +192,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateStatus(Long id, Integer status) {
public boolean updateStatus(String id, Integer status) {
LambdaUpdateWrapper<SysUser> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(SysUser::getId, id);
wrapper.set(SysUser::getStatus, status);
@ -204,7 +204,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateProfile(Long userId, ProfileDTO dto) {
public boolean updateProfile(String userId, ProfileDTO dto) {
SysUser user = userDataService.getById(userId);
if (user == null || user.getDeleted() == 1) {
throw new RuntimeException("用户不存在");
@ -227,7 +227,7 @@ public class UserServiceImpl implements UserService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updatePassword(Long userId, PasswordDTO dto) {
public boolean updatePassword(String userId, PasswordDTO dto) {
// 验证新密码和确认密码一致
if (!dto.getNewPassword().equals(dto.getConfirmPassword())) {
throw new RuntimeException("新密码和确认密码不一致");

View File

@ -7,7 +7,7 @@ import java.time.LocalDateTime;
*/
public class ConfigVO {
private Long id;
private String id;
private String configKey;
private String configValue;
private String configType;
@ -20,11 +20,11 @@ public class ConfigVO {
private LocalDateTime createdTime;
private LocalDateTime updatedTime;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}

View File

@ -8,8 +8,8 @@ import java.util.List;
*/
public class DeptVO {
private Long id;
private Long parentId;
private String id;
private String parentId;
private String parentName;
private String deptCode;
private String deptName;
@ -18,26 +18,26 @@ public class DeptVO {
private String email;
private Integer sortOrder;
private Integer status;
private Long tenantId;
private String tenantId;
private LocalDateTime createdTime;
private LocalDateTime updatedTime;
// 子部门
private List<DeptVO> children;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
public Long getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}
@ -105,11 +105,11 @@ public class DeptVO {
this.status = status;
}
public Long getTenantId() {
public String getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}

View File

@ -5,26 +5,26 @@ package com.fundplatform.sys.vo;
*/
public class LoginVO {
private Long userId;
private String userId;
private String username;
private String token;
private Long tenantId;
private String tenantId;
public LoginVO() {
}
public LoginVO(Long userId, String username, String token, Long tenantId) {
public LoginVO(String userId, String username, String token, String tenantId) {
this.userId = userId;
this.username = username;
this.token = token;
this.tenantId = tenantId;
}
public Long getUserId() {
public String getUserId() {
return userId;
}
public void setUserId(Long userId) {
public void setUserId(String userId) {
this.userId = userId;
}
@ -44,11 +44,11 @@ public class LoginVO {
this.token = token;
}
public Long getTenantId() {
public String getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
}

View File

@ -8,8 +8,8 @@ import java.util.List;
*/
public class MenuVO {
private Long id;
private Long parentId;
private String id;
private String parentId;
private String menuName;
private Integer menuType;
private String menuTypeName;
@ -20,26 +20,26 @@ public class MenuVO {
private Integer sortOrder;
private Integer visible;
private Integer status;
private Long tenantId;
private String tenantId;
private LocalDateTime createdTime;
private LocalDateTime updatedTime;
// 子菜单
private List<MenuVO> children;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
public Long getParentId() {
public String getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
public void setParentId(String parentId) {
this.parentId = parentId;
}
@ -123,11 +123,11 @@ public class MenuVO {
this.status = status;
}
public Long getTenantId() {
public String getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}

View File

@ -7,22 +7,22 @@ import java.time.LocalDateTime;
*/
public class RoleVO {
private Long id;
private String id;
private String roleCode;
private String roleName;
private Integer dataScope;
private String dataScopeName;
private Integer status;
private Integer sortOrder;
private Long tenantId;
private String tenantId;
private LocalDateTime createdTime;
private LocalDateTime updatedTime;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
@ -74,11 +74,11 @@ public class RoleVO {
this.sortOrder = sortOrder;
}
public Long getTenantId() {
public String getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}

View File

@ -7,7 +7,7 @@ import java.time.LocalDateTime;
*/
public class TenantVO {
private Long id;
private String id;
private String tenantCode;
private String tenantName;
private String contact;
@ -22,11 +22,11 @@ public class TenantVO {
private LocalDateTime createdTime;
private LocalDateTime updatedTime;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}

View File

@ -7,24 +7,24 @@ import java.time.LocalDateTime;
*/
public class UserVO {
private Long id;
private String id;
private String username;
private String realName;
private String phone;
private String email;
private Long deptId;
private String deptId;
private String deptName;
private Integer status;
private String avatar;
private Long tenantId;
private String tenantId;
private LocalDateTime createdTime;
private LocalDateTime updatedTime;
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
@ -60,11 +60,11 @@ public class UserVO {
this.email = email;
}
public Long getDeptId() {
public String getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
public void setDeptId(String deptId) {
this.deptId = deptId;
}
@ -92,11 +92,11 @@ public class UserVO {
this.avatar = avatar;
}
public Long getTenantId() {
public String getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}