refactor: 项目目录重构
This commit is contained in:
1 parent
95ef5dfd1f
commit
f9e9dbcedd
181 files changed
+749
-603
No files matched your search
@@ -0,0 +1,81 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.youlai.boot.common.result.PageResult;
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.system.model.form.ConfigForm;
|
||||
import com.youlai.boot.system.model.query.ConfigPageQuery;
|
||||
import com.youlai.boot.system.model.vo.ConfigVO;
|
||||
import com.youlai.boot.system.service.SysConfigService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置前端控制层
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-07-30 11:25
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "10.系统配置")
|
||||
@RequestMapping("/api/v1/config")
|
||||
public class SysConfigController {
|
||||
|
||||
private final SysConfigService sysConfigService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "系统配置分页列表")
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:query')")
|
||||
public PageResult<ConfigVO> page(@ParameterObject ConfigPageQuery configPageQuery) {
|
||||
IPage<ConfigVO> result = sysConfigService.page(configPageQuery);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增系统配置")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:add')")
|
||||
public Result<?> save(@RequestBody @Valid ConfigForm configForm) {
|
||||
return Result.judge(sysConfigService.save(configForm));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取系统配置表单数据")
|
||||
@GetMapping("/{id}/form")
|
||||
public Result<ConfigForm> getConfigForm(
|
||||
@Parameter(description = "系统配置ID") @PathVariable Long id
|
||||
) {
|
||||
ConfigForm formData = sysConfigService.getConfigFormData(id);
|
||||
return Result.success(formData);
|
||||
}
|
||||
|
||||
@Operation(summary = "刷新系统配置缓存")
|
||||
@PatchMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:refresh')")
|
||||
public Result<ConfigForm> refreshCache() {
|
||||
return Result.judge(sysConfigService.refreshCache());
|
||||
}
|
||||
|
||||
@PutMapping(value = "/{id}")
|
||||
@Operation(summary = "修改系统配置")
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:update')")
|
||||
public Result<?> update(@Valid @PathVariable Long id, @RequestBody ConfigForm configForm) {
|
||||
return Result.judge(sysConfigService.edit(id, configForm));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "删除系统配置")
|
||||
@PreAuthorize("@ss.hasPerm('sys:config:delete')")
|
||||
public Result<?> delete(@PathVariable Long id) {
|
||||
return Result.judge(sysConfigService.delete(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.youlai.boot.common.enums.LogModuleEnum;
|
||||
import com.youlai.boot.common.annotation.NoRepeat;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.system.model.form.DeptForm;
|
||||
import com.youlai.boot.system.model.query.DeptQuery;
|
||||
import com.youlai.boot.system.model.vo.DeptVO;
|
||||
import com.youlai.boot.common.annotation.LogAnnotation;
|
||||
import com.youlai.boot.system.service.SysDeptService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门控制器
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2020/11/6
|
||||
*/
|
||||
@Tag(name = "05.部门接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/dept")
|
||||
@RequiredArgsConstructor
|
||||
public class SysDeptController {
|
||||
|
||||
private final SysDeptService deptService;
|
||||
|
||||
@Operation(summary = "部门列表")
|
||||
@GetMapping
|
||||
@LogAnnotation( value = "部门列表",module = LogModuleEnum.DEPT)
|
||||
public Result<List<DeptVO>> getDeptList(
|
||||
DeptQuery queryParams
|
||||
) {
|
||||
List<DeptVO> list = deptService.getDeptList(queryParams);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "部门下拉列表")
|
||||
@GetMapping("/options")
|
||||
public Result<List<Option<Long>>> getDeptOptions() {
|
||||
List<Option<Long>> list = deptService.listDeptOptions();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增部门")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:dept:add')")
|
||||
@NoRepeat
|
||||
public Result<?> saveDept(
|
||||
@Valid @RequestBody DeptForm formData
|
||||
) {
|
||||
Long id = deptService.saveDept(formData);
|
||||
return Result.success(id);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取部门表单数据")
|
||||
@GetMapping("/{deptId}/form")
|
||||
public Result<DeptForm> getDeptForm(
|
||||
@Parameter(description ="部门ID") @PathVariable Long deptId
|
||||
) {
|
||||
DeptForm deptForm = deptService.getDeptForm(deptId);
|
||||
return Result.success(deptForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改部门")
|
||||
@PutMapping(value = "/{deptId}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dept:edit')")
|
||||
public Result<?> updateDept(
|
||||
@PathVariable Long deptId,
|
||||
@Valid @RequestBody DeptForm formData
|
||||
) {
|
||||
deptId = deptService.updateDept(deptId, formData);
|
||||
return Result.success(deptId);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除部门")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dept:delete')")
|
||||
public Result<?> deleteDepartments(
|
||||
@Parameter(description ="部门ID,多个以英文逗号(,)分割") @PathVariable("ids") String ids
|
||||
) {
|
||||
boolean result = deptService.deleteByIds(ids);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.common.result.PageResult;
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.common.enums.LogModuleEnum;
|
||||
import com.youlai.boot.system.model.query.DictPageQuery;
|
||||
import com.youlai.boot.system.model.vo.DictPageVO;
|
||||
import com.youlai.boot.common.annotation.NoRepeat;
|
||||
import com.youlai.boot.system.model.form.DictForm;
|
||||
import com.youlai.boot.common.annotation.LogAnnotation;
|
||||
import com.youlai.boot.system.service.SysDictService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典控制层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.9.0
|
||||
*/
|
||||
@Tag(name = "06.字典接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/dict")
|
||||
@RequiredArgsConstructor
|
||||
public class SysDictController {
|
||||
|
||||
private final SysDictService dictService;
|
||||
|
||||
@Operation(summary = "字典分页列表")
|
||||
@GetMapping("/page")
|
||||
@LogAnnotation( value = "字典分页列表",module = LogModuleEnum.DICT)
|
||||
public PageResult<DictPageVO> getDictPage(
|
||||
DictPageQuery queryParams
|
||||
) {
|
||||
Page<DictPageVO> result = dictService.getDictPage(queryParams);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典列表")
|
||||
@GetMapping("/list")
|
||||
public Result<List<Option<String>>> getDictList() {
|
||||
List<Option<String>> list = dictService.getDictList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典数据项列表")
|
||||
@GetMapping("/{code}/options")
|
||||
public Result<List<Option<Long>>> getDictOptions(
|
||||
@Parameter(description = "字典编码") @PathVariable String code
|
||||
) {
|
||||
List<Option<Long>> options = dictService.listDictItemsByCode(code);
|
||||
return Result.success(options);
|
||||
}
|
||||
|
||||
@Operation(summary = "字典表单")
|
||||
@GetMapping("/{id}/form")
|
||||
public Result<DictForm> getDictForm(
|
||||
@Parameter(description = "字典ID") @PathVariable Long id
|
||||
) {
|
||||
DictForm formData = dictService.getDictForm(id);
|
||||
return Result.success(formData);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增字典")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:dict:add')")
|
||||
@NoRepeat
|
||||
public Result<?> saveDict(@RequestBody DictForm formData) {
|
||||
boolean result = dictService.saveDict(formData);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改字典")
|
||||
@PutMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dict:edit')")
|
||||
public Result<?> updateDict(
|
||||
@PathVariable Long id,
|
||||
@RequestBody DictForm DictForm
|
||||
) {
|
||||
boolean status = dictService.updateDict(id, DictForm);
|
||||
return Result.judge(status);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除字典")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:dict:delete')")
|
||||
public Result<?> deleteDictionaries(
|
||||
@Parameter(description = "字典ID,多个以英文逗号(,)拼接") @PathVariable String ids
|
||||
) {
|
||||
dictService.deleteDictByIds(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.common.result.PageResult;
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.system.model.query.LogPageQuery;
|
||||
import com.youlai.boot.system.model.vo.LogPageVO;
|
||||
import com.youlai.boot.system.model.vo.VisitStatsVO;
|
||||
import com.youlai.boot.system.model.vo.VisitTrendVO;
|
||||
import com.youlai.boot.system.service.SysLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 日志控制层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Tag(name = "08.日志接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/logs")
|
||||
@RequiredArgsConstructor
|
||||
public class SysLogController {
|
||||
|
||||
private final SysLogService logService;
|
||||
|
||||
@Operation(summary = "日志分页列表")
|
||||
@GetMapping("/page")
|
||||
public PageResult<LogPageVO> listPagedLogs(
|
||||
LogPageQuery queryParams
|
||||
) {
|
||||
Page<LogPageVO> result = logService.listPagedLogs(queryParams);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取访问趋势")
|
||||
@GetMapping("/visit-trend")
|
||||
public Result<VisitTrendVO> getVisitTrend(
|
||||
@Parameter(description = "开始时间", example = "yyyy-MM-dd") @RequestParam String startDate,
|
||||
@Parameter(description = "结束时间", example = "yyyy-MM-dd") @RequestParam String endDate
|
||||
) {
|
||||
LocalDate start = LocalDate.parse(startDate);
|
||||
LocalDate end = LocalDate.parse(endDate);
|
||||
VisitTrendVO data = logService.getVisitTrend(start, end);
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取统计数据")
|
||||
@GetMapping("/visit-stats")
|
||||
public Result<List<VisitStatsVO>> getVisitStats() {
|
||||
List<VisitStatsVO> list = logService.getVisitStats();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.common.enums.LogModuleEnum;
|
||||
import com.youlai.boot.common.annotation.NoRepeat;
|
||||
import com.youlai.boot.system.model.form.MenuForm;
|
||||
import com.youlai.boot.system.model.query.MenuQuery;
|
||||
import com.youlai.boot.system.model.vo.MenuVO;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.model.vo.RouteVO;
|
||||
import com.youlai.boot.common.annotation.LogAnnotation;
|
||||
import com.youlai.boot.core.security.util.SecurityUtils;
|
||||
import com.youlai.boot.system.service.SysMenuService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 菜单控制层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2020/11/06
|
||||
*/
|
||||
@Tag(name = "04.菜单接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/menus")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SysMenuController {
|
||||
|
||||
private final SysMenuService menuService;
|
||||
|
||||
@Operation(summary = "菜单列表")
|
||||
@GetMapping
|
||||
@LogAnnotation( value = "菜单列表",module = LogModuleEnum.MENU)
|
||||
public Result<List<MenuVO>> listMenus(MenuQuery queryParams) {
|
||||
List<MenuVO> menuList = menuService.listMenus(queryParams);
|
||||
return Result.success(menuList);
|
||||
}
|
||||
|
||||
@Operation(summary = "菜单下拉列表")
|
||||
@GetMapping("/options")
|
||||
public Result<?> listMenuOptions(
|
||||
@Parameter(description = "是否只查询父级菜单")
|
||||
@RequestParam(required = false, defaultValue = "false") boolean onlyParent
|
||||
) {
|
||||
List<Option> menus = menuService.listMenuOptions(onlyParent);
|
||||
return Result.success(menus);
|
||||
}
|
||||
|
||||
@Operation(summary = "菜单路由列表")
|
||||
@GetMapping("/routes")
|
||||
public Result<List<RouteVO>> listRoutes() {
|
||||
Set<String> roles = SecurityUtils.getRoles();
|
||||
List<RouteVO> routeList = menuService.listRoutes(roles);
|
||||
return Result.success(routeList);
|
||||
}
|
||||
|
||||
@Operation(summary = "菜单表单数据")
|
||||
@GetMapping("/{id}/form")
|
||||
public Result<MenuForm> getMenuForm(
|
||||
@Parameter(description = "菜单ID") @PathVariable Long id
|
||||
) {
|
||||
MenuForm menu = menuService.getMenuForm(id);
|
||||
return Result.success(menu);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增菜单")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:menu:add')")
|
||||
@NoRepeat
|
||||
public Result<?> addMenu(@RequestBody MenuForm menuForm) {
|
||||
boolean result = menuService.saveMenu(menuForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改菜单")
|
||||
@PutMapping(value = "/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:menu:edit')")
|
||||
public Result<?> updateMenu(
|
||||
@RequestBody MenuForm menuForm
|
||||
) {
|
||||
boolean result = menuService.saveMenu(menuForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除菜单")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:menu:delete')")
|
||||
public Result<?> deleteMenu(
|
||||
@Parameter(description = "菜单ID,多个以英文(,)分割") @PathVariable("id") Long id
|
||||
) {
|
||||
boolean result = menuService.deleteMenu(id);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改菜单显示状态")
|
||||
@PatchMapping("/{menuId}")
|
||||
public Result<?> updateMenuVisible(
|
||||
@Parameter(description = "菜单ID") @PathVariable Long menuId,
|
||||
@Parameter(description = "显示状态(1:显示;0:隐藏)") Integer visible
|
||||
|
||||
) {
|
||||
boolean result = menuService.updateMenuVisible(menuId, visible);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.common.enums.LogModuleEnum;
|
||||
import com.youlai.boot.common.annotation.NoRepeat;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.common.result.PageResult;
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.system.model.form.RoleForm;
|
||||
import com.youlai.boot.system.model.query.RolePageQuery;
|
||||
import com.youlai.boot.system.model.vo.RolePageVO;
|
||||
import com.youlai.boot.common.annotation.LogAnnotation;
|
||||
import com.youlai.boot.system.service.SysRoleService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 角色控制层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2022/10/16
|
||||
*/
|
||||
@Tag(name = "03.角色接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/roles")
|
||||
@RequiredArgsConstructor
|
||||
public class SysRoleController {
|
||||
|
||||
private final SysRoleService roleService;
|
||||
|
||||
@Operation(summary = "角色分页列表")
|
||||
@GetMapping("/page")
|
||||
@LogAnnotation( value = "角色分页列表",module = LogModuleEnum.ROLE)
|
||||
public PageResult<RolePageVO> getRolePage(
|
||||
RolePageQuery queryParams
|
||||
) {
|
||||
Page<RolePageVO> result = roleService.getRolePage(queryParams);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "角色下拉列表")
|
||||
@GetMapping("/options")
|
||||
public Result<List<Option<Long>>> listRoleOptions() {
|
||||
List<Option<Long>> list = roleService.listRoleOptions();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增角色")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:role:add')")
|
||||
@NoRepeat
|
||||
public Result<?> addRole(@Valid @RequestBody RoleForm roleForm) {
|
||||
boolean result = roleService.saveRole(roleForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "角色表单数据")
|
||||
@GetMapping("/{roleId}/form")
|
||||
public Result<RoleForm> getRoleForm(
|
||||
@Parameter(description = "角色ID") @PathVariable Long roleId
|
||||
) {
|
||||
RoleForm roleForm = roleService.getRoleForm(roleId);
|
||||
return Result.success(roleForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改角色")
|
||||
@PutMapping(value = "/{id}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:role:edit')")
|
||||
public Result<?> updateRole(@Valid @RequestBody RoleForm roleForm) {
|
||||
boolean result = roleService.saveRole(roleForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除角色")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:role:delete')")
|
||||
public Result<?> deleteRoles(
|
||||
@Parameter(description = "删除角色,多个以英文逗号(,)拼接") @PathVariable String ids
|
||||
) {
|
||||
boolean result = roleService.deleteRoles(ids);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改角色状态")
|
||||
@PutMapping(value = "/{roleId}/status")
|
||||
public Result<?> updateRoleStatus(
|
||||
@Parameter(description = "角色ID") @PathVariable Long roleId,
|
||||
@Parameter(description = "状态(1:启用;0:禁用)") @RequestParam Integer status
|
||||
) {
|
||||
boolean result = roleService.updateRoleStatus(roleId, status);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取角色的菜单ID集合")
|
||||
@GetMapping("/{roleId}/menuIds")
|
||||
public Result<List<Long>> getRoleMenuIds(
|
||||
@Parameter(description = "角色ID") @PathVariable Long roleId
|
||||
) {
|
||||
List<Long> menuIds = roleService.getRoleMenuIds(roleId);
|
||||
return Result.success(menuIds);
|
||||
}
|
||||
|
||||
@Operation(summary = "分配菜单(包括按钮权限)给角色")
|
||||
@PutMapping("/{roleId}/menus")
|
||||
public Result<?> assignMenusToRole(
|
||||
@PathVariable Long roleId,
|
||||
@RequestBody List<Long> menuIds
|
||||
) {
|
||||
boolean result = roleService.assignMenusToRole(roleId, menuIds);
|
||||
return Result.judge(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.youlai.boot.system.model.form.*;
|
||||
import com.youlai.boot.common.result.PageResult;
|
||||
import com.youlai.boot.common.result.Result;
|
||||
import com.youlai.boot.common.enums.ContactType;
|
||||
import com.youlai.boot.system.model.vo.UserProfileVO;
|
||||
import com.youlai.boot.core.security.util.SecurityUtils;
|
||||
import com.youlai.boot.common.util.ExcelUtils;
|
||||
import com.youlai.boot.common.enums.LogModuleEnum;
|
||||
import com.youlai.boot.system.model.dto.UserImportDTO;
|
||||
import com.youlai.boot.common.annotation.NoRepeat;
|
||||
import com.youlai.boot.system.listener.UserImportListener;
|
||||
import com.youlai.boot.system.model.entity.SysUser;
|
||||
import com.youlai.boot.system.model.query.UserPageQuery;
|
||||
import com.youlai.boot.system.model.dto.UserExportDTO;
|
||||
import com.youlai.boot.system.model.vo.UserInfoVO;
|
||||
import com.youlai.boot.system.model.vo.UserPageVO;
|
||||
import com.youlai.boot.common.annotation.LogAnnotation;
|
||||
import com.youlai.boot.system.service.SysUserService;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户控制层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2022/10/16
|
||||
*/
|
||||
@Tag(name = "02.用户接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/users")
|
||||
@RequiredArgsConstructor
|
||||
public class SysUserController {
|
||||
|
||||
private final SysUserService userService;
|
||||
|
||||
@Operation(summary = "用户分页列表")
|
||||
@GetMapping("/page")
|
||||
@LogAnnotation(value = "用户分页列表", module = LogModuleEnum.USER)
|
||||
public PageResult<UserPageVO> listPagedUsers(
|
||||
UserPageQuery queryParams
|
||||
) {
|
||||
IPage<UserPageVO> result = userService.listPagedUsers(queryParams);
|
||||
return PageResult.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增用户")
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:add')")
|
||||
@NoRepeat
|
||||
public Result<?> saveUser(
|
||||
@RequestBody @Valid UserForm userForm
|
||||
) {
|
||||
boolean result = userService.saveUser(userForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "用户表单数据")
|
||||
@GetMapping("/{userId}/form")
|
||||
public Result<UserForm> getUserForm(
|
||||
@Parameter(description = "用户ID") @PathVariable Long userId
|
||||
) {
|
||||
UserForm formData = userService.getUserFormData(userId);
|
||||
return Result.success(formData);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改用户")
|
||||
@PutMapping(value = "/{userId}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:edit')")
|
||||
public Result<?> updateUser(
|
||||
@Parameter(description = "用户ID") @PathVariable Long userId,
|
||||
@RequestBody @Validated UserForm userForm) {
|
||||
boolean result = userService.updateUser(userId, userForm);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除用户")
|
||||
@DeleteMapping("/{ids}")
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:delete')")
|
||||
public Result<?> deleteUsers(
|
||||
@Parameter(description = "用户ID,多个以英文逗号(,)分割") @PathVariable String ids
|
||||
) {
|
||||
boolean result = userService.deleteUsers(ids);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改用户状态")
|
||||
@PatchMapping(value = "/{userId}/status")
|
||||
public Result<?> updateUserStatus(
|
||||
@Parameter(description = "用户ID") @PathVariable Long userId,
|
||||
@Parameter(description = "用户状态(1:启用;0:禁用)") @RequestParam Integer status
|
||||
) {
|
||||
boolean result = userService.update(new LambdaUpdateWrapper<SysUser>()
|
||||
.eq(SysUser::getId, userId)
|
||||
.set(SysUser::getStatus, status)
|
||||
);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取当前登录用户信息")
|
||||
@GetMapping("/me")
|
||||
public Result<UserInfoVO> getCurrentUserInfo() {
|
||||
UserInfoVO userInfoVO = userService.getCurrentUserInfo();
|
||||
return Result.success(userInfoVO);
|
||||
}
|
||||
|
||||
@Operation(summary = "用户导入模板下载")
|
||||
@GetMapping("/template")
|
||||
public void downloadTemplate(HttpServletResponse response) throws IOException {
|
||||
String fileName = "用户导入模板.xlsx";
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
|
||||
|
||||
String fileClassPath = "templates" + File.separator + "excel" + File.separator + fileName;
|
||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileClassPath);
|
||||
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
ExcelWriter excelWriter = EasyExcel.write(outputStream).withTemplate(inputStream).build();
|
||||
|
||||
excelWriter.finish();
|
||||
}
|
||||
|
||||
@Operation(summary = "导入用户")
|
||||
@PostMapping("/import")
|
||||
public Result<?> importUsers(MultipartFile file) throws IOException {
|
||||
UserImportListener listener = new UserImportListener();
|
||||
String msg = ExcelUtils.importExcel(file.getInputStream(), UserImportDTO.class, listener);
|
||||
return Result.success(msg);
|
||||
}
|
||||
|
||||
@Operation(summary = "导出用户")
|
||||
@GetMapping("/export")
|
||||
public void exportUsers(UserPageQuery queryParams, HttpServletResponse response) throws IOException {
|
||||
String fileName = "用户列表.xlsx";
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, StandardCharsets.UTF_8));
|
||||
|
||||
List<UserExportDTO> exportUserList = userService.listExportUsers(queryParams);
|
||||
EasyExcel.write(response.getOutputStream(), UserExportDTO.class).sheet("用户列表")
|
||||
.doWrite(exportUserList);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取个人中心用户信息")
|
||||
@GetMapping("/profile")
|
||||
public Result<UserProfileVO> getUserProfile() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
UserProfileVO userProfile = userService.getUserProfile(userId);
|
||||
return Result.success(userProfile);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改个人中心用户信息")
|
||||
@PutMapping("/profile")
|
||||
public Result<?> updateUserProfile(@RequestBody UserProfileForm formData) {
|
||||
boolean result = userService.updateUserProfile(formData);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "重置用户密码")
|
||||
@PutMapping(value = "/{userId}/password/reset")
|
||||
@PreAuthorize("@ss.hasPerm('sys:user:password:reset')")
|
||||
public Result<?> resetPassword(
|
||||
@Parameter(description = "用户ID") @PathVariable Long userId,
|
||||
@RequestParam String password
|
||||
) {
|
||||
boolean result = userService.resetPassword(userId, password);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改密码")
|
||||
@PutMapping(value = "/password")
|
||||
public Result<?> changePassword(
|
||||
@RequestBody PasswordChangeForm data
|
||||
) {
|
||||
Long currUserId = SecurityUtils.getUserId();
|
||||
boolean result = userService.changePassword(currUserId, data);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "发送短信/邮箱验证码")
|
||||
@PostMapping(value = "/send-verification-code")
|
||||
public Result<?> sendVerificationCode(
|
||||
@Parameter(description = "联系方式(手机号码或邮箱地址)", required = true) @RequestParam String contact,
|
||||
@Parameter(description = "联系方式类型(Mobile或Email)", required = true) @RequestParam ContactType contactType
|
||||
) {
|
||||
boolean result = userService.sendVerificationCode(contact, contactType);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "绑定个人中心用户手机号")
|
||||
@PutMapping(value = "/mobile")
|
||||
public Result<?> bindMobile(
|
||||
@RequestBody @Validated MobileBindingForm data
|
||||
) {
|
||||
boolean result = userService.bindMobile(data);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "绑定个人中心用户邮箱")
|
||||
@PutMapping(value = "/email")
|
||||
public Result<?> bindEmail(
|
||||
@RequestBody @Validated EmailChangeForm data
|
||||
) {
|
||||
boolean result = userService.bindEmail(data);
|
||||
return Result.judge(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.youlai.boot.system.controller;
|
||||
|
||||
import com.youlai.boot.system.model.dto.ChatMessage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.messaging.handler.annotation.DestinationVariable;
|
||||
import org.springframework.messaging.handler.annotation.MessageMapping;
|
||||
import org.springframework.messaging.handler.annotation.SendTo;
|
||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.security.Principal;
|
||||
|
||||
/**
|
||||
* WebSocket 测试控制层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.3.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/websocket")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WebsocketController {
|
||||
|
||||
private final SimpMessagingTemplate messagingTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 广播发送消息
|
||||
*
|
||||
* @param message 消息内容
|
||||
*/
|
||||
@MessageMapping("/sendToAll")
|
||||
@SendTo("/topic/notice")
|
||||
public String sendToAll(String message) {
|
||||
return "服务端通知: " + message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 点对点发送消息
|
||||
* <p>
|
||||
* 模拟 张三 给 李四 发送消息场景
|
||||
*
|
||||
* @param principal 当前用户
|
||||
* @param username 接收消息的用户
|
||||
* @param message 消息内容
|
||||
*/
|
||||
@MessageMapping("/sendToUser/{username}")
|
||||
public void sendToUser(Principal principal, @DestinationVariable String username, String message) {
|
||||
|
||||
String sender = principal.getName(); // 发送人
|
||||
String receiver = username; // 接收人
|
||||
|
||||
log.info("发送人:{}; 接收人:{}", sender, receiver);
|
||||
// 发送消息给指定用户,拼接后路径 /user/{receiver}/queue/greeting
|
||||
messagingTemplate.convertAndSendToUser(receiver, "/queue/greeting", new ChatMessage(sender, message));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.entity.SysConfig;
|
||||
import com.youlai.boot.system.model.vo.ConfigVO;
|
||||
import com.youlai.boot.system.model.form.ConfigForm;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* 系统配置对象转换器
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-7-29 11:42:49
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ConfigConverter {
|
||||
|
||||
Page<ConfigVO> toPageVo(Page<SysConfig> page);
|
||||
|
||||
SysConfig toEntity(ConfigForm configForm);
|
||||
|
||||
ConfigForm toForm(SysConfig entity);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.youlai.boot.system.model.entity.SysDept;
|
||||
import com.youlai.boot.system.model.vo.DeptVO;
|
||||
import com.youlai.boot.system.model.form.DeptForm;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* 部门对象转换器
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/7/29
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DeptConverter {
|
||||
|
||||
DeptForm toForm(SysDept entity);
|
||||
|
||||
DeptVO toVo(SysDept entity);
|
||||
|
||||
SysDept toEntity(DeptForm deptForm);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.entity.SysDict;
|
||||
import com.youlai.boot.system.model.vo.DictPageVO;
|
||||
import com.youlai.boot.system.model.form.DictForm;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* 字典 对象转换器
|
||||
*
|
||||
* @author Ray Hao
|
||||
* @since 2022/6/8
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DictConverter {
|
||||
|
||||
Page<DictPageVO> toPageVo(Page<SysDict> page);
|
||||
|
||||
DictForm toForm(SysDict entity);
|
||||
|
||||
SysDict toEntity(DictForm entity);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.entity.SysDictItem;
|
||||
import com.youlai.boot.system.model.vo.DictPageVO;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.model.form.DictForm;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典项 对象转换器
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2022/6/8
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DictItemConverter {
|
||||
|
||||
Page<DictPageVO> toPageVo(Page<SysDictItem> page);
|
||||
|
||||
DictForm toForm(SysDictItem entity);
|
||||
|
||||
SysDictItem toEntity(DictForm.DictItem dictItems);
|
||||
List<SysDictItem> toEntity(List<DictForm.DictItem> dictItems);
|
||||
|
||||
DictForm.DictItem toDictItem(SysDictItem entity);
|
||||
List<DictForm.DictItem> toDictItem(List<SysDictItem> entities);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "value", source = "value"),
|
||||
@Mapping(target = "label", source = "name")
|
||||
})
|
||||
Option<Long> toOption(SysDictItem dictItem);
|
||||
List<Option<Long>> toOption(List<SysDictItem> dictItems);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.youlai.boot.infrastructure.generator.model.entity.GenConfig;
|
||||
import com.youlai.boot.infrastructure.generator.model.entity.GenFieldConfig;
|
||||
import com.youlai.boot.infrastructure.generator.model.form.GenConfigForm;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代码生成配置转换器
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface GenConfigConverter {
|
||||
|
||||
@Mapping(source = "genConfig.tableName", target = "tableName")
|
||||
@Mapping(source = "genConfig.businessName", target = "businessName")
|
||||
@Mapping(source = "genConfig.moduleName", target = "moduleName")
|
||||
@Mapping(source = "genConfig.packageName", target = "packageName")
|
||||
@Mapping(source = "genConfig.entityName", target = "entityName")
|
||||
@Mapping(source = "genConfig.author", target = "author")
|
||||
@Mapping(source = "fieldConfigs", target = "fieldConfigs")
|
||||
GenConfigForm toGenConfigForm(GenConfig genConfig, List<GenFieldConfig> fieldConfigs);
|
||||
|
||||
List<GenConfigForm.FieldConfig> toGenFieldConfigForm(List<GenFieldConfig> fieldConfigs);
|
||||
|
||||
GenConfigForm.FieldConfig toGenFieldConfigForm(GenFieldConfig genFieldConfig);
|
||||
|
||||
GenConfig toGenConfig(GenConfigForm formData);
|
||||
|
||||
List<GenFieldConfig> toGenFieldConfig(List<GenConfigForm.FieldConfig> fieldConfigs);
|
||||
|
||||
GenFieldConfig toGenFieldConfig(GenConfigForm.FieldConfig fieldConfig);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.youlai.boot.system.model.entity.SysMenu;
|
||||
import com.youlai.boot.system.model.vo.MenuVO;
|
||||
import com.youlai.boot.system.model.form.MenuForm;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
/**
|
||||
* 菜单对象转换器
|
||||
*
|
||||
* @author Ray Hao
|
||||
* @since 2024/5/26
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface MenuConverter {
|
||||
|
||||
MenuVO toVo(SysMenu entity);
|
||||
|
||||
@Mapping(target = "params", ignore = true)
|
||||
MenuForm toForm(SysMenu entity);
|
||||
|
||||
@Mapping(target = "params", ignore = true)
|
||||
SysMenu toEntity(MenuForm menuForm);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.entity.SysRole;
|
||||
import com.youlai.boot.system.model.vo.RolePageVO;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.model.form.RoleForm;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色对象转换器
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/5/29
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface RoleConverter {
|
||||
|
||||
Page<RolePageVO> toPageVo(Page<SysRole> page);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "value", source = "id"),
|
||||
@Mapping(target = "label", source = "name")
|
||||
})
|
||||
Option<Long> entity2Option(SysRole role);
|
||||
|
||||
List<Option<Long>> entities2Options(List<SysRole> roles);
|
||||
|
||||
SysRole toEntity(RoleForm roleForm);
|
||||
|
||||
RoleForm toForm(SysRole entity);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.youlai.boot.system.converter;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.entity.SysUser;
|
||||
import com.youlai.boot.system.model.vo.UserInfoVO;
|
||||
import com.youlai.boot.system.model.vo.UserPageVO;
|
||||
import com.youlai.boot.system.model.vo.UserProfileVO;
|
||||
import com.youlai.boot.system.model.bo.UserBO;
|
||||
import com.youlai.boot.system.model.form.UserForm;
|
||||
import com.youlai.boot.system.model.dto.UserImportDTO;
|
||||
import com.youlai.boot.system.model.form.UserProfileForm;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
|
||||
/**
|
||||
* 用户对象转换器
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/6/8
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface UserConverter {
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "genderLabel", expression = "java(com.youlai.boot.common.base.IBaseEnum.getLabelByValue(bo.getGender(), com.youlai.boot.common.enums.GenderEnum.class))")
|
||||
})
|
||||
UserPageVO toPageVo(UserBO bo);
|
||||
|
||||
Page<UserPageVO> toPageVo(Page<UserBO> bo);
|
||||
|
||||
UserForm toForm(SysUser entity);
|
||||
|
||||
@InheritInverseConfiguration(name = "toForm")
|
||||
SysUser toEntity(UserForm entity);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "userId", source = "id")
|
||||
})
|
||||
UserInfoVO toUserInfoVo(SysUser entity);
|
||||
|
||||
SysUser toEntity(UserImportDTO vo);
|
||||
|
||||
|
||||
UserProfileVO toProfileVO(UserBO bo);
|
||||
|
||||
SysUser toEntity(UserProfileForm formData);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.youlai.boot.system.event;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
@Getter
|
||||
public class UserConnectionEvent extends ApplicationEvent {
|
||||
private final String username;
|
||||
private final boolean connected;
|
||||
|
||||
public UserConnectionEvent(Object source, String username, boolean connected) {
|
||||
super(source);
|
||||
this.username = username;
|
||||
this.connected = connected;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.youlai.boot.system.handler;
|
||||
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* xxl-job 测试示例(Bean模式)
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class XxlJobSampleHandler {
|
||||
|
||||
@XxlJob("demoJobHandler")
|
||||
public void demoJobHandler() {
|
||||
log.info("XXL-JOB, Hello World.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.youlai.boot.system.listener;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.youlai.boot.common.base.BaseAnalysisEventListener;
|
||||
import com.youlai.boot.system.model.entity.SysDept;
|
||||
import com.youlai.boot.system.model.entity.SysRole;
|
||||
import com.youlai.boot.system.model.entity.SysUser;
|
||||
import com.youlai.boot.system.model.entity.SysUserRole;
|
||||
import com.youlai.boot.common.base.IBaseEnum;
|
||||
import com.youlai.boot.common.constant.SystemConstants;
|
||||
import com.youlai.boot.common.enums.GenderEnum;
|
||||
import com.youlai.boot.common.enums.StatusEnum;
|
||||
import com.youlai.boot.system.converter.UserConverter;
|
||||
import com.youlai.boot.system.model.dto.UserImportDTO;
|
||||
import com.youlai.boot.system.service.SysDeptService;
|
||||
import com.youlai.boot.system.service.SysRoleService;
|
||||
import com.youlai.boot.system.service.SysUserRoleService;
|
||||
import com.youlai.boot.system.service.SysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户导入监听器
|
||||
* <p>
|
||||
* <a href="https://easyexcel.opensource.alibaba.com/docs/current/quickstart/read#%E6%9C%80%E7%AE%80%E5%8D%95%E7%9A%84%E8%AF%BB%E7%9A%84%E7%9B%91%E5%90%AC%E5%99%A8">最简单的读的监听器</a>
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2022/4/10
|
||||
*/
|
||||
@Slf4j
|
||||
public class UserImportListener extends BaseAnalysisEventListener<UserImportDTO> {
|
||||
|
||||
|
||||
// 有效条数
|
||||
private int validCount;
|
||||
|
||||
// 无效条数
|
||||
private int invalidCount;
|
||||
|
||||
// 导入返回信息
|
||||
StringBuilder msg = new StringBuilder();
|
||||
|
||||
private final SysUserService userService;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final UserConverter userConverter;
|
||||
private final SysRoleService roleService;
|
||||
private final SysUserRoleService userRoleService;
|
||||
private final SysDeptService deptService;
|
||||
|
||||
public UserImportListener() {
|
||||
this.userService = SpringUtil.getBean(SysUserService.class);
|
||||
this.passwordEncoder = SpringUtil.getBean(PasswordEncoder.class);
|
||||
this.roleService = SpringUtil.getBean(SysRoleService.class);
|
||||
this.userRoleService = SpringUtil.getBean(SysUserRoleService.class);
|
||||
this.deptService = SpringUtil.getBean(SysDeptService.class);
|
||||
this.userConverter = SpringUtil.getBean(UserConverter.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 每一条数据解析都会来调用
|
||||
* <p>
|
||||
* 1. 数据校验;全字段校验
|
||||
* 2. 数据持久化;
|
||||
*
|
||||
* @param userImportDTO 一行数据,类似于 {@link AnalysisContext#readRowHolder()}
|
||||
*/
|
||||
@Override
|
||||
public void invoke(UserImportDTO userImportDTO, AnalysisContext analysisContext) {
|
||||
log.info("解析到一条用户数据:{}", JSONUtil.toJsonStr(userImportDTO));
|
||||
// 校验数据
|
||||
StringBuilder validationMsg = new StringBuilder();
|
||||
|
||||
String username = userImportDTO.getUsername();
|
||||
if (StrUtil.isBlank(username)) {
|
||||
validationMsg.append("用户名为空;");
|
||||
} else {
|
||||
long count = userService.count(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, username));
|
||||
if (count > 0) {
|
||||
validationMsg.append("用户名已存在;");
|
||||
}
|
||||
}
|
||||
|
||||
String nickname = userImportDTO.getNickname();
|
||||
if (StrUtil.isBlank(nickname)) {
|
||||
validationMsg.append("用户昵称为空;");
|
||||
}
|
||||
|
||||
String mobile = userImportDTO.getMobile();
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
validationMsg.append("手机号码为空;");
|
||||
} else {
|
||||
if (!Validator.isMobile(mobile)) {
|
||||
validationMsg.append("手机号码不正确;");
|
||||
}
|
||||
}
|
||||
|
||||
if (validationMsg.isEmpty()) {
|
||||
// 校验通过,持久化至数据库
|
||||
SysUser entity = userConverter.toEntity(userImportDTO);
|
||||
entity.setPassword(passwordEncoder.encode(SystemConstants.DEFAULT_PASSWORD)); // 默认密码
|
||||
// 性别翻译
|
||||
String genderLabel = userImportDTO.getGenderLabel();
|
||||
if (StrUtil.isNotBlank(genderLabel)) {
|
||||
Integer genderValue = (Integer) IBaseEnum.getValueByLabel(genderLabel, GenderEnum.class);
|
||||
entity.setGender(genderValue);
|
||||
}
|
||||
|
||||
// 角色解析
|
||||
String roleCodes = userImportDTO.getRoleCodes();
|
||||
List<Long> roleIds = null;
|
||||
if (StrUtil.isNotBlank(roleCodes)) {
|
||||
roleIds = roleService.list(
|
||||
new LambdaQueryWrapper<SysRole>()
|
||||
.in(SysRole::getCode, (Object) roleCodes.split(","))
|
||||
.eq(SysRole::getStatus, StatusEnum.ENABLE.getValue())
|
||||
.select(SysRole::getId)
|
||||
).stream()
|
||||
.map(SysRole::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 部门解析
|
||||
String deptCode = userImportDTO.getDeptCode();
|
||||
if (StrUtil.isNotBlank(deptCode)) {
|
||||
SysDept dept = deptService.getOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getCode, deptCode)
|
||||
.select(SysDept::getId)
|
||||
);
|
||||
if (dept != null) {
|
||||
entity.setDeptId(dept.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean saveResult = userService.save(entity);
|
||||
if (saveResult) {
|
||||
validCount++;
|
||||
// 保存用户角色关联
|
||||
if (CollectionUtil.isNotEmpty(roleIds)) {
|
||||
List<SysUserRole> userRoles = roleIds.stream()
|
||||
.map(roleId -> new SysUserRole(entity.getId(), roleId))
|
||||
.collect(Collectors.toList());
|
||||
userRoleService.saveBatch(userRoles);
|
||||
}
|
||||
} else {
|
||||
invalidCount++;
|
||||
msg.append("第").append(validCount + invalidCount).append("行数据保存失败;<br/>");
|
||||
}
|
||||
} else {
|
||||
invalidCount++;
|
||||
msg.append("第").append(validCount + invalidCount).append("行数据校验失败:").append(validationMsg + "<br/>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 所有数据解析完成会来调用
|
||||
*/
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
|
||||
log.info("所有数据解析完成!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getMsg() {
|
||||
// 总结信息
|
||||
return StrUtil.format("导入用户结束:成功{}条,失败{}条;<br/>{}", validCount, invalidCount, msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.boot.system.model.entity.SysConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 系统配置 访问层
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-7-29 11:41:04
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysConfigMapper extends BaseMapper<SysConfig> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.youlai.boot.common.annotation.DataPermission;
|
||||
import com.youlai.boot.system.model.entity.SysDept;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||
|
||||
@DataPermission(deptIdColumnName = "id")
|
||||
@Override
|
||||
List<SysDept> selectList(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.boot.system.model.entity.SysDictItem;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 字典项 访问层
|
||||
*
|
||||
* @author Ray Hao
|
||||
* @since 2.9.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.entity.SysDict;
|
||||
import com.youlai.boot.system.model.query.DictPageQuery;
|
||||
import com.youlai.boot.system.model.vo.DictPageVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 字典 访问层
|
||||
*
|
||||
* @author Ray Hao
|
||||
* @since 2.9.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||
|
||||
/**
|
||||
* 字典分页列表
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param queryParams 查询参数
|
||||
* @return
|
||||
*/
|
||||
Page<DictPageVO> getDictPage(Page<DictPageVO> page, DictPageQuery queryParams);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.bo.VisitCount;
|
||||
import com.youlai.boot.system.model.entity.SysLog;
|
||||
import com.youlai.boot.system.model.query.LogPageQuery;
|
||||
import com.youlai.boot.system.model.vo.LogPageVO;
|
||||
import com.youlai.boot.system.model.vo.VisitStatsVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 系统日志 数据库访问层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysLogMapper extends BaseMapper<SysLog> {
|
||||
|
||||
/**
|
||||
* 获取日志分页列表
|
||||
*
|
||||
* @param page
|
||||
* @param queryParams
|
||||
* @return
|
||||
*/
|
||||
Page<LogPageVO> listPagedLogs(Page<LogPageVO> page, LogPageQuery queryParams);
|
||||
|
||||
/**
|
||||
* 统计浏览数(PV)
|
||||
*
|
||||
* @param startDate 开始日期 yyyy-MM-dd
|
||||
* @param endDate 结束日期 yyyy-MM-dd
|
||||
* @return
|
||||
*/
|
||||
List<VisitCount> getPvCounts(String startDate, String endDate);
|
||||
|
||||
/**
|
||||
* 统计IP数
|
||||
*
|
||||
* @param startDate 开始日期 yyyy-MM-dd
|
||||
* @param endDate 结束日期 yyyy-MM-dd
|
||||
* @return
|
||||
*/
|
||||
List<VisitCount> getIpCounts(String startDate, String endDate);
|
||||
|
||||
/**
|
||||
* 获取浏览量(PV)统计数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
VisitStatsVO getPvStats();
|
||||
|
||||
/**
|
||||
* 获取IP统计数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
VisitStatsVO getIpStats();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.boot.system.model.bo.RouteBO;
|
||||
import com.youlai.boot.system.model.entity.SysMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 菜单访问层
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2022/1/24
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
|
||||
/**
|
||||
* 获取菜单路由列表
|
||||
*/
|
||||
List<RouteBO> listRoutes(Set<String> roles);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.boot.system.model.entity.SysRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取最大范围的数据权限
|
||||
*
|
||||
* @param roles
|
||||
* @return
|
||||
*/
|
||||
Integer getMaximumDataScope(Set<String> roles);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.boot.system.model.bo.RolePermsBO;
|
||||
import com.youlai.boot.system.model.entity.SysRoleMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色菜单访问层
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/6/4
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {
|
||||
|
||||
/**
|
||||
* 获取角色拥有的菜单ID集合
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 菜单ID集合
|
||||
*/
|
||||
List<Long> listMenuIdsByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 获取权限和拥有权限的角色列表
|
||||
*/
|
||||
List<RolePermsBO> getRolePermsList(String roleCode);
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色权限集合
|
||||
*
|
||||
* @param roles
|
||||
* @return
|
||||
*/
|
||||
Set<String> listRolePerms(Set<String> roles);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.bo.UserBO;
|
||||
import com.youlai.boot.system.model.entity.SysUser;
|
||||
import com.youlai.boot.system.model.query.UserPageQuery;
|
||||
import com.youlai.boot.system.model.form.UserForm;
|
||||
import com.youlai.boot.common.annotation.DataPermission;
|
||||
import com.youlai.boot.system.model.dto.UserAuthInfo;
|
||||
import com.youlai.boot.system.model.dto.UserExportDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户持久层
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
|
||||
/**
|
||||
* 获取用户分页列表
|
||||
*
|
||||
* @param page
|
||||
* @param queryParams 查询参数
|
||||
* @return
|
||||
*/
|
||||
@DataPermission(deptAlias = "u")
|
||||
Page<UserBO> listPagedUsers(Page<UserBO> page, UserPageQuery queryParams);
|
||||
|
||||
/**
|
||||
* 获取用户表单详情
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return
|
||||
*/
|
||||
UserForm getUserFormData(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户名获取认证信息
|
||||
*
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
UserAuthInfo getUserAuthInfo(String username);
|
||||
|
||||
/**
|
||||
* 获取导出用户列表
|
||||
*
|
||||
* @param queryParams
|
||||
* @return
|
||||
*/
|
||||
@DataPermission(deptAlias = "u")
|
||||
List<UserExportDTO> listExportUsers(UserPageQuery queryParams);
|
||||
|
||||
/**
|
||||
* 获取用户个人中心信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return
|
||||
*/
|
||||
UserBO getUserProfile(Long userId);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.youlai.boot.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.youlai.boot.system.model.entity.SysUserRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户角色访问层
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/15
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||
|
||||
/**
|
||||
* 获取角色绑定的用户数
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
int countUsersForRole(Long roleId);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.youlai.boot.system.model.bo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "数据表字段VO")
|
||||
@Data
|
||||
public class ColumnMetaData {
|
||||
|
||||
/**
|
||||
* 字段名称
|
||||
*/
|
||||
private String columnName;
|
||||
|
||||
/**
|
||||
* 字段类型
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 字段描述
|
||||
*/
|
||||
private String columnComment;
|
||||
|
||||
/**
|
||||
* 字段长度
|
||||
*/
|
||||
private Integer characterMaximumLength;
|
||||
|
||||
/**
|
||||
* 是否主键(1-是 0-否)
|
||||
*/
|
||||
private Integer isPrimaryKey;
|
||||
|
||||
/**
|
||||
* 是否可为空(1-是 0-否)
|
||||
*/
|
||||
private String isNullable;
|
||||
|
||||
/**
|
||||
* 字符集
|
||||
*/
|
||||
private String characterSetName;
|
||||
|
||||
/**
|
||||
* 排序规则
|
||||
*/
|
||||
private String collationName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.youlai.boot.system.model.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色权限业务对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2023/11/29
|
||||
*/
|
||||
@Data
|
||||
public class RolePermsBO {
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* 权限标识集合
|
||||
*/
|
||||
private Set<String> perms;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.youlai.boot.system.model.bo;
|
||||
|
||||
import com.youlai.boot.common.enums.MenuTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 路由
|
||||
*/
|
||||
@Data
|
||||
public class RouteBO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 父菜单ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单类型(1-菜单 2-目录 3-外链 4-按钮)
|
||||
*/
|
||||
private MenuTypeEnum type;
|
||||
|
||||
/**
|
||||
* 路由名称(Vue Router 中定义的路由名称)
|
||||
*/
|
||||
private String routeName;
|
||||
|
||||
/**
|
||||
* 路由路径(Vue Router 中定义的 URL 路径)
|
||||
*/
|
||||
private String routePath;
|
||||
|
||||
/**
|
||||
* 组件路径(vue页面完整路径,省略.vue后缀)
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
*/
|
||||
private String perm;
|
||||
|
||||
/**
|
||||
* 显示状态(1:显示;0:隐藏)
|
||||
*/
|
||||
private Integer visible;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 跳转路径
|
||||
*/
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 【目录】只有一个子路由是否始终显示(1:是 0:否)
|
||||
*/
|
||||
private Integer alwaysShow;
|
||||
|
||||
/**
|
||||
* 【菜单】是否开启页面缓存(1:是 0:否)
|
||||
*/
|
||||
private Integer keepAlive;
|
||||
|
||||
/**
|
||||
* 【菜单】路由参数
|
||||
*/
|
||||
private String params;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.youlai.boot.system.model.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 数据表元数据
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Data
|
||||
public class TableMetaData {
|
||||
|
||||
/**
|
||||
* 表名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 表描述
|
||||
*/
|
||||
private String tableComment;
|
||||
|
||||
/**
|
||||
* 排序规则
|
||||
*/
|
||||
private String tableCollation;
|
||||
|
||||
/**
|
||||
* 存储引擎
|
||||
*/
|
||||
private String engine;
|
||||
|
||||
/**
|
||||
* 字符集
|
||||
*/
|
||||
private String charset;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.youlai.boot.system.model.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户持久化对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/6/10
|
||||
*/
|
||||
@Data
|
||||
public class UserBO {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 账户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 性别(1->男;2->女)
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 头像URL
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 状态: 1->启用;0->禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 角色名称,多个使用英文逗号(,)分割
|
||||
*/
|
||||
private String roleNames;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.youlai.boot.system.model.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 特定日期访问统计
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Data
|
||||
public class VisitCount {
|
||||
|
||||
/**
|
||||
* 日期 yyyy-MM-dd
|
||||
*/
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 访问次数
|
||||
*/
|
||||
private Integer count;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.youlai.boot.system.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 验证码响应对象
|
||||
*
|
||||
* @author Ray Hao
|
||||
* @since 2023/03/24
|
||||
*/
|
||||
@Schema(description = "验证码响应对象")
|
||||
@Builder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CaptchaResult {
|
||||
|
||||
@Schema(description = "验证码ID")
|
||||
private String captchaKey;
|
||||
|
||||
@Schema(description = "验证码图片Base64字符串")
|
||||
private String captchaBase64;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.youlai.boot.system.model.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* WebSocket 消息体
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChatMessage {
|
||||
|
||||
/**
|
||||
* 发送者
|
||||
*/
|
||||
private String sender;
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.youlai.boot.system.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "文件对象")
|
||||
@Data
|
||||
public class FileInfo {
|
||||
|
||||
@Schema(description = "文件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "文件URL")
|
||||
private String url;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.youlai.boot.system.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description ="登录响应对象")
|
||||
@Data
|
||||
@Builder
|
||||
public class LoginResult {
|
||||
|
||||
@Schema(description = "访问token")
|
||||
private String accessToken;
|
||||
|
||||
@Schema(description = "token 类型",example = "Bearer")
|
||||
private String tokenType;
|
||||
|
||||
@Schema(description = "刷新token")
|
||||
private String refreshToken;
|
||||
|
||||
@Schema(description = "过期时间(单位:毫秒)")
|
||||
private Long expires;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.youlai.boot.system.model.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户认证信息
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/10/22
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class UserAuthInfo {
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String username;
|
||||
|
||||
private String nickname;
|
||||
|
||||
private Long deptId;
|
||||
|
||||
private String password;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Set<String> roles;
|
||||
|
||||
private Set<String> perms;
|
||||
|
||||
private Integer dataScope;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.youlai.boot.system.model.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户导出视图对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/4/11 8:46
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ColumnWidth(20)
|
||||
public class UserExportDTO {
|
||||
|
||||
@ExcelProperty(value = "用户名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ExcelProperty(value = "部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty(value = "性别")
|
||||
private String gender;
|
||||
|
||||
@ExcelProperty(value = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
@ExcelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
@ExcelProperty(value = "创建时间")
|
||||
@DateTimeFormat("yyyy/MM/dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.youlai.boot.system.model.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户导入对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/4/10
|
||||
*/
|
||||
@Data
|
||||
public class UserImportDTO {
|
||||
|
||||
@ExcelProperty(value = "用户名")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty(value = "昵称")
|
||||
private String nickname;
|
||||
|
||||
@ExcelProperty(value = "性别")
|
||||
private String genderLabel;
|
||||
|
||||
@ExcelProperty(value = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
@ExcelProperty(value = "邮箱")
|
||||
private String email;
|
||||
|
||||
@ExcelProperty("角色")
|
||||
private String roleCodes;
|
||||
|
||||
@ExcelProperty("部门")
|
||||
private String deptCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.youlai.boot.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 系统配置 实体
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-07-29 11:17:26
|
||||
*/
|
||||
@Schema(description = "系统配置")
|
||||
@TableName("sys_config")
|
||||
@Data
|
||||
public class SysConfig extends BaseEntity {
|
||||
|
||||
@Schema(description = "配置名称")
|
||||
private String configName;
|
||||
|
||||
@Schema(description = "配置键")
|
||||
private String configKey;
|
||||
|
||||
@Schema(description = "配置值")
|
||||
private String configValue;
|
||||
|
||||
@Schema(description = "描述、备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人ID")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createBy;
|
||||
|
||||
@Schema(description = "更新人ID")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Long updateBy;
|
||||
|
||||
@TableLogic(value = "0", delval = "1")
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.youlai.boot.common.base.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 部门 实体
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/06/23
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysDept extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 父节点id路径
|
||||
*/
|
||||
private String treePath;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态(1-正常 0-禁用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建人 ID
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人 ID
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.youlai.boot.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典实体
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/12/17
|
||||
*/
|
||||
@Data
|
||||
public class SysDict extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 状态(0:正常;1:禁用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典项实体
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/12/17
|
||||
*/
|
||||
@Data
|
||||
public class SysDictItem implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 字典类ID
|
||||
*/
|
||||
private Long dictId;
|
||||
|
||||
/**
|
||||
* 字典项名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字典项值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态(1-正常,0-禁用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.youlai.boot.common.enums.LogModuleEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 系统日志 实体类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Data
|
||||
public class SysLog implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 日志模块
|
||||
*/
|
||||
private LogModuleEnum module;
|
||||
|
||||
|
||||
/**
|
||||
* 日志内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 请求路径
|
||||
*/
|
||||
private String requestUri;
|
||||
|
||||
/**
|
||||
* IP 地址
|
||||
*/
|
||||
private String ip;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 浏览器
|
||||
*/
|
||||
private String browser;
|
||||
|
||||
/**
|
||||
* 浏览器版本
|
||||
*/
|
||||
private String browserVersion;
|
||||
|
||||
/**
|
||||
* 终端系统
|
||||
*/
|
||||
private String os;
|
||||
|
||||
/**
|
||||
* 执行时间(毫秒)
|
||||
*/
|
||||
private Long executionTime;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import com.youlai.boot.common.enums.MenuTypeEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 菜单 实体
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2023/3/6
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysMenu {
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 父菜单ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 菜单类型(1-菜单;2-目录;3-外链;4-按钮权限)
|
||||
*/
|
||||
private MenuTypeEnum type;
|
||||
|
||||
/**
|
||||
* 路由名称(Vue Router 中定义的路由名称)
|
||||
*/
|
||||
private String routeName;
|
||||
|
||||
/**
|
||||
* 路由路径(Vue Router 中定义的 URL 路径)
|
||||
*/
|
||||
private String routePath;
|
||||
|
||||
/**
|
||||
* 组件路径(vue页面完整路径,省略.vue后缀)
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
*/
|
||||
private String perm;
|
||||
|
||||
/**
|
||||
* 显示状态(1:显示;0:隐藏)
|
||||
*/
|
||||
private Integer visible;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 跳转路径
|
||||
*/
|
||||
private String redirect;
|
||||
|
||||
/**
|
||||
* 父节点路径,以英文逗号(,)分割
|
||||
*/
|
||||
private String treePath;
|
||||
|
||||
/**
|
||||
* 【菜单】是否开启页面缓存(1:开启;0:关闭)
|
||||
*/
|
||||
private Integer keepAlive;
|
||||
|
||||
/**
|
||||
* 【目录】只有一个子路由是否始终显示(1:是 0:否)
|
||||
*/
|
||||
private Integer alwaysShow;
|
||||
|
||||
/**
|
||||
* 路由参数
|
||||
*/
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String params;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.youlai.boot.common.base.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 角色 实体
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/6/23
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysRole extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 角色状态(1-正常 0-停用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 数据权限
|
||||
*/
|
||||
private Integer dataScope;
|
||||
|
||||
/**
|
||||
* 创建人 ID
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人 ID
|
||||
*/
|
||||
private Long updateBy;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 角色和菜单关联表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysRoleMenu {
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
private Long menuId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.youlai.boot.common.base.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 用户 实体
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SysUser extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 性别((1-男 2-女 0-保密)
|
||||
*/
|
||||
private Integer gender;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 状态((1-正常 0-禁用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 创建人 ID
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 更新人 ID
|
||||
*/
|
||||
private Long updateBy;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.youlai.boot.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 用户和角色关联表
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/12/17
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SysUserRole {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 系统配置 表单实体
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-07-29 11:17:26
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "系统配置Form实体")
|
||||
public class ConfigForm implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "配置名称不能为空")
|
||||
@Schema(description = "配置名称")
|
||||
private String configName;
|
||||
|
||||
@NotBlank(message = "配置键不能为空")
|
||||
@Schema(description = "配置键")
|
||||
private String configKey;
|
||||
|
||||
@NotBlank(message = "配置值不能为空")
|
||||
@Schema(description = "配置值")
|
||||
private String configValue;
|
||||
|
||||
@Schema(description = "描述、备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
@Schema(description = "部门表单对象")
|
||||
@Getter
|
||||
@Setter
|
||||
public class DeptForm {
|
||||
|
||||
@Schema(description="部门ID", example = "1001")
|
||||
private Long id;
|
||||
|
||||
@Schema(description="部门名称", example = "研发部")
|
||||
private String name;
|
||||
|
||||
@Schema(description="部门编号", example = "RD001")
|
||||
private String code;
|
||||
|
||||
@Schema(description="父部门ID", example = "1000")
|
||||
@NotNull(message = "父部门ID不能为空")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description="状态(1:启用;0:禁用)", example = "1")
|
||||
@Range(min = 0, max = 1, message = "状态值不正确")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="排序(数字越小排名越靠前)", example = "1")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典表单对象
|
||||
*
|
||||
* @author Ray Hao
|
||||
* @since 2.9.0
|
||||
*/
|
||||
@Schema(description = "字典")
|
||||
@Data
|
||||
public class DictForm {
|
||||
|
||||
@Schema(description = "字典ID",example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "字典名称",example = "性别")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "字典编码", example ="gender")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "字典状态(1-启用,0-禁用)", example = "1")
|
||||
@Range(min = 0, max = 1, message = "字典状态不正确")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "字典数据项列表",example = "[{\"id\":1,\"name\":\"男\",\"value\":\"1\",\"sort\":1,\"status\":1},{\"id\":2,\"name\":\"女\",\"value\":\"2\",\"sort\":2,\"status\":1}]")
|
||||
private List<DictItem> dictItems;
|
||||
|
||||
@Schema(description = "字典数据项")
|
||||
@Getter
|
||||
@Setter
|
||||
public static class DictItem {
|
||||
|
||||
@Schema(description = "字典ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "字典名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "字典值")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态(1-启用,0-禁用)")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 修改邮箱表单
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/8/19
|
||||
*/
|
||||
@Schema(description = "修改邮箱表单")
|
||||
@Data
|
||||
public class EmailChangeForm {
|
||||
|
||||
@Schema(description = "原密码")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "验证码")
|
||||
private String code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import com.youlai.boot.common.enums.MenuTypeEnum;
|
||||
import com.youlai.boot.common.model.KeyValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单表单对象
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/06/23
|
||||
*/
|
||||
@Schema(description = "菜单表单对象")
|
||||
@Data
|
||||
public class MenuForm {
|
||||
|
||||
@Schema(description = "菜单ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父菜单ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "菜单类型(1-菜单 2-目录 3-外链 4-按钮)")
|
||||
private MenuTypeEnum type;
|
||||
|
||||
@Schema(description = "路由名称")
|
||||
private String routeName;
|
||||
|
||||
@Schema(description = "路由路径")
|
||||
private String routePath;
|
||||
|
||||
@Schema(description = "组件路径(vue页面完整路径,省略.vue后缀)")
|
||||
private String component;
|
||||
|
||||
@Schema(description = "权限标识")
|
||||
private String perm;
|
||||
|
||||
@Schema(description = "显示状态(1:显示;0:隐藏)")
|
||||
@Range(max = 1, min = 0, message = "显示状态不正确")
|
||||
private Integer visible;
|
||||
|
||||
@Schema(description = "排序(数字越小排名越靠前)")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "跳转路径")
|
||||
private String redirect;
|
||||
|
||||
@Schema(description = "【菜单】是否开启页面缓存", example = "1")
|
||||
private Integer keepAlive;
|
||||
|
||||
@Schema(description = "【目录】只有一个子路由是否始终显示", example = "1")
|
||||
private Integer alwaysShow;
|
||||
|
||||
@Schema(description = "路由参数")
|
||||
private List<KeyValue> params;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 修改手机表单
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/8/19
|
||||
*/
|
||||
@Schema(description = "修改手机表单")
|
||||
@Data
|
||||
public class MobileBindingForm {
|
||||
|
||||
@Schema(description = "原密码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "验证码")
|
||||
private String code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 修改密码表单
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/8/13
|
||||
*/
|
||||
@Schema(description = "修改密码表单")
|
||||
@Data
|
||||
public class PasswordChangeForm {
|
||||
|
||||
@Schema(description = "原密码")
|
||||
private String oldPassword;
|
||||
|
||||
@Schema(description = "新密码")
|
||||
private String newPassword;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 重置密码表单
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/8/13
|
||||
*/
|
||||
@Schema(description = "重置密码表单")
|
||||
@Data
|
||||
public class PasswordResetForm {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "密码")
|
||||
private String password;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
// import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
@Schema(description = "角色表单对象")
|
||||
@Data
|
||||
public class RoleForm {
|
||||
|
||||
@Schema(description="角色ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description="角色名称")
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description="角色编码")
|
||||
@NotBlank(message = "角色编码不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description="排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description="角色状态(1-正常;0-停用)")
|
||||
@Range(max = 1, min = 0, message = "角色状态不正确")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="数据权限")
|
||||
private Integer dataScope;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户表单对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/4/12 11:04
|
||||
*/
|
||||
@Schema(description = "用户表单对象")
|
||||
@Data
|
||||
public class UserForm {
|
||||
|
||||
@Schema(description="用户ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description="用户名")
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@Schema(description="昵称")
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
private String nickname;
|
||||
|
||||
|
||||
@Schema(description="手机号码")
|
||||
@Pattern(regexp = "^$|^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$", message = "手机号码格式不正确")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description="性别")
|
||||
private Integer gender;
|
||||
|
||||
@Schema(description="用户头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description="邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(description="用户状态(1:正常;0:禁用)")
|
||||
@Range(min = 0, max = 1, message = "用户状态不正确")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description="角色ID集合")
|
||||
@NotEmpty(message = "用户角色不能为空")
|
||||
private List<Long> roleIds;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.youlai.boot.system.model.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 个人中心用户信息
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/8/13
|
||||
*/
|
||||
@Schema(description = "个人中心用户信息")
|
||||
@Data
|
||||
public class UserProfileForm {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "头像URL")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private Integer gender;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "邮箱")
|
||||
private String email;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import com.youlai.boot.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 系统配置查询对象
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-7-29 11:38:00
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "系统配置分页查询")
|
||||
public class ConfigPageQuery extends BasePageQuery {
|
||||
|
||||
@Schema(description="关键字(配置项名称/配置项值)")
|
||||
private String keywords;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 部门查询对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/6/11
|
||||
*/
|
||||
@Schema(description ="部门分页查询对象")
|
||||
@Data
|
||||
public class DeptQuery {
|
||||
|
||||
@Schema(description="关键字(部门名称)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description="状态(1->正常;0->禁用)")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
|
||||
import com.youlai.boot.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description ="字典数据项分页查询对象")
|
||||
@Data
|
||||
public class DictPageQuery extends BasePageQuery {
|
||||
|
||||
@Schema(description="关键字(字典项名称)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description="字典编码")
|
||||
private String typeCode;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import com.youlai.boot.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志分页查询对象
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Schema(description = "日志分页查询对象")
|
||||
@Getter
|
||||
@Setter
|
||||
public class LogPageQuery extends BasePageQuery {
|
||||
|
||||
@Schema(description="关键字(日志内容/请求路径/请求方法/地区/浏览器/终端系统)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description="操作时间范围")
|
||||
List<String> createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 菜单查询对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/10/28
|
||||
*/
|
||||
@Schema(description ="部门分页查询对象")
|
||||
@Data
|
||||
public class MenuQuery {
|
||||
|
||||
@Schema(description="关键字(菜单名称)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description="状态(1->显示;0->隐藏)")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import com.youlai.boot.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 权限分页查询对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/14 22:22
|
||||
*/
|
||||
@Data
|
||||
@Schema
|
||||
public class PermPageQuery extends BasePageQuery {
|
||||
|
||||
@Schema(description="权限名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description="菜单ID")
|
||||
private Long menuId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.youlai.boot.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 角色分页查询对象
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2022/6/3
|
||||
*/
|
||||
@Schema(description = "角色分页查询对象")
|
||||
@Getter
|
||||
@Setter
|
||||
public class RolePageQuery extends BasePageQuery {
|
||||
|
||||
@Schema(description="关键字(角色名称/角色编码)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description="开始日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime startDate;
|
||||
|
||||
@Schema(description="结束日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime endDate;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.youlai.boot.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据表分页查询对象
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Schema(description = "数据表分页查询对象")
|
||||
@Getter
|
||||
@Setter
|
||||
public class TablePageQuery extends BasePageQuery {
|
||||
|
||||
@Schema(description="关键字(表名)")
|
||||
private String keywords;
|
||||
|
||||
/**
|
||||
* 排除的表名
|
||||
*/
|
||||
@JsonIgnore
|
||||
private List<String> excludeTables;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.youlai.boot.system.model.query;
|
||||
|
||||
import com.youlai.boot.common.base.BasePageQuery;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户分页查询对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/14
|
||||
*/
|
||||
@Schema(description ="用户分页查询对象")
|
||||
@Data
|
||||
public class UserPageQuery extends BasePageQuery {
|
||||
|
||||
@Schema(description="关键字(用户名/昵称/手机号)")
|
||||
private String keywords;
|
||||
|
||||
@Schema(description="用户状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description="创建时间范围")
|
||||
private List<String> createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 系统配置视图对象
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-07-30 14:49
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "系统配置VO")
|
||||
public class ConfigVO {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置名称")
|
||||
private String configName;
|
||||
|
||||
@Schema(description = "配置键")
|
||||
private String configKey;
|
||||
|
||||
@Schema(description = "配置值")
|
||||
private String configValue;
|
||||
|
||||
@Schema(description = "描述、备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "部门视图对象")
|
||||
@Data
|
||||
public class DeptVO {
|
||||
|
||||
@Schema(description = "部门ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父部门ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "部门名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "部门编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态(1:启用;0:禁用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "子部门")
|
||||
private List<DeptVO> children;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime createTime;
|
||||
@Schema(description = "修改时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 字典分页VO
|
||||
*
|
||||
* @author Ray
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Schema(description = "字典分页对象")
|
||||
@Getter
|
||||
@Setter
|
||||
public class DictPageVO {
|
||||
|
||||
@Schema(description = "字典ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "字典名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "字典编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "字典状态(1-启用,0-禁用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "字典项列表")
|
||||
private List<DictItem> dictItems;
|
||||
|
||||
@Schema(description = "字典")
|
||||
@Getter
|
||||
@Setter
|
||||
public static class DictItem {
|
||||
|
||||
@Schema(description = "字典项ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "字典项名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "字典项值")
|
||||
private String value;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态(1-启用,0-禁用)")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "代码生成代码预览VO")
|
||||
@Data
|
||||
public class GeneratorPreviewVO {
|
||||
|
||||
@Schema(description = "生成文件路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "生成文件名称",example = "SysUser.java" )
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "生成文件内容")
|
||||
private String content;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.youlai.boot.common.enums.LogModuleEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 系统日志分页VO
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "系统日志分页VO")
|
||||
public class LogPageVO implements Serializable {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "日志模块")
|
||||
private LogModuleEnum module;
|
||||
|
||||
@Schema(description = "日志内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "请求路径")
|
||||
private String requestUri;
|
||||
|
||||
@Schema(description = "请求方法")
|
||||
private String method;
|
||||
|
||||
@Schema(description = "IP 地址")
|
||||
private String ip;
|
||||
|
||||
@Schema(description = "地区")
|
||||
private String region;
|
||||
|
||||
@Schema(description = "浏览器")
|
||||
private String browser;
|
||||
|
||||
@Schema(description = "终端系统")
|
||||
private String os;
|
||||
|
||||
@Schema(description = "执行时间(毫秒)")
|
||||
private Long executionTime;
|
||||
|
||||
@Schema(description = "创建人ID")
|
||||
private Long createBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "操作人")
|
||||
private String operator;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.youlai.boot.common.enums.MenuTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description ="菜单视图对象")
|
||||
@Data
|
||||
public class MenuVO {
|
||||
|
||||
@Schema(description = "菜单ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "父菜单ID")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description="菜单类型")
|
||||
private MenuTypeEnum type;
|
||||
|
||||
@Schema(description = "路由名称")
|
||||
private String routeName;
|
||||
|
||||
@Schema(description = "路由路径")
|
||||
private String routePath;
|
||||
|
||||
@Schema(description = "组件路径")
|
||||
private String component;
|
||||
|
||||
@Schema(description = "菜单排序(数字越小排名越靠前)")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "菜单是否可见(1:显示;0:隐藏)")
|
||||
private Integer visible;
|
||||
|
||||
@Schema(description = "ICON")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "跳转路径")
|
||||
private String redirect;
|
||||
|
||||
@Schema(description="按钮权限标识")
|
||||
private String perm;
|
||||
|
||||
@Schema(description = "子菜单")
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
private List<MenuVO> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description ="角色分页对象")
|
||||
@Data
|
||||
public class RolePageVO {
|
||||
|
||||
@Schema(description="角色ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description="角色名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description="角色编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description="角色状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="排序")
|
||||
private Integer sort;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 菜单路由视图对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2020/11/28
|
||||
*/
|
||||
@Schema(description = "路由对象")
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
public class RouteVO {
|
||||
|
||||
@Schema(description = "路由路径", example = "user")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "组件路径", example = "system/user/index")
|
||||
private String component;
|
||||
|
||||
@Schema(description = "跳转链接", example = "https://www.youlai.tech")
|
||||
private String redirect;
|
||||
|
||||
@Schema(description = "路由名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "路由属性")
|
||||
private Meta meta;
|
||||
|
||||
@Schema(description = "路由属性类型")
|
||||
@Data
|
||||
public static class Meta {
|
||||
|
||||
@Schema(description = "路由title")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "ICON")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "是否隐藏(true-是 false-否)", example = "true")
|
||||
private Boolean hidden;
|
||||
|
||||
@Schema(description = "【菜单】是否开启页面缓存", example = "true")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Boolean keepAlive;
|
||||
|
||||
@Schema(description = "【目录】只有一个子路由是否始终显示", example = "true")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private Boolean alwaysShow;
|
||||
|
||||
@Schema(description = "路由参数")
|
||||
private Map<String,String> params;
|
||||
}
|
||||
|
||||
@Schema(description = "子路由列表")
|
||||
private List<RouteVO> children;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Schema(description = "表视图对象")
|
||||
@Data
|
||||
public class TablePageVO {
|
||||
|
||||
@Schema(description = "表名称", example = "sys_user")
|
||||
private String tableName;
|
||||
|
||||
@Schema(description = "表描述",example = "用户表")
|
||||
private String tableComment;
|
||||
|
||||
@Schema(description = "表排序规则",example = "utf8mb4_general_ci")
|
||||
private String tableCollation;
|
||||
|
||||
@Schema(description = "存储引擎",example = "InnoDB")
|
||||
private String engine;
|
||||
|
||||
@Schema(description = "字符集",example = "utf8mb4")
|
||||
private String charset;
|
||||
|
||||
@Schema(description = "创建时间",example = "2023-08-08 08:08:08")
|
||||
private String createTime;
|
||||
|
||||
@Schema(description="是否已配置")
|
||||
private Integer isConfigured;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户登录视图对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/14
|
||||
*/
|
||||
@Schema(description ="当前登录用户视图对象")
|
||||
@Data
|
||||
public class UserInfoVO {
|
||||
|
||||
@Schema(description="用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description="用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(description="用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description="头像地址")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description="用户角色编码集合")
|
||||
private Set<String> roles;
|
||||
|
||||
@Schema(description="用户权限标识集合")
|
||||
private Set<String> perms;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户分页视图对象
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/15 9:41
|
||||
*/
|
||||
@Schema(description ="用户分页对象")
|
||||
@Data
|
||||
public class UserPageVO {
|
||||
|
||||
@Schema(description="用户ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description="用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(description="用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description="手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description="性别")
|
||||
private String genderLabel;
|
||||
|
||||
@Schema(description="用户头像地址")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description="用户邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(description="用户状态(1:启用;0:禁用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description="部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description="角色名称,多个使用英文逗号(,)分割")
|
||||
private String roleNames;
|
||||
|
||||
@Schema(description="创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 个人中心用户信息
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/8/13
|
||||
*/
|
||||
@Schema(description = "个人中心用户信息")
|
||||
@Data
|
||||
public class UserProfileVO {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "头像URL")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "性别")
|
||||
private Integer gender;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "角色名称")
|
||||
private String roleNames;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 访问量统计VO
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2024/7/2
|
||||
*/
|
||||
@Schema(description = "访问量统计VO")
|
||||
@Getter
|
||||
@Setter
|
||||
public class VisitStatsVO {
|
||||
|
||||
@Schema(description = "统计类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "今日访问量")
|
||||
private Integer todayCount;
|
||||
|
||||
@Schema(description = "总访问量")
|
||||
private Integer totalCount;
|
||||
|
||||
@Schema(description = "增长率")
|
||||
private BigDecimal growthRate;
|
||||
|
||||
@Schema(description = "统计粒度标签")
|
||||
private String granularityLabel;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.youlai.boot.system.model.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "访问趋势VO")
|
||||
@Getter
|
||||
@Setter
|
||||
public class VisitTrendVO {
|
||||
|
||||
@Schema(description = "日期列表")
|
||||
private List<String> dates;
|
||||
|
||||
@Schema(description = "浏览量(PV)")
|
||||
private List<Integer> pvList;
|
||||
|
||||
@Schema(description = "访客数(UV)")
|
||||
private List<Integer> uvList;
|
||||
|
||||
@Schema(description = "IP数")
|
||||
private List<Integer> ipList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.system.model.entity.SysConfig;
|
||||
import com.youlai.boot.system.model.form.ConfigForm;
|
||||
import com.youlai.boot.system.model.query.ConfigPageQuery;
|
||||
import com.youlai.boot.system.model.vo.ConfigVO;
|
||||
|
||||
/**
|
||||
* 系统配置Service接口
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-07-29 11:17:26
|
||||
*/
|
||||
public interface SysConfigService extends IService<SysConfig> {
|
||||
|
||||
/**
|
||||
* 分页查询系统配置
|
||||
* @param sysConfigPageQuery 查询参数
|
||||
* @return 系统配置分页列表
|
||||
*/
|
||||
IPage<ConfigVO> page(ConfigPageQuery sysConfigPageQuery);
|
||||
|
||||
/**
|
||||
* 保存系统配置
|
||||
* @param sysConfigForm 系统配置表单
|
||||
* @return 是否保存成功
|
||||
*/
|
||||
boolean save(ConfigForm sysConfigForm);
|
||||
|
||||
/**
|
||||
* 获取系统配置表单数据
|
||||
*
|
||||
* @param id 系统配置ID
|
||||
* @return 系统配置表单数据
|
||||
*/
|
||||
ConfigForm getConfigFormData(Long id);
|
||||
|
||||
/**
|
||||
* 编辑系统配置
|
||||
* @param id 系统配置ID
|
||||
* @param sysConfigForm 系统配置表单
|
||||
* @return 是否编辑成功
|
||||
*/
|
||||
boolean edit(Long id, ConfigForm sysConfigForm);
|
||||
|
||||
/**
|
||||
* 删除系统配置
|
||||
* @param ids 系统配置ID
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
boolean delete(Long ids);
|
||||
|
||||
/**
|
||||
* 刷新系统配置缓存
|
||||
* @return 是否刷新成功
|
||||
*/
|
||||
boolean refreshCache();
|
||||
|
||||
/**
|
||||
* 获取系统配置
|
||||
* @param key 配置键
|
||||
* @return 配置值
|
||||
*/
|
||||
Object getSystemConfig(String key);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.system.model.entity.SysDept;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.model.form.DeptForm;
|
||||
import com.youlai.boot.system.model.query.DeptQuery;
|
||||
import com.youlai.boot.system.model.vo.DeptVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门业务接口
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2021/8/22
|
||||
*/
|
||||
public interface SysDeptService extends IService<SysDept> {
|
||||
/**
|
||||
* 部门列表
|
||||
*
|
||||
* @return 部门列表
|
||||
*/
|
||||
List<DeptVO> getDeptList(DeptQuery queryParams);
|
||||
|
||||
/**
|
||||
* 部门树形下拉选项
|
||||
*
|
||||
* @return 部门树形下拉选项
|
||||
*/
|
||||
List<Option<Long>> listDeptOptions();
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*
|
||||
* @param formData 部门表单
|
||||
* @return 部门ID
|
||||
*/
|
||||
Long saveDept(DeptForm formData);
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @param formData 部门表单
|
||||
* @return 部门ID
|
||||
*/
|
||||
Long updateDept(Long deptId, DeptForm formData);
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*
|
||||
* @param ids 部门ID,多个以英文逗号,拼接字符串
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteByIds(String ids);
|
||||
|
||||
/**
|
||||
* 获取部门详情
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门详情
|
||||
*/
|
||||
DeptForm getDeptForm(Long deptId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.system.model.entity.SysDictItem;
|
||||
|
||||
/**
|
||||
* 字典项 接口
|
||||
*
|
||||
* @author Ray Hao
|
||||
* @since 2023/3/4
|
||||
*/
|
||||
public interface SysDictItemService extends IService<SysDictItem> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.model.entity.SysDict;
|
||||
import com.youlai.boot.system.model.form.DictForm;
|
||||
import com.youlai.boot.system.model.query.DictPageQuery;
|
||||
import com.youlai.boot.system.model.vo.DictPageVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据字典业务接口
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/10/12
|
||||
*/
|
||||
public interface SysDictService extends IService<SysDict> {
|
||||
|
||||
/**
|
||||
* 字典分页列表
|
||||
*
|
||||
* @param queryParams 分页查询对象
|
||||
* @return
|
||||
*/
|
||||
Page<DictPageVO> getDictPage(DictPageQuery queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典表单详情
|
||||
*
|
||||
* @param id 字典ID
|
||||
* @return
|
||||
*/
|
||||
DictForm getDictForm(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增字典
|
||||
*
|
||||
* @param dictForm 字典表单
|
||||
* @return
|
||||
*/
|
||||
boolean saveDict(DictForm dictForm);
|
||||
|
||||
|
||||
/**
|
||||
* 修改字典
|
||||
*
|
||||
* @param id
|
||||
* @param dictForm 字典表单
|
||||
* @return
|
||||
*/
|
||||
boolean updateDict(Long id, DictForm dictForm);
|
||||
|
||||
/**
|
||||
* 删除字典
|
||||
*
|
||||
* @param idsStr 字典ID,多个以英文逗号(,)分割
|
||||
* @return
|
||||
*/
|
||||
void deleteDictByIds(String idsStr);
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典的数据项
|
||||
*
|
||||
* @param code 字典编码
|
||||
* @return
|
||||
*/
|
||||
List<Option<Long>> listDictItemsByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Option<String>> getDictList();
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.youlai.boot.system.model.entity.SysLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.system.model.query.LogPageQuery;
|
||||
import com.youlai.boot.system.model.vo.LogPageVO;
|
||||
import com.youlai.boot.system.model.vo.VisitStatsVO;
|
||||
import com.youlai.boot.system.model.vo.VisitTrendVO;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统日志 服务接口
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2.10.0
|
||||
*/
|
||||
public interface SysLogService extends IService<SysLog> {
|
||||
|
||||
/**
|
||||
* 获取日志分页列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return
|
||||
*/
|
||||
Page<LogPageVO> listPagedLogs(LogPageQuery queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* 获取访问趋势
|
||||
*
|
||||
* @param startDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
* @return
|
||||
*/
|
||||
VisitTrendVO getVisitTrend(LocalDate startDate, LocalDate endDate);
|
||||
|
||||
/**
|
||||
* 获取访问统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<VisitStatsVO> getVisitStats();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.infrastructure.generator.model.entity.GenConfig;
|
||||
import com.youlai.boot.system.model.form.MenuForm;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.model.entity.SysMenu;
|
||||
import com.youlai.boot.system.model.query.MenuQuery;
|
||||
import com.youlai.boot.system.model.vo.MenuVO;
|
||||
import com.youlai.boot.system.model.vo.RouteVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 菜单业务接口
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2020/11/06
|
||||
*/
|
||||
public interface SysMenuService extends IService<SysMenu> {
|
||||
|
||||
/**
|
||||
* 获取菜单表格列表
|
||||
*/
|
||||
List<MenuVO> listMenus(MenuQuery queryParams);
|
||||
|
||||
/**
|
||||
* 获取菜单下拉列表
|
||||
*
|
||||
* @param onlyParent 是否只查询父级菜单
|
||||
*/
|
||||
List<Option> listMenuOptions(boolean onlyParent);
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*
|
||||
* @param menuForm 菜单表单对象
|
||||
*/
|
||||
boolean saveMenu(MenuForm menuForm);
|
||||
|
||||
/**
|
||||
* 获取路由列表
|
||||
*/
|
||||
List<RouteVO> listRoutes( Set<String> roles);
|
||||
|
||||
/**
|
||||
* 修改菜单显示状态
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @param visible 是否显示(1-显示 0-隐藏)
|
||||
*/
|
||||
boolean updateMenuVisible(Long menuId, Integer visible);
|
||||
|
||||
/**
|
||||
* 获取菜单表单数据
|
||||
*
|
||||
* @param id 菜单ID
|
||||
*/
|
||||
MenuForm getMenuForm(Long id);
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
*/
|
||||
boolean deleteMenu(Long id);
|
||||
|
||||
/**
|
||||
* 为代码生成添加菜单
|
||||
*
|
||||
* @param parentMenuId 父菜单ID
|
||||
* @param genConfig 实体名
|
||||
*/
|
||||
void saveMenu(Long parentMenuId, GenConfig genConfig);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.system.model.entity.SysRoleMenu;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色菜单业务接口
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2.5.0
|
||||
*/
|
||||
public interface SysRoleMenuService extends IService<SysRoleMenu> {
|
||||
|
||||
/**
|
||||
* 获取角色拥有的菜单ID集合
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 菜单ID集合
|
||||
*/
|
||||
List<Long> listMenuIdsByRoleId(Long roleId);
|
||||
|
||||
|
||||
/**
|
||||
* 刷新权限缓存(所有角色)
|
||||
*/
|
||||
void refreshRolePermsCache();
|
||||
|
||||
/**
|
||||
* 刷新权限缓存(指定角色)
|
||||
*
|
||||
* @param roleCode 角色编码
|
||||
*/
|
||||
void refreshRolePermsCache(String roleCode);
|
||||
|
||||
/**
|
||||
* 刷新权限缓存(修改角色编码时调用)
|
||||
*
|
||||
* @param oldRoleCode 旧角色编码
|
||||
* @param newRoleCode 新角色编码
|
||||
*/
|
||||
void refreshRolePermsCache(String oldRoleCode, String newRoleCode);
|
||||
|
||||
/**
|
||||
* 获取角色权限集合
|
||||
*
|
||||
* @param roles 角色编码集合
|
||||
* @return 权限集合
|
||||
*/
|
||||
Set<String> getRolePermsByRoleCodes(Set<String> roles);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.system.model.entity.SysRole;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.model.form.RoleForm;
|
||||
import com.youlai.boot.system.model.query.RolePageQuery;
|
||||
import com.youlai.boot.system.model.vo.RolePageVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色业务接口层
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/6/3
|
||||
*/
|
||||
public interface SysRoleService extends IService<SysRole> {
|
||||
|
||||
/**
|
||||
* 角色分页列表
|
||||
*
|
||||
* @param queryParams
|
||||
* @return
|
||||
*/
|
||||
Page<RolePageVO> getRolePage(RolePageQuery queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* 角色下拉列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Option<Long>> listRoleOptions();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param roleForm
|
||||
* @return
|
||||
*/
|
||||
boolean saveRole(RoleForm roleForm);
|
||||
|
||||
/**
|
||||
* 获取角色表单数据
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return {@link RoleForm} – 角色表单数据
|
||||
*/
|
||||
RoleForm getRoleForm(Long roleId);
|
||||
|
||||
/**
|
||||
* 修改角色状态
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param status 角色状态(1:启用;0:禁用)
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
boolean updateRoleStatus(Long roleId, Integer status);
|
||||
|
||||
/**
|
||||
* 批量删除角色
|
||||
*
|
||||
* @param ids 角色ID,多个使用英文逗号(,)分割
|
||||
* @return
|
||||
*/
|
||||
boolean deleteRoles(String ids);
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色的菜单ID集合
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 菜单ID集合(包括按钮权限ID)
|
||||
*/
|
||||
List<Long> getRoleMenuIds(Long roleId);
|
||||
|
||||
|
||||
/**
|
||||
* 修改角色的资源权限
|
||||
*
|
||||
* @param roleId
|
||||
* @param menuIds
|
||||
* @return
|
||||
*/
|
||||
boolean assignMenusToRole(Long roleId, List<Long> menuIds);
|
||||
|
||||
/**
|
||||
* 获取最大范围的数据权限
|
||||
*
|
||||
* @param roles
|
||||
* @return
|
||||
*/
|
||||
Integer getMaximumDataScope(Set<String> roles);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.system.model.entity.SysUserRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysUserRoleService extends IService<SysUserRole> {
|
||||
|
||||
/**
|
||||
* 保存用户角色
|
||||
*
|
||||
* @param userId
|
||||
* @param roleIds
|
||||
* @return
|
||||
*/
|
||||
boolean saveUserRoles(Long userId, List<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 判断角色是否存在绑定的用户
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return true:已分配 false:未分配
|
||||
*/
|
||||
boolean hasAssignedUsers(Long roleId);
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.youlai.boot.common.enums.ContactType;
|
||||
import com.youlai.boot.system.model.dto.UserAuthInfo;
|
||||
import com.youlai.boot.system.model.dto.UserExportDTO;
|
||||
import com.youlai.boot.system.model.entity.SysUser;
|
||||
import com.youlai.boot.system.model.query.UserPageQuery;
|
||||
import com.youlai.boot.system.model.vo.UserInfoVO;
|
||||
import com.youlai.boot.system.model.vo.UserPageVO;
|
||||
import com.youlai.boot.system.model.vo.UserProfileVO;
|
||||
import com.youlai.boot.system.model.form.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户业务接口
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/1/14
|
||||
*/
|
||||
public interface SysUserService extends IService<SysUser> {
|
||||
|
||||
/**
|
||||
* 用户分页列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IPage<UserPageVO> listPagedUsers(UserPageQuery queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户表单数据
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
UserForm getUserFormData(Long userId);
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param userForm 用户表单对象
|
||||
* @return
|
||||
*/
|
||||
boolean saveUser(UserForm userForm);
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param userForm 用户表单对象
|
||||
* @return
|
||||
*/
|
||||
boolean updateUser(Long userId, UserForm userForm);
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*
|
||||
* @param idsStr 用户ID,多个以英文逗号(,)分割
|
||||
* @return
|
||||
*/
|
||||
boolean deleteUsers(String idsStr);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户名获取认证信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return {@link UserAuthInfo}
|
||||
*/
|
||||
|
||||
UserAuthInfo getUserAuthInfo(String username);
|
||||
|
||||
|
||||
/**
|
||||
* 获取导出用户列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return
|
||||
*/
|
||||
List<UserExportDTO> listExportUsers(UserPageQuery queryParams);
|
||||
|
||||
|
||||
/**
|
||||
* 获取登录用户信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
UserInfoVO getCurrentUserInfo();
|
||||
|
||||
/**
|
||||
* 获取个人中心用户信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
UserProfileVO getUserProfile(Long userId);
|
||||
|
||||
/**
|
||||
* 修改个人中心用户信息
|
||||
*
|
||||
* @param formData 表单数据
|
||||
* @return
|
||||
*/
|
||||
boolean updateUserProfile(UserProfileForm formData);
|
||||
|
||||
/**
|
||||
* 修改用户密码
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param data 修改密码表单数据
|
||||
* @return
|
||||
*/
|
||||
boolean changePassword(Long userId, PasswordChangeForm data);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param password 重置后的密码
|
||||
* @return
|
||||
*/
|
||||
boolean resetPassword(Long userId, String password);
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
*
|
||||
* @param contact 联系方式
|
||||
* @param type 联系方式类型
|
||||
* @return
|
||||
*/
|
||||
boolean sendVerificationCode(String contact, ContactType type);
|
||||
|
||||
/**
|
||||
* 修改当前用户手机号
|
||||
*
|
||||
* @param data 表单数据
|
||||
* @return
|
||||
*/
|
||||
boolean bindMobile(MobileBindingForm data);
|
||||
|
||||
/**
|
||||
* 修改当前用户邮箱
|
||||
*
|
||||
* @param data 表单数据
|
||||
* @return
|
||||
*/
|
||||
boolean bindEmail(EmailChangeForm data);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.youlai.boot.system.service;
|
||||
|
||||
public interface WebsocketService {
|
||||
|
||||
void addUser(String username);
|
||||
|
||||
void removeUser(String username) ;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.youlai.boot.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.boot.common.constant.RedisConstants;
|
||||
import com.youlai.boot.system.converter.ConfigConverter;
|
||||
import com.youlai.boot.system.mapper.SysConfigMapper;
|
||||
import com.youlai.boot.system.model.entity.SysConfig;
|
||||
import com.youlai.boot.system.model.form.ConfigForm;
|
||||
import com.youlai.boot.system.model.query.ConfigPageQuery;
|
||||
import com.youlai.boot.system.model.vo.ConfigVO;
|
||||
import com.youlai.boot.system.service.SysConfigService;
|
||||
import com.youlai.boot.core.security.util.SecurityUtils;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 系统配置Service接口实现
|
||||
*
|
||||
* @author Theo
|
||||
* @since 2024-07-29 11:17:26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {
|
||||
|
||||
private final SysConfigMapper sysConfigMapper;
|
||||
|
||||
private final ConfigConverter configConverter;
|
||||
|
||||
private final RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 系统启动完成后,加载系统配置到缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
refreshCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询系统配置
|
||||
*
|
||||
* @param configPageQuery 查询参数
|
||||
* @return 系统配置分页列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<ConfigVO> page(ConfigPageQuery configPageQuery) {
|
||||
Page<SysConfig> page = new Page<>(configPageQuery.getPageNum(), configPageQuery.getPageSize());
|
||||
String keywords = configPageQuery.getKeywords();
|
||||
LambdaQueryWrapper<SysConfig> query = new LambdaQueryWrapper<SysConfig>()
|
||||
.and(StringUtils.isNotBlank(keywords),
|
||||
q -> q.like(SysConfig::getConfigKey, keywords)
|
||||
.or()
|
||||
.like(SysConfig::getConfigName, keywords)
|
||||
);
|
||||
Page<SysConfig> pageList = this.page(page, query);
|
||||
return configConverter.toPageVo(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存系统配置
|
||||
*
|
||||
* @param configForm 系统配置表单
|
||||
* @return 是否保存成功
|
||||
*/
|
||||
@Override
|
||||
public boolean save(ConfigForm configForm) {
|
||||
Assert.isTrue(
|
||||
super.count(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, configForm.getConfigKey())) == 0,
|
||||
"配置键已存在");
|
||||
SysConfig sysConfig = configConverter.toEntity(configForm);
|
||||
sysConfig.setCreateBy(SecurityUtils.getUserId());
|
||||
return this.save(sysConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统配置表单数据
|
||||
*
|
||||
* @param id 系统配置ID
|
||||
* @return 系统配置表单数据
|
||||
*/
|
||||
@Override
|
||||
public ConfigForm getConfigFormData(Long id) {
|
||||
SysConfig entity = this.getById(id);
|
||||
return configConverter.toForm(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑系统配置
|
||||
*
|
||||
* @param id 系统配置ID
|
||||
* @param configForm 系统配置表单
|
||||
* @return 是否编辑成功
|
||||
*/
|
||||
@Override
|
||||
public boolean edit(Long id, ConfigForm configForm) {
|
||||
Assert.isTrue(
|
||||
super.count(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, configForm.getConfigKey()).ne(SysConfig::getId, id)) == 0,
|
||||
"配置键已存在");
|
||||
SysConfig sysConfig = configConverter.toEntity(configForm);
|
||||
sysConfig.setUpdateBy(SecurityUtils.getUserId());
|
||||
return this.updateById(sysConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统配置
|
||||
*
|
||||
* @param id 系统配置ID
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public boolean delete(Long id) {
|
||||
if (id != null) {
|
||||
return super.remove(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getId,id));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新系统配置缓存
|
||||
*
|
||||
* @return 是否刷新成功
|
||||
*/
|
||||
@Override
|
||||
public boolean refreshCache() {
|
||||
redisTemplate.delete(RedisConstants.SYSTEM_CONFIG_KEY);
|
||||
List<SysConfig> list = this.list();
|
||||
if (list != null) {
|
||||
Map<String, String> map = list.stream().collect(Collectors.toMap(SysConfig::getConfigKey, SysConfig::getConfigValue));
|
||||
redisTemplate.opsForHash().putAll(RedisConstants.SYSTEM_CONFIG_KEY, map);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统配置
|
||||
*
|
||||
* @param key 配置键
|
||||
* @return 配置值
|
||||
*/
|
||||
@Override
|
||||
public Object getSystemConfig(String key) {
|
||||
if (StringUtils.isNotBlank(key)) {
|
||||
return redisTemplate.opsForHash().get(RedisConstants.SYSTEM_CONFIG_KEY, key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
package com.youlai.boot.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.boot.system.converter.DeptConverter;
|
||||
import com.youlai.boot.system.mapper.SysDeptMapper;
|
||||
import com.youlai.boot.system.model.entity.SysDept;
|
||||
import com.youlai.boot.system.model.form.DeptForm;
|
||||
import com.youlai.boot.system.model.query.DeptQuery;
|
||||
import com.youlai.boot.system.model.vo.DeptVO;
|
||||
import com.youlai.boot.common.constant.SymbolConstant;
|
||||
import com.youlai.boot.common.constant.SystemConstants;
|
||||
import com.youlai.boot.common.enums.StatusEnum;
|
||||
import com.youlai.boot.common.model.Option;
|
||||
import com.youlai.boot.system.service.SysDeptService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 部门 业务实现类
|
||||
*
|
||||
* @author Ray
|
||||
* @since 2021/08/22
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
|
||||
|
||||
|
||||
private final DeptConverter deptConverter;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
@Override
|
||||
public List<DeptVO> getDeptList(DeptQuery queryParams) {
|
||||
// 查询参数
|
||||
String keywords = queryParams.getKeywords();
|
||||
Integer status = queryParams.getStatus();
|
||||
|
||||
// 查询数据
|
||||
List<SysDept> deptList = this.list(
|
||||
new LambdaQueryWrapper<SysDept>()
|
||||
.like(StrUtil.isNotBlank(keywords), SysDept::getName, keywords)
|
||||
.eq(status != null, SysDept::getStatus, status)
|
||||
.orderByAsc(SysDept::getSort)
|
||||
);
|
||||
|
||||
if (CollectionUtil.isEmpty(deptList)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
// 获取所有部门ID
|
||||
Set<Long> deptIds = deptList.stream()
|
||||
.map(SysDept::getId)
|
||||
.collect(Collectors.toSet());
|
||||
// 获取父节点ID
|
||||
Set<Long> parentIds = deptList.stream()
|
||||
.map(SysDept::getParentId)
|
||||
.collect(Collectors.toSet());
|
||||
// 获取根节点ID(递归的起点),即父节点ID中不包含在部门ID中的节点,注意这里不能拿顶级部门 O 作为根节点,因为部门筛选的时候 O 会被过滤掉
|
||||
List<Long> rootIds = CollectionUtil.subtractToList(parentIds, deptIds);
|
||||
|
||||
// 递归生成部门树形列表
|
||||
return rootIds.stream()
|
||||
.flatMap(rootId -> recurDeptList(rootId, deptList).stream())
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归生成部门树形列表
|
||||
*
|
||||
* @param parentId 父ID
|
||||
* @param deptList 部门列表
|
||||
* @return 部门树形列表
|
||||
*/
|
||||
public List<DeptVO> recurDeptList(Long parentId, List<SysDept> deptList) {
|
||||
return deptList.stream()
|
||||
.filter(dept -> dept.getParentId().equals(parentId))
|
||||
.map(dept -> {
|
||||
DeptVO deptVO = deptConverter.toVo(dept);
|
||||
List<DeptVO> children = recurDeptList(dept.getId(), deptList);
|
||||
deptVO.setChildren(children);
|
||||
return deptVO;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门下拉选项
|
||||
*
|
||||
* @return 部门下拉List集合
|
||||
*/
|
||||
@Override
|
||||
public List<Option<Long>> listDeptOptions() {
|
||||
|
||||
List<SysDept> deptList = this.list(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getStatus, StatusEnum.ENABLE.getValue())
|
||||
.select(SysDept::getId, SysDept::getParentId, SysDept::getName)
|
||||
.orderByAsc(SysDept::getSort)
|
||||
);
|
||||
if (CollectionUtil.isEmpty(deptList)) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
Set<Long> deptIds = deptList.stream()
|
||||
.map(SysDept::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<Long> parentIds = deptList.stream()
|
||||
.map(SysDept::getParentId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<Long> rootIds = CollectionUtil.subtractToList(parentIds, deptIds);
|
||||
|
||||
// 递归生成部门树形列表
|
||||
return rootIds.stream()
|
||||
.flatMap(rootId -> recurDeptTreeOptions(rootId, deptList).stream())
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*
|
||||
* @param formData 部门表单
|
||||
* @return 部门ID
|
||||
*/
|
||||
@Override
|
||||
public Long saveDept(DeptForm formData) {
|
||||
// 校验部门名称是否存在
|
||||
String code = formData.getCode();
|
||||
long count = this.count(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getCode, code)
|
||||
);
|
||||
Assert.isTrue(count == 0, "部门编号已存在");
|
||||
|
||||
// form->entity
|
||||
SysDept entity = deptConverter.toEntity(formData);
|
||||
|
||||
// 生成部门路径(tree_path),格式:父节点tree_path + , + 父节点ID,用于删除部门时级联删除子部门
|
||||
String treePath = generateDeptTreePath(formData.getParentId());
|
||||
entity.setTreePath(treePath);
|
||||
|
||||
// 保存部门并返回部门ID
|
||||
boolean result = this.save(entity);
|
||||
Assert.isTrue(result, "部门保存失败");
|
||||
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取部门表单
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门表单对象
|
||||
*/
|
||||
@Override
|
||||
public DeptForm getDeptForm(Long deptId) {
|
||||
SysDept entity = this.getById(deptId);
|
||||
return deptConverter.toForm(entity);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新部门
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @param formData 部门表单
|
||||
* @return 部门ID
|
||||
*/
|
||||
@Override
|
||||
public Long updateDept(Long deptId, DeptForm formData) {
|
||||
// 校验部门名称/部门编号是否存在
|
||||
String code = formData.getCode();
|
||||
long count = this.count(new LambdaQueryWrapper<SysDept>()
|
||||
.ne(SysDept::getId, deptId)
|
||||
.eq(SysDept::getCode, code)
|
||||
);
|
||||
Assert.isTrue(count == 0, "部门编号已存在");
|
||||
|
||||
|
||||
// form->entity
|
||||
SysDept entity = deptConverter.toEntity(formData);
|
||||
entity.setId(deptId);
|
||||
|
||||
// 生成部门路径(tree_path),格式:父节点tree_path + , + 父节点ID,用于删除部门时级联删除子部门
|
||||
String treePath = generateDeptTreePath(formData.getParentId());
|
||||
entity.setTreePath(treePath);
|
||||
|
||||
// 保存部门并返回部门ID
|
||||
boolean result = this.updateById(entity);
|
||||
Assert.isTrue(result, "部门更新失败");
|
||||
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归生成部门表格层级列表
|
||||
*
|
||||
* @param parentId 父ID
|
||||
* @param deptList 部门列表
|
||||
* @return 部门表格层级列表
|
||||
*/
|
||||
public static List<Option<Long>> recurDeptTreeOptions(long parentId, List<SysDept> deptList) {
|
||||
return CollectionUtil.emptyIfNull(deptList).stream()
|
||||
.filter(dept -> dept.getParentId().equals(parentId))
|
||||
.map(dept -> {
|
||||
Option<Long> option = new Option<>(dept.getId(), dept.getName());
|
||||
List<Option<Long>> children = recurDeptTreeOptions(dept.getId(), deptList);
|
||||
if (CollectionUtil.isNotEmpty(children)) {
|
||||
option.setChildren(children);
|
||||
}
|
||||
return option;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*
|
||||
* @param ids 部门ID,多个以英文逗号,拼接字符串
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteByIds(String ids) {
|
||||
// 删除部门及子部门
|
||||
if (StrUtil.isNotBlank(ids)) {
|
||||
String[] menuIds = ids.split(SymbolConstant.COMMA);
|
||||
for (String deptId : menuIds) {
|
||||
this.remove(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getId, deptId)
|
||||
.or()
|
||||
.apply("CONCAT (',',tree_path,',') LIKE CONCAT('%,',{0},',%')", deptId));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 部门路径生成
|
||||
*
|
||||
* @param parentId 父ID
|
||||
* @return 父节点路径以英文逗号(, )分割,eg: 1,2,3
|
||||
*/
|
||||
private String generateDeptTreePath(Long parentId) {
|
||||
String treePath = null;
|
||||
if (SystemConstants.ROOT_NODE_ID.equals(parentId)) {
|
||||
treePath = String.valueOf(parentId);
|
||||
} else {
|
||||
SysDept parent = this.getById(parentId);
|
||||
if (parent != null) {
|
||||
treePath = parent.getTreePath() + SymbolConstant.COMMA + parent.getId();
|
||||
}
|
||||
}
|
||||
return treePath;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.youlai.boot.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.youlai.boot.system.mapper.SysDictItemMapper;
|
||||
import com.youlai.boot.system.model.entity.SysDictItem;
|
||||
import com.youlai.boot.system.service.SysDictItemService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 数据字典 服务实现类
|
||||
*
|
||||
* @author haoxr
|
||||
* @since 2022/10/12
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDictItem> implements SysDictItemService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loaded 100 of 181 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user