🎉 优化 infra 模块逻辑.

This commit is contained in:
lijiahangmax
2025-06-25 19:06:08 +08:00
parent f69093de66
commit c603c57ad8
43 changed files with 797 additions and 298 deletions

View File

@@ -97,6 +97,16 @@ public interface DataGroupUserRelApi {
*/
Future<Set<Long>> getGroupIdByRelIdAsync(DataGroupTypeEnum type, Long userId, Long relId);
/**
* 通过 relIdList 查询 groupRel
*
* @param type type
* @param userId userId
* @param relIdList relIdList
* @return rows
*/
Map<Long, Set<Long>> getGroupIdByRelIdList(DataGroupTypeEnum type, Long userId, List<Long> relIdList);
/**
* 删除数据分组关联
*

View File

@@ -22,6 +22,7 @@
*/
package org.dromara.visor.module.infra.api;
import org.dromara.visor.module.infra.entity.dto.data.DataPermissionBatchUpdateDTO;
import org.dromara.visor.module.infra.entity.dto.data.DataPermissionUpdateDTO;
import org.dromara.visor.module.infra.enums.DataPermissionTypeEnum;
@@ -37,12 +38,12 @@ import java.util.List;
public interface DataPermissionApi {
/**
* 添加数据权限
* 更新数据权限
*
* @param type type
* @param dto dto
*/
void addDataPermission(DataPermissionTypeEnum type, DataPermissionUpdateDTO dto);
void updateDataPermission(DataPermissionTypeEnum type, DataPermissionUpdateDTO dto);
/**
* 更新数据权限
@@ -50,7 +51,7 @@ public interface DataPermissionApi {
* @param type type
* @param dto dto
*/
void updateDataPermission(DataPermissionTypeEnum type, DataPermissionUpdateDTO dto);
void updateDataPermission(DataPermissionTypeEnum type, DataPermissionBatchUpdateDTO dto);
/**
* 检查用户是否有权限
@@ -62,6 +63,24 @@ public interface DataPermissionApi {
*/
boolean hasPermission(DataPermissionTypeEnum type, Long userId, Long relId);
/**
* 通过 relId 查询 userId
*
* @param type type
* @param relId relId
* @return relId
*/
List<Long> getUserIdListByRelId(DataPermissionTypeEnum type, Long relId);
/**
* 通过 relId 查询 roleId
*
* @param type type
* @param relId relId
* @return relId
*/
List<Long> getRoleIdListByRelId(DataPermissionTypeEnum type, Long relId);
/**
* 通过 userId 查询数据权限 (不包含角色 不走缓存)
*

View File

@@ -45,6 +45,22 @@ public interface OperatorLogApi {
*/
DataGrid<OperatorLogDTO> getOperatorLogPage(OperatorLogQueryDTO request);
/**
* 查询操作日志列表
*
* @param request request
* @return rows
*/
List<OperatorLogDTO> getOperatorLogList(OperatorLogQueryDTO request);
/**
* 获取操作日志数量
*
* @param request request
* @return count
*/
Long getOperatorLogCount(OperatorLogQueryDTO request);
/**
* 删除操作日志
*

View File

@@ -26,6 +26,7 @@ import org.dromara.visor.module.infra.entity.dto.tag.TagDTO;
import org.dromara.visor.module.infra.enums.TagTypeEnum;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
/**
@@ -46,6 +47,14 @@ public interface TagRelApi {
*/
void addTagRel(TagTypeEnum type, Long relId, List<Long> tagIdList);
/**
* 创建标签引用 只新增
*
* @param type type
* @param relTagIdList relTagIdList
*/
void addTagRel(TagTypeEnum type, Map<Long, List<Long>> relTagIdList);
/**
* 设置标签引用 先删除后新增
*

View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - ljh1553488six@139.com - author
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.visor.module.infra.entity.dto.data;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 数据权限 更新请求业务对象
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-11-21 10:32
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "DataPermissionBatchUpdateDTO", description = "数据权限 批量更新请求业务对象")
public class DataPermissionBatchUpdateDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
private List<Long> userIdList;
@Schema(description = "角色id")
private List<Long> roleIdList;
@Schema(description = "引用id")
private List<Long> relIdList;
}

View File

@@ -28,7 +28,6 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
@@ -50,7 +49,6 @@ public class SystemMessageDTO implements Serializable {
private static final long serialVersionUID = 1L;
@NotBlank
@Size(max = 64)
@Schema(description = "消息关联")
private String relKey;

View File

@@ -27,6 +27,7 @@ import lombok.*;
import org.dromara.visor.common.entity.BaseQueryRequest;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@@ -43,13 +44,16 @@ import java.util.List;
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Schema(name = "OperatorLogQueryDTO", description = "操作日志 查询对象")
public class OperatorLogQueryDTO extends BaseQueryRequest {
public class OperatorLogQueryDTO extends BaseQueryRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private Long id;
@Schema(description = "id less than")
private Long idLt;
@Schema(description = "用户id")
private Long userId;

View File

@@ -29,7 +29,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* 用户 业务对象

View File

@@ -22,6 +22,13 @@
<artifactId>orion-visor-common</artifactId>
</dependency>
<!-- module common -->
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-module-common</artifactId>
<version>${revision}</version>
</dependency>
<!-- module provider -->
<dependency>
<groupId>org.dromara.visor</groupId>
@@ -33,6 +40,11 @@
<artifactId>orion-visor-module-asset-provider</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.dromara.visor</groupId>
<artifactId>orion-visor-module-terminal-provider</artifactId>
<version>${revision}</version>
</dependency>
<!-- framework starter -->
<dependency>

View File

@@ -100,6 +100,14 @@ public class DataGroupUserRelApiImpl implements DataGroupUserRelApi {
return CompletableFuture.completedFuture(groupIdList);
}
@Override
public Map<Long, Set<Long>> getGroupIdByRelIdList(DataGroupTypeEnum type, Long userId, List<Long> relIdList) {
return dataGroupRelService.getGroupRelByRelIdList(type.name(), userId, relIdList)
.stream()
.collect(Collectors.groupingBy(DataGroupRelDO::getRelId,
Collectors.mapping(DataGroupRelDO::getGroupId, Collectors.toSet())));
}
@Override
public Integer deleteByRelId(DataGroupTypeEnum type, Long userId, Long relId) {
return dataGroupRelService.deleteByRelId(type.name(), userId, relId);

View File

@@ -22,10 +22,11 @@
*/
package org.dromara.visor.module.infra.api.impl;
import cn.orionsec.kit.lang.utils.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.utils.Valid;
import org.dromara.visor.module.infra.api.DataPermissionApi;
import org.dromara.visor.module.infra.convert.DataPermissionProviderConvert;
import org.dromara.visor.module.infra.entity.dto.data.DataPermissionBatchUpdateDTO;
import org.dromara.visor.module.infra.entity.dto.data.DataPermissionUpdateDTO;
import org.dromara.visor.module.infra.entity.request.data.DataPermissionUpdateRequest;
import org.dromara.visor.module.infra.enums.DataPermissionTypeEnum;
@@ -50,24 +51,38 @@ public class DataPermissionApiImpl implements DataPermissionApi {
private DataPermissionService dataPermissionService;
@Override
public void addDataPermission(DataPermissionTypeEnum type, DataPermissionUpdateDTO dto) {
public void updateDataPermission(DataPermissionTypeEnum type, DataPermissionUpdateDTO dto) {
Long userId = dto.getUserId();
Long roleId = dto.getRoleId();
// 校验参数
List<Long> relIdList = dto.getRelIdList();
Valid.isTrue(dto.getUserId() != null || dto.getRoleId() != null);
Valid.notEmpty(relIdList);
// 添加权限
DataPermissionUpdateRequest request = DataPermissionProviderConvert.MAPPER.toRequest(dto);
request.setType(type.name());
dataPermissionService.addDataPermission(request);
Valid.isTrue(userId != null || roleId != null);
// 修改权限
DataPermissionUpdateRequest request = DataPermissionUpdateRequest.builder()
.type(type.name())
.relIdList(dto.getRelIdList())
.build();
if (userId != null) {
request.setUserIdList(Lists.singleton(userId));
}
if (roleId != null) {
request.setRoleIdList(Lists.singleton(roleId));
}
dataPermissionService.updateDataPermission(request);
}
@Override
public void updateDataPermission(DataPermissionTypeEnum type, DataPermissionUpdateDTO dto) {
public void updateDataPermission(DataPermissionTypeEnum type, DataPermissionBatchUpdateDTO dto) {
List<Long> userIdList = dto.getUserIdList();
List<Long> roleIdList = dto.getRoleIdList();
// 校验参数
Valid.isTrue(dto.getUserId() != null || dto.getRoleId() != null);
Valid.isTrue(Lists.isNotEmpty(userIdList) || Lists.isNotEmpty(roleIdList));
// 修改权限
DataPermissionUpdateRequest request = DataPermissionProviderConvert.MAPPER.toRequest(dto);
request.setType(type.name());
DataPermissionUpdateRequest request = DataPermissionUpdateRequest.builder()
.type(type.name())
.relIdList(dto.getRelIdList())
.userIdList(userIdList)
.roleIdList(roleIdList)
.build();
dataPermissionService.updateDataPermission(request);
}
@@ -77,6 +92,16 @@ public class DataPermissionApiImpl implements DataPermissionApi {
return dataPermissionService.hasPermission(type.name(), userId, relId);
}
@Override
public List<Long> getUserIdListByRelId(DataPermissionTypeEnum type, Long relId) {
return dataPermissionService.getUserIdListByRelId(type.name(), relId);
}
@Override
public List<Long> getRoleIdListByRelId(DataPermissionTypeEnum type, Long relId) {
return dataPermissionService.getRoleIdListByRelId(type.name(), relId);
}
@Override
public List<Long> getRelIdListByUserId(DataPermissionTypeEnum type, Long userId) {
return dataPermissionService.getRelIdListByUserId(type.name(), userId);

View File

@@ -64,6 +64,30 @@ public class OperatorLogApiImpl implements OperatorLogApi {
.dataGrid(OperatorLogProviderConvert.MAPPER::to);
}
@Override
public List<OperatorLogDTO> getOperatorLogList(OperatorLogQueryDTO request) {
Valid.valid(request);
// 条件
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request)
.orderByDesc(OperatorLogDO::getId);
// 查询
return operatorLogDAO.of()
.wrapper(wrapper)
.limit(request.getLimit())
.list(OperatorLogProviderConvert.MAPPER::to);
}
@Override
public Long getOperatorLogCount(OperatorLogQueryDTO request) {
Valid.valid(request);
// 条件
LambdaQueryWrapper<OperatorLogDO> wrapper = this.buildQueryWrapper(request);
// 查询
return operatorLogDAO.of()
.wrapper(wrapper)
.countMax(request.getLimit());
}
@Override
public Integer deleteOperatorLog(List<Long> idList) {
return operatorLogDAO.deleteBatchIds(idList);
@@ -78,6 +102,7 @@ public class OperatorLogApiImpl implements OperatorLogApi {
private LambdaQueryWrapper<OperatorLogDO> buildQueryWrapper(OperatorLogQueryDTO request) {
return operatorLogDAO.wrapper()
.eq(OperatorLogDO::getId, request.getId())
.lt(OperatorLogDO::getId, request.getIdLt())
.eq(OperatorLogDO::getUserId, request.getUserId())
.eq(OperatorLogDO::getRiskLevel, request.getRiskLevel())
.eq(OperatorLogDO::getModule, request.getModule())

View File

@@ -23,6 +23,7 @@
package org.dromara.visor.module.infra.api.impl;
import cn.orionsec.kit.lang.utils.collect.Lists;
import cn.orionsec.kit.lang.utils.collect.Maps;
import org.dromara.visor.common.utils.Valid;
import org.dromara.visor.module.infra.api.TagRelApi;
import org.dromara.visor.module.infra.convert.TagProviderConvert;
@@ -35,6 +36,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
@@ -61,6 +63,14 @@ public class TagRelApiImpl implements TagRelApi {
tagRelService.addTagRel(type.name(), relId, tagIdList);
}
@Override
public void addTagRel(TagTypeEnum type, Map<Long, List<Long>> relTagIdList) {
if (Maps.isEmpty(relTagIdList)) {
return;
}
tagRelService.addTagRel(type.name(), relTagIdList);
}
@Override
public void setTagRel(TagTypeEnum type, Long relId, List<Long> tagIdList) {
Valid.notNull(relId);

View File

@@ -62,7 +62,7 @@ public class PreferenceController {
return true;
}
@PutMapping("/update-update")
@PutMapping("/update-batch")
@Operation(summary = "更新用户偏好-多个")
public Boolean updatePreferenceBatch(@Validated @RequestBody PreferenceUpdateBatchRequest request) {
preferenceService.updatePreferenceBatch(request);

View File

@@ -162,6 +162,13 @@ public class SystemUserController {
return systemUserService.getSystemUserPage(request);
}
@PostMapping("/count")
@Operation(summary = "查询系统用户数量")
@PreAuthorize("@ss.hasPermission('infra:system-user:query')")
public Long getSystemUserCount(@Validated @RequestBody SystemUserQueryRequest request) {
return systemUserService.getSystemUserCount(request);
}
@DemoDisableApi
@OperatorLog(SystemUserOperatorType.DELETE)
@DeleteMapping("/delete")

View File

@@ -55,9 +55,7 @@ public interface SystemUserConvert {
SystemUserVO to(SystemUserDO domain);
SystemUserVO to(UserInfoDTO user);
List<SystemUserVO> to(List<SystemUserDO> list);
SystemUserVO to(UserInfoDTO dto);
LoginUser toLoginUser(UserLoginRequest request);
@@ -67,4 +65,6 @@ public interface SystemUserConvert {
SystemUserBaseVO toBase(SystemUserDO user);
List<SystemUserVO> to(List<SystemUserDO> list);
}

View File

@@ -22,7 +22,6 @@
*/
package org.dromara.visor.module.infra.dao;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.visor.framework.mybatis.core.mapper.IMapper;
import org.dromara.visor.module.infra.entity.domain.DataPermissionDO;
@@ -37,19 +36,4 @@ import org.dromara.visor.module.infra.entity.domain.DataPermissionDO;
@Mapper
public interface DataPermissionDAO extends IMapper<DataPermissionDO> {
/**
* 获取查询条件
*
* @param entity entity
* @return 查询条件
*/
default LambdaQueryWrapper<DataPermissionDO> queryCondition(DataPermissionDO entity) {
return this.wrapper()
.eq(DataPermissionDO::getId, entity.getId())
.eq(DataPermissionDO::getUserId, entity.getUserId())
.eq(DataPermissionDO::getRoleId, entity.getRoleId())
.eq(DataPermissionDO::getRelId, entity.getRelId())
.eq(DataPermissionDO::getType, entity.getType());
}
}

View File

@@ -98,7 +98,6 @@ public interface FavoriteDAO extends IMapper<FavoriteDO> {
/**
* 通过 userId 删除收藏
*
* @param type type
* @param userIdList userIdList
* @return effect
*/

View File

@@ -66,6 +66,18 @@ public interface OperatorLogDAO extends IMapper<OperatorLogDO> {
return this.delete(wrapper);
}
/**
* 查询操作日志类型结果数量
*
* @param type type
* @param startTime startTime
* @param endTime endTime
* @return rows
*/
List<OperatorLogCountPO> selectOperatorLogTypeResultCount(@Param("type") String type,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
/**
* 查询操作日志数量
*

View File

@@ -48,10 +48,10 @@ public class DataPermissionUpdateRequest implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "用户id")
private Long userId;
private List<Long> userIdList;
@Schema(description = "角色id")
private Long roleId;
private List<Long> roleIdList;
@Schema(description = "引用id")
private List<Long> relIdList;

View File

@@ -38,19 +38,21 @@ import org.dromara.visor.common.constant.ErrorCode;
public enum UserStatusEnum {
/**
* 0 停用
* 停用
*/
DISABLED(0),
DISABLED(0, "停用"),
/**
* 1 启用
* 启用
*/
ENABLED(1),
ENABLED(1, "启用"),
;
private final Integer status;
private final String label;
public static UserStatusEnum of(Integer status) {
if (status == null) {
return null;

View File

@@ -29,7 +29,7 @@ import lombok.NoArgsConstructor;
import org.dromara.visor.common.handler.data.model.GenericsDataModel;
/**
* 系统偏好模型
* 系统偏好模型 未配置的使用前端默认配置
*
* @author Jiahang Li
* @version 1.0.0

View File

@@ -56,14 +56,24 @@ public class TerminalPreferenceModel implements GenericsDataModel {
private JSONObject theme;
/**
* 显示设置
* ssh 显示设置
*/
private JSONObject displaySetting;
private JSONObject sshDisplaySetting;
/**
* 操作栏设置
* rdp 图形化设置
*/
private JSONObject actionBarSetting;
private JSONObject rdpGraphSetting;
/**
* ssh 操作栏设置
*/
private JSONObject sshActionBarSetting;
/**
* rdp 操作栏设置
*/
private JSONObject rdpActionBarSetting;
/**
* 右键菜单设置
@@ -94,7 +104,7 @@ public class TerminalPreferenceModel implements GenericsDataModel {
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class DisplaySettingModel implements IJsonObject {
public static class SshDisplaySettingModel implements IJsonObject {
/**
* 字体样式
@@ -138,6 +148,225 @@ public class TerminalPreferenceModel implements GenericsDataModel {
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RdpGraphSettingModel implements IJsonObject {
/**
* 显示大小
*/
private String displaySize;
/**
* 显示宽度
*/
private Integer displayWidth;
/**
* 显示高度
*/
private Integer displayHeight;
/**
* 启用音频输入
*/
private Boolean enableAudioInput;
/**
* 启用音频输出
*/
private Boolean enableAudioOutput;
/**
* 颜色深度
*/
private Integer colorDepth;
/**
* 无损压缩
*/
private Boolean forceLossless;
/**
* 启用壁纸
*/
private Boolean enableWallpaper;
/**
* 启用主题
*/
private Boolean enableTheming;
/**
* 启动平滑字体
*/
private Boolean enableFontSmoothing;
/**
* 启用窗口拖动
*/
private Boolean enableFullWindowDrag;
/**
* 启用桌面合成
*/
private Boolean enableDesktopComposition;
/**
* 启用菜单动画
*/
private Boolean enableMenuAnimations;
/**
* 禁用位图缓存
*/
private Boolean disableBitmapCaching;
/**
* 禁用离屏缓存
*/
private Boolean disableOffscreenCaching;
/**
* 禁用字形缓存
*/
private Boolean disableGlyphCaching;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class SshActionBarSettingModel implements IJsonObject {
/**
* 连接状态
*/
private Boolean connectStatus;
/**
* 去顶部
*/
private Boolean toTop;
/**
* 去底部
*/
private Boolean toBottom;
/**
* 全选
*/
private Boolean selectAll;
/**
* 搜索
*/
private Boolean search;
/**
* 复制
*/
private Boolean copy;
/**
* 粘贴
*/
private Boolean paste;
/**
* 中断
*/
private Boolean interrupt;
/**
* 回车
*/
private Boolean enter;
/**
* 增大字号
*/
private Boolean fontSizePlus;
/**
* 减小字号
*/
private Boolean fontSizeSubtract;
/**
* 打开 SFTP
*/
private Boolean openSftp;
/**
* 上传文件
*/
private Boolean uploadFile;
/**
* 清空
*/
private Boolean clear;
/**
* 断开连接
*/
private Boolean disconnect;
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class RdpActionBarSettingModel implements IJsonObject {
/**
* 位置
*/
private String position;
/**
* 显示设置
*/
private Boolean display;
/**
* 组合键
*/
private Boolean combinationKey;
/**
* 剪切板
*/
private Boolean clipboard;
/**
* 上传
*/
private Boolean upload;
/**
* 保存为 rdp 文件
*/
private Boolean saveRdp;
/**
* 断开连接
*/
private Boolean disconnect;
/**
* 关闭
*/
private Boolean close;
}
@Data
@Builder
@NoArgsConstructor
@@ -260,94 +489,6 @@ public class TerminalPreferenceModel implements GenericsDataModel {
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ActionBarSettingModel implements IJsonObject {
/**
* 连接状态
*/
private Boolean connectStatus;
/**
* 去顶部
*/
private Boolean toTop;
/**
* 去底部
*/
private Boolean toBottom;
/**
* 全选
*/
private Boolean selectAll;
/**
* 搜索
*/
private Boolean search;
/**
* 复制
*/
private Boolean copy;
/**
* 粘贴
*/
private Boolean paste;
/**
* 中断
*/
private Boolean interrupt;
/**
* 回车
*/
private Boolean enter;
/**
* 增大字号
*/
private Boolean fontSizePlus;
/**
* 减小字号
*/
private Boolean fontSizeSubtract;
/**
* 命令编辑器
*/
private Boolean commandEditor;
/**
* 打开 SFTP
*/
private Boolean openSftp;
/**
* 上传文件
*/
private Boolean uploadFile;
/**
* 清空
*/
private Boolean clear;
/**
* 断开连接
*/
private Boolean disconnect;
}
@Data
@Builder
@NoArgsConstructor

View File

@@ -29,6 +29,8 @@ import org.dromara.visor.common.handler.data.strategy.AbstractGenericsDataStrate
import org.dromara.visor.module.infra.handler.preference.model.TerminalPreferenceModel;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 终端偏好处理策略
*
@@ -45,8 +47,39 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
@Override
public TerminalPreferenceModel getDefault() {
// 默认显示设置
String defaultDisplaySetting = TerminalPreferenceModel.DisplaySettingModel
return TerminalPreferenceModel.builder()
// 连接类型
.newConnectionType("group")
// ssh 主题
.theme(new JSONObject())
// ssh 显示设置
.sshDisplaySetting(JSONObject.parseObject(this.getDefaultSshDisplaySetting()))
// rdp 图形化设置
.rdpGraphSetting(JSONObject.parseObject(this.getDefaultRdpGraphSetting()))
// ssh 操作栏设置
.sshActionBarSetting(JSONObject.parseObject(this.getDefaultSshActionBarSetting()))
// rdp 操作栏设置
.rdpActionBarSetting(JSONObject.parseObject(this.getDefaultRdpActionBarSetting()))
// ssh 右键菜单设置
.rightMenuSetting(this.getDefaultRightMenuSetting())
// 交互设置
.interactSetting(JSONObject.parseObject(this.getDefaultInteractSetting()))
// 插件设置
.pluginsSetting(JSONObject.parseObject(this.getDefaultPluginsSetting()))
// 会话设置
.sessionSetting(JSONObject.parseObject(this.getDefaultSessionSetting()))
// 快捷键设置
.shortcutSetting(JSONObject.parseObject(this.getDefaultShortcutSetting()))
.build();
}
/**
* 获取 ssh 显示默认设置
*
* @return setting
*/
private String getDefaultSshDisplaySetting() {
return TerminalPreferenceModel.SshDisplaySettingModel
.builder()
.fontFamily("_")
.fontSize(14)
@@ -58,8 +91,97 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
.cursorBlink(true)
.build()
.toJsonString();
// 默认交互设置
String defaultInteractSetting = TerminalPreferenceModel.InteractSettingModel.builder()
}
/**
* 获取 rdp 图形化默认设置
*
* @return setting
*/
private String getDefaultRdpGraphSetting() {
return TerminalPreferenceModel.RdpGraphSettingModel.builder()
.displaySize("fit")
.displayWidth(0)
.displayHeight(0)
.colorDepth(24)
.enableAudioInput(false)
.enableAudioOutput(true)
.forceLossless(true)
.enableWallpaper(true)
.enableTheming(true)
.enableFontSmoothing(true)
.enableFullWindowDrag(true)
.enableDesktopComposition(true)
.enableMenuAnimations(false)
.disableBitmapCaching(false)
.disableOffscreenCaching(false)
.disableGlyphCaching(false)
.build()
.toJsonString();
}
/**
* 获取 ssh 操作栏默认设置
*
* @return setting
*/
private String getDefaultSshActionBarSetting() {
// 操作栏设置
return TerminalPreferenceModel.SshActionBarSettingModel.builder()
.connectStatus(true)
.toTop(false)
.toBottom(false)
.selectAll(false)
.search(true)
.copy(true)
.paste(true)
.interrupt(false)
.enter(false)
.fontSizePlus(false)
.fontSizeSubtract(false)
.openSftp(true)
.uploadFile(true)
.clear(true)
.disconnect(false)
.build()
.toJsonString();
}
/**
* 获取 rdp 操作栏默认设置
*
* @return setting
*/
private String getDefaultRdpActionBarSetting() {
return TerminalPreferenceModel.RdpActionBarSettingModel.builder()
.position("top")
.display(true)
.combinationKey(true)
.clipboard(true)
.upload(true)
.saveRdp(true)
.disconnect(true)
.close(true)
.build()
.toJsonString();
}
/**
* 获取 ssh 右键菜单默认设置
*
* @return setting
*/
private List<String> getDefaultRightMenuSetting() {
return Lists.of("selectAll", "copy", "paste", "search", "clear");
}
/**
* 获取默认交互设置
*
* @return setting
*/
private String getDefaultInteractSetting() {
return TerminalPreferenceModel.InteractSettingModel.builder()
.fastScrollModifier(true)
.altClickMovesCursor(true)
.rightClickSelectsWord(false)
@@ -72,22 +194,43 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
.wordSeparator("/\\()\"'` -.,:;<>~!@#$%^&*|+=[]{}~?│")
.build()
.toJsonString();
// 默认插件设置
String defaultPluginsSetting = TerminalPreferenceModel.PluginsSettingModel.builder()
}
/**
* 获取默认插件设置
*
* @return setting
*/
private String getDefaultPluginsSetting() {
return TerminalPreferenceModel.PluginsSettingModel.builder()
.enableWeblinkPlugin(true)
.enableWebglPlugin(true)
.enableUnicodePlugin(true)
.enableImagePlugin(false)
.build()
.toJsonString();
// 默认会话设置
String defaultSessionSetting = TerminalPreferenceModel.SessionSettingModel.builder()
}
/**
* 获取默认会话设置
*
* @return setting
*/
private String getDefaultSessionSetting() {
return TerminalPreferenceModel.SessionSettingModel.builder()
.terminalEmulationType(TerminalType.XTERM.getType())
.scrollBackLine(1000)
.build()
.toJsonString();
// 默认快捷键设置
String shortcutSetting = TerminalPreferenceModel.ShortcutSettingModel.builder()
}
/**
* 获取默认快捷键设置
*
* @return setting
*/
private String getDefaultShortcutSetting() {
return TerminalPreferenceModel.ShortcutSettingModel.builder()
.enabled(true)
.keys(Lists.of(
// 全局快捷键
@@ -114,46 +257,11 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
new TerminalPreferenceModel.ShortcutKeysModel("selectAll", true, true, false, "KeyA", true),
new TerminalPreferenceModel.ShortcutKeysModel("search", true, true, false, "KeyF", true),
new TerminalPreferenceModel.ShortcutKeysModel("uploadFile", true, true, false, "KeyU", true),
new TerminalPreferenceModel.ShortcutKeysModel("commandEditor", true, false, true, "KeyE", true),
new TerminalPreferenceModel.ShortcutKeysModel("fontSizePlus", true, false, true, "Equal", true),
new TerminalPreferenceModel.ShortcutKeysModel("fontSizeSubtract", true, false, true, "Minus", true)
))
.build()
.toJsonString();
// 操作栏设置
String actionBarSetting = TerminalPreferenceModel.ActionBarSettingModel.builder()
.connectStatus(true)
.toTop(false)
.toBottom(false)
.selectAll(false)
.search(true)
.copy(true)
.paste(true)
.interrupt(false)
.enter(false)
.fontSizePlus(false)
.fontSizeSubtract(false)
.commandEditor(true)
.fontSizePlus(false)
.fontSizeSubtract(false)
.openSftp(true)
.uploadFile(true)
.clear(true)
.disconnect(false)
.build()
.toJsonString();
// 默认配置
return TerminalPreferenceModel.builder()
.newConnectionType("group")
.theme(new JSONObject())
.displaySetting(JSONObject.parseObject(defaultDisplaySetting))
.actionBarSetting(JSONObject.parseObject(actionBarSetting))
.rightMenuSetting(Lists.of("selectAll", "copy", "paste", "search", "clear"))
.interactSetting(JSONObject.parseObject(defaultInteractSetting))
.pluginsSetting(JSONObject.parseObject(defaultPluginsSetting))
.sessionSetting(JSONObject.parseObject(defaultSessionSetting))
.shortcutSetting(JSONObject.parseObject(shortcutSetting))
.build();
}
}

View File

@@ -35,13 +35,6 @@ import java.util.List;
*/
public interface DataPermissionService {
/**
* 添加数据权限
*
* @param request request
*/
void addDataPermission(DataPermissionUpdateRequest request);
/**
* 更新数据权限
*
@@ -59,6 +52,24 @@ public interface DataPermissionService {
*/
boolean hasPermission(String type, Long userId, Long relId);
/**
* 通过 relId 查询 userId
*
* @param type type
* @param relId relId
* @return relId
*/
List<Long> getUserIdListByRelId(String type, Long relId);
/**
* 通过 relId 查询 roleId
*
* @param type type
* @param relId relId
* @return relId
*/
List<Long> getRoleIdListByRelId(String type, Long relId);
/**
* 通过 userId 查询数据权限 (不包含角色 不走缓存)
*

View File

@@ -25,6 +25,7 @@ package org.dromara.visor.module.infra.service;
import org.dromara.visor.module.infra.entity.dto.TagCacheDTO;
import java.util.List;
import java.util.Map;
/**
* 标签引用 服务类
@@ -44,6 +45,14 @@ public interface TagRelService {
*/
void addTagRel(String type, Long relId, List<Long> tagIdList);
/**
* 创建标签引用
*
* @param type type
* @param relTagIdList relTagIdList
*/
void addTagRel(String type, Map<Long, List<Long>> relTagIdList);
/**
* 设置标签引用
*

View File

@@ -46,12 +46,12 @@ import org.dromara.visor.framework.biz.operator.log.core.utils.OperatorLogs;
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
import org.dromara.visor.module.common.config.AppLoginConfig;
import org.dromara.visor.module.infra.api.SystemMessageApi;
import org.dromara.visor.module.infra.convert.SystemUserConvert;
import org.dromara.visor.module.infra.dao.SystemUserDAO;
import org.dromara.visor.module.infra.dao.SystemUserRoleDAO;
import org.dromara.visor.module.infra.define.cache.UserCacheKeyDefine;
import org.dromara.visor.module.infra.define.config.AppLoginConfig;
import org.dromara.visor.module.infra.define.message.SystemUserMessageDefine;
import org.dromara.visor.module.infra.entity.domain.SystemUserDO;
import org.dromara.visor.module.infra.entity.dto.LoginTokenDTO;

View File

@@ -62,67 +62,51 @@ public class DataPermissionServiceImpl implements DataPermissionService {
@Resource
private SystemUserRoleDAO systemUserRoleDAO;
@Override
@Transactional(rollbackFor = Exception.class)
public void addDataPermission(DataPermissionUpdateRequest request) {
Long userId = request.getUserId();
Long roleId = request.getRoleId();
String type = request.getType();
// 查询
LambdaQueryWrapper<DataPermissionDO> wrapper = dataPermissionDAO.wrapper()
.eq(DataPermissionDO::getUserId, userId)
.eq(DataPermissionDO::getRoleId, roleId)
.eq(DataPermissionDO::getType, type);
List<Long> beforeRelIdList = dataPermissionDAO.selectList(wrapper)
.stream()
.map(DataPermissionDO::getRelId)
.distinct()
.collect(Collectors.toList());
// 新增
List<DataPermissionDO> records = request.getRelIdList()
.stream()
.distinct()
.filter(s -> !beforeRelIdList.contains(s))
.map(s -> DataPermissionDO.builder()
.type(type)
.userId(userId)
.roleId(roleId)
.relId(s)
.build())
.collect(Collectors.toList());
dataPermissionDAO.insertBatch(records);
// 删除缓存
this.deleteCache(type, userId, roleId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateDataPermission(DataPermissionUpdateRequest request) {
Long userId = request.getUserId();
Long roleId = request.getRoleId();
String type = request.getType();
List<Long> userIdList = request.getUserIdList();
List<Long> roleIdList = request.getRoleIdList();
List<Long> relIdList = request.getRelIdList();
// 删除
LambdaQueryWrapper<DataPermissionDO> wrapper = dataPermissionDAO.wrapper()
.eq(DataPermissionDO::getUserId, userId)
.eq(DataPermissionDO::getRoleId, roleId)
.in(DataPermissionDO::getUserId, userIdList)
.in(DataPermissionDO::getRoleId, roleIdList)
.eq(DataPermissionDO::getType, type);
dataPermissionDAO.delete(wrapper);
// 删除缓存
this.deleteCache(type, userId, roleId);
if (Lists.isEmpty(request.getRelIdList())) {
this.deleteCache(type, userIdList, roleIdList);
if (Lists.isEmpty(relIdList)) {
return;
}
// 新增
List<DataPermissionDO> records = request.getRelIdList()
.stream()
.distinct()
.map(s -> DataPermissionDO.builder()
.type(type)
.userId(userId)
.roleId(roleId)
.relId(s)
.build())
.collect(Collectors.toList());
relIdList = new ArrayList<>(new HashSet<>(relIdList));
List<DataPermissionDO> records = new ArrayList<>();
if (!Lists.isEmpty(userIdList)) {
userIdList = new ArrayList<>(new HashSet<>(userIdList));
for (Long relId : relIdList) {
for (Long userId : userIdList) {
records.add(DataPermissionDO.builder()
.type(type)
.userId(userId)
.relId(relId)
.build());
}
}
}
if (!Lists.isEmpty(roleIdList)) {
roleIdList = new ArrayList<>(new HashSet<>(roleIdList));
for (Long relId : relIdList) {
for (Long roleId : roleIdList) {
records.add(DataPermissionDO.builder()
.type(type)
.roleId(roleId)
.relId(relId)
.build());
}
}
}
dataPermissionDAO.insertBatch(records);
}
@@ -136,6 +120,38 @@ public class DataPermissionServiceImpl implements DataPermissionService {
return relIdList.contains(relId);
}
@Override
public List<Long> getUserIdListByRelId(String type, Long relId) {
return dataPermissionDAO.of()
.createWrapper()
.select(DataPermissionDO::getUserId)
.eq(DataPermissionDO::getType, type)
.eq(DataPermissionDO::getRelId, relId)
.isNotNull(DataPermissionDO::getUserId)
.then()
.stream()
.map(DataPermissionDO::getUserId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
}
@Override
public List<Long> getRoleIdListByRelId(String type, Long relId) {
return dataPermissionDAO.of()
.createWrapper()
.select(DataPermissionDO::getRoleId)
.eq(DataPermissionDO::getType, type)
.eq(DataPermissionDO::getRelId, relId)
.isNotNull(DataPermissionDO::getRoleId)
.then()
.stream()
.map(DataPermissionDO::getRoleId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
}
@Override
public List<Long> getRelIdListByUserId(String type, Long userId) {
return dataPermissionDAO.of()
@@ -293,32 +309,6 @@ public class DataPermissionServiceImpl implements DataPermissionService {
RedisUtils.scanKeysDelete(keyMatches);
}
/**
* 删除缓存
*
* @param type type
* @param userId userId
* @param roleId roleId
*/
private void deleteCache(String type, Long userId, Long roleId) {
List<Long> userIdList = new ArrayList<>();
if (userId != null) {
userIdList.add(userId);
}
// 查询角色的权限
if (roleId != null) {
List<Long> roleUserIdList = systemUserRoleDAO.selectUserIdByRoleId(roleId);
userIdList.addAll(roleUserIdList);
}
// 删除缓存
if (!userIdList.isEmpty()) {
List<String> keys = userIdList.stream()
.map(s -> DataPermissionCacheKeyDefine.DATA_PERMISSION_USER.format(type, s))
.collect(Collectors.toList());
RedisUtils.delete(keys);
}
}
/**
* 删除缓存
*

View File

@@ -24,8 +24,8 @@ package org.dromara.visor.module.infra.service.impl;
import cn.orionsec.kit.lang.utils.time.Dates;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.entity.StatisticsRange;
import org.dromara.visor.common.entity.chart.LineSingleChartData;
import org.dromara.visor.common.enums.StatisticsRange;
import org.dromara.visor.framework.redis.core.utils.RedisStrings;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
import org.dromara.visor.module.infra.dao.OperatorLogDAO;

View File

@@ -171,9 +171,9 @@ public class SystemRoleServiceImpl implements SystemRoleService {
// 构造条件
LambdaQueryWrapper<SystemRoleDO> wrapper = systemRoleDAO.wrapper()
.eq(SystemRoleDO::getId, request.getId())
.like(SystemRoleDO::getName, request.getName())
.eq(SystemRoleDO::getCode, request.getCode())
.eq(SystemRoleDO::getStatus, request.getStatus())
.like(SystemRoleDO::getName, request.getName())
.like(SystemRoleDO::getDescription, request.getDescription());
// 查询
return systemRoleDAO.of()

View File

@@ -30,6 +30,7 @@ import cn.orionsec.kit.lang.utils.crypto.Keys;
import cn.orionsec.kit.lang.utils.crypto.RSA;
import cn.orionsec.kit.spring.SpringHolder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.common.constant.AppConst;
import org.dromara.visor.common.constant.ConfigKeys;
import org.dromara.visor.framework.config.core.event.ConfigUpdateEvent;
@@ -55,12 +56,13 @@ import java.util.Map;
import java.util.stream.Collectors;
/**
* 系统服务 实现类
* 系统设置服务 服务实现类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/17 18:10
* @since 2024/6/16 0:19
*/
@Slf4j
@Service
public class SystemSettingServiceImpl implements SystemSettingService {

View File

@@ -40,8 +40,6 @@ import org.dromara.visor.framework.redis.core.utils.RedisStrings;
import org.dromara.visor.framework.redis.core.utils.RedisUtils;
import org.dromara.visor.framework.redis.core.utils.barrier.CacheBarriers;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;
import org.dromara.visor.module.asset.api.CommandSnippetApi;
import org.dromara.visor.module.asset.api.PathBookmarkApi;
import org.dromara.visor.module.infra.convert.SystemRoleConvert;
import org.dromara.visor.module.infra.convert.SystemUserConvert;
import org.dromara.visor.module.infra.dao.OperatorLogDAO;
@@ -59,6 +57,8 @@ import org.dromara.visor.module.infra.enums.UpdatePasswordReasonEnum;
import org.dromara.visor.module.infra.enums.UpdatePasswordStatusEnum;
import org.dromara.visor.module.infra.enums.UserStatusEnum;
import org.dromara.visor.module.infra.service.*;
import org.dromara.visor.module.terminal.api.CommandSnippetApi;
import org.dromara.visor.module.terminal.api.PathBookmarkApi;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -388,12 +388,12 @@ public class SystemUserServiceImpl implements SystemUserService {
public LambdaQueryWrapper<SystemUserDO> buildQueryWrapper(SystemUserQueryRequest request) {
return systemUserDAO.wrapper()
.eq(SystemUserDO::getId, request.getId())
.eq(SystemUserDO::getStatus, request.getStatus())
.like(SystemUserDO::getUsername, request.getUsername())
.like(SystemUserDO::getNickname, request.getNickname())
.like(SystemUserDO::getMobile, request.getMobile())
.like(SystemUserDO::getEmail, request.getEmail())
.like(SystemUserDO::getDescription, request.getDescription());
.like(SystemUserDO::getDescription, request.getDescription())
.eq(SystemUserDO::getStatus, request.getStatus());
}
}

View File

@@ -41,6 +41,8 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -81,6 +83,33 @@ public class TagRelServiceImpl implements TagRelService {
tagRelDAO.insertBatch(tagRelList);
}
@Override
public void addTagRel(String type, Map<Long, List<Long>> relTagIdList) {
// 查询 tag
List<Long> allTagIdList = relTagIdList.values()
.stream()
.flatMap(Collection::stream)
.distinct()
.collect(Collectors.toList());
List<TagDO> tagList = tagDAO.selectBatchIds(allTagIdList);
Map<Long, String> tagNameMap = tagList.stream()
.collect(Collectors.toMap(TagDO::getId, TagDO::getName));
// 设置新增的引用
List<TagRelDO> tagRelList = new ArrayList<>();
relTagIdList.forEach((relId, tagIdList) -> {
for (Long tagId : tagIdList) {
tagRelList.add(TagRelDO.builder()
.tagId(tagId)
.tagName(tagNameMap.get(tagId))
.tagType(type)
.relId(relId)
.build());
}
});
// 新增
tagRelDAO.insertBatch(tagRelList);
}
@Override
public void setTagRel(String type, Long relId, List<Long> tagIdList) {
// 删除

View File

@@ -22,7 +22,6 @@
*/
package org.dromara.visor.module.infra.service.impl;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.dromara.visor.framework.security.core.utils.SecurityUtils;

View File

@@ -38,7 +38,7 @@
)
WHERE deleted = 0
AND type = 'HOST'
AND item = 'ssh'
AND item = 'SSH'
<foreach collection="keyIdList" item="item" separator="OR" open="AND (" close=")">
JSON_CONTAINS(value, JSON_OBJECT('keyId', #{item}))
</foreach>
@@ -60,7 +60,7 @@
)
WHERE deleted = 0
AND type = 'HOST'
AND item = 'ssh'
AND item IN ('SSH', 'RDP')
<foreach collection="identityIdList" item="item" separator="OR" open="AND (" close=")">
JSON_CONTAINS(value, JSON_OBJECT('identityId', #{item}))
</foreach>

View File

@@ -26,15 +26,15 @@
UPDATE data_group
SET sort = sort + #{addition}
WHERE parent_id = #{parentId}
AND sort ${condition} #{referSort}
AND sort ${condition} #{referSort}
</update>
<select id="selectMaxSort" resultType="java.lang.Integer">
SELECT IFNULL(MAX(sort), 0)
FROM data_group
WHERE deleted = 0
AND type = #{type}
AND parent_id = #{parentId}
AND type = #{type}
AND parent_id = #{parentId}
</select>
</mapper>

View File

@@ -5,14 +5,14 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="org.dromara.visor.module.infra.entity.domain.FavoriteDO">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="rel_id" property="relId"/>
<result column="type" property="type"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="updater" property="updater"/>
<result column="deleted" property="deleted"/>
<result column="user_id" property="userId"/>
<result column="rel_id" property="relId"/>
<result column="type" property="type"/>
</resultMap>
<!-- 通用查询结果列 -->

View File

@@ -38,6 +38,15 @@
id, user_id, username, trace_id, address, location, user_agent, risk_level, module, type, log_info, extra, result, error_message, return_value, duration, start_time, end_time, create_time, deleted
</sql>
<select id="selectOperatorLogTypeResultCount" resultMap="CountResultMap">
SELECT DATE(create_time) operator_date, result, COUNT(1) total_count
FROM operator_log
WHERE deleted = 0
AND type = #{type}
AND create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY operator_date, result
</select>
<select id="selectOperatorLogCount" resultMap="CountResultMap">
SELECT DATE(create_time) operator_date, COUNT(1) total_count
FROM operator_log

View File

@@ -5,15 +5,15 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="org.dromara.visor.module.infra.entity.domain.PreferenceDO">
<id column="id" property="id"/>
<result column="user_id" property="userId"/>
<result column="type" property="type"/>
<result column="item" property="item"/>
<result column="value" property="value"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="updater" property="updater"/>
<result column="deleted" property="deleted"/>
<result column="user_id" property="userId"/>
<result column="type" property="type"/>
<result column="item" property="item"/>
<result column="value" property="value"/>
</resultMap>
<!-- 通用查询结果列 -->

View File

@@ -5,11 +5,6 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="org.dromara.visor.module.infra.entity.domain.SystemMenuDO">
<id column="id" property="id"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="updater" property="updater"/>
<result column="deleted" property="deleted"/>
<result column="parent_id" property="parentId"/>
<result column="name" property="name"/>
<result column="permission" property="permission"/>
@@ -22,6 +17,11 @@
<result column="icon" property="icon"/>
<result column="path" property="path"/>
<result column="component" property="component"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="updater" property="updater"/>
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 通用查询结果列 -->

View File

@@ -18,9 +18,10 @@
<result column="deleted" property="deleted"/>
</resultMap>
<!-- 数量询映射结果 -->
<resultMap id="CountResultMap" type="org.dromara.visor.module.infra.entity.po.SystemMessageCountPO">
<result column="classify" property="classify"/>
<result column="count" property="count"/>
<result column="total_count" property="count"/>
</resultMap>
<!-- 通用查询结果列 -->
@@ -30,7 +31,7 @@
<!-- 查询消息数量 -->
<select id="selectSystemMessageCount" resultMap="CountResultMap">
SELECT classify, count(1) count
SELECT classify, count(1) total_count
FROM system_message
WHERE deleted = 0
AND receiver_id = #{receiverId}

View File

@@ -17,7 +17,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, config_key, type, value, create_time, update_time, creator, updater, deleted
id, type, config_key, value, create_time, update_time, creator, updater, deleted
</sql>
</mapper>