12
README.md
12
README.md
@@ -66,16 +66,16 @@ git clone https://github.com/lijiahangmax/orion-visor
|
||||
cd orion-visor
|
||||
# 启动
|
||||
docker compose up -d
|
||||
# 等待后端服务启动后 (2min±) 访问 http://localhost:1081/
|
||||
```
|
||||
|
||||
## 项目文档
|
||||
|
||||
* [文档地址](https://lijiahangmax.github.io/orion-visor/#/)
|
||||
* [docker安装](https://lijiahangmax.github.io/orion-visor/#/quickstart/docker-install)
|
||||
* [普通安装](https://lijiahangmax.github.io/orion-visor/#/quickstart/install)
|
||||
* [更新日志](https://lijiahangmax.github.io/orion-visor/#/about/change-log)
|
||||
* [操作手册](https://lijiahangmax.github.io/orion-visor/#/operator/asset)
|
||||
* [常见问题](https://lijiahangmax.github.io/orion-visor/#/quickstart/faq)
|
||||
* [文档地址](https://lijiahangmax.github.io/open-orion/orion-visor/)
|
||||
* [安装文档](https://lijiahangmax.github.io/open-orion/orion-visor/quickstart/docker.html)
|
||||
* [更新日志](https://lijiahangmax.github.io/open-orion/orion-visor/update/change-log.html)
|
||||
* [操作手册](https://lijiahangmax.github.io/open-orion/orion-visor/operator/asset.html)
|
||||
* [常见问题](https://lijiahangmax.github.io/open-orion/orion-visor/support/faq.html)
|
||||
|
||||
## 技术栈
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
orion-visor-service:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.4
|
||||
ports:
|
||||
- 1081:80
|
||||
environment:
|
||||
@@ -20,7 +20,7 @@ services:
|
||||
- orion-visor-mysql
|
||||
- orion-visor-redis
|
||||
orion-visor-mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.4
|
||||
privileged: true
|
||||
ports:
|
||||
- 3307:3306
|
||||
@@ -34,7 +34,7 @@ services:
|
||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||
- /data/orion-visor-space/docker-volumes/orion-visor-mysql/etc-mysql:/etc/mysql
|
||||
orion-visor-redis:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.3
|
||||
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.4
|
||||
privileged: true
|
||||
ports:
|
||||
- 6380:6379
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.0.3
|
||||
version=2.0.4
|
||||
cp -r ../../sql ./sql
|
||||
docker build -t orion-visor-mysql:${version} .
|
||||
rm -rf ./sql
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.0.3
|
||||
version=2.0.4
|
||||
docker build -t orion-visor-redis:${version} .
|
||||
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bin/bash
|
||||
version=2.0.3
|
||||
version=2.0.4
|
||||
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
|
||||
mv ../../orion-visor-ui/dist ./dist
|
||||
docker build -t orion-visor-service:${version} .
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
|
||||
------------------------------
|
||||
|
||||
<p><b>⛔⛔此页面已不再维护, 请跳转至
|
||||
<a target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor">这里</a>
|
||||
查看最新文档 ❗</b></p>
|
||||
|
||||
------------------------------
|
||||
|
||||
**`orion-visor`** 提供一站式服务器运维解决方案。
|
||||
|
||||
* **资产管理**:支持对资产进行分组,实现对主机、密钥和身份的统一管理和授权。
|
||||
@@ -70,9 +76,8 @@ docker compose up -d
|
||||
|
||||
## 项目文档
|
||||
|
||||
* [文档地址](https://lijiahangmax.github.io/orion-visor/#/)
|
||||
* [docker安装](/quickstart/docker-install)
|
||||
* [普通安装](/quickstart/install)
|
||||
* [文档地址](/)
|
||||
* [安装文档](/quickstart/docker-install)
|
||||
* [更新日志](/about/change-log)
|
||||
* [操作手册](/operator/asset)
|
||||
* [常见问题](/quickstart/faq)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# orion-visor <small>2.0.3</small>
|
||||
# orion-visor
|
||||
|
||||
> 一款高颜值、现代化的智能运维&轻量堡垒机平台。
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<url>https://github.com/lijiahangmax/orion-visor</url>
|
||||
|
||||
<properties>
|
||||
<revision>2.0.3</revision>
|
||||
<revision>2.0.4</revision>
|
||||
<spring.boot.version>2.7.17</spring.boot.version>
|
||||
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
|
||||
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
|
||||
<orion.kit.revision>1.0.7</orion.kit.revision>
|
||||
<orion.kit.version>1.0.7</orion.kit.version>
|
||||
<aspectj.version>1.9.7</aspectj.version>
|
||||
<lombok.version>1.18.26</lombok.version>
|
||||
<springdoc.version>1.6.15</springdoc.version>
|
||||
@@ -50,7 +50,7 @@
|
||||
<dependency>
|
||||
<groupId>io.github.lijiahangmax</groupId>
|
||||
<artifactId>orion-all</artifactId>
|
||||
<version>${orion.kit.revision}</version>
|
||||
<version>${orion.kit.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>orion-log</artifactId>
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
|
||||
/**
|
||||
* 同 ${orion.version} 迭代时候需要手动更改
|
||||
*/
|
||||
String VERSION = "2.0.3";
|
||||
String VERSION = "2.0.4";
|
||||
|
||||
String ORION_VISOR = "orion-visor";
|
||||
|
||||
|
||||
@@ -62,10 +62,6 @@ public class CustomFileFilter {
|
||||
if (!table.isEnableCache()) {
|
||||
files.removeIf(file -> isServerCacheFile(file.getTemplatePath()));
|
||||
}
|
||||
// 不生成导出文件
|
||||
if (!table.isEnableExport()) {
|
||||
files.removeIf(file -> isExportFile(file.getTemplatePath()));
|
||||
}
|
||||
// 不生成操作日志文件
|
||||
if (!table.isEnableOperatorLog()) {
|
||||
files.removeIf(file -> isOperatorLogFile(file.getTemplatePath()));
|
||||
|
||||
@@ -73,16 +73,6 @@ public class ServerTemplate extends Template {
|
||||
return this;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 生成导出
|
||||
// *
|
||||
// * @return this
|
||||
// */
|
||||
// public ServerTemplate enableExport() {
|
||||
// table.enableExport = true;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 不生成单元测试
|
||||
*
|
||||
|
||||
@@ -43,11 +43,6 @@ public class Table {
|
||||
*/
|
||||
protected boolean enableUnitTest;
|
||||
|
||||
/**
|
||||
* 是否生成导出
|
||||
*/
|
||||
protected boolean enableExport;
|
||||
|
||||
/**
|
||||
* 是否可缓存
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,7 @@ public class VueTemplate extends Template {
|
||||
public VueTemplate(Table table, String module, String feature) {
|
||||
super(table);
|
||||
table.enableVue = true;
|
||||
table.enableRowSelection = true;
|
||||
table.module = module;
|
||||
table.feature = feature;
|
||||
}
|
||||
@@ -54,12 +55,12 @@ public class VueTemplate extends Template {
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表可多选
|
||||
* 关闭列表可多选
|
||||
*
|
||||
* @return this
|
||||
*/
|
||||
public VueTemplate enableRowSelection() {
|
||||
table.enableRowSelection = true;
|
||||
public VueTemplate disableRowSelection() {
|
||||
table.enableRowSelection = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,19 +68,5 @@ Authorization: {{token}}
|
||||
${httpComment} ${apiComment.batchDelete}
|
||||
DELETE {{baseUrl}}/${package.ModuleName}/${typeHyphen}/batch-delete?idList=1,2,3
|
||||
Authorization: {{token}}
|
||||
#if($meta.enableExport)
|
||||
|
||||
|
||||
${httpComment} ${apiComment.export}
|
||||
POST {{baseUrl}}/${package.ModuleName}/${typeHyphen}/export
|
||||
Content-Type: application/json
|
||||
Authorization: {{token}}
|
||||
|
||||
{
|
||||
#foreach($field in ${table.fields})
|
||||
"${field.propertyName}": ""#if($foreach.hasNext),#end
|
||||
#end
|
||||
}
|
||||
#end
|
||||
|
||||
${httpComment}
|
||||
|
||||
@@ -141,19 +141,6 @@ public class ${table.controllerName} {
|
||||
public Integer batchDelete${type}(@RequestParam("idList") List<Long> idList) {
|
||||
return ${typeLower}Service.delete${type}ByIdList(idList);
|
||||
}
|
||||
#if($meta.enableExport)
|
||||
|
||||
#if($meta.enableOperatorLog)
|
||||
@OperatorLog(${type}OperatorType.EXPORT)
|
||||
#end
|
||||
@PostMapping("/export")
|
||||
@Operation(summary = "${apiComment.export}")
|
||||
@PreAuthorize("@ss.hasPermission('${package.ModuleName}:${typeHyphen}:export')")
|
||||
public void export${type}(@Validated @RequestBody ${type}QueryRequest request,
|
||||
HttpServletResponse response) throws IOException {
|
||||
${typeLower}Service.export${type}(request, response);
|
||||
}
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,6 @@ public interface ${type}Convert {
|
||||
${type}DO to(${type}QueryRequest request);
|
||||
|
||||
${type}VO to(${type}DO domain);
|
||||
#if($meta.enableExport)
|
||||
|
||||
${type}Export toExport(${type}DO domain);
|
||||
#end
|
||||
|
||||
List<${type}VO> to(List<${type}DO> list);
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ public class ${type}OperatorType extends InitializingOperatorTypes {
|
||||
public static final String UPDATE = "${typeHyphen}:update";
|
||||
|
||||
public static final String DELETE = "${typeHyphen}:delete";
|
||||
#if($meta.enableExport)
|
||||
|
||||
public static final String EXPORT = "${typeHyphen}:export";
|
||||
#end
|
||||
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
@@ -32,9 +28,6 @@ public class ${type}OperatorType extends InitializingOperatorTypes {
|
||||
new OperatorType(L, CREATE, "创建$!{table.comment}"),
|
||||
new OperatorType(M, UPDATE, "更新$!{table.comment}"),
|
||||
new OperatorType(H, DELETE, "删除$!{table.comment}"),
|
||||
#if($meta.enableExport)
|
||||
new OperatorType(M, EXPORT, "导出$!{table.comment}"),
|
||||
#end
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
#if($meta.enableExport)
|
||||
import com.orion.office.excel.writer.exporting.ExcelExport;
|
||||
#end
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
#if($meta.enableExport)
|
||||
import com.orion.visor.framework.common.utils.FileNames;
|
||||
#end
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
#if($meta.enableCache)
|
||||
import com.orion.visor.framework.redis.core.utils.RedisMaps;
|
||||
@@ -23,18 +17,11 @@ import ${pkg}.*;
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
#if($meta.enableExport)
|
||||
import com.orion.web.servlet.web.Servlets;
|
||||
#end
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
#if($meta.enableExport)
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
#end
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -54,6 +41,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
private ${type}DAO ${typeLower}DAO;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long create${type}(${type}CreateRequest request) {
|
||||
log.info("${type}Service-create${type} request: {}", JSON.toJSONString(request));
|
||||
// 转换
|
||||
@@ -72,6 +60,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer update${type}ById(${type}UpdateRequest request) {
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
log.info("${type}Service-update${type}ById id: {}, request: {}", id, JSON.toJSONString(request));
|
||||
@@ -93,6 +82,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer update${type}(${type}QueryRequest query, ${type}UpdateRequest update) {
|
||||
log.info("${type}Service.update${type} query: {}, update: {}", JSON.toJSONString(query), JSON.toJSONString(update));
|
||||
// 条件
|
||||
@@ -179,6 +169,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}ById(Long id) {
|
||||
log.info("${type}Service-delete${type}ById id: {}", id);
|
||||
// 检查数据是否存在
|
||||
@@ -195,6 +186,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}ByIdList(List<Long> idList) {
|
||||
log.info("${type}Service-delete${type}ByIdList idList: {}", idList);
|
||||
int effect = ${typeLower}DAO.deleteBatchIds(idList);
|
||||
@@ -207,6 +199,7 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer delete${type}(${type}QueryRequest request) {
|
||||
log.info("${type}Service.delete${type} request: {}", JSON.toJSONString(request));
|
||||
// 条件
|
||||
@@ -220,26 +213,6 @@ public class ${table.serviceImplName} implements ${table.serviceName} {
|
||||
#end
|
||||
return effect;
|
||||
}
|
||||
#if($meta.enableExport)
|
||||
|
||||
@Override
|
||||
public void export${type}(${type}QueryRequest request, HttpServletResponse response) throws IOException {
|
||||
log.info("${type}Service.export${type} request: {}", JSON.toJSONString(request));
|
||||
// 条件
|
||||
LambdaQueryWrapper<${type}DO> wrapper = this.buildQueryWrapper(request);
|
||||
// 查询
|
||||
List<${type}Export> rows = ${typeLower}DAO.of(wrapper).list(${type}Convert.MAPPER::toExport);
|
||||
log.info("${type}Service.export${type} size: {}", rows.size());
|
||||
// 导出
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ExcelExport.create(${type}Export.class)
|
||||
.addRows(rows)
|
||||
.write(out)
|
||||
.close();
|
||||
// 传输
|
||||
Servlets.transfer(response, out.toByteArray(), FileNames.exportName(${type}Export.TITLE));
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* 检查对象是否存在
|
||||
|
||||
@@ -115,16 +115,5 @@ public interface ${table.serviceName} {
|
||||
* @return effect
|
||||
*/
|
||||
Integer delete${type}(${type}QueryRequest request);
|
||||
#if($meta.enableExport)
|
||||
|
||||
/**
|
||||
* ${apiComment.export}
|
||||
*
|
||||
* @param request request
|
||||
* @param response response
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
void export${type}(${type}QueryRequest request, HttpServletResponse response) throws IOException;
|
||||
#end
|
||||
|
||||
}
|
||||
|
||||
@@ -14,12 +14,7 @@ VALUES
|
||||
(@MODULE_KEY_ID, 'operatorLogModule', '${package.ModuleName}:${typeHyphen}', '$!{table.comment}', '{}', @MODULE_KEY_MAX_SORT + 10, now(), now(), '1', '1', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:create', '创建$!{table.comment}', '{}', 10, now(), now(), '1', '1', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:update', '更新$!{table.comment}', '{}', 20, now(), now(), '1', '1', 0),
|
||||
#if($meta.enableExport)
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:delete', '删除$!{table.comment}', '{}', 30, now(), now(), '1', '1', 0),
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:export', '导出$!{table.comment}', '{}', 40, now(), now(), '1', '1', 0);
|
||||
#else
|
||||
(@TYPE_KEY_ID, 'operatorLogType', '${typeHyphen}:delete', '删除$!{table.comment}', '{}', 30, now(), now(), '1', '1', 0);
|
||||
#end
|
||||
#end
|
||||
|
||||
#if($dictMap.entrySet().size() > 0)
|
||||
|
||||
@@ -133,12 +133,4 @@ export function batchDelete${vue.featureEntity}(idList: Array<number>) {
|
||||
}
|
||||
});
|
||||
}
|
||||
#if($meta.enableExport)
|
||||
|
||||
/**
|
||||
* $apiComment.export
|
||||
*/
|
||||
export function export${vue.featureEntity}(request: ${vue.featureEntity}QueryRequest) {
|
||||
return axios.post('/${package.ModuleName}/${typeHyphen}/export', request);
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -79,12 +79,16 @@
|
||||
</div>
|
||||
</template>
|
||||
<!-- table -->
|
||||
#if($vue.enableRowSelection)
|
||||
<a-table v-model:selected-keys="selectedKeys"
|
||||
row-key="id"
|
||||
#else
|
||||
<a-table row-key="id"
|
||||
#end
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
:columns="columns"
|
||||
#if($vue.enableRowSelection)
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:row-selection="rowSelection"
|
||||
#end
|
||||
:data="tableRenderData"
|
||||
|
||||
@@ -6,7 +6,7 @@ const columns = [
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 70,
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
|
||||
|
||||
@@ -195,7 +195,7 @@ orion:
|
||||
api:
|
||||
# 公共 api 前缀
|
||||
prefix: /orion-visor/api
|
||||
# 是否开启跨域
|
||||
# 是否允许跨域
|
||||
cors: true
|
||||
websocket:
|
||||
# 公共 websocket 前缀
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 命令片段 对外服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:07
|
||||
*/
|
||||
public interface CommandSnippetApi {
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路径标签 对外服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:07
|
||||
*/
|
||||
public interface PathBookmarkApi {
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.asset.api.impl;
|
||||
|
||||
import com.orion.visor.module.asset.service.CommandSnippetService;
|
||||
import com.orion.visor.module.infra.api.CommandSnippetApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 命令片段 对外服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CommandSnippetApiImpl implements CommandSnippetApi {
|
||||
|
||||
@Resource
|
||||
private CommandSnippetService commandSnippetService;
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return commandSnippetService.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.asset.api.impl;
|
||||
|
||||
import com.orion.visor.module.asset.service.PathBookmarkService;
|
||||
import com.orion.visor.module.infra.api.PathBookmarkApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路径标签 对外服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PathBookmarkApiImpl implements PathBookmarkApi {
|
||||
|
||||
@Resource
|
||||
private PathBookmarkService pathBookmarkService;
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return pathBookmarkService.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -98,6 +98,15 @@ public class ExecJobController {
|
||||
return execJobService.deleteExecJobById(id);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecJobOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除计划任务")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-job:delete')")
|
||||
public Integer batchDeleteExecJob(@RequestParam("idList") List<Long> idList) {
|
||||
return execJobService.deleteExecJobByIdList(idList);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecJobOperatorType.TRIGGER)
|
||||
@PostMapping("/trigger")
|
||||
@Operation(summary = "手动触发计划任务")
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行模板 api
|
||||
@@ -92,5 +93,14 @@ public class ExecTemplateController {
|
||||
return execTemplateService.deleteExecTemplateById(id);
|
||||
}
|
||||
|
||||
@OperatorLog(ExecTemplateOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除执行模板")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:exec-template:delete')")
|
||||
public Integer batchDeleteExecTemplate(@RequestParam("idList") List<Long> idList) {
|
||||
return execTemplateService.deleteExecTemplateByIdList(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -96,5 +96,15 @@ public class HostController {
|
||||
return hostService.deleteHostById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除主机")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:delete')")
|
||||
public Integer batchDeleteHost(@RequestParam("idList") List<Long> idList) {
|
||||
return hostService.deleteHostByIdList(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -97,5 +97,15 @@ public class HostIdentityController {
|
||||
return hostIdentityService.deleteHostIdentityById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostIdentityOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除主机身份")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-identity:delete')")
|
||||
public Integer batchDeleteHostIdentity(@RequestParam("idList") List<Long> idList) {
|
||||
return hostIdentityService.deleteHostIdentityByIdList(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -96,5 +96,15 @@ public class HostKeyController {
|
||||
return hostKeyService.deleteHostKeyById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(HostKeyOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除主机密钥")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('asset:host-key:delete')")
|
||||
public Integer batchDeleteHostKey(@RequestParam("idList") List<Long> idList) {
|
||||
return hostKeyService.deleteHostKeyByIdList(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.visor.module.asset.entity.domain.CommandSnippetDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 命令片段 Mapper 接口
|
||||
*
|
||||
@@ -42,4 +44,16 @@ public interface CommandSnippetDAO extends IMapper<CommandSnippetDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
LambdaQueryWrapper<CommandSnippetDO> wrapper = this.lambda()
|
||||
.in(CommandSnippetDO::getUserId, userIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +44,18 @@ public interface ExecJobHostDAO extends IMapper<ExecJobHostDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 jobId 删除
|
||||
*
|
||||
* @param jobIdList jobIdList
|
||||
* @return effect
|
||||
*/
|
||||
default Integer deleteByJobIdList(List<Long> jobIdList) {
|
||||
LambdaQueryWrapper<ExecJobHostDO> wrapper = this.wrapper()
|
||||
.in(ExecJobHostDO::getJobId, jobIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
@@ -56,4 +68,16 @@ public interface ExecJobHostDAO extends IMapper<ExecJobHostDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
* @param hostIdList hostIdList
|
||||
* @return effect
|
||||
*/
|
||||
default Integer deleteByHostIdList(List<Long> hostIdList) {
|
||||
LambdaQueryWrapper<ExecJobHostDO> wrapper = this.wrapper()
|
||||
.in(ExecJobHostDO::getHostId, hostIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,17 +95,17 @@ public interface HostConfigDAO extends IMapper<HostConfigDO> {
|
||||
/**
|
||||
* 设置 keyId 为 NULL
|
||||
*
|
||||
* @param keyId keyId
|
||||
* @param keyIdList keyIdList
|
||||
* @return effect
|
||||
*/
|
||||
int setKeyIdWithNull(@Param("keyId") Long keyId);
|
||||
int setKeyIdWithNull(@Param("keyIdList") List<Long> keyIdList);
|
||||
|
||||
/**
|
||||
* 设置 identityId 为 NULL
|
||||
*
|
||||
* @param identityId identityId
|
||||
* @param identityIdList identityIdList
|
||||
* @return effect
|
||||
*/
|
||||
int setIdentityIdWithNull(@Param("identityId") Long identityId);
|
||||
int setIdentityIdWithNull(@Param("identityIdList") List<Long> identityIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.visor.module.asset.entity.domain.HostIdentityDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主机身份 Mapper 接口
|
||||
@@ -20,13 +21,13 @@ public interface HostIdentityDAO extends IMapper<HostIdentityDO> {
|
||||
/**
|
||||
* 设置 keyId 为 null
|
||||
*
|
||||
* @param keyId keyId
|
||||
* @param keyIdList keyIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int setKeyWithNull(@Param("keyId") Long keyId) {
|
||||
default int setKeyWithNull(List<Long> keyIdList) {
|
||||
LambdaUpdateWrapper<HostIdentityDO> updateWrapper = Wrappers.<HostIdentityDO>lambdaUpdate()
|
||||
.set(HostIdentityDO::getKeyId, null)
|
||||
.eq(HostIdentityDO::getKeyId, keyId);
|
||||
.in(HostIdentityDO::getKeyId, keyIdList);
|
||||
return this.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.visor.module.asset.entity.domain.PathBookmarkDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路径标签 Mapper 接口
|
||||
*
|
||||
@@ -42,4 +44,16 @@ public interface PathBookmarkDAO extends IMapper<PathBookmarkDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
LambdaQueryWrapper<PathBookmarkDO> wrapper = this.lambda()
|
||||
.in(PathBookmarkDO::getUserId, userIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,14 +46,6 @@ public interface CommandSnippetService {
|
||||
*/
|
||||
List<CommandSnippetVO> getCommandSnippetList();
|
||||
|
||||
/**
|
||||
* 删除命令片段
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteCommandSnippetById(Long id);
|
||||
|
||||
/**
|
||||
* 设置分组为 null
|
||||
*
|
||||
@@ -63,6 +55,14 @@ public interface CommandSnippetService {
|
||||
*/
|
||||
Integer setGroupNull(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 删除命令片段
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteCommandSnippetById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 groupId 删除
|
||||
*
|
||||
@@ -72,4 +72,12 @@ public interface CommandSnippetService {
|
||||
*/
|
||||
Integer deleteByGroupId(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,14 @@ public interface ExecJobHostService {
|
||||
*/
|
||||
Integer deleteByJobId(Long jobId);
|
||||
|
||||
/**
|
||||
* 通过 jobId 删除
|
||||
*
|
||||
* @param jobIdList jobIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByJobIdList(List<Long> jobIdList);
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
@@ -43,4 +51,12 @@ public interface ExecJobHostService {
|
||||
*/
|
||||
Integer deleteByHostId(Long hostId);
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
* @param hostIdList hostIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByHostIdList(List<Long> hostIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -78,6 +78,14 @@ public interface ExecJobService {
|
||||
*/
|
||||
Integer deleteExecJobById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除计划任务
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteExecJobByIdList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 手动触发任务
|
||||
*
|
||||
|
||||
@@ -45,6 +45,14 @@ public interface ExecTemplateHostService {
|
||||
*/
|
||||
Integer deleteByTemplateId(Long templateId);
|
||||
|
||||
/**
|
||||
* 通过 templateId 删除
|
||||
*
|
||||
* @param templateIdList templateIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByTemplateIdList(List<Long> templateIdList);
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
@@ -53,4 +61,12 @@ public interface ExecTemplateHostService {
|
||||
*/
|
||||
Integer deleteByHostId(Long hostId);
|
||||
|
||||
/**
|
||||
* 通过 hostId 删除
|
||||
*
|
||||
* @param hostIdList hostIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByHostIdList(List<Long> hostIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.orion.visor.module.asset.entity.request.exec.ExecTemplateQueryRequest
|
||||
import com.orion.visor.module.asset.entity.request.exec.ExecTemplateUpdateRequest;
|
||||
import com.orion.visor.module.asset.entity.vo.ExecTemplateVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 执行模板 服务类
|
||||
*
|
||||
@@ -63,4 +65,12 @@ public interface ExecTemplateService {
|
||||
*/
|
||||
Integer deleteExecTemplateById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除执行模板
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteExecTemplateByIdList(List<Long> idList);
|
||||
|
||||
}
|
||||
|
||||
@@ -64,4 +64,12 @@ public interface HostIdentityService {
|
||||
*/
|
||||
Integer deleteHostIdentityById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量删除主机身份
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteHostIdentityByIdList(List<Long> idList);
|
||||
|
||||
}
|
||||
|
||||
@@ -66,11 +66,19 @@ public interface HostKeyService {
|
||||
DataGrid<HostKeyVO> getHostKeyPage(HostKeyQueryRequest request);
|
||||
|
||||
/**
|
||||
* 通过 id 删除主机密钥
|
||||
* 通过 id 批量删除主机密钥
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteHostKeyById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 删除主机密钥
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteHostKeyByIdList(List<Long> idList);
|
||||
|
||||
}
|
||||
|
||||
@@ -64,11 +64,19 @@ public interface HostService {
|
||||
*/
|
||||
Integer deleteHostById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 id 批量删除主机
|
||||
*
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteHostByIdList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 通过 id 删除主机引用
|
||||
*
|
||||
* @param id id
|
||||
* @param idList idList
|
||||
*/
|
||||
void deleteHostRelByIdAsync(Long id);
|
||||
void deleteHostRelByIdListAsync(List<Long> idList);
|
||||
|
||||
}
|
||||
|
||||
@@ -46,14 +46,6 @@ public interface PathBookmarkService {
|
||||
*/
|
||||
List<PathBookmarkVO> getPathBookmarkList();
|
||||
|
||||
/**
|
||||
* 删除路径标签
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deletePathBookmarkById(Long id);
|
||||
|
||||
/**
|
||||
* 设置分组为 null
|
||||
*
|
||||
@@ -63,6 +55,14 @@ public interface PathBookmarkService {
|
||||
*/
|
||||
Integer setGroupNull(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 删除路径标签
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deletePathBookmarkById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 groupId 删除
|
||||
*
|
||||
@@ -72,4 +72,12 @@ public interface PathBookmarkService {
|
||||
*/
|
||||
Integer deleteByGroupId(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.orion.visor.module.asset.service.CommandSnippetGroupService;
|
||||
import com.orion.visor.module.asset.service.CommandSnippetService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
@@ -52,7 +51,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
@Override
|
||||
public Long createCommandSnippet(CommandSnippetCreateRequest request) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-createCommandSnippet request: {}", JSON.toJSONString(request));
|
||||
log.info("CommandSnippetService-createCommandSnippet request: {}" , JSON.toJSONString(request));
|
||||
// 转换
|
||||
CommandSnippetDO record = CommandSnippetConvert.MAPPER.to(request);
|
||||
record.setUserId(userId);
|
||||
@@ -61,7 +60,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
// 插入
|
||||
int effect = commandSnippetDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}", id, effect);
|
||||
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}" , id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return id;
|
||||
@@ -71,7 +70,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
public Integer updateCommandSnippetById(CommandSnippetUpdateRequest request) {
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-updateCommandSnippetById id: {}, request: {}", id, JSON.toJSONString(request));
|
||||
log.info("CommandSnippetService-updateCommandSnippetById id: {}, request: {}" , id, JSON.toJSONString(request));
|
||||
// 查询
|
||||
CommandSnippetDO record = commandSnippetDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
@@ -86,7 +85,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
.eq(CommandSnippetDO::getId, id)
|
||||
.eq(CommandSnippetDO::getUserId, userId);
|
||||
int effect = commandSnippetDAO.update(null, update);
|
||||
log.info("CommandSnippetService-updateCommandSnippetById effect: {}", effect);
|
||||
log.info("CommandSnippetService-updateCommandSnippetById effect: {}" , effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
@@ -145,29 +144,28 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteCommandSnippetById(Long id) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}", id);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}" , id);
|
||||
// 检查数据是否存在
|
||||
CommandSnippetDO record = commandSnippetDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 删除
|
||||
int effect = commandSnippetDAO.deleteById(id);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}, effect: {}", id, effect);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}, effect: {}" , id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId), id);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.deleteByGroupId(groupId);
|
||||
@@ -176,6 +174,11 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return commandSnippetDAO.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查对象是否存在
|
||||
*
|
||||
|
||||
@@ -49,9 +49,19 @@ public class ExecJobHostServiceImpl implements ExecJobHostService {
|
||||
return execJobHostDAO.deleteByJobId(jobId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByJobIdList(List<Long> jobIdList) {
|
||||
return execJobHostDAO.deleteByJobIdList(jobIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByHostId(Long hostId) {
|
||||
return execJobHostDAO.deleteByHostId(hostId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByHostIdList(List<Long> hostIdList) {
|
||||
return execJobHostDAO.deleteByHostIdList(hostIdList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.time.cron.Cron;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.job.core.utils.QuartzUtils;
|
||||
@@ -235,19 +236,30 @@ public class ExecJobServiceImpl implements ExecJobService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteExecJobById(Long id) {
|
||||
log.info("ExecJobService-deleteExecJobById id: {}", id);
|
||||
return this.deleteExecJobByIdList(Lists.singleton(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteExecJobByIdList(List<Long> idList) {
|
||||
log.info("ExecJobService-deleteExecJobByIdList idList: {}", idList);
|
||||
// 检查数据是否存在
|
||||
ExecJobDO record = execJobDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
List<ExecJobDO> jobList = execJobDAO.selectBatchIds(idList);
|
||||
Valid.notEmpty(jobList, ErrorMessage.DATA_ABSENT);
|
||||
// 删除任务
|
||||
int effect = execJobDAO.deleteById(id);
|
||||
int effect = execJobDAO.deleteBatchIds(idList);
|
||||
// 删除任务主机
|
||||
effect += execJobHostService.deleteByJobId(id);
|
||||
effect += execJobHostService.deleteByJobIdList(idList);
|
||||
// 设置日志参数
|
||||
OperatorLogs.add(OperatorLogs.NAME, record.getName());
|
||||
String name = jobList.stream()
|
||||
.map(ExecJobDO::getName)
|
||||
.collect(Collectors.joining(Const.COMMA));
|
||||
OperatorLogs.add(OperatorLogs.NAME, name);
|
||||
// 设置 quartz 状态
|
||||
this.setQuartzJobStatus(record, true, false);
|
||||
log.info("ExecJobService-deleteExecJobById id: {}, effect: {}", id, effect);
|
||||
for (ExecJobDO job : jobList) {
|
||||
this.setQuartzJobStatus(job, true, false);
|
||||
}
|
||||
log.info("ExecJobService-deleteExecJobByIdList idList: {}, effect: {}", idList, effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,20 +97,40 @@ public class ExecTemplateHostServiceImpl implements ExecTemplateHostService {
|
||||
public Integer deleteByTemplateId(Long templateId) {
|
||||
LambdaQueryWrapper<ExecTemplateHostDO> wrapper = execTemplateHostDAO.lambda()
|
||||
.eq(ExecTemplateHostDO::getTemplateId, templateId);
|
||||
log.info("ExecTemplateHostService-deleteByTemplateId idList: {}", templateId);
|
||||
log.info("ExecTemplateHostService-deleteByTemplateId id: {}", templateId);
|
||||
int effect = execTemplateHostDAO.delete(wrapper);
|
||||
log.info("ExecTemplateHostService-deleteByTemplateId effect: {}", effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByTemplateIdList(List<Long> templateIdList) {
|
||||
LambdaQueryWrapper<ExecTemplateHostDO> wrapper = execTemplateHostDAO.lambda()
|
||||
.in(ExecTemplateHostDO::getTemplateId, templateIdList);
|
||||
log.info("ExecTemplateHostService-deleteByTemplateIdList idList: {}", templateIdList);
|
||||
int effect = execTemplateHostDAO.delete(wrapper);
|
||||
log.info("ExecTemplateHostService-deleteByTemplateIdList effect: {}", effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByHostId(Long hostId) {
|
||||
LambdaQueryWrapper<ExecTemplateHostDO> wrapper = execTemplateHostDAO.lambda()
|
||||
.eq(ExecTemplateHostDO::getHostId, hostId);
|
||||
log.info("ExecTemplateHostService-deleteByHostId idList: {}", hostId);
|
||||
log.info("ExecTemplateHostService-deleteByHostId id: {}", hostId);
|
||||
int effect = execTemplateHostDAO.delete(wrapper);
|
||||
log.info("ExecTemplateHostService-deleteByHostId effect: {}", effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByHostIdList(List<Long> hostIdList) {
|
||||
LambdaQueryWrapper<ExecTemplateHostDO> wrapper = execTemplateHostDAO.lambda()
|
||||
.in(ExecTemplateHostDO::getHostId, hostIdList);
|
||||
log.info("ExecTemplateHostService-deleteByHostIdList id: {}", hostIdList);
|
||||
int effect = execTemplateHostDAO.delete(wrapper);
|
||||
log.info("ExecTemplateHostService-deleteByHostIdList effect: {}", effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
@@ -21,10 +23,12 @@ import com.orion.visor.module.asset.service.ExecTemplateHostService;
|
||||
import com.orion.visor.module.asset.service.ExecTemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 执行模板 服务实现类
|
||||
@@ -126,16 +130,28 @@ public class ExecTemplateServiceImpl implements ExecTemplateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteExecTemplateById(Long id) {
|
||||
log.info("ExecTemplateService-deleteExecTemplateById id: {}", id);
|
||||
return this.deleteExecTemplateByIdList(Lists.singleton(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteExecTemplateByIdList(List<Long> idList) {
|
||||
log.info("ExecTemplateService-deleteExecTemplateByIdList idList: {}", idList);
|
||||
// 检查数据是否存在
|
||||
ExecTemplateDO record = execTemplateDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
List<ExecTemplateDO> recordList = execTemplateDAO.selectBatchIds(idList);
|
||||
Valid.notEmpty(recordList, ErrorMessage.DATA_ABSENT);
|
||||
// 设置日志参数
|
||||
String name = recordList.stream()
|
||||
.map(ExecTemplateDO::getName)
|
||||
.collect(Collectors.joining(Const.COMMA));
|
||||
OperatorLogs.add(OperatorLogs.NAME, name);
|
||||
// 删除模板
|
||||
int effect = execTemplateDAO.deleteById(id);
|
||||
log.info("ExecTemplateService-deleteExecTemplateById id: {}, effect: {}", id, effect);
|
||||
int effect = execTemplateDAO.deleteBatchIds(idList);
|
||||
log.info("ExecTemplateService-deleteExecTemplateByIdList idList: {}, effect: {}", idList, effect);
|
||||
// 删除模板主机
|
||||
effect += execTemplateHostService.deleteByTemplateId(id);
|
||||
effect += execTemplateHostService.deleteByTemplateIdList(idList);
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.security.PasswordModifier;
|
||||
import com.orion.visor.framework.common.utils.CryptoUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisMaps;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisUtils;
|
||||
import com.orion.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import com.orion.visor.module.asset.convert.HostIdentityConvert;
|
||||
import com.orion.visor.module.asset.dao.HostConfigDAO;
|
||||
@@ -32,6 +35,7 @@ import com.orion.visor.module.infra.api.DataPermissionApi;
|
||||
import com.orion.visor.module.infra.enums.DataPermissionTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
@@ -185,24 +189,34 @@ public class HostIdentityServiceImpl implements HostIdentityService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteHostIdentityById(Long id) {
|
||||
log.info("HostIdentityService-deleteHostIdentityById id: {}", id);
|
||||
return this.deleteHostIdentityByIdList(Lists.singleton(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteHostIdentityByIdList(List<Long> idList) {
|
||||
log.info("HostIdentityService-deleteHostIdentityByIdList idList: {}", idList);
|
||||
// 检查数据是否存在
|
||||
HostIdentityDO record = hostIdentityDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
List<HostIdentityDO> list = hostIdentityDAO.selectBatchIds(idList);
|
||||
Valid.notEmpty(list, ErrorMessage.DATA_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.NAME, record.getName());
|
||||
String name = list.stream()
|
||||
.map(HostIdentityDO::getName)
|
||||
.collect(Collectors.joining(Const.COMMA));
|
||||
OperatorLogs.add(OperatorLogs.NAME, name);
|
||||
// 删除数据库
|
||||
int effect = hostIdentityDAO.deleteById(id);
|
||||
int effect = hostIdentityDAO.deleteBatchIds(idList);
|
||||
// 删除主机配置
|
||||
hostConfigDAO.setIdentityIdWithNull(id);
|
||||
hostConfigDAO.setIdentityIdWithNull(idList);
|
||||
// 删除主机身份额外配置
|
||||
dataExtraApi.deleteHostIdentityExtra(id);
|
||||
dataExtraApi.deleteHostIdentityExtra(idList);
|
||||
// 删除数据权限
|
||||
dataPermissionApi.deleteByRelId(DataPermissionTypeEnum.HOST_IDENTITY, id);
|
||||
dataPermissionApi.deleteByRelIdList(DataPermissionTypeEnum.HOST_IDENTITY, idList);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_IDENTITY.getKey(), record.getId());
|
||||
log.info("HostIdentityService-deleteHostIdentityById effect: {}", effect);
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_IDENTITY);
|
||||
log.info("HostIdentityService-deleteHostIdentityByIdList effect: {}", effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,15 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.security.PasswordModifier;
|
||||
import com.orion.visor.framework.common.utils.CryptoUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisMaps;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisUtils;
|
||||
import com.orion.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import com.orion.visor.module.asset.convert.HostKeyConvert;
|
||||
import com.orion.visor.module.asset.dao.HostConfigDAO;
|
||||
@@ -170,24 +173,33 @@ public class HostKeyServiceImpl implements HostKeyService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteHostKeyById(Long id) {
|
||||
log.info("HostKeyService-deleteHostKeyById id: {}", id);
|
||||
return this.deleteHostKeyByIdList(Lists.singleton(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteHostKeyByIdList(List<Long> idList) {
|
||||
log.info("HostKeyService-deleteHostKeyById idList: {}", idList);
|
||||
// 检查数据是否存在
|
||||
HostKeyDO record = hostKeyDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
List<HostKeyDO> list = hostKeyDAO.selectBatchIds(idList);
|
||||
Valid.notEmpty(list, ErrorMessage.DATA_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.NAME, record.getName());
|
||||
String name = list.stream()
|
||||
.map(HostKeyDO::getName)
|
||||
.collect(Collectors.joining(Const.COMMA));
|
||||
OperatorLogs.add(OperatorLogs.NAME, name);
|
||||
// 删除数据库
|
||||
int effect = hostKeyDAO.deleteById(id);
|
||||
int effect = hostKeyDAO.deleteBatchIds(idList);
|
||||
// 删除关联
|
||||
hostIdentityDAO.setKeyWithNull(id);
|
||||
hostIdentityDAO.setKeyWithNull(idList);
|
||||
// 删除主机配置
|
||||
hostConfigDAO.setKeyIdWithNull(id);
|
||||
hostConfigDAO.setKeyIdWithNull(idList);
|
||||
// 删除主机密钥额外配置
|
||||
dataExtraApi.deleteHostKeyExtra(id);
|
||||
dataExtraApi.deleteHostKeyExtra(idList);
|
||||
// 删除数据权限
|
||||
dataPermissionApi.deleteByRelId(DataPermissionTypeEnum.HOST_KEY, id);
|
||||
dataPermissionApi.deleteByRelIdList(DataPermissionTypeEnum.HOST_KEY, idList);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_KEY.getKey(), record.getId());
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_KEY);
|
||||
log.info("HostKeyService-deleteHostKeyById effect: {}", effect);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@ import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisMaps;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisUtils;
|
||||
import com.orion.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import com.orion.visor.module.asset.convert.HostConvert;
|
||||
import com.orion.visor.module.asset.dao.HostConfigDAO;
|
||||
@@ -191,41 +193,49 @@ public class HostServiceImpl implements HostService {
|
||||
|
||||
@Override
|
||||
public Integer deleteHostById(Long id) {
|
||||
log.info("HostService-deleteHostById id: {}", id);
|
||||
return this.deleteHostByIdList(Lists.singleton(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteHostByIdList(List<Long> idList) {
|
||||
log.info("HostService-deleteHostByIdList idList: {}", idList);
|
||||
// 查询
|
||||
HostDO record = hostDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.HOST_ABSENT);
|
||||
List<HostDO> hosts = hostDAO.selectBatchIds(idList);
|
||||
Valid.notEmpty(hosts, ErrorMessage.HOST_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.NAME, record.getName());
|
||||
String name = hosts.stream()
|
||||
.map(HostDO::getName)
|
||||
.collect(Collectors.joining(Const.COMMA));
|
||||
OperatorLogs.add(OperatorLogs.NAME, name);
|
||||
// 删除
|
||||
int effect = hostDAO.deleteById(id);
|
||||
log.info("HostService-deleteHostById effect: {}", effect);
|
||||
int effect = hostDAO.deleteBatchIds(hosts);
|
||||
log.info("HostService-deleteHostByIdList effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(HostCacheKeyDefine.HOST_INFO, id);
|
||||
RedisUtils.delete(HostCacheKeyDefine.HOST_INFO);
|
||||
// 删除主机引用
|
||||
SpringHolder.getBean(HostService.class)
|
||||
.deleteHostRelByIdAsync(id);
|
||||
.deleteHostRelByIdListAsync(idList);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void deleteHostRelByIdAsync(Long id) {
|
||||
log.info("HostService-deleteHostRelByIdAsync id: {}", id);
|
||||
public void deleteHostRelByIdListAsync(List<Long> idList) {
|
||||
log.info("HostService-deleteHostRelByIdListAsync idList: {}", idList);
|
||||
// 删除主机配置
|
||||
hostConfigDAO.deleteByHostId(id);
|
||||
hostConfigDAO.deleteByHostIdList(idList);
|
||||
// 删除计划任务主机
|
||||
execJobHostService.deleteByHostId(id);
|
||||
execJobHostService.deleteByHostIdList(idList);
|
||||
// 删除执行模板主机
|
||||
execTemplateHostService.deleteByHostId(id);
|
||||
execTemplateHostService.deleteByHostIdList(idList);
|
||||
// 删除分组
|
||||
dataGroupRelApi.deleteByRelId(DataGroupTypeEnum.HOST, id);
|
||||
dataGroupRelApi.deleteByRelIdList(DataGroupTypeEnum.HOST, idList);
|
||||
// 删除 tag 引用
|
||||
tagRelApi.deleteRelId(TagTypeEnum.HOST, id);
|
||||
tagRelApi.deleteRelIdList(TagTypeEnum.HOST, idList);
|
||||
// 删除收藏引用
|
||||
favoriteApi.deleteByRelId(FavoriteTypeEnum.HOST, id);
|
||||
favoriteApi.deleteByRelIdList(FavoriteTypeEnum.HOST, idList);
|
||||
// 删除额外配置
|
||||
dataExtraApi.deleteByRelId(DataExtraTypeEnum.HOST, id);
|
||||
dataExtraApi.deleteByRelIdList(DataExtraTypeEnum.HOST, idList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -151,11 +151,13 @@ public class HostTerminalServiceImpl implements HostTerminalService {
|
||||
HostExtraSshAuthTypeEnum extraAuthType = HostExtraSshAuthTypeEnum.of(extra.getAuthType());
|
||||
if (HostExtraSshAuthTypeEnum.CUSTOM_KEY.equals(extraAuthType)) {
|
||||
// 验证主机密钥是否有权限
|
||||
Valid.notNull(extra.getKeyId(), ErrorMessage.KEY_ABSENT);
|
||||
Valid.isTrue(dataPermissionApi.hasPermission(DataPermissionTypeEnum.HOST_KEY, userId, extra.getKeyId()),
|
||||
ErrorMessage.ANY_NO_PERMISSION,
|
||||
DataPermissionTypeEnum.HOST_KEY.getPermissionName());
|
||||
} else if (HostExtraSshAuthTypeEnum.CUSTOM_IDENTITY.equals(extraAuthType)) {
|
||||
// 验证主机身份是否有权限
|
||||
Valid.notNull(extra.getIdentityId(), ErrorMessage.IDENTITY_ABSENT);
|
||||
Valid.isTrue(dataPermissionApi.hasPermission(DataPermissionTypeEnum.HOST_IDENTITY, userId, extra.getIdentityId()),
|
||||
ErrorMessage.ANY_NO_PERMISSION,
|
||||
DataPermissionTypeEnum.HOST_IDENTITY.getPermissionName());
|
||||
@@ -270,6 +272,7 @@ public class HostTerminalServiceImpl implements HostTerminalService {
|
||||
HostSshAuthTypeEnum authType = HostSshAuthTypeEnum.of(config.getAuthType());
|
||||
if (HostSshAuthTypeEnum.IDENTITY.equals(authType)) {
|
||||
// 身份认证
|
||||
Valid.notNull(config.getIdentityId(), ErrorMessage.IDENTITY_ABSENT);
|
||||
HostIdentityDO identity = hostIdentityDAO.selectById(config.getIdentityId());
|
||||
Valid.notNull(identity, ErrorMessage.IDENTITY_ABSENT);
|
||||
config.setUsername(identity.getUsername());
|
||||
@@ -293,6 +296,7 @@ public class HostTerminalServiceImpl implements HostTerminalService {
|
||||
} else if (HostSshAuthTypeEnum.KEY.equals(authType)) {
|
||||
// 密钥认证
|
||||
Long keyId = config.getKeyId();
|
||||
Valid.notNull(keyId, ErrorMessage.KEY_ABSENT);
|
||||
HostKeyDO key = hostKeyDAO.selectById(keyId);
|
||||
Valid.notNull(key, ErrorMessage.KEY_ABSENT);
|
||||
conn.setKeyId(keyId);
|
||||
|
||||
@@ -143,6 +143,14 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deletePathBookmarkById(Long id) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
@@ -159,19 +167,16 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.setGroupIdWithNull(groupId);
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.deleteByGroupId(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.deleteByGroupId(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return pathBookmarkDAO.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,17 +25,21 @@
|
||||
<update id="setKeyIdWithNull">
|
||||
UPDATE host_config
|
||||
SET version = version + 1,
|
||||
config = JSON_REMOVE(config, '$.keyId')
|
||||
config = JSON_REMOVE(config, '$.keyId')
|
||||
WHERE deleted = 0
|
||||
AND JSON_CONTAINS(config, JSON_OBJECT('keyId', #{keyId}))
|
||||
<foreach collection="keyIdList" item="item" separator="OR" open="AND (" close=")">
|
||||
JSON_CONTAINS(config, JSON_OBJECT('keyId', #{item}))
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="setIdentityIdWithNull">
|
||||
UPDATE host_config
|
||||
SET version = version + 1,
|
||||
config = JSON_REMOVE(config, '$.identityId')
|
||||
config = JSON_REMOVE(config, '$.identityId')
|
||||
WHERE deleted = 0
|
||||
AND JSON_CONTAINS(config, JSON_OBJECT('identityId', #{identityId}))
|
||||
<foreach collection="identityIdList" item="item" separator="OR" open="AND (" close=")">
|
||||
JSON_CONTAINS(config, JSON_OBJECT('identityId', #{item}))
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -139,19 +139,28 @@ public interface DataExtraApi {
|
||||
Integer deleteByRelId(DataExtraTypeEnum type, Long relId);
|
||||
|
||||
/**
|
||||
* 删除主机密钥
|
||||
* 通过 relId 删除
|
||||
*
|
||||
* @param keyId keyId
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteHostKeyExtra(Long keyId);
|
||||
Integer deleteByRelIdList(DataExtraTypeEnum type, List<Long> relIdList);
|
||||
|
||||
/**
|
||||
* 删除主机密钥
|
||||
*
|
||||
* @param keyIdList keyIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteHostKeyExtra(List<Long> keyIdList);
|
||||
|
||||
/**
|
||||
* 删除主机身份
|
||||
*
|
||||
* @param identityId identityId
|
||||
* @param identityIdList identityIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteHostIdentityExtra(Long identityId);
|
||||
int deleteHostIdentityExtra(List<Long> identityIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -76,4 +76,13 @@ public interface DataPermissionApi {
|
||||
*/
|
||||
int deleteByRelId(DataPermissionTypeEnum type, Long relId);
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteByRelIdList(DataPermissionTypeEnum type, List<Long> relIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- asset provider -->
|
||||
<dependency>
|
||||
<groupId>com.orion.visor</groupId>
|
||||
<artifactId>orion-visor-module-asset-provider</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- web -->
|
||||
<dependency>
|
||||
<groupId>com.orion.visor</groupId>
|
||||
|
||||
@@ -134,15 +134,20 @@ public class DataExtraApiImpl implements DataExtraApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteHostKeyExtra(Long keyId) {
|
||||
Valid.notNull(keyId);
|
||||
return dataExtraDAO.deleteHostKey(keyId);
|
||||
public Integer deleteByRelIdList(DataExtraTypeEnum type, List<Long> relIdList) {
|
||||
return dataExtraService.deleteByRelIdList(type.name(), relIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteHostIdentityExtra(Long identityId) {
|
||||
Valid.notNull(identityId);
|
||||
return dataExtraDAO.deleteHostIdentity(identityId);
|
||||
public int deleteHostKeyExtra(List<Long> keyIdList) {
|
||||
Valid.notEmpty(keyIdList);
|
||||
return dataExtraDAO.deleteHostKey(keyIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteHostIdentityExtra(List<Long> identityIdList) {
|
||||
Valid.notEmpty(identityIdList);
|
||||
return dataExtraDAO.deleteHostIdentity(identityIdList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,4 +75,9 @@ public class DataPermissionApiImpl implements DataPermissionApi {
|
||||
return dataPermissionService.deleteByRelId(type.name(), relId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByRelIdList(DataPermissionTypeEnum type, List<Long> relIdList) {
|
||||
return dataPermissionService.deleteByRelIdList(type.name(), relIdList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,6 +150,16 @@ public class SystemUserController {
|
||||
return systemUserService.deleteSystemUserById(id);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
@OperatorLog(SystemUserOperatorType.DELETE)
|
||||
@DeleteMapping("/batch-delete")
|
||||
@Operation(summary = "批量删除用户")
|
||||
@Parameter(name = "idList", description = "idList", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('infra:system-user:delete')")
|
||||
public Integer batchDeleteSystemUser(@RequestParam("idList") List<Long> idList) {
|
||||
return systemUserService.deleteSystemUserByIdList(idList);
|
||||
}
|
||||
|
||||
@IgnoreLog(IgnoreLogMode.RET)
|
||||
@GetMapping("/session/list")
|
||||
@Operation(summary = "获取用户会话列表")
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.orion.visor.module.infra.entity.domain.DataExtraDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据拓展信息 Mapper 接口
|
||||
*
|
||||
@@ -28,6 +30,18 @@ public interface DataExtraDAO extends IMapper<DataExtraDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
LambdaQueryWrapper<DataExtraDO> wrapper = this.lambda()
|
||||
.in(DataExtraDO::getUserId, userIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
@@ -43,19 +57,33 @@ public interface DataExtraDAO extends IMapper<DataExtraDO> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主机密钥
|
||||
* 通过 relId 删除
|
||||
*
|
||||
* @param keyId keyId
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteHostKey(@Param("keyId") Long keyId);
|
||||
default int deleteByRelIdList(String type, List<Long> relIdList) {
|
||||
LambdaQueryWrapper<DataExtraDO> wrapper = this.lambda()
|
||||
.eq(DataExtraDO::getType, type)
|
||||
.in(DataExtraDO::getRelId, relIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主机密钥
|
||||
*
|
||||
* @param keyIdList keyIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteHostKey(@Param("keyIdList") List<Long> keyIdList);
|
||||
|
||||
/**
|
||||
* 删除主机身份
|
||||
*
|
||||
* @param identityId identityId
|
||||
* @param identityIdList identityIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteHostIdentity(@Param("identityId") Long identityId);
|
||||
int deleteHostIdentity(@Param("identityIdList") List<Long> identityIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.visor.module.infra.entity.domain.OperatorLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 Mapper 接口
|
||||
*
|
||||
@@ -27,4 +29,16 @@ public interface OperatorLogDAO extends IMapper<OperatorLogDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
LambdaQueryWrapper<OperatorLogDO> wrapper = this.wrapper()
|
||||
.in(OperatorLogDO::getUserId, userIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.orion.visor.framework.mybatis.core.query.Conditions;
|
||||
import com.orion.visor.module.infra.entity.domain.PreferenceDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户偏好 Mapper 接口
|
||||
*
|
||||
@@ -25,4 +27,14 @@ public interface PreferenceDAO extends IMapper<PreferenceDO> {
|
||||
return this.delete(Conditions.eq(PreferenceDO::getUserId, userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
return this.delete(Conditions.in(PreferenceDO::getUserId, userIdList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,6 +76,18 @@ public interface SystemUserRoleDAO extends IMapper<SystemUserRoleDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
LambdaQueryWrapper<SystemUserRoleDO> wrapper = this.wrapper()
|
||||
.in(SystemUserRoleDO::getUserId, userIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 roleId 删除
|
||||
*
|
||||
|
||||
@@ -119,6 +119,14 @@ public interface DataExtraService {
|
||||
*/
|
||||
Integer deleteByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
@@ -128,4 +136,13 @@ public interface DataExtraService {
|
||||
*/
|
||||
Integer deleteByRelId(String type, Long relId);
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByRelIdList(String type, List<Long> relIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -84,4 +84,12 @@ public interface DataGroupService {
|
||||
*/
|
||||
Integer deleteDataGroupByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除数据分组
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteDataGroupByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,15 @@ public interface DataPermissionService {
|
||||
*/
|
||||
int deleteByRelId(String type, Long relId);
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
* @param type type
|
||||
* @param relIdList relIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteByRelIdList(String type, List<Long> relIdList);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
@@ -81,6 +90,14 @@ public interface DataPermissionService {
|
||||
*/
|
||||
int deleteByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
int deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
/**
|
||||
* 通过 roleId 删除
|
||||
*
|
||||
|
||||
@@ -66,4 +66,11 @@ public interface PreferenceService {
|
||||
*/
|
||||
void deletePreferenceByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 删除用户偏好
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
*/
|
||||
void deletePreferenceByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -71,12 +71,19 @@ public interface SystemUserService {
|
||||
Integer deleteSystemUserById(Long id);
|
||||
|
||||
/**
|
||||
* 删除 id 删除用户拓展信息
|
||||
* 通过 id 批量删除用户
|
||||
*
|
||||
* @param id id
|
||||
* @param username username
|
||||
* @param idList idList
|
||||
* @return effect
|
||||
*/
|
||||
void deleteSystemUserRelAsync(Long id, String username);
|
||||
Integer deleteSystemUserByIdList(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 通过 idList 删除用户拓展信息
|
||||
*
|
||||
* @param idList idList
|
||||
*/
|
||||
void deleteSystemUserListRelAsync(List<Long> idList);
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
|
||||
@@ -192,32 +192,56 @@ public class DataExtraServiceImpl implements DataExtraService {
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserId(Long userId) {
|
||||
List<DataExtraDO> list = this.getCacheSelectWrapper()
|
||||
.eq(DataExtraDO::getUserId, userId)
|
||||
.then()
|
||||
.list();
|
||||
if (list.isEmpty()) {
|
||||
return Const.N_0;
|
||||
if (userId == null) {
|
||||
return 0;
|
||||
}
|
||||
// 删除
|
||||
return this.deleteByUserIdList(Lists.singleton(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
if (Lists.isEmpty(userIdList)) {
|
||||
return 0;
|
||||
}
|
||||
// 删除数据
|
||||
int effect = dataExtraDAO.deleteByUserId(userId);
|
||||
// 删除缓存
|
||||
this.deleteCache(list);
|
||||
return effect;
|
||||
return dataExtraDAO.deleteByUserIdList(userIdList);
|
||||
// // 查询数据
|
||||
// List<DataExtraDO> list = this.getCacheSelectWrapper()
|
||||
// .in(DataExtraDO::getUserId, userIdList)
|
||||
// .then()
|
||||
// .list();
|
||||
// if (list.isEmpty()) {
|
||||
// return Const.N_0;
|
||||
// }
|
||||
// // 删除缓存 让其自动过期
|
||||
// this.deleteCache(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByRelId(String type, Long relId) {
|
||||
if (relId == null) {
|
||||
return 0;
|
||||
}
|
||||
// 删除
|
||||
return this.deleteByRelIdList(type, Lists.singleton(relId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByRelIdList(String type, List<Long> relIdList) {
|
||||
if (Lists.isEmpty(relIdList)) {
|
||||
return 0;
|
||||
}
|
||||
List<DataExtraDO> list = this.getCacheSelectWrapper()
|
||||
.eq(DataExtraDO::getType, type)
|
||||
.eq(DataExtraDO::getRelId, relId)
|
||||
.in(DataExtraDO::getRelId, relIdList)
|
||||
.then()
|
||||
.list();
|
||||
if (list.isEmpty()) {
|
||||
return Const.N_0;
|
||||
}
|
||||
// 删除数据
|
||||
int effect = dataExtraDAO.deleteByRelId(type, relId);
|
||||
int effect = dataExtraDAO.deleteByRelIdList(type, relIdList);
|
||||
// 删除缓存
|
||||
this.deleteCache(list);
|
||||
return effect;
|
||||
|
||||
@@ -250,15 +250,27 @@ public class DataGroupServiceImpl implements DataGroupService {
|
||||
|
||||
@Override
|
||||
public Integer deleteDataGroupByUserId(Long userId) {
|
||||
if (userId == null) {
|
||||
return 0;
|
||||
}
|
||||
// 删除
|
||||
return this.deleteDataGroupByUserIdList(Lists.singleton(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteDataGroupByUserIdList(List<Long> userIdList) {
|
||||
if (Lists.isEmpty(userIdList)) {
|
||||
return 0;
|
||||
}
|
||||
// 删除分组
|
||||
LambdaQueryWrapper<DataGroupDO> deleteGroup = dataGroupDAO.wrapper()
|
||||
.eq(DataGroupDO::getUserId, userId);
|
||||
.in(DataGroupDO::getUserId, userIdList);
|
||||
int effect = dataGroupDAO.delete(deleteGroup);
|
||||
// 删除分组引用
|
||||
LambdaQueryWrapper<DataGroupRelDO> deleteRel = dataGroupRelDAO.wrapper()
|
||||
.eq(DataGroupRelDO::getUserId, userId);
|
||||
.in(DataGroupRelDO::getUserId, userIdList);
|
||||
effect += dataGroupRelDAO.delete(deleteRel);
|
||||
// 不删除缓存 自动过期
|
||||
// 不删除缓存 让其自动过期
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
||||
@@ -182,9 +182,21 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
|
||||
@Override
|
||||
public int deleteByRelId(String type, Long relId) {
|
||||
if (relId == null) {
|
||||
return 0;
|
||||
}
|
||||
// 删除
|
||||
return this.deleteByRelIdList(type, Lists.singleton(relId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByRelIdList(String type, List<Long> relIdList) {
|
||||
if (Lists.isEmpty(relIdList)) {
|
||||
return 0;
|
||||
}
|
||||
LambdaQueryWrapper<DataPermissionDO> wrapper = dataPermissionDAO.wrapper()
|
||||
.eq(DataPermissionDO::getType, type)
|
||||
.eq(DataPermissionDO::getRelId, relId);
|
||||
.in(DataPermissionDO::getRelId, relIdList);
|
||||
// 查询
|
||||
List<DataPermissionDO> rows = dataPermissionDAO.selectList(wrapper);
|
||||
// 删除
|
||||
@@ -204,12 +216,23 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
|
||||
@Override
|
||||
public int deleteByUserId(Long userId) {
|
||||
LambdaQueryWrapper<DataPermissionDO> wrapper = Conditions.eq(DataPermissionDO::getUserId, userId);
|
||||
if (userId == null) {
|
||||
return 0;
|
||||
}
|
||||
// 删除
|
||||
int effect = dataPermissionDAO.delete(wrapper);
|
||||
// 删除缓存
|
||||
this.deleteCache(null, Lists.singleton(userId), null);
|
||||
return effect;
|
||||
return this.deleteByUserIdList(Lists.singleton(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByUserIdList(List<Long> userIdList) {
|
||||
if (Lists.isEmpty(userIdList)) {
|
||||
return 0;
|
||||
}
|
||||
LambdaQueryWrapper<DataPermissionDO> wrapper = Conditions.in(DataPermissionDO::getUserId, userIdList);
|
||||
// 删除
|
||||
return dataPermissionDAO.delete(wrapper);
|
||||
// 删除缓存 让其自动过期
|
||||
// this.deleteCache(null, userIdList, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.Objects1;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.collect.Maps;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
@@ -176,24 +177,13 @@ public class DictKeyServiceImpl implements DictKeyService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteDictKeyById(Long id) {
|
||||
log.info("DictKeyService-deleteDictKeyById id: {}", id);
|
||||
// 检查数据是否存在
|
||||
DictKeyDO record = dictKeyDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.CONFIG_ABSENT);
|
||||
OperatorLogs.add(OperatorLogs.KEY_NAME, record.getKeyName());
|
||||
// 删除配置项
|
||||
int effect = dictKeyDAO.deleteById(id);
|
||||
// 删除配置值
|
||||
dictValueService.deleteDictValueByKeyId(id);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(DictCacheKeyDefine.DICT_KEY, id);
|
||||
RedisUtils.delete(DictCacheKeyDefine.DICT_SCHEMA.format(record.getKeyName()));
|
||||
log.info("DictKeyService-deleteDictKeyById id: {}, effect: {}", id, effect);
|
||||
return effect;
|
||||
return this.deleteDictKeyByIdList(Lists.singleton(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer deleteDictKeyByIdList(List<Long> idList) {
|
||||
log.info("DictKeyService-deleteDictKeyByIdList idList: {}", idList);
|
||||
// 检查数据是否存在
|
||||
|
||||
@@ -20,8 +20,6 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -118,13 +116,8 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
if (userId == null) {
|
||||
return;
|
||||
}
|
||||
// 删除库
|
||||
favoriteDAO.deleteFavoriteByUserId(userId);
|
||||
// 删除缓存
|
||||
List<String> favoriteKeyList = Arrays.stream(FavoriteTypeEnum.values())
|
||||
.map(s -> FavoriteCacheKeyDefine.FAVORITE.format(s, userId))
|
||||
.collect(Collectors.toList());
|
||||
redisTemplate.delete(favoriteKeyList);
|
||||
// 删除
|
||||
this.deleteFavoriteByUserIdList(Lists.singleton(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,14 +127,14 @@ public class FavoriteServiceImpl implements FavoriteService {
|
||||
}
|
||||
// 删除库
|
||||
favoriteDAO.deleteFavoriteByUserIdList(userIdList);
|
||||
// 删除缓存
|
||||
List<String> favoriteKeyList = new ArrayList<>();
|
||||
for (Long userId : userIdList) {
|
||||
Arrays.stream(FavoriteTypeEnum.values())
|
||||
.map(s -> FavoriteCacheKeyDefine.FAVORITE.format(s, userId))
|
||||
.forEach(favoriteKeyList::add);
|
||||
}
|
||||
redisTemplate.delete(favoriteKeyList);
|
||||
// 缓存自动过期
|
||||
// List<String> favoriteKeyList = new ArrayList<>();
|
||||
// for (Long userId : userIdList) {
|
||||
// Arrays.stream(FavoriteTypeEnum.values())
|
||||
// .map(s -> FavoriteCacheKeyDefine.FAVORITE.format(s, userId))
|
||||
// .forEach(favoriteKeyList::add);
|
||||
// }
|
||||
// redisTemplate.delete(favoriteKeyList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -164,14 +163,29 @@ public class PreferenceServiceImpl implements PreferenceService {
|
||||
|
||||
@Override
|
||||
public void deletePreferenceByUserId(Long userId) {
|
||||
if (userId == null) {
|
||||
return;
|
||||
}
|
||||
// 删除
|
||||
int effect = preferenceDAO.deleteByUserId(userId);
|
||||
log.info("PreferenceService-deletePreferenceById userId: {}, effect: {}", userId, effect);
|
||||
// 删除缓存
|
||||
List<String> deleteKeys = Arrays.stream(PreferenceTypeEnum.values())
|
||||
.map(s -> PreferenceCacheKeyDefine.PREFERENCE.format(userId, s))
|
||||
.collect(Collectors.toList());
|
||||
RedisMaps.delete(deleteKeys);
|
||||
this.deletePreferenceByUserIdList(Lists.singleton(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePreferenceByUserIdList(List<Long> userIdList) {
|
||||
if (Lists.isEmpty(userIdList)) {
|
||||
return;
|
||||
}
|
||||
// 删除
|
||||
int effect = preferenceDAO.deleteByUserIdList(userIdList);
|
||||
log.info("PreferenceService-deletePreferenceByUserIdList userIdList: {}, effect: {}", userIdList, effect);
|
||||
// 删除缓存 让他自动过期
|
||||
// List<String> deleteKeys = new ArrayList<>();
|
||||
// for (Long userId : userIdList) {
|
||||
// Arrays.stream(PreferenceTypeEnum.values())
|
||||
// .map(s -> PreferenceCacheKeyDefine.PREFERENCE.format(userId, s))
|
||||
// .forEach(deleteKeys::add);
|
||||
// }
|
||||
// RedisMaps.delete(deleteKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.orion.visor.module.infra.service.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.lang.define.wrapper.DataGrid;
|
||||
import com.orion.lang.utils.collect.Lists;
|
||||
import com.orion.lang.utils.crypto.Signatures;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorCode;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.security.LoginUser;
|
||||
@@ -15,6 +17,8 @@ import com.orion.visor.framework.redis.core.utils.RedisStrings;
|
||||
import com.orion.visor.framework.redis.core.utils.RedisUtils;
|
||||
import com.orion.visor.framework.redis.core.utils.barrier.CacheBarriers;
|
||||
import com.orion.visor.framework.security.core.utils.SecurityUtils;
|
||||
import com.orion.visor.module.infra.api.CommandSnippetApi;
|
||||
import com.orion.visor.module.infra.api.PathBookmarkApi;
|
||||
import com.orion.visor.module.infra.convert.SystemRoleConvert;
|
||||
import com.orion.visor.module.infra.convert.SystemUserConvert;
|
||||
import com.orion.visor.module.infra.dao.OperatorLogDAO;
|
||||
@@ -38,7 +42,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -82,6 +88,12 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
@Resource
|
||||
private DataGroupService dataGroupService;
|
||||
|
||||
@Resource
|
||||
private CommandSnippetApi commandSnippetApi;
|
||||
|
||||
@Resource
|
||||
private PathBookmarkApi pathBookmarkApi;
|
||||
|
||||
@Override
|
||||
public Long createSystemUser(SystemUserCreateRequest request) {
|
||||
// 转换
|
||||
@@ -212,58 +224,58 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
|
||||
@Override
|
||||
public Integer deleteSystemUserById(Long id) {
|
||||
if (id.equals(SecurityUtils.getLoginUserId())) {
|
||||
return this.deleteSystemUserByIdList(Lists.singleton(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteSystemUserByIdList(List<Long> idList) {
|
||||
if (idList.contains(SecurityUtils.getLoginUserId())) {
|
||||
throw ErrorCode.UNSUPPOETED.exception();
|
||||
}
|
||||
// 查询用户
|
||||
SystemUserDO record = systemUserDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.USER_ABSENT);
|
||||
// 查询用户列表
|
||||
List<SystemUserDO> userList = systemUserDAO.selectBatchIds(idList);
|
||||
Valid.notEmpty(userList, ErrorMessage.USER_ABSENT);
|
||||
// 添加日志参数
|
||||
OperatorLogs.add(OperatorLogs.USERNAME, record.getUsername());
|
||||
idList = userList.stream()
|
||||
.map(SystemUserDO::getId)
|
||||
.collect(Collectors.toList());
|
||||
String username = userList.stream()
|
||||
.map(SystemUserDO::getUsername)
|
||||
.collect(Collectors.joining(Const.COMMA));
|
||||
OperatorLogs.add(OperatorLogs.USERNAME, username);
|
||||
// 删除用户
|
||||
int effect = systemUserDAO.deleteById(id);
|
||||
log.info("SystemUserService-deleteSystemUserById id: {}, effect: {}", id, effect);
|
||||
// 删除用户信息缓存
|
||||
RedisUtils.delete(UserCacheKeyDefine.USER_INFO.format(id));
|
||||
// 删除 token 缓存
|
||||
RedisUtils.scanKeysDelete(
|
||||
// 登录 token
|
||||
UserCacheKeyDefine.LOGIN_TOKEN.format(id, "*"),
|
||||
// 刷新 token
|
||||
UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*")
|
||||
);
|
||||
int effect = systemUserDAO.deleteBatchIds(idList);
|
||||
log.info("SystemUserService-deleteSystemUserByIdList idList: {}, effect: {}", idList, effect);
|
||||
// 删除缓存 其他的缓存自动过期
|
||||
this.deleteUserCacheKey(userList);
|
||||
// 异步删除额外信息
|
||||
SpringHolder.getBean(SystemUserService.class).deleteSystemUserRelAsync(id, record.getUsername());
|
||||
SpringHolder.getBean(SystemUserService.class)
|
||||
.deleteSystemUserListRelAsync(idList);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void deleteSystemUserRelAsync(Long id, String username) {
|
||||
log.info("SystemUserService-deleteSystemUserRel id: {}", id);
|
||||
// 删除用户列表缓存
|
||||
RedisMaps.delete(UserCacheKeyDefine.USER_LIST, id);
|
||||
// 删除用户缓存 其他的 key 让其自动过期
|
||||
RedisUtils.delete(
|
||||
// 登录失败次数
|
||||
UserCacheKeyDefine.LOGIN_FAILED_COUNT.format(username),
|
||||
// 用户提示
|
||||
TipsCacheKeyDefine.TIPS.format(id)
|
||||
);
|
||||
public void deleteSystemUserListRelAsync(List<Long> idList) {
|
||||
log.info("SystemUserService-deleteSystemUserListRelAsync idList: {}", idList);
|
||||
// 删除角色关联
|
||||
systemUserRoleDAO.deleteByUserId(id);
|
||||
systemUserRoleDAO.deleteByUserIdList(idList);
|
||||
// 删除操作日志
|
||||
operatorLogDAO.deleteByUserId(id);
|
||||
operatorLogDAO.deleteByUserIdList(idList);
|
||||
// 删除用户收藏
|
||||
favoriteService.deleteFavoriteByUserId(id);
|
||||
favoriteService.deleteFavoriteByUserIdList(idList);
|
||||
// 删除用户偏好
|
||||
preferenceService.deletePreferenceByUserId(id);
|
||||
preferenceService.deletePreferenceByUserIdList(idList);
|
||||
// 删除用户数据权限
|
||||
dataPermissionService.deleteByUserId(id);
|
||||
dataPermissionService.deleteByUserIdList(idList);
|
||||
// 删除用户拓展数据
|
||||
dataExtraService.deleteByUserId(id);
|
||||
dataExtraService.deleteByUserIdList(idList);
|
||||
// 删除分组数据
|
||||
dataGroupService.deleteDataGroupByUserId(id);
|
||||
dataGroupService.deleteDataGroupByUserIdList(idList);
|
||||
// 删除命令片段
|
||||
commandSnippetApi.deleteByUserIdList(idList);
|
||||
// 删除路径标签
|
||||
pathBookmarkApi.deleteByUserIdList(idList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -327,4 +339,29 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
Valid.isFalse(present, ErrorMessage.NICKNAME_PRESENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主要用户缓存 其他的缓存自动过期
|
||||
*
|
||||
* @param userList
|
||||
*/
|
||||
private void deleteUserCacheKey(List<SystemUserDO> userList) {
|
||||
Set<String> deleteKeys = new HashSet<>();
|
||||
// 用户列表缓存
|
||||
deleteKeys.add(UserCacheKeyDefine.USER_LIST.getKey());
|
||||
userList.forEach(s -> {
|
||||
Long id = s.getId();
|
||||
// 用户提示
|
||||
deleteKeys.add(TipsCacheKeyDefine.TIPS.format(id));
|
||||
// 用户信息缓存
|
||||
deleteKeys.add(UserCacheKeyDefine.USER_INFO.format(id));
|
||||
// 登录失败次数
|
||||
deleteKeys.add(UserCacheKeyDefine.LOGIN_FAILED_COUNT.format(s.getUsername()));
|
||||
// 登录 token
|
||||
deleteKeys.addAll(RedisUtils.scanKeys(UserCacheKeyDefine.LOGIN_TOKEN.format(id, "*")));
|
||||
// 刷新 token
|
||||
deleteKeys.addAll(RedisUtils.scanKeys(UserCacheKeyDefine.LOGIN_REFRESH.format(id, "*")));
|
||||
});
|
||||
RedisUtils.delete(deleteKeys);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,30 +26,44 @@
|
||||
UPDATE data_extra
|
||||
SET value = JSON_REPLACE(value,
|
||||
"$.keyId", NULL,
|
||||
"$.authType", IF(
|
||||
JSON_EXTRACT(value, "$.authType") = 'CUSTOM_KEY',
|
||||
'DEFAULT',
|
||||
JSON_EXTRACT(value, "$.authType")
|
||||
))
|
||||
"$.authType",
|
||||
REPLACE(
|
||||
IF(JSON_EXTRACT(value, "$.authType") = 'CUSTOM_KEY',
|
||||
'DEFAULT',
|
||||
JSON_EXTRACT(value, "$.authType")
|
||||
),
|
||||
'"',
|
||||
''
|
||||
)
|
||||
)
|
||||
WHERE deleted = 0
|
||||
AND type = 'HOST'
|
||||
AND item = 'ssh'
|
||||
AND JSON_CONTAINS(value, JSON_OBJECT('keyId', #{keyId}))
|
||||
AND type = 'HOST'
|
||||
AND item = 'ssh'
|
||||
<foreach collection="keyIdList" item="item" separator="OR" open="AND (" close=")">
|
||||
JSON_CONTAINS(value, JSON_OBJECT('keyId', #{item}))
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHostIdentity">
|
||||
UPDATE data_extra
|
||||
SET value = JSON_REPLACE(value,
|
||||
"$.identityId", NULL,
|
||||
"$.authType", IF(
|
||||
JSON_EXTRACT(value, "$.authType") = 'CUSTOM_IDENTITY',
|
||||
'DEFAULT',
|
||||
JSON_EXTRACT(value, "$.authType")
|
||||
))
|
||||
"$.authType",
|
||||
REPLACE(
|
||||
IF(JSON_EXTRACT(value, "$.authType") = 'CUSTOM_IDENTITY',
|
||||
'DEFAULT',
|
||||
JSON_EXTRACT(value, "$.authType")
|
||||
),
|
||||
'"',
|
||||
''
|
||||
)
|
||||
)
|
||||
WHERE deleted = 0
|
||||
AND type = 'HOST'
|
||||
AND item = 'ssh'
|
||||
AND JSON_CONTAINS(value, JSON_OBJECT('identityId', #{identityId}))
|
||||
AND type = 'HOST'
|
||||
AND item = 'ssh'
|
||||
<foreach collection="identityIdList" item="item" separator="OR" open="AND (" close=")">
|
||||
JSON_CONTAINS(value, JSON_OBJECT('identityId', #{item}))
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-visor/api'
|
||||
VITE_WS_BASE_URL= 'ws://127.0.0.1:9200/orion-visor/keep-alive'
|
||||
VITE_APP_VERSION= '2.0.3'
|
||||
VITE_APP_VERSION= '2.0.4'
|
||||
VITE_SFTP_PREVIEW_MB= 2
|
||||
VITE_DEMO_MODE= false
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
VITE_API_BASE_URL= '/orion-visor/api'
|
||||
VITE_WS_BASE_URL= '/orion-visor/keep-alive'
|
||||
VITE_APP_VERSION= '2.0.3'
|
||||
VITE_APP_VERSION= '2.0.4'
|
||||
VITE_SFTP_PREVIEW_MB= 2
|
||||
VITE_DEMO_MODE= false
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "orion-visor-ui",
|
||||
"description": "Orion Visor UI",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"private": true,
|
||||
"author": "Jiahang Li",
|
||||
"license": "Apache 2.0",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 主机身份创建请求
|
||||
@@ -91,3 +92,14 @@ export function deleteHostIdentity(id: number) {
|
||||
return axios.delete('/asset/host-identity/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除主机身份
|
||||
*/
|
||||
export function batchDeleteHostIdentity(idList: Array<number>) {
|
||||
return axios.delete('/asset/host-identity/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 主机密钥创建请求
|
||||
@@ -85,3 +86,15 @@ export function getHostKeyPage(request: HostKeyQueryRequest) {
|
||||
export function deleteHostKey(id: number) {
|
||||
return axios.delete('/asset/host-key/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除主机密钥
|
||||
*/
|
||||
export function batchDeleteHostKey(idList: Array<number>) {
|
||||
return axios.delete('/asset/host-key/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 主机创建请求
|
||||
@@ -102,3 +103,15 @@ export function getHostPage(request: HostQueryRequest) {
|
||||
export function deleteHost(id: number) {
|
||||
return axios.delete('/asset/host/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除主机
|
||||
*/
|
||||
export function batchDeleteHost(idList: Array<number>) {
|
||||
return axios.delete('/asset/host/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 执行模板创建请求
|
||||
@@ -88,3 +89,15 @@ export function getExecTemplatePage(request: ExecTemplateQueryRequest) {
|
||||
export function deleteExecTemplate(id: number) {
|
||||
return axios.delete('/asset/exec-template/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除执行模板
|
||||
*/
|
||||
export function batchDeleteExecTemplate(idList: Array<number>) {
|
||||
return axios.delete('/asset/exec-template/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { HostQueryResponse } from '@/api/asset/host';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 计划任务创建请求
|
||||
@@ -112,6 +113,18 @@ export function deleteExecJob(id: number) {
|
||||
return axios.delete('/asset/exec-job/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除计划任务
|
||||
*/
|
||||
export function batchDeleteExecJob(idList: Array<number>) {
|
||||
return axios.delete('/asset/exec-job/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动触发计划任务
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { DataGrid, Pagination } from '@/types/global';
|
||||
import type { TableData } from '@arco-design/web-vue/es/table/interface';
|
||||
import type { RoleQueryResponse } from '@/api/user/role';
|
||||
import axios from 'axios';
|
||||
import qs from 'query-string';
|
||||
|
||||
/**
|
||||
* 用户创建请求
|
||||
@@ -162,6 +163,18 @@ export function deleteUser(id: number) {
|
||||
return axios.delete('/infra/system-user/delete', { params: { id } });
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*/
|
||||
export function batchDeleteUser(idList: Array<number>) {
|
||||
return axios.delete('/infra/system-user/batch-delete', {
|
||||
params: { idList },
|
||||
paramsSerializer: params => {
|
||||
return qs.stringify(params, { arrayFormat: 'comma' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户会话列表
|
||||
*/
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
<a-layout-footer class="footer">
|
||||
<a-space direction="vertical" size="small">
|
||||
<a-space size="large">
|
||||
<!-- <a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor">官网</a-link> -->
|
||||
<!-- <a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor">教程</a-link> -->
|
||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor">github</a-link>
|
||||
<a-link target="_blank" href="https://gitee.com/lijiahangmax/orion-visor">gitee</a-link>
|
||||
<a-link target="_blank" href="https://lijiahangmax.github.io/orion-visor">文档</a-link>
|
||||
<a-link target="_blank" href="https://lijiahangmax.github.io/open-orion/orion-visor">文档</a-link>
|
||||
<a-link target="_blank" href="https://github.com/lijiahangmax/orion-visor/blob/main/LICENSE">License</a-link>
|
||||
<a-link target="_blank" :href="`https://github.com/lijiahangmax/orion-visor/releases/tag/v${version}`">v{{ version }} Community</a-link>
|
||||
</a-space>
|
||||
|
||||
@@ -49,10 +49,10 @@
|
||||
:columns="columns"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
:scroll="{ x: '100%', y: '60vh' }"
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(1, size)"
|
||||
:bordered="false">
|
||||
@page-size-change="(size) => fetchTableData(1, size)">
|
||||
<!-- 模板名称 -->
|
||||
<template #name="{ record }">
|
||||
<span class="span-blue">{{ record.name }}</span>
|
||||
|
||||
@@ -5,7 +5,7 @@ const columns = [
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 70,
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, {
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
:columns="columns"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(1, size)"
|
||||
:bordered="false">
|
||||
@page-size-change="(size) => fetchTableData(1, size)">
|
||||
<!-- 修改前 -->
|
||||
<template #beforeValue="{ record }">
|
||||
<span class="copy-left"
|
||||
|
||||
@@ -6,7 +6,7 @@ const columns = [
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 70,
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
type="warning"
|
||||
@ok="deleteSelectRows">
|
||||
<a-button v-permission="['asset:host-connect-log:management:delete']"
|
||||
type="secondary"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
删除
|
||||
@@ -87,17 +87,17 @@
|
||||
</div>
|
||||
</template>
|
||||
<!-- table -->
|
||||
<a-table row-key="id"
|
||||
<a-table v-model:selected-keys="selectedKeys"
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:row-selection="rowSelection"
|
||||
:columns="columns"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(1, size)"
|
||||
:bordered="false">
|
||||
@page-size-change="(size) => fetchTableData(1, size)">
|
||||
<!-- 连接用户 -->
|
||||
<template #username="{ record }">
|
||||
{{ record.username }}
|
||||
|
||||
@@ -6,7 +6,7 @@ const columns = [
|
||||
title: 'id',
|
||||
dataIndex: 'id',
|
||||
slotName: 'id',
|
||||
width: 70,
|
||||
width: 100,
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
}, {
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
type="warning"
|
||||
@ok="deleteSelectRows">
|
||||
<a-button v-permission="['infra:operator-log:delete', 'asset:host-sftp-log:management:delete']"
|
||||
type="secondary"
|
||||
type="primary"
|
||||
status="danger"
|
||||
:disabled="selectedKeys.length === 0">
|
||||
删除
|
||||
@@ -74,17 +74,17 @@
|
||||
</div>
|
||||
</template>
|
||||
<!-- table -->
|
||||
<a-table row-key="id"
|
||||
<a-table v-model:selected-keys="selectedKeys"
|
||||
row-key="id"
|
||||
ref="tableRef"
|
||||
:loading="loading"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:row-selection="rowSelection"
|
||||
:columns="columns"
|
||||
:data="tableRenderData"
|
||||
:pagination="pagination"
|
||||
:bordered="false"
|
||||
@page-change="(page) => fetchTableData(page, pagination.pageSize)"
|
||||
@page-size-change="(size) => fetchTableData(1, size)"
|
||||
:bordered="false">
|
||||
@page-size-change="(size) => fetchTableData(1, size)">
|
||||
<!-- 操作用户 -->
|
||||
<template #username="{ record }">
|
||||
{{ record.username }}
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
@select-all="selectAll"
|
||||
@reverse="reverseSelect">
|
||||
<!-- 主机身份表格 -->
|
||||
<a-table row-key="id"
|
||||
<a-table v-model:selected-keys="selectedKeys"
|
||||
row-key="id"
|
||||
class="host-identity-main-table"
|
||||
:columns="hostIdentityColumns"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:row-selection="rowSelection"
|
||||
row-class="pointer"
|
||||
:sticky-header="true"
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
@select-all="selectAll"
|
||||
@reverse="reverseSelect">
|
||||
<!-- 主机密钥表格 -->
|
||||
<a-table row-key="id"
|
||||
<a-table v-model:selected-keys="selectedKeys"
|
||||
row-key="id"
|
||||
class="host-key-main-table"
|
||||
:columns="hostKeyColumns"
|
||||
v-model:selected-keys="selectedKeys"
|
||||
:row-selection="rowSelection"
|
||||
row-class="pointer"
|
||||
:sticky-header="true"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user