| | |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("根据参数编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:config:query')") |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult<SysConfig> getInfo(@PathVariable Long configId) { |
| | | public AjaxResult<SysConfig> getInfo(@ApiParam("参数ID") @PathVariable Long configId) { |
| | | return AjaxResult.success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation("根据参数键名查询参数值") |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult<Void> getConfigKey(@PathVariable String configKey) { |
| | | public AjaxResult<Void> getConfigKey(@ApiParam("参数Key") @PathVariable String configKey) { |
| | | return AjaxResult.success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] configIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("参数ID串") @PathVariable Long[] configIds) { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("查询部门列表(排除节点)") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public AjaxResult<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { |
| | | public AjaxResult<List<SysDept>> excludeChild(@ApiParam("部门ID") @PathVariable(value = "deptId", required = false) Long deptId) { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().equals(deptId) |
| | | || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | |
| | | @ApiOperation("根据部门编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| | | @GetMapping(value = "/{deptId}") |
| | | public AjaxResult<SysDept> getInfo(@PathVariable Long deptId) { |
| | | public AjaxResult<SysDept> getInfo(@ApiParam("部门ID") @PathVariable Long deptId) { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return AjaxResult.success(deptService.selectDeptById(deptId)); |
| | | } |
| | |
| | | */ |
| | | @ApiOperation("加载对应角色部门列表树") |
| | | @GetMapping(value = "/roleDeptTreeselect/{roleId}") |
| | | public AjaxResult<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { |
| | | public AjaxResult<Map<String, Object>> roleDeptTreeselect(@ApiParam("角色ID") @PathVariable("roleId") Long roleId) { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:dept:remove')") |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult<Void> remove(@PathVariable Long deptId) { |
| | | public AjaxResult<Void> remove(@ApiParam("部门ID串") @PathVariable Long deptId) { |
| | | if (deptService.hasChildByDeptId(deptId)) { |
| | | return AjaxResult.error("存在下级部门,不允许删除"); |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("查询字典数据详细") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictCode}") |
| | | public AjaxResult<SysDictData> getInfo(@PathVariable Long dictCode) { |
| | | public AjaxResult<SysDictData> getInfo(@ApiParam("字典code") @PathVariable Long dictCode) { |
| | | return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation("根据字典类型查询字典数据信息") |
| | | @GetMapping(value = "/type/{dictType}") |
| | | public AjaxResult<List<SysDictData>> dictType(@PathVariable String dictType) { |
| | | public AjaxResult<List<SysDictData>> dictType(@ApiParam("字典类型") @PathVariable String dictType) { |
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |
| | | if (StringUtils.isNull(data)) { |
| | | data = new ArrayList<>(); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] dictCodes) { |
| | | public AjaxResult<Void> remove(@ApiParam("字典code串") @PathVariable Long[] dictCodes) { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return success(); |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("查询字典类型详细") |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictId}") |
| | | public AjaxResult<SysDictType> getInfo(@PathVariable Long dictId) { |
| | | public AjaxResult<SysDictType> getInfo(@ApiParam("字典ID") @PathVariable Long dictId) { |
| | | return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] dictIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return success(); |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("根据菜单编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:menu:query')") |
| | | @GetMapping(value = "/{menuId}") |
| | | public AjaxResult<SysMenu> getInfo(@PathVariable Long menuId) { |
| | | public AjaxResult<SysMenu> getInfo(@ApiParam("菜单ID") @PathVariable Long menuId) { |
| | | return AjaxResult.success(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiOperation("加载对应角色菜单列表树") |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public AjaxResult<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { |
| | | public AjaxResult<Map<String, Object>> roleMenuTreeselect(@ApiParam("角色ID") @PathVariable("roleId") Long roleId) { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:menu:remove')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{menuId}") |
| | | public AjaxResult<Void> remove(@PathVariable("menuId") Long menuId) { |
| | | public AjaxResult<Void> remove(@ApiParam("菜单ID") @PathVariable("menuId") Long menuId) { |
| | | if (menuService.hasChildByMenuId(menuId)) { |
| | | return AjaxResult.error("存在子菜单,不允许删除"); |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysNoticeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("根据通知公告编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:notice:query')") |
| | | @GetMapping(value = "/{noticeId}") |
| | | public AjaxResult<SysNotice> getInfo(@PathVariable Long noticeId) { |
| | | public AjaxResult<SysNotice> getInfo(@ApiParam("公告ID") @PathVariable Long noticeId) { |
| | | return AjaxResult.success(noticeService.selectNoticeById(noticeId)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:notice:remove')") |
| | | @Log(title = "通知公告", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{noticeIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] noticeIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("公告ID串") @PathVariable Long[] noticeIds) { |
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysOssConfigService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("获取对象存储配置详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:query')") |
| | | @GetMapping("/{ossConfigId}") |
| | | public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空") |
| | | public AjaxResult<SysOssConfigVo> getInfo(@ApiParam("OSS配置ID") |
| | | @NotNull(message = "主键不能为空") |
| | | @PathVariable("ossConfigId") Integer ossConfigId) { |
| | | return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId)); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:oss:remove')") |
| | | @Log(title = "对象存储配置", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ossConfigIds}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | public AjaxResult<Void> remove(@ApiParam("OSS配置ID串") |
| | | @NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossConfigIds) { |
| | | return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0); |
| | | } |
| | |
| | | import com.ruoyi.system.domain.vo.SysOssVo; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysOssService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | |
| | | @ApiOperation("下载OSS对象存储") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:download')") |
| | | @GetMapping("/download/{ossId}") |
| | | public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { |
| | | public void download(@ApiParam("OSS对象ID") @PathVariable Long ossId, HttpServletResponse response) throws IOException { |
| | | SysOss sysOss = iSysOssService.getById(ossId); |
| | | if (ObjectUtil.isNull(sysOss)) { |
| | | throw new ServiceException("文件数据不存在!"); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:oss:remove')") |
| | | @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ossIds}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | public AjaxResult<Void> remove(@ApiParam("OSS对象ID串") |
| | | @NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossIds) { |
| | | return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); |
| | | } |
| | |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("根据岗位编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public AjaxResult<SysPost> getInfo(@PathVariable Long postId) { |
| | | public AjaxResult<SysPost> getInfo(@ApiParam("岗位ID") @PathVariable Long postId) { |
| | | return AjaxResult.success(postService.selectPostById(postId)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] postIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("岗位ID串") @PathVariable Long[] postIds) { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |
| | |
| | | * 重置密码 |
| | | */ |
| | | @ApiOperation("重置密码") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "oldPassword", value = "旧密码", paramType = "query"), |
| | | @ApiImplicitParam(name = "newPassword", value = "新密码", paramType = "query") |
| | | }) |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public AjaxResult<Void> updatePwd(String oldPassword, String newPassword) { |
| | |
| | | */ |
| | | @ApiOperation("头像上传") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "用户头像", dataType = "java.io.File", required = true), |
| | | @ApiImplicitParam(name = "avatarfile", value = "用户头像", dataType = "java.io.File", required = true), |
| | | }) |
| | | @Log(title = "用户头像", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/avatar") |
| | |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.SysPermissionService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("根据角色编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/{roleId}") |
| | | public AjaxResult<SysRole> getInfo(@PathVariable Long roleId) { |
| | | public AjaxResult<SysRole> getInfo(@ApiParam("角色ID") @PathVariable Long roleId) { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return AjaxResult.success(roleService.selectRoleById(roleId)); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')") |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] roleIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("岗位ID串") @PathVariable Long[] roleIds) { |
| | | return toAjax(roleService.deleteRoleByIds(roleIds)); |
| | | } |
| | | |
| | |
| | | * 批量取消授权用户 |
| | | */ |
| | | @ApiOperation("批量取消授权用户") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "query"), |
| | | @ApiImplicitParam(name = "userIds", value = "用户ID串", paramType = "query") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | |
| | | * 批量选择用户授权 |
| | | */ |
| | | @ApiOperation("批量选择用户授权") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "roleId", value = "角色ID", paramType = "query"), |
| | | @ApiImplicitParam(name = "userIds", value = "用户ID串", paramType = "query") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("根据用户编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping(value = {"/", "/{userId}"}) |
| | | public AjaxResult<Map<String, Object>> getInfo(@PathVariable(value = "userId", required = false) Long userId) { |
| | | public AjaxResult<Map<String, Object>> getInfo(@ApiParam("用户ID") @PathVariable(value = "userId", required = false) Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] userIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("角色ID串") @PathVariable Long[] userIds) { |
| | | if (ArrayUtil.contains(userIds, getUserId())) { |
| | | return error("当前用户不能删除"); |
| | | } |
| | |
| | | @ApiOperation("根据用户编号获取授权角色") |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/authRole/{userId}") |
| | | public AjaxResult<Map<String, Object>> authRole(@PathVariable("userId") Long userId) { |
| | | public AjaxResult<Map<String, Object>> authRole(@ApiParam("用户ID") @PathVariable("userId") Long userId) { |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | Map<String, Object> ajax = new HashMap<>(); |
| | |
| | | * 用户授权角色 |
| | | */ |
| | | @ApiOperation("用户授权角色") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userId", value = "用户Id", paramType = "query"), |
| | | @ApiImplicitParam(name = "roleIds", value = "角色ID串", paramType = "query") |
| | | }) |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | |
| | | |
| | | /** |
| | | * 测试 @Cacheable |
| | | * |
| | | * <p> |
| | | * 表示这个方法有了缓存的功能,方法的返回值会被缓存下来 |
| | | * 下一次调用该方法前,会去检查是否缓存中已经有值 |
| | | * 如果有就直接返回,不调用方法 |
| | | * 如果没有,就调用方法,然后把结果缓存起来 |
| | | * 这个注解「一般用在查询方法上」 |
| | | * |
| | | * <p> |
| | | * 重点说明: 缓存注解严谨与其他筛选数据功能一起使用 |
| | | * 例如: 数据权限注解 会造成 缓存击穿 与 数据不一致问题 |
| | | * |
| | | * <p> |
| | | * cacheNames 为配置文件内 groupId |
| | | */ |
| | | @ApiOperation("测试 @Cacheable") |
| | |
| | | |
| | | /** |
| | | * 测试 @CachePut |
| | | * |
| | | * <p> |
| | | * 加了@CachePut注解的方法,会把方法的返回值put到缓存里面缓存起来,供其它地方使用 |
| | | * 它「通常用在新增方法上」 |
| | | * |
| | | * <p> |
| | | * cacheNames 为 配置文件内 groupId |
| | | */ |
| | | @ApiOperation("测试 @CachePut") |
| | |
| | | |
| | | /** |
| | | * 测试 @CacheEvict |
| | | * |
| | | * <p> |
| | | * 使用了CacheEvict注解的方法,会清空指定缓存 |
| | | * 「一般用在更新或者删除的方法上」 |
| | | * |
| | | * <p> |
| | | * cacheNames 为 配置文件内 groupId |
| | | */ |
| | | @ApiOperation("测试 @CacheEvict") |
| | |
| | | import com.ruoyi.common.utils.RedisUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | |
| | | @ApiOperation("发布消息") |
| | | @GetMapping("/pub") |
| | | public AjaxResult<Void> pub(String key, String value){ |
| | | public AjaxResult<Void> pub(@ApiParam("通道Key") String key, @ApiParam("发送内容") String value) { |
| | | RedisUtils.publish(key, value, consumer -> { |
| | | System.out.println("发布通道 => " + key + ", 发送值 => " + value); |
| | | }); |
| | |
| | | |
| | | @ApiOperation("订阅消息") |
| | | @GetMapping("/sub") |
| | | public AjaxResult<Void> sub(String key){ |
| | | public AjaxResult<Void> sub(@ApiParam("通道Key") String key) { |
| | | RedisUtils.subscribe(key, String.class, msg -> { |
| | | System.out.println("订阅通道 => " + key + ", 接收值 => " + msg); |
| | | }); |
| | |
| | | import com.ruoyi.demo.service.ITestDemoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("获取测试单表详细信息") |
| | | @PreAuthorize("@ss.hasPermi('demo:demo:query')") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult<TestDemoVo> getInfo(@NotNull(message = "主键不能为空") |
| | | public AjaxResult<TestDemoVo> getInfo(@ApiParam("测试ID") |
| | | @NotNull(message = "主键不能为空") |
| | | @PathVariable("id") Long id) { |
| | | return AjaxResult.success(iTestDemoService.queryById(id)); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('demo:demo:remove')") |
| | | @Log(title = "测试单表" , businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | public AjaxResult<Void> remove(@ApiParam("测试ID串") |
| | | @NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); |
| | | } |
| | |
| | | import com.ruoyi.common.utils.MessageUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | */ |
| | | @ApiOperation("通过code获取国际化内容") |
| | | @GetMapping() |
| | | public AjaxResult<Void> get(String code) { |
| | | public AjaxResult<Void> get(@ApiParam("国际化code") String code) { |
| | | return AjaxResult.success(MessageUtils.message(code)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.demo.service.ITestTreeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("获取测试树表详细信息") |
| | | @PreAuthorize("@ss.hasPermi('demo:tree:query')") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult<TestTreeVo> getInfo(@NotNull(message = "主键不能为空") |
| | | public AjaxResult<TestTreeVo> getInfo(@ApiParam("测试树ID") |
| | | @NotNull(message = "主键不能为空") |
| | | @PathVariable("id") Long id) { |
| | | return AjaxResult.success(iTestTreeService.queryById(id)); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('demo:tree:remove')") |
| | | @Log(title = "测试树表" , businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | public AjaxResult<Void> remove(@ApiParam("测试树ID串") |
| | | @NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); |
| | | } |
| | |
| | | #elseif($table.tree) |
| | | #end |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | /** |
| | |
| | | @ApiOperation("获取${functionName}详细信息") |
| | | @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") |
| | | @GetMapping("/{${pkColumn.javaField}}") |
| | | public AjaxResult<${ClassName}Vo> getInfo(@NotNull(message = "主键不能为空") |
| | | public AjaxResult<${ClassName}Vo> getInfo(@ApiParam("主键") |
| | | @NotNull(message = "主键不能为空") |
| | | @PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) { |
| | | return AjaxResult.success(i${ClassName}Service.queryById(${pkColumn.javaField})); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") |
| | | @Log(title = "${functionName}" , businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{${pkColumn.javaField}s}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | public AjaxResult<Void> remove(@ApiParam("主键串") |
| | | @NotEmpty(message = "主键不能为空") |
| | | @PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) { |
| | | return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true) ? 1 : 0); |
| | | } |