mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-24 06:14:32 +08:00
!282 System 相关表请求响应参数优化
* update 更新 system 相关表接口 (sys_role) 新增 Bo | Vo 类, 更改请求以及响应参数 ; * update 更新 system 相关表接口 (sys_notice, sys_post) 新增 Bo | Vo 类, 更改请求以及响应参数 ; * update 更新 system 相关表接口 (sys_menu) 新增 Bo | Vo 类, 更改请求以及响应参数 ; * update 更新 system 相关表接口 (sys_dict_data, sys_dict_type) 新增 Bo | Vo 类, 更改请求以及响应参数 ; * update 更新 system 相关表接口 (sys_config, sys_dept) 新增 Bo | Vo 类, 更改请求以及响应参数 ;
This commit is contained in:
@@ -2,7 +2,8 @@ package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.domain.bo.SysConfigBo;
|
||||
import com.ruoyi.system.domain.vo.SysConfigVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,7 +15,7 @@ import java.util.List;
|
||||
public interface ISysConfigService {
|
||||
|
||||
|
||||
TableDataInfo<SysConfig> selectPageConfigList(SysConfig config, PageQuery pageQuery);
|
||||
TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
@@ -22,7 +23,7 @@ public interface ISysConfigService {
|
||||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
SysConfig selectConfigById(Long configId);
|
||||
SysConfigVo selectConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
@@ -45,23 +46,23 @@ public interface ISysConfigService {
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
List<SysConfig> selectConfigList(SysConfig config);
|
||||
List<SysConfigVo> selectConfigList(SysConfigBo config);
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @param bo 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
String insertConfig(SysConfig config);
|
||||
String insertConfig(SysConfigBo bo);
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @param bo 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
String updateConfig(SysConfig config);
|
||||
String updateConfig(SysConfigBo bo);
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
@@ -91,6 +92,6 @@ public interface ISysConfigService {
|
||||
* @param config 参数信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkConfigKeyUnique(SysConfig config);
|
||||
String checkConfigKeyUnique(SysConfigBo config);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.ruoyi.system.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.ruoyi.system.domain.SysDept;
|
||||
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,7 +19,7 @@ public interface ISysDeptService {
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
List<SysDept> selectDeptList(SysDept dept);
|
||||
List<SysDeptVo> selectDeptList(SysDeptBo dept);
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
@@ -49,7 +51,7 @@ public interface ISysDeptService {
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
SysDept selectDeptById(Long deptId);
|
||||
SysDeptVo selectDeptById(Long deptId);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有子部门数(正常状态)
|
||||
@@ -81,7 +83,7 @@ public interface ISysDeptService {
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkDeptNameUnique(SysDept dept);
|
||||
String checkDeptNameUnique(SysDeptBo dept);
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
@@ -93,18 +95,18 @@ public interface ISysDeptService {
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @param bo 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDept(SysDept dept);
|
||||
int insertDept(SysDeptBo bo);
|
||||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @param bo 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDept(SysDept dept);
|
||||
int updateDept(SysDeptBo bo);
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.system.domain.SysDictData;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.bo.SysDictDataBo;
|
||||
import com.ruoyi.system.domain.vo.SysDictDataVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,7 +15,7 @@ import java.util.List;
|
||||
public interface ISysDictDataService {
|
||||
|
||||
|
||||
TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData, PageQuery pageQuery);
|
||||
TableDataInfo<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典数据
|
||||
@@ -22,7 +23,7 @@ public interface ISysDictDataService {
|
||||
* @param dictData 字典数据信息
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
List<SysDictData> selectDictDataList(SysDictData dictData);
|
||||
List<SysDictDataVo> selectDictDataList(SysDictDataBo dictData);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
@@ -39,7 +40,7 @@ public interface ISysDictDataService {
|
||||
* @param dictCode 字典数据ID
|
||||
* @return 字典数据
|
||||
*/
|
||||
SysDictData selectDictDataById(Long dictCode);
|
||||
SysDictDataVo selectDictDataById(Long dictCode);
|
||||
|
||||
/**
|
||||
* 批量删除字典数据信息
|
||||
@@ -51,16 +52,16 @@ public interface ISysDictDataService {
|
||||
/**
|
||||
* 新增保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @param bo 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
List<SysDictData> insertDictData(SysDictData dictData);
|
||||
List<SysDictDataVo> insertDictData(SysDictDataBo bo);
|
||||
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
*
|
||||
* @param dictData 字典数据信息
|
||||
* @param bo 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
List<SysDictData> updateDictData(SysDictData dictData);
|
||||
List<SysDictDataVo> updateDictData(SysDictDataBo bo);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.system.domain.SysDictData;
|
||||
import com.ruoyi.system.domain.SysDictType;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.bo.SysDictTypeBo;
|
||||
import com.ruoyi.system.domain.vo.SysDictDataVo;
|
||||
import com.ruoyi.system.domain.vo.SysDictTypeVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,7 +17,7 @@ import java.util.List;
|
||||
public interface ISysDictTypeService {
|
||||
|
||||
|
||||
TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType, PageQuery pageQuery);
|
||||
TableDataInfo<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
@@ -23,7 +25,7 @@ public interface ISysDictTypeService {
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
List<SysDictType> selectDictTypeList(SysDictType dictType);
|
||||
List<SysDictTypeVo> selectDictTypeList(SysDictTypeBo dictType);
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
@@ -38,7 +40,7 @@ public interface ISysDictTypeService {
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
List<SysDictData> selectDictDataByType(String dictType);
|
||||
List<SysDictDataVo> selectDictDataByType(String dictType);
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
@@ -46,7 +48,7 @@ public interface ISysDictTypeService {
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
SysDictType selectDictTypeById(Long dictId);
|
||||
SysDictTypeVo selectDictTypeById(Long dictId);
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
@@ -54,7 +56,7 @@ public interface ISysDictTypeService {
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
SysDictType selectDictTypeByType(String dictType);
|
||||
SysDictTypeVo selectDictTypeByType(String dictType);
|
||||
|
||||
/**
|
||||
* 批量删除字典信息
|
||||
@@ -81,18 +83,18 @@ public interface ISysDictTypeService {
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @param bo 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
List<SysDictData> insertDictType(SysDictType dictType);
|
||||
List<SysDictTypeVo> insertDictType(SysDictTypeBo bo);
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @param bo 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
List<SysDictData> updateDictType(SysDictType dictType);
|
||||
List<SysDictDataVo> updateDictType(SysDictTypeBo bo);
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
@@ -100,5 +102,5 @@ public interface ISysDictTypeService {
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
String checkDictTypeUnique(SysDictType dictType);
|
||||
String checkDictTypeUnique(SysDictTypeBo dictType);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.ruoyi.system.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.ruoyi.system.domain.SysMenu;
|
||||
import com.ruoyi.system.domain.bo.SysMenuBo;
|
||||
import com.ruoyi.system.domain.vo.RouterVo;
|
||||
import com.ruoyi.system.domain.vo.SysMenuVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -85,7 +87,7 @@ public interface ISysMenuService {
|
||||
* @param menuId 菜单ID
|
||||
* @return 菜单信息
|
||||
*/
|
||||
SysMenu selectMenuById(Long menuId);
|
||||
SysMenuVo selectMenuById(Long menuId);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
@@ -106,18 +108,18 @@ public interface ISysMenuService {
|
||||
/**
|
||||
* 新增保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @param bo 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertMenu(SysMenu menu);
|
||||
int insertMenu(SysMenuBo bo);
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @param bo 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateMenu(SysMenu menu);
|
||||
int updateMenu(SysMenuBo bo);
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
@@ -133,5 +135,5 @@ public interface ISysMenuService {
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkMenuNameUnique(SysMenu menu);
|
||||
String checkMenuNameUnique(SysMenuBo menu);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.domain.bo.SysNoticeBo;
|
||||
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,7 +15,7 @@ import java.util.List;
|
||||
public interface ISysNoticeService {
|
||||
|
||||
|
||||
TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice, PageQuery pageQuery);
|
||||
TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询公告信息
|
||||
@@ -22,7 +23,7 @@ public interface ISysNoticeService {
|
||||
* @param noticeId 公告ID
|
||||
* @return 公告信息
|
||||
*/
|
||||
SysNotice selectNoticeById(Long noticeId);
|
||||
SysNoticeVo selectNoticeById(Long noticeId);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
@@ -30,23 +31,23 @@ public interface ISysNoticeService {
|
||||
* @param notice 公告信息
|
||||
* @return 公告集合
|
||||
*/
|
||||
List<SysNotice> selectNoticeList(SysNotice notice);
|
||||
List<SysNoticeVo> selectNoticeList(SysNoticeBo notice);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @param bo 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertNotice(SysNotice notice);
|
||||
int insertNotice(SysNoticeBo bo);
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @param bo 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateNotice(SysNotice notice);
|
||||
int updateNotice(SysNoticeBo bo);
|
||||
|
||||
/**
|
||||
* 删除公告信息
|
||||
|
||||
@@ -2,7 +2,8 @@ package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.bo.SysPostBo;
|
||||
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,7 +15,7 @@ import java.util.List;
|
||||
public interface ISysPostService {
|
||||
|
||||
|
||||
TableDataInfo<SysPost> selectPagePostList(SysPost post, PageQuery pageQuery);
|
||||
TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询岗位信息集合
|
||||
@@ -22,14 +23,14 @@ public interface ISysPostService {
|
||||
* @param post 岗位信息
|
||||
* @return 岗位列表
|
||||
*/
|
||||
List<SysPost> selectPostList(SysPost post);
|
||||
List<SysPostVo> selectPostList(SysPostBo post);
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
List<SysPost> selectPostAll();
|
||||
List<SysPostVo> selectPostAll();
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位信息
|
||||
@@ -37,7 +38,7 @@ public interface ISysPostService {
|
||||
* @param postId 岗位ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
SysPost selectPostById(Long postId);
|
||||
SysPostVo selectPostById(Long postId);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取岗位选择框列表
|
||||
@@ -53,7 +54,7 @@ public interface ISysPostService {
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkPostNameUnique(SysPost post);
|
||||
String checkPostNameUnique(SysPostBo post);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
@@ -61,7 +62,7 @@ public interface ISysPostService {
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkPostCodeUnique(SysPost post);
|
||||
String checkPostCodeUnique(SysPostBo post);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
@@ -90,16 +91,16 @@ public interface ISysPostService {
|
||||
/**
|
||||
* 新增保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @param bo 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertPost(SysPost post);
|
||||
int insertPost(SysPostBo bo);
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @param bo 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updatePost(SysPost post);
|
||||
int updatePost(SysPostBo bo);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.domain.bo.SysRoleBo;
|
||||
import com.ruoyi.system.domain.vo.SysRoleVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -16,7 +17,7 @@ import java.util.Set;
|
||||
public interface ISysRoleService {
|
||||
|
||||
|
||||
TableDataInfo<SysRole> selectPageRoleList(SysRole role, PageQuery pageQuery);
|
||||
TableDataInfo<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
@@ -24,7 +25,7 @@ public interface ISysRoleService {
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
List<SysRole> selectRoleList(SysRole role);
|
||||
List<SysRoleVo> selectRoleList(SysRoleBo role);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色列表
|
||||
@@ -32,7 +33,7 @@ public interface ISysRoleService {
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
List<SysRole> selectRolesByUserId(Long userId);
|
||||
List<SysRoleVo> selectRolesByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色权限
|
||||
@@ -47,7 +48,7 @@ public interface ISysRoleService {
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
List<SysRole> selectRoleAll();
|
||||
List<SysRoleVo> selectRoleAll();
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
@@ -63,7 +64,7 @@ public interface ISysRoleService {
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
SysRole selectRoleById(Long roleId);
|
||||
SysRoleVo selectRoleById(Long roleId);
|
||||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
@@ -71,7 +72,7 @@ public interface ISysRoleService {
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkRoleNameUnique(SysRole role);
|
||||
String checkRoleNameUnique(SysRoleBo role);
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
@@ -79,14 +80,14 @@ public interface ISysRoleService {
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkRoleKeyUnique(SysRole role);
|
||||
String checkRoleKeyUnique(SysRoleBo role);
|
||||
|
||||
/**
|
||||
* 校验角色是否允许操作
|
||||
*
|
||||
* @param role 角色信息
|
||||
*/
|
||||
void checkRoleAllowed(SysRole role);
|
||||
void checkRoleAllowed(SysRoleBo role);
|
||||
|
||||
/**
|
||||
* 校验角色是否有数据权限
|
||||
@@ -106,34 +107,34 @@ public interface ISysRoleService {
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertRole(SysRole role);
|
||||
int insertRole(SysRoleBo bo);
|
||||
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateRole(SysRole role);
|
||||
int updateRole(SysRoleBo bo);
|
||||
|
||||
/**
|
||||
* 修改角色状态
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateRoleStatus(SysRole role);
|
||||
int updateRoleStatus(SysRoleBo bo);
|
||||
|
||||
/**
|
||||
* 修改数据权限信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
int authDataScope(SysRole role);
|
||||
int authDataScope(SysRoleBo bo);
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.constant.CacheNames;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
@@ -15,6 +17,8 @@ import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.redis.utils.CacheUtils;
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.system.domain.SysConfig;
|
||||
import com.ruoyi.system.domain.bo.SysConfigBo;
|
||||
import com.ruoyi.system.domain.vo.SysConfigVo;
|
||||
import com.ruoyi.system.mapper.SysConfigMapper;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -38,15 +42,9 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
private final SysConfigMapper baseMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysConfig> selectPageConfigList(SysConfig config, PageQuery pageQuery) {
|
||||
Map<String, Object> params = config.getParams();
|
||||
LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>()
|
||||
.like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName())
|
||||
.eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType())
|
||||
.like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey())
|
||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
Page<SysConfig> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
||||
public TableDataInfo<SysConfigVo> selectPageConfigList(SysConfigBo config, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
||||
Page<SysConfigVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@@ -58,8 +56,8 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
*/
|
||||
@Override
|
||||
@DS("master")
|
||||
public SysConfig selectConfigById(Long configId) {
|
||||
return baseMapper.selectById(configId);
|
||||
public SysConfigVo selectConfigById(Long configId) {
|
||||
return baseMapper.selectVoById(configId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,26 +98,32 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysConfig> selectConfigList(SysConfig config) {
|
||||
Map<String, Object> params = config.getParams();
|
||||
LambdaQueryWrapper<SysConfig> lqw = new LambdaQueryWrapper<SysConfig>()
|
||||
.like(StringUtils.isNotBlank(config.getConfigName()), SysConfig::getConfigName, config.getConfigName())
|
||||
.eq(StringUtils.isNotBlank(config.getConfigType()), SysConfig::getConfigType, config.getConfigType())
|
||||
.like(StringUtils.isNotBlank(config.getConfigKey()), SysConfig::getConfigKey, config.getConfigKey())
|
||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
return baseMapper.selectList(lqw);
|
||||
public List<SysConfigVo> selectConfigList(SysConfigBo config) {
|
||||
LambdaQueryWrapper<SysConfig> lqw = buildQueryWrapper(config);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysConfig> buildQueryWrapper(SysConfigBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysConfig> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getConfigName()), SysConfig::getConfigName, bo.getConfigName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getConfigType()), SysConfig::getConfigType, bo.getConfigType());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getConfigKey()), SysConfig::getConfigKey, bo.getConfigKey());
|
||||
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @param bo 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#config.configKey")
|
||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#bo.configKey")
|
||||
@Override
|
||||
public String insertConfig(SysConfig config) {
|
||||
public String insertConfig(SysConfigBo bo) {
|
||||
SysConfig config = BeanUtil.toBean(bo, SysConfig.class);
|
||||
int row = baseMapper.insert(config);
|
||||
if (row > 0) {
|
||||
return config.getConfigValue();
|
||||
@@ -130,13 +134,14 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
/**
|
||||
* 修改参数配置
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @param bo 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#config.configKey")
|
||||
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#bo.configKey")
|
||||
@Override
|
||||
public String updateConfig(SysConfig config) {
|
||||
public String updateConfig(SysConfigBo bo) {
|
||||
int row = 0;
|
||||
SysConfig config = BeanUtil.toBean(bo, SysConfig.class);
|
||||
if (config.getConfigId() != null) {
|
||||
SysConfig temp = baseMapper.selectById(config.getConfigId());
|
||||
if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) {
|
||||
@@ -161,7 +166,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
@Override
|
||||
public void deleteConfigByIds(Long[] configIds) {
|
||||
for (Long configId : configIds) {
|
||||
SysConfig config = selectConfigById(configId);
|
||||
SysConfig config = baseMapper.selectById(configId);
|
||||
if (StringUtils.equals(UserConstants.YES, config.getConfigType())) {
|
||||
throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
|
||||
}
|
||||
@@ -175,7 +180,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
*/
|
||||
@Override
|
||||
public void loadingConfigCache() {
|
||||
List<SysConfig> configsList = selectConfigList(new SysConfig());
|
||||
List<SysConfigVo> configsList = selectConfigList(new SysConfigBo());
|
||||
configsList.forEach(config ->
|
||||
CacheUtils.put(CacheNames.SYS_CONFIG, config.getConfigKey(), config.getConfigValue()));
|
||||
}
|
||||
@@ -204,7 +209,7 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkConfigKeyUnique(SysConfig config) {
|
||||
public String checkConfigKeyUnique(SysConfigBo config) {
|
||||
long configId = ObjectUtil.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
||||
SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey()));
|
||||
if (ObjectUtil.isNotNull(info) && info.getConfigId() != configId) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.system.domain.SysDept;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
@@ -15,6 +17,8 @@ import com.ruoyi.common.mybatis.helper.DataBaseHelper;
|
||||
import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.utils.TreeBuildUtils;
|
||||
import com.ruoyi.system.domain.bo.SysDeptBo;
|
||||
import com.ruoyi.system.domain.vo.SysDeptVo;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
@@ -46,15 +50,8 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysDept> selectDeptList(SysDept dept) {
|
||||
LambdaQueryWrapper<SysDept> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SysDept::getDelFlag, "0")
|
||||
.eq(ObjectUtil.isNotNull(dept.getDeptId()), SysDept::getDeptId, dept.getDeptId())
|
||||
.eq(ObjectUtil.isNotNull(dept.getParentId()), SysDept::getParentId, dept.getParentId())
|
||||
.like(StringUtils.isNotBlank(dept.getDeptName()), SysDept::getDeptName, dept.getDeptName())
|
||||
.eq(StringUtils.isNotBlank(dept.getStatus()), SysDept::getStatus, dept.getStatus())
|
||||
.orderByAsc(SysDept::getParentId)
|
||||
.orderByAsc(SysDept::getOrderNum);
|
||||
public List<SysDeptVo> selectDeptList(SysDeptBo dept) {
|
||||
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(dept);
|
||||
return baseMapper.selectDeptList(lqw);
|
||||
}
|
||||
|
||||
@@ -66,10 +63,24 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
*/
|
||||
@Override
|
||||
public List<Tree<Long>> selectDeptTreeList(SysDept dept) {
|
||||
List<SysDept> depts = this.selectDeptList(dept);
|
||||
SysDeptBo bo = BeanUtil.toBean(dept, SysDeptBo.class);
|
||||
LambdaQueryWrapper<SysDept> lqw = buildQueryWrapper(bo);
|
||||
List<SysDept> depts = baseMapper.selectList(lqw);
|
||||
return buildDeptTreeSelect(depts);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysDept> buildQueryWrapper(SysDeptBo bo) {
|
||||
LambdaQueryWrapper<SysDept> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SysDept::getDelFlag, "0");
|
||||
lqw.eq(ObjectUtil.isNotNull(bo.getDeptId()), SysDept::getDeptId, bo.getDeptId());
|
||||
lqw.eq(ObjectUtil.isNotNull(bo.getParentId()), SysDept::getParentId, bo.getParentId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), SysDept::getDeptName, bo.getDeptName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDept::getStatus, bo.getStatus());
|
||||
lqw.orderByAsc(SysDept::getParentId);
|
||||
lqw.orderByAsc(SysDept::getOrderNum);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
@@ -107,9 +118,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
* @return 部门信息
|
||||
*/
|
||||
@Override
|
||||
public SysDept selectDeptById(Long deptId) {
|
||||
SysDept dept = baseMapper.selectById(deptId);
|
||||
SysDept parentDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
||||
public SysDeptVo selectDeptById(Long deptId) {
|
||||
SysDeptVo dept = baseMapper.selectVoById(deptId);
|
||||
SysDeptVo parentDept = baseMapper.selectVoOne(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
||||
dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null);
|
||||
return dept;
|
||||
@@ -159,7 +170,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDeptNameUnique(SysDept dept) {
|
||||
public String checkDeptNameUnique(SysDeptBo dept) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getDeptName, dept.getDeptName())
|
||||
.eq(SysDept::getParentId, dept.getParentId())
|
||||
@@ -178,9 +189,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
@Override
|
||||
public void checkDeptDataScope(Long deptId) {
|
||||
if (!LoginHelper.isAdmin()) {
|
||||
SysDept dept = new SysDept();
|
||||
SysDeptBo dept = new SysDeptBo();
|
||||
dept.setDeptId(deptId);
|
||||
List<SysDept> depts = this.selectDeptList(dept);
|
||||
List<SysDeptVo> depts = this.selectDeptList(dept);
|
||||
if (CollUtil.isEmpty(depts)) {
|
||||
throw new ServiceException("没有权限访问部门数据!");
|
||||
}
|
||||
@@ -190,16 +201,17 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @param bo 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDept(SysDept dept) {
|
||||
SysDept info = baseMapper.selectById(dept.getParentId());
|
||||
public int insertDept(SysDeptBo bo) {
|
||||
SysDept info = baseMapper.selectById(bo.getParentId());
|
||||
// 如果父节点不为正常状态,则不允许新增子节点
|
||||
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
|
||||
throw new ServiceException("部门停用,不允许新增");
|
||||
}
|
||||
SysDept dept = BeanUtil.toBean(bo, SysDept.class);
|
||||
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
|
||||
return baseMapper.insert(dept);
|
||||
}
|
||||
@@ -207,11 +219,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @param bo 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDept(SysDept dept) {
|
||||
public int updateDept(SysDeptBo bo) {
|
||||
SysDept dept = BeanUtil.toBean(bo, SysDept.class);
|
||||
SysDept newParentDept = baseMapper.selectById(dept.getParentId());
|
||||
SysDept oldDept = baseMapper.selectById(dept.getDeptId());
|
||||
if (ObjectUtil.isNotNull(newParentDept) && ObjectUtil.isNotNull(oldDept)) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.constant.CacheNames;
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
@@ -9,6 +11,8 @@ import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.redis.utils.CacheUtils;
|
||||
import com.ruoyi.system.domain.bo.SysDictDataBo;
|
||||
import com.ruoyi.system.domain.vo.SysDictDataVo;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -29,13 +33,9 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
private final SysDictDataMapper baseMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysDictData> selectPageDictDataList(SysDictData dictData, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysDictData> lqw = new LambdaQueryWrapper<SysDictData>()
|
||||
.eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType())
|
||||
.like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel())
|
||||
.eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus())
|
||||
.orderByAsc(SysDictData::getDictSort);
|
||||
Page<SysDictData> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
||||
public TableDataInfo<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
||||
Page<SysDictDataVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@@ -46,12 +46,19 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysDictData> selectDictDataList(SysDictData dictData) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysDictData>()
|
||||
.eq(StringUtils.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType())
|
||||
.like(StringUtils.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel())
|
||||
.eq(StringUtils.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus())
|
||||
.orderByAsc(SysDictData::getDictSort));
|
||||
public List<SysDictDataVo> selectDictDataList(SysDictDataBo dictData) {
|
||||
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysDictData> buildQueryWrapper(SysDictDataBo bo) {
|
||||
LambdaQueryWrapper<SysDictData> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getDictSort() != null, SysDictData::getDictSort, bo.getDictSort());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDictLabel()), SysDictData::getDictLabel, bo.getDictLabel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDictType()), SysDictData::getDictType, bo.getDictType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDictData::getStatus, bo.getStatus());
|
||||
lqw.orderByAsc(SysDictData::getDictSort);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,8 +84,8 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
* @return 字典数据
|
||||
*/
|
||||
@Override
|
||||
public SysDictData selectDictDataById(Long dictCode) {
|
||||
return baseMapper.selectById(dictCode);
|
||||
public SysDictDataVo selectDictDataById(Long dictCode) {
|
||||
return baseMapper.selectVoById(dictCode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +96,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
@Override
|
||||
public void deleteDictDataByIds(Long[] dictCodes) {
|
||||
for (Long dictCode : dictCodes) {
|
||||
SysDictData data = selectDictDataById(dictCode);
|
||||
SysDictData data = baseMapper.selectById(dictCode);
|
||||
baseMapper.deleteById(dictCode);
|
||||
CacheUtils.evict(CacheNames.SYS_DICT, data.getDictType());
|
||||
}
|
||||
@@ -98,12 +105,13 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
/**
|
||||
* 新增保存字典数据信息
|
||||
*
|
||||
* @param data 字典数据信息
|
||||
* @param bo 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#data.dictType")
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
||||
@Override
|
||||
public List<SysDictData> insertDictData(SysDictData data) {
|
||||
public List<SysDictDataVo> insertDictData(SysDictDataBo bo) {
|
||||
SysDictData data = BeanUtil.toBean(bo, SysDictData.class);
|
||||
int row = baseMapper.insert(data);
|
||||
if (row > 0) {
|
||||
return baseMapper.selectDictDataByType(data.getDictType());
|
||||
@@ -114,12 +122,13 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
/**
|
||||
* 修改保存字典数据信息
|
||||
*
|
||||
* @param data 字典数据信息
|
||||
* @param bo 字典数据信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#data.dictType")
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
||||
@Override
|
||||
public List<SysDictData> updateDictData(SysDictData data) {
|
||||
public List<SysDictDataVo> updateDictData(SysDictDataBo bo) {
|
||||
SysDictData data = BeanUtil.toBean(bo, SysDictData.class);
|
||||
int row = baseMapper.updateById(data);
|
||||
if (row > 0) {
|
||||
return baseMapper.selectDictDataByType(data.getDictType());
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.constant.CacheNames;
|
||||
@@ -19,6 +21,9 @@ import com.ruoyi.common.core.utils.StreamUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.redis.utils.CacheUtils;
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.system.domain.bo.SysDictTypeBo;
|
||||
import com.ruoyi.system.domain.vo.SysDictDataVo;
|
||||
import com.ruoyi.system.domain.vo.SysDictTypeVo;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import com.ruoyi.system.mapper.SysDictTypeMapper;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
@@ -44,15 +49,9 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
private final SysDictDataMapper dictDataMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType, PageQuery pageQuery) {
|
||||
Map<String, Object> params = dictType.getParams();
|
||||
LambdaQueryWrapper<SysDictType> lqw = new LambdaQueryWrapper<SysDictType>()
|
||||
.like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName())
|
||||
.eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus())
|
||||
.like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType())
|
||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
Page<SysDictType> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
||||
public TableDataInfo<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
||||
Page<SysDictTypeVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@@ -63,14 +62,20 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysDictType> selectDictTypeList(SysDictType dictType) {
|
||||
Map<String, Object> params = dictType.getParams();
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysDictType>()
|
||||
.like(StringUtils.isNotBlank(dictType.getDictName()), SysDictType::getDictName, dictType.getDictName())
|
||||
.eq(StringUtils.isNotBlank(dictType.getStatus()), SysDictType::getStatus, dictType.getStatus())
|
||||
.like(StringUtils.isNotBlank(dictType.getDictType()), SysDictType::getDictType, dictType.getDictType())
|
||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime")));
|
||||
public List<SysDictTypeVo> selectDictTypeList(SysDictTypeBo dictType) {
|
||||
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysDictType> buildQueryWrapper(SysDictTypeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysDictType> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDictName()), SysDictType::getDictName, bo.getDictName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDictType()), SysDictType::getDictType, bo.getDictType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDictType::getStatus, bo.getStatus());
|
||||
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,8 +96,8 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
*/
|
||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||
@Override
|
||||
public List<SysDictData> selectDictDataByType(String dictType) {
|
||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
public List<SysDictDataVo> selectDictDataByType(String dictType) {
|
||||
List<SysDictDataVo> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
if (CollUtil.isNotEmpty(dictDatas)) {
|
||||
return dictDatas;
|
||||
}
|
||||
@@ -106,8 +111,8 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
* @return 字典类型
|
||||
*/
|
||||
@Override
|
||||
public SysDictType selectDictTypeById(Long dictId) {
|
||||
return baseMapper.selectById(dictId);
|
||||
public SysDictTypeVo selectDictTypeById(Long dictId) {
|
||||
return baseMapper.selectVoById(dictId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,8 +123,8 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
*/
|
||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||
@Override
|
||||
public SysDictType selectDictTypeByType(String dictType) {
|
||||
return baseMapper.selectById(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType));
|
||||
public SysDictTypeVo selectDictTypeByType(String dictType) {
|
||||
return baseMapper.selectVoById(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +135,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
@Override
|
||||
public void deleteDictTypeByIds(Long[] dictIds) {
|
||||
for (Long dictId : dictIds) {
|
||||
SysDictType dictType = selectDictTypeById(dictId);
|
||||
SysDictType dictType = baseMapper.selectById(dictId);
|
||||
if (dictDataMapper.exists(new LambdaQueryWrapper<SysDictData>()
|
||||
.eq(SysDictData::getDictType, dictType.getDictType()))) {
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
||||
@@ -145,11 +150,11 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
*/
|
||||
@Override
|
||||
public void loadingDictCache() {
|
||||
List<SysDictData> dictDataList = dictDataMapper.selectList(
|
||||
List<SysDictDataVo> dictDataList = dictDataMapper.selectVoList(
|
||||
new LambdaQueryWrapper<SysDictData>().eq(SysDictData::getStatus, UserConstants.DICT_NORMAL));
|
||||
Map<String, List<SysDictData>> dictDataMap = StreamUtils.groupByKey(dictDataList, SysDictData::getDictType);
|
||||
Map<String, List<SysDictDataVo>> dictDataMap = StreamUtils.groupByKey(dictDataList, SysDictDataVo::getDictType);
|
||||
dictDataMap.forEach((k,v) -> {
|
||||
List<SysDictData> dictList = StreamUtils.sorted(v, Comparator.comparing(SysDictData::getDictSort));
|
||||
List<SysDictDataVo> dictList = StreamUtils.sorted(v, Comparator.comparing(SysDictDataVo::getDictSort));
|
||||
CacheUtils.put(CacheNames.SYS_DICT, k, dictList);
|
||||
});
|
||||
}
|
||||
@@ -174,12 +179,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @param bo 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#dict.dictType")
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
||||
@Override
|
||||
public List<SysDictData> insertDictType(SysDictType dict) {
|
||||
public List<SysDictTypeVo> insertDictType(SysDictTypeBo bo) {
|
||||
SysDictType dict = BeanUtil.toBean(bo, SysDictType.class);
|
||||
int row = baseMapper.insert(dict);
|
||||
if (row > 0) {
|
||||
return new ArrayList<>();
|
||||
@@ -190,13 +196,14 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @param bo 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#dict.dictType")
|
||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<SysDictData> updateDictType(SysDictType dict) {
|
||||
public List<SysDictDataVo> updateDictType(SysDictTypeBo bo) {
|
||||
SysDictType dict = BeanUtil.toBean(bo, SysDictType.class);
|
||||
SysDictType oldDict = baseMapper.selectById(dict.getDictId());
|
||||
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
||||
.set(SysDictData::getDictType, dict.getDictType())
|
||||
@@ -212,14 +219,14 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
* @param dict 字典类型
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDictTypeUnique(SysDictType dict) {
|
||||
public String checkDictTypeUnique(SysDictTypeBo dictType) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDictType>()
|
||||
.eq(SysDictType::getDictType, dict.getDictType())
|
||||
.ne(ObjectUtil.isNotNull(dict.getDictId()), SysDictType::getDictId, dict.getDictId()));
|
||||
.eq(SysDictType::getDictType, dictType.getDictType())
|
||||
.ne(ObjectUtil.isNotNull(dictType.getDictId()), SysDictType::getDictId, dictType.getDictId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
@@ -238,13 +245,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
@Override
|
||||
public String getDictLabel(String dictType, String dictValue, String separator) {
|
||||
// 优先从本地缓存获取
|
||||
List<SysDictData> datas = (List<SysDictData>) SaHolder.getStorage().get(CacheConstants.SYS_DICT_KEY + dictType);
|
||||
List<SysDictDataVo> datas = (List<SysDictDataVo>) SaHolder.getStorage().get(CacheConstants.SYS_DICT_KEY + dictType);
|
||||
if (ObjectUtil.isNull(datas)) {
|
||||
datas = SpringUtils.getAopProxy(this).selectDictDataByType(dictType);
|
||||
SaHolder.getStorage().set(CacheConstants.SYS_DICT_KEY + dictType, datas);
|
||||
}
|
||||
|
||||
Map<String, String> map = StreamUtils.toMap(datas, SysDictData::getDictValue, SysDictData::getDictLabel);
|
||||
Map<String, String> map = StreamUtils.toMap(datas, SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel);
|
||||
if (StringUtils.containsAny(dictValue, separator)) {
|
||||
return Arrays.stream(dictValue.split(separator))
|
||||
.map(v -> map.getOrDefault(v, StringUtils.EMPTY))
|
||||
@@ -266,13 +273,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
@Override
|
||||
public String getDictValue(String dictType, String dictLabel, String separator) {
|
||||
// 优先从本地缓存获取
|
||||
List<SysDictData> datas = (List<SysDictData>) SaHolder.getStorage().get(CacheConstants.SYS_DICT_KEY + dictType);
|
||||
List<SysDictDataVo> datas = (List<SysDictDataVo>) SaHolder.getStorage().get(CacheConstants.SYS_DICT_KEY + dictType);
|
||||
if (ObjectUtil.isNull(datas)) {
|
||||
datas = SpringUtils.getAopProxy(this).selectDictDataByType(dictType);
|
||||
SaHolder.getStorage().set(CacheConstants.SYS_DICT_KEY + dictType, datas);
|
||||
}
|
||||
|
||||
Map<String, String> map = StreamUtils.toMap(datas, SysDictData::getDictLabel, SysDictData::getDictValue);
|
||||
Map<String, String> map = StreamUtils.toMap(datas, SysDictDataVo::getDictLabel, SysDictDataVo::getDictValue);
|
||||
if (StringUtils.containsAny(dictLabel, separator)) {
|
||||
return Arrays.stream(dictLabel.split(separator))
|
||||
.map(l -> map.getOrDefault(l, StringUtils.EMPTY))
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -15,8 +16,10 @@ import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||
import com.ruoyi.system.domain.SysMenu;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import com.ruoyi.system.domain.SysRoleMenu;
|
||||
import com.ruoyi.system.domain.bo.SysMenuBo;
|
||||
import com.ruoyi.system.domain.vo.MetaVo;
|
||||
import com.ruoyi.system.domain.vo.RouterVo;
|
||||
import com.ruoyi.system.domain.vo.SysMenuVo;
|
||||
import com.ruoyi.system.mapper.SysMenuMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMenuMapper;
|
||||
@@ -221,8 +224,8 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
* @return 菜单信息
|
||||
*/
|
||||
@Override
|
||||
public SysMenu selectMenuById(Long menuId) {
|
||||
return baseMapper.selectById(menuId);
|
||||
public SysMenuVo selectMenuById(Long menuId) {
|
||||
return baseMapper.selectVoById(menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,22 +253,24 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
/**
|
||||
* 新增保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @param bo 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMenu(SysMenu menu) {
|
||||
public int insertMenu(SysMenuBo bo) {
|
||||
SysMenu menu = BeanUtil.toBean(bo, SysMenu.class);
|
||||
return baseMapper.insert(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @param bo 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMenu(SysMenu menu) {
|
||||
public int updateMenu(SysMenuBo bo) {
|
||||
SysMenu menu = BeanUtil.toBean(bo, SysMenu.class);
|
||||
return baseMapper.updateById(menu);
|
||||
}
|
||||
|
||||
@@ -287,7 +292,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkMenuNameUnique(SysMenu menu) {
|
||||
public String checkMenuNameUnique(SysMenuBo menu) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysMenu>()
|
||||
.eq(SysMenu::getMenuName, menu.getMenuName())
|
||||
.eq(SysMenu::getParentId, menu.getParentId())
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.domain.bo.SysNoticeBo;
|
||||
import com.ruoyi.system.domain.vo.SysNoticeVo;
|
||||
import com.ruoyi.system.mapper.SysNoticeMapper;
|
||||
import com.ruoyi.system.service.ISysNoticeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -27,12 +31,9 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
||||
private final SysNoticeMapper baseMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysNotice> selectPageNoticeList(SysNotice notice, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysNotice> lqw = new LambdaQueryWrapper<SysNotice>()
|
||||
.like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle())
|
||||
.eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType())
|
||||
.like(ObjectUtil.isNotNull(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy());
|
||||
Page<SysNotice> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
||||
public TableDataInfo<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
||||
Page<SysNoticeVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@@ -43,8 +44,8 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
||||
* @return 公告信息
|
||||
*/
|
||||
@Override
|
||||
public SysNotice selectNoticeById(Long noticeId) {
|
||||
return baseMapper.selectById(noticeId);
|
||||
public SysNoticeVo selectNoticeById(Long noticeId) {
|
||||
return baseMapper.selectVoById(noticeId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,32 +55,40 @@ public class SysNoticeServiceImpl implements ISysNoticeService {
|
||||
* @return 公告集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysNotice> selectNoticeList(SysNotice notice) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysNotice>()
|
||||
.like(StringUtils.isNotBlank(notice.getNoticeTitle()), SysNotice::getNoticeTitle, notice.getNoticeTitle())
|
||||
.eq(StringUtils.isNotBlank(notice.getNoticeType()), SysNotice::getNoticeType, notice.getNoticeType())
|
||||
.like(ObjectUtil.isNotNull(notice.getCreateBy()), SysNotice::getCreateBy, notice.getCreateBy()));
|
||||
public List<SysNoticeVo> selectNoticeList(SysNoticeBo notice) {
|
||||
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysNotice> buildQueryWrapper(SysNoticeBo bo) {
|
||||
LambdaQueryWrapper<SysNotice> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getNoticeTitle()), SysNotice::getNoticeTitle, bo.getNoticeTitle());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getNoticeType()), SysNotice::getNoticeType, bo.getNoticeType());
|
||||
lqw.eq(ObjectUtil.isNotNull(bo.getCreateBy()), SysNotice::getCreateBy, bo.getCreateBy());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @param bo 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertNotice(SysNotice notice) {
|
||||
public int insertNotice(SysNoticeBo bo) {
|
||||
SysNotice notice = BeanUtil.toBean(bo, SysNotice.class);
|
||||
return baseMapper.insert(notice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param notice 公告信息
|
||||
* @param bo 公告信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateNotice(SysNotice notice) {
|
||||
public int updateNotice(SysNoticeBo bo) {
|
||||
SysNotice notice = BeanUtil.toBean(bo, SysNotice.class);
|
||||
return baseMapper.updateById(notice);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
@@ -10,6 +13,8 @@ import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
import com.ruoyi.system.domain.bo.SysPostBo;
|
||||
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||
import com.ruoyi.system.mapper.SysPostMapper;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
@@ -32,12 +37,9 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
private final SysUserPostMapper userPostMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysPost> selectPagePostList(SysPost post, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysPost> lqw = new LambdaQueryWrapper<SysPost>()
|
||||
.like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
|
||||
.eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
|
||||
.like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName());
|
||||
Page<SysPost> page = baseMapper.selectPage(pageQuery.build(), lqw);
|
||||
public TableDataInfo<SysPostVo> selectPagePostList(SysPostBo post, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysPost> lqw = buildQueryWrapper(post);
|
||||
Page<SysPostVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@@ -48,11 +50,18 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 岗位信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysPost> selectPostList(SysPost post) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysPost>()
|
||||
.like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode())
|
||||
.eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus())
|
||||
.like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName()));
|
||||
public List<SysPostVo> selectPostList(SysPostBo post) {
|
||||
LambdaQueryWrapper<SysPost> lqw = buildQueryWrapper(post);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysPost> buildQueryWrapper(SysPostBo bo) {
|
||||
LambdaQueryWrapper<SysPost> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getPostCode()), SysPost::getPostCode, bo.getPostCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getPostName()), SysPost::getPostName, bo.getPostName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysPost::getStatus, bo.getStatus());
|
||||
lqw.orderByAsc(SysPost::getPostSort);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,8 +70,8 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 岗位列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysPost> selectPostAll() {
|
||||
return baseMapper.selectList();
|
||||
public List<SysPostVo> selectPostAll() {
|
||||
return baseMapper.selectVoList(new QueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,8 +81,8 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysPost selectPostById(Long postId) {
|
||||
return baseMapper.selectById(postId);
|
||||
public SysPostVo selectPostById(Long postId) {
|
||||
return baseMapper.selectVoById(postId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,7 +103,7 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostNameUnique(SysPost post) {
|
||||
public String checkPostNameUnique(SysPostBo post) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||
.eq(SysPost::getPostName, post.getPostName())
|
||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
||||
@@ -111,7 +120,7 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostCodeUnique(SysPost post) {
|
||||
public String checkPostCodeUnique(SysPostBo post) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||
.eq(SysPost::getPostCode, post.getPostCode())
|
||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
||||
@@ -152,7 +161,7 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
@Override
|
||||
public int deletePostByIds(Long[] postIds) {
|
||||
for (Long postId : postIds) {
|
||||
SysPost post = selectPostById(postId);
|
||||
SysPost post = baseMapper.selectById(postId);
|
||||
if (countUserPostById(postId) > 0) {
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
|
||||
}
|
||||
@@ -163,22 +172,24 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
/**
|
||||
* 新增保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @param bo 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPost(SysPost post) {
|
||||
public int insertPost(SysPostBo bo) {
|
||||
SysPost post = BeanUtil.toBean(bo, SysPost.class);
|
||||
return baseMapper.insert(post);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @param bo 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePost(SysPost post) {
|
||||
public int updatePost(SysPostBo bo) {
|
||||
SysPost post = BeanUtil.toBean(bo, SysPost.class);
|
||||
return baseMapper.updateById(post);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
@@ -18,6 +19,8 @@ import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||
import com.ruoyi.system.domain.SysRoleDept;
|
||||
import com.ruoyi.system.domain.SysRoleMenu;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
import com.ruoyi.system.domain.bo.SysRoleBo;
|
||||
import com.ruoyi.system.domain.vo.SysRoleVo;
|
||||
import com.ruoyi.system.mapper.SysRoleDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMenuMapper;
|
||||
@@ -44,8 +47,8 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
private final SysRoleDeptMapper roleDeptMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysRole> selectPageRoleList(SysRole role, PageQuery pageQuery) {
|
||||
Page<SysRole> page = baseMapper.selectPageRoleList(pageQuery.build(), this.buildQueryWrapper(role));
|
||||
public TableDataInfo<SysRoleVo> selectPageRoleList(SysRoleBo role, PageQuery pageQuery) {
|
||||
Page<SysRoleVo> page = baseMapper.selectPageRoleList(pageQuery.build(), this.buildQueryWrapper(role));
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@@ -56,18 +59,18 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> selectRoleList(SysRole role) {
|
||||
public List<SysRoleVo> selectRoleList(SysRoleBo role) {
|
||||
return baseMapper.selectRoleList(this.buildQueryWrapper(role));
|
||||
}
|
||||
|
||||
private Wrapper<SysRole> buildQueryWrapper(SysRole role) {
|
||||
Map<String, Object> params = role.getParams();
|
||||
private Wrapper<SysRole> buildQueryWrapper(SysRoleBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
QueryWrapper<SysRole> wrapper = Wrappers.query();
|
||||
wrapper.eq("r.del_flag", UserConstants.ROLE_NORMAL)
|
||||
.eq(ObjectUtil.isNotNull(role.getRoleId()), "r.role_id", role.getRoleId())
|
||||
.like(StringUtils.isNotBlank(role.getRoleName()), "r.role_name", role.getRoleName())
|
||||
.eq(StringUtils.isNotBlank(role.getStatus()), "r.status", role.getStatus())
|
||||
.like(StringUtils.isNotBlank(role.getRoleKey()), "r.role_key", role.getRoleKey())
|
||||
.eq(ObjectUtil.isNotNull(bo.getRoleId()), "r.role_id", bo.getRoleId())
|
||||
.like(StringUtils.isNotBlank(bo.getRoleName()), "r.role_name", bo.getRoleName())
|
||||
.eq(StringUtils.isNotBlank(bo.getStatus()), "r.status", bo.getStatus())
|
||||
.like(StringUtils.isNotBlank(bo.getRoleKey()), "r.role_key", bo.getRoleKey())
|
||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
||||
"r.create_time", params.get("beginTime"), params.get("endTime"))
|
||||
.orderByAsc("r.role_sort");
|
||||
@@ -81,11 +84,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> selectRolesByUserId(Long userId) {
|
||||
List<SysRole> userRoles = baseMapper.selectRolePermissionByUserId(userId);
|
||||
List<SysRole> roles = selectRoleAll();
|
||||
for (SysRole role : roles) {
|
||||
for (SysRole userRole : userRoles) {
|
||||
public List<SysRoleVo> selectRolesByUserId(Long userId) {
|
||||
List<SysRoleVo> userRoles = baseMapper.selectRolePermissionByUserId(userId);
|
||||
List<SysRoleVo> roles = selectRoleAll();
|
||||
for (SysRoleVo role : roles) {
|
||||
for (SysRoleVo userRole : userRoles) {
|
||||
if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) {
|
||||
role.setFlag(true);
|
||||
break;
|
||||
@@ -103,9 +106,9 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
*/
|
||||
@Override
|
||||
public Set<String> selectRolePermissionByUserId(Long userId) {
|
||||
List<SysRole> perms = baseMapper.selectRolePermissionByUserId(userId);
|
||||
List<SysRoleVo> perms = baseMapper.selectRolePermissionByUserId(userId);
|
||||
Set<String> permsSet = new HashSet<>();
|
||||
for (SysRole perm : perms) {
|
||||
for (SysRoleVo perm : perms) {
|
||||
if (ObjectUtil.isNotNull(perm)) {
|
||||
permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(",")));
|
||||
}
|
||||
@@ -119,8 +122,8 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> selectRoleAll() {
|
||||
return this.selectRoleList(new SysRole());
|
||||
public List<SysRoleVo> selectRoleAll() {
|
||||
return this.selectRoleList(new SysRoleBo());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,8 +144,8 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysRole selectRoleById(Long roleId) {
|
||||
return baseMapper.selectById(roleId);
|
||||
public SysRoleVo selectRoleById(Long roleId) {
|
||||
return baseMapper.selectVoById(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,7 +155,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleNameUnique(SysRole role) {
|
||||
public String checkRoleNameUnique(SysRoleBo role) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>()
|
||||
.eq(SysRole::getRoleName, role.getRoleName())
|
||||
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
||||
@@ -169,7 +172,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleKeyUnique(SysRole role) {
|
||||
public String checkRoleKeyUnique(SysRoleBo role) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>()
|
||||
.eq(SysRole::getRoleKey, role.getRoleKey())
|
||||
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
||||
@@ -185,7 +188,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @param role 角色信息
|
||||
*/
|
||||
@Override
|
||||
public void checkRoleAllowed(SysRole role) {
|
||||
public void checkRoleAllowed(SysRoleBo role) {
|
||||
if (ObjectUtil.isNotNull(role.getRoleId()) && role.isAdmin()) {
|
||||
throw new ServiceException("不允许操作超级管理员角色");
|
||||
}
|
||||
@@ -199,9 +202,9 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
@Override
|
||||
public void checkRoleDataScope(Long roleId) {
|
||||
if (!LoginHelper.isAdmin()) {
|
||||
SysRole role = new SysRole();
|
||||
SysRoleBo role = new SysRoleBo();
|
||||
role.setRoleId(roleId);
|
||||
List<SysRole> roles = this.selectRoleList(role);
|
||||
List<SysRoleVo> roles = this.selectRoleList(role);
|
||||
if (CollUtil.isEmpty(roles)) {
|
||||
throw new ServiceException("没有权限访问角色数据!");
|
||||
}
|
||||
@@ -222,12 +225,13 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertRole(SysRole role) {
|
||||
public int insertRole(SysRoleBo bo) {
|
||||
SysRole role = BeanUtil.toBean(bo, SysRole.class);
|
||||
// 新增角色信息
|
||||
baseMapper.insert(role);
|
||||
return insertRoleMenu(role);
|
||||
@@ -236,12 +240,13 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateRole(SysRole role) {
|
||||
public int updateRole(SysRoleBo bo) {
|
||||
SysRole role = BeanUtil.toBean(bo, SysRole.class);
|
||||
// 修改角色信息
|
||||
baseMapper.updateById(role);
|
||||
// 删除角色与菜单关联
|
||||
@@ -252,23 +257,25 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
/**
|
||||
* 修改角色状态
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRoleStatus(SysRole role) {
|
||||
public int updateRoleStatus(SysRoleBo bo) {
|
||||
SysRole role = BeanUtil.toBean(bo, SysRole.class);
|
||||
return baseMapper.updateById(role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据权限信息
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int authDataScope(SysRole role) {
|
||||
public int authDataScope(SysRoleBo bo) {
|
||||
SysRole role = BeanUtil.toBean(bo, SysRole.class);
|
||||
// 修改角色信息
|
||||
baseMapper.updateById(role);
|
||||
// 删除角色与部门关联
|
||||
@@ -345,9 +352,9 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteRoleByIds(Long[] roleIds) {
|
||||
for (Long roleId : roleIds) {
|
||||
checkRoleAllowed(new SysRole(roleId));
|
||||
checkRoleAllowed(new SysRoleBo(roleId));
|
||||
checkRoleDataScope(roleId);
|
||||
SysRole role = selectRoleById(roleId);
|
||||
SysRole role = baseMapper.selectById(roleId);
|
||||
if (countUserRoleByRoleId(roleId) > 0) {
|
||||
throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName()));
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.ruoyi.common.mybatis.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.mybatis.helper.DataBaseHelper;
|
||||
import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.vo.SysPostVo;
|
||||
import com.ruoyi.system.domain.vo.SysRoleVo;
|
||||
import com.ruoyi.system.mapper.*;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -164,11 +166,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
*/
|
||||
@Override
|
||||
public String selectUserRoleGroup(String userName) {
|
||||
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
||||
List<SysRoleVo> list = roleMapper.selectRolesByUserName(userName);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return StreamUtils.join(list, SysRole::getRoleName);
|
||||
return StreamUtils.join(list, SysRoleVo::getRoleName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,11 +181,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
*/
|
||||
@Override
|
||||
public String selectUserPostGroup(String userName) {
|
||||
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
||||
List<SysPostVo> list = postMapper.selectPostsByUserName(userName);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return StreamUtils.join(list, SysPost::getPostName);
|
||||
return StreamUtils.join(list, SysPostVo::getPostName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user