refactor: 主机服务抽离.

This commit is contained in:
lijiahang
2023-12-20 12:20:38 +08:00
parent 29b3fa5a9c
commit 2506d567b8
21 changed files with 338 additions and 176 deletions

View File

@@ -0,0 +1,31 @@
### 查询主机配置
GET {{baseUrl}}/asset/host-config/get?hostId=1&type=SSH
Authorization: {{token}}
### 查询全部主机配置
GET {{baseUrl}}/asset/host-config/list?hostId=1
Authorization: {{token}}
### 通过 id 更新主机配置
PUT {{baseUrl}}/asset/host-config/update
Content-Type: application/json
Authorization: {{token}}
{
"id": "",
"config": "",
"version": ""
}
### 通过 id 更新主机配置状态
PUT {{baseUrl}}/asset/host-config/update-status
Content-Type: application/json
Authorization: {{token}}
{
"id": "",
"status": "",
"version": ""
}
###

View File

@@ -0,0 +1,79 @@
package com.orion.ops.module.asset.controller;
import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
import com.orion.ops.framework.web.core.annotation.RestWrapper;
import com.orion.ops.module.asset.define.operator.HostOperatorType;
import com.orion.ops.module.asset.entity.request.host.HostConfigUpdateRequest;
import com.orion.ops.module.asset.entity.request.host.HostConfigUpdateStatusRequest;
import com.orion.ops.module.asset.entity.vo.HostConfigVO;
import com.orion.ops.module.asset.service.HostConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 主机配置 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-9-11 14:16
*/
@Tag(name = "asset - 主机配置服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/host-config")
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
public class HostConfigController {
@Resource
private HostConfigService hostConfigService;
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/get")
@Operation(summary = "查询主机配置")
@Parameter(name = "hostId", description = "hostId", required = true)
@Parameter(name = "type", description = "配置类型", required = true)
@PreAuthorize("@ss.hasPermission('asset:host:query')")
public HostConfigVO getHostConfig(@RequestParam("hostId") Long hostId,
@RequestParam(name = "type") String type) {
return hostConfigService.getHostConfig(hostId, type);
}
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/list")
@Operation(summary = "查询全部主机配置")
@Parameter(name = "hostId", description = "hostId", required = true)
@PreAuthorize("@ss.hasPermission('asset:host:query')")
public List<HostConfigVO> getHostConfigList(@RequestParam("hostId") Long hostId) {
return hostConfigService.getHostConfigList(hostId);
}
@OperatorLog(HostOperatorType.UPDATE_CONFIG)
@PutMapping("/update")
@Operation(summary = "更新主机配置")
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
public Integer updateHostConfig(@Validated @RequestBody HostConfigUpdateRequest request) {
return hostConfigService.updateHostConfig(request);
}
@OperatorLog(HostOperatorType.UPDATE_CONFIG_STATUS)
@PutMapping("/update-status")
@Operation(summary = "更新主机配置状态")
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
public Integer updateHostConfigStatus(@Validated @RequestBody HostConfigUpdateStatusRequest request) {
return hostConfigService.updateHostConfigStatus(request);
}
}

View File

@@ -53,15 +53,4 @@ DELETE {{baseUrl}}/asset/host/delete?id=1
Authorization: {{token}}
### 更新主机别名
PUT {{baseUrl}}/asset/host/update-alias
Content-Type: application/json
Authorization: {{token}}
{
"id": 1,
"name": "alias"
}
###

View File

@@ -5,17 +5,13 @@ import com.orion.ops.framework.biz.operator.log.core.annotation.OperatorLog;
import com.orion.ops.framework.common.validator.group.Page;
import com.orion.ops.framework.log.core.annotation.IgnoreLog;
import com.orion.ops.framework.log.core.enums.IgnoreLogMode;
import com.orion.ops.framework.security.core.utils.SecurityUtils;
import com.orion.ops.framework.web.core.annotation.RestWrapper;
import com.orion.ops.module.asset.define.operator.HostOperatorType;
import com.orion.ops.module.asset.entity.request.host.*;
import com.orion.ops.module.asset.entity.vo.HostConfigVO;
import com.orion.ops.module.asset.entity.request.host.HostCreateRequest;
import com.orion.ops.module.asset.entity.request.host.HostQueryRequest;
import com.orion.ops.module.asset.entity.request.host.HostUpdateRequest;
import com.orion.ops.module.asset.entity.vo.HostVO;
import com.orion.ops.module.asset.service.HostConfigService;
import com.orion.ops.module.asset.service.HostService;
import com.orion.ops.module.infra.api.DataAliasApi;
import com.orion.ops.module.infra.entity.dto.data.DataAliasUpdateDTO;
import com.orion.ops.module.infra.enums.DataExtraTypeEnum;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -46,12 +42,6 @@ public class HostController {
@Resource
private HostService hostService;
@Resource
private HostConfigService hostConfigService;
@Resource
private DataAliasApi dataAliasApi;
@OperatorLog(HostOperatorType.CREATE)
@PostMapping("/create")
@Operation(summary = "创建主机")
@@ -102,52 +92,5 @@ public class HostController {
return hostService.deleteHostById(id);
}
@PutMapping("/update-alias")
@Operation(summary = "修改主机别名")
public Integer updateHostAlias(@Validated @RequestBody HostAliasUpdateRequest request) {
DataAliasUpdateDTO update = DataAliasUpdateDTO.builder()
.userId(SecurityUtils.getLoginUserId())
.relId(request.getId())
.alias(request.getName())
.build();
return dataAliasApi.updateDataAlias(update, DataExtraTypeEnum.HOST);
}
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/get-config")
@Operation(summary = "查询主机配置")
@Parameter(name = "hostId", description = "hostId", required = true)
@Parameter(name = "type", description = "配置类型", required = true)
@PreAuthorize("@ss.hasPermission('asset:host:query')")
public HostConfigVO getHostConfig(@RequestParam("hostId") Long hostId,
@RequestParam(name = "type") String type) {
return hostConfigService.getHostConfig(hostId, type);
}
@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/get-config-all")
@Operation(summary = "查询主机配置 - 全部")
@Parameter(name = "hostId", description = "hostId", required = true)
@PreAuthorize("@ss.hasPermission('asset:host:query')")
public List<HostConfigVO> getHostConfig(@RequestParam("hostId") Long hostId) {
return hostConfigService.getHostConfig(hostId);
}
@OperatorLog(HostOperatorType.UPDATE_CONFIG)
@PutMapping("/update-config")
@Operation(summary = "更新主机配置")
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
public Integer updateHostConfig(@Validated @RequestBody HostConfigUpdateRequest request) {
return hostConfigService.updateHostConfig(request);
}
@OperatorLog(HostOperatorType.UPDATE_CONFIG_STATUS)
@PutMapping("/update-config-status")
@Operation(summary = "更新主机配置状态")
@PreAuthorize("@ss.hasPermission('asset:host:update-config')")
public Integer updateHostConfigStatus(@Validated @RequestBody HostConfigUpdateStatusRequest request) {
return hostConfigService.updateHostConfigStatus(request);
}
}

View File

@@ -0,0 +1,11 @@
### 修改主机别名
PUT {{baseUrl}}/asset/host-extra/update-alias
Content-Type: application/json
Authorization: {{token}}
{
"id": 1,
"name": "alias"
}
###

View File

@@ -0,0 +1,43 @@
package com.orion.ops.module.asset.controller;
import com.orion.ops.framework.web.core.annotation.RestWrapper;
import com.orion.ops.module.asset.entity.request.host.HostAliasUpdateRequest;
import com.orion.ops.module.asset.service.HostExtraService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 主机拓展信息 api
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023-9-11 14:16
*/
@Tag(name = "asset - 主机拓展信息服务")
@Slf4j
@Validated
@RestWrapper
@RestController
@RequestMapping("/asset/host-extra")
@SuppressWarnings({"ELValidationInJSP", "SpringElInspection"})
public class HostExtraController {
@Resource
private HostExtraService hostExtraService;
@PutMapping("/update-alias")
@Operation(summary = "修改主机别名")
public Integer updateHostAlias(@Validated @RequestBody HostAliasUpdateRequest request) {
return hostExtraService.updateHostAlias(request);
}
}

View File

@@ -41,7 +41,7 @@ public interface HostConfigService {
* @param hostId hostId
* @return 配置
*/
List<HostConfigVO> getHostConfig(Long hostId);
List<HostConfigVO> getHostConfigList(Long hostId);
/**
* 更新配置

View File

@@ -0,0 +1,24 @@
package com.orion.ops.module.asset.service;
import com.orion.ops.module.asset.entity.request.host.HostAliasUpdateRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 主机拓展信息 服务
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/20 12:04
*/
public interface HostExtraService {
/**
* 修改主机别名
*
* @param request request
* @return effect
*/
Integer updateHostAlias(@Validated @RequestBody HostAliasUpdateRequest request);
}

View File

@@ -69,7 +69,7 @@ public class HostConfigServiceImpl implements HostConfigService {
}
@Override
public List<HostConfigVO> getHostConfig(Long hostId) {
public List<HostConfigVO> getHostConfigList(Long hostId) {
List<HostConfigDO> configs = hostConfigDAO.getHostConfigByHostId(hostId);
if (configs.isEmpty()) {
// 初始化 兜底

View File

@@ -0,0 +1,36 @@
package com.orion.ops.module.asset.service.impl;
import com.orion.ops.framework.security.core.utils.SecurityUtils;
import com.orion.ops.module.asset.entity.request.host.HostAliasUpdateRequest;
import com.orion.ops.module.asset.service.HostExtraService;
import com.orion.ops.module.infra.api.DataAliasApi;
import com.orion.ops.module.infra.entity.dto.data.DataAliasUpdateDTO;
import com.orion.ops.module.infra.enums.DataExtraTypeEnum;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 主机拓展信息 服务实现类
*
* @author Jiahang Li
* @version 1.0.0
* @since 2023/12/20 12:11
*/
@Service
public class HostExtraServiceImpl implements HostExtraService {
@Resource
private DataAliasApi dataAliasApi;
@Override
public Integer updateHostAlias(HostAliasUpdateRequest request) {
DataAliasUpdateDTO update = DataAliasUpdateDTO.builder()
.userId(SecurityUtils.getLoginUserId())
.relId(request.getId())
.alias(request.getName())
.build();
return dataAliasApi.updateDataAlias(update, DataExtraTypeEnum.HOST);
}
}

View File

@@ -7,7 +7,7 @@ package com.orion.ops.module.infra.constant;
* @version 1.0.0
* @since 2023/12/19 22:26
*/
public interface DataExtraItemConst {
public interface DataExtraItems {
String ALIAS = "alias";

View File

@@ -1,7 +1,10 @@
package com.orion.ops.module.infra.entity.dto.data;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Size;
import java.io.Serializable;
@@ -23,7 +26,6 @@ public class DataExtraQueryDTO implements Serializable {
private static final long serialVersionUID = 1L;
@NonNull
@Schema(description = "用户id")
private Long userId;

View File

@@ -48,8 +48,7 @@ public class DataExtraApiImpl implements DataExtraApi {
@Override
public String getExtraItem(DataExtraQueryDTO dto, DataExtraTypeEnum type) {
Valid.valid(dto);
Valid.allNotNull(dto.getRelId(), dto.getItem());
Valid.allNotNull(dto.getUserId(), dto.getRelId(), dto.getItem());
// 查询
DataExtraQueryRequest request = DataExtraProviderConvert.MAPPER.to(dto);
request.setType(type.name());
@@ -58,8 +57,7 @@ public class DataExtraApiImpl implements DataExtraApi {
@Override
public Map<Long, String> getExtraItemList(DataExtraQueryDTO dto, DataExtraTypeEnum type) {
Valid.valid(dto);
Valid.allNotNull(dto.getRelIdList(), dto.getItem());
Valid.allNotNull(dto.getUserId(), dto.getRelIdList(), dto.getItem());
// 查询
DataExtraQueryRequest request = DataExtraProviderConvert.MAPPER.to(dto);
request.setType(type.name());

View File

@@ -4,7 +4,7 @@ import com.orion.lang.utils.Refs;
import com.orion.lang.utils.collect.Maps;
import com.orion.ops.framework.redis.core.utils.RedisMaps;
import com.orion.ops.framework.redis.core.utils.barrier.CacheBarriers;
import com.orion.ops.module.infra.constant.DataExtraItemConst;
import com.orion.ops.module.infra.constant.DataExtraItems;
import com.orion.ops.module.infra.define.cache.DataExtraCacheKeyDefine;
import com.orion.ops.module.infra.entity.request.data.DataAliasUpdateRequest;
import com.orion.ops.module.infra.entity.request.data.DataExtraQueryRequest;
@@ -41,7 +41,7 @@ public class DataAliasServiceImpl implements DataAliasService {
update.setUserId(userId);
update.setRelId(request.getRelId());
update.setType(type);
update.setItem(DataExtraItemConst.ALIAS);
update.setItem(DataExtraItems.ALIAS);
update.setValue(request.getAlias());
Integer effect = dataExtraService.updateExtraItem(update);
// 删除缓存
@@ -64,7 +64,7 @@ public class DataAliasServiceImpl implements DataAliasService {
DataExtraQueryRequest request = DataExtraQueryRequest.builder()
.userId(userId)
.type(type)
.item(DataExtraItemConst.ALIAS)
.item(DataExtraItems.ALIAS)
.build();
Map<Long, String> extras = dataExtraService.getExtraItemList(request);
entities = Maps.map(extras, String::valueOf, Refs::unrefToString);

View File

@@ -0,0 +1,51 @@
import axios from 'axios';
/**
* 主机配置请求
*/
export interface HostConfigRequest {
id?: number;
hostId?: number;
version?: number;
status?: number;
config?: string;
}
/**
* 主机配置查询响应
*/
export interface HostConfigQueryResponse {
id: number;
type: string;
version: number;
status: number;
config: Record<string, any>;
}
/**
* 查询主机配置
*/
export function getHostConfig(params: HostConfigRequest) {
return axios.get<HostConfigQueryResponse>('/asset/host-config/get', { params });
}
/**
* 查询全部主机配置
*/
export function getHostConfigList(hostId: number) {
return axios.get<Array<HostConfigQueryResponse>>('/asset/host-config/list', { params: { hostId } });
}
/**
* 更新主机配置
*/
export function updateHostConfig(request: HostConfigRequest) {
return axios.put('/asset/host-config/update', request);
}
/**
* 更新主机配置状态
*/
export function updateHostConfigStatus(request: HostConfigRequest) {
return axios.put('/asset/host-config/update-status', request);
}

View File

@@ -0,0 +1,16 @@
import axios from 'axios';
/**
* 主机别名修改请求
*/
export interface HostAliasUpdateRequest {
id?: number;
name?: string;
}
/**
* 修改主机别名
*/
export function updateHostAlias(request: HostAliasUpdateRequest) {
return axios.put('/asset/host-extra/update-alias', request);
}

View File

@@ -55,36 +55,6 @@ export interface HostQueryResponse extends TableData {
modCount: number;
}
/**
* 主机配置请求
*/
export interface HostConfigRequest {
id?: number;
hostId?: number;
version?: number;
status?: number;
config?: string;
}
/**
* 主机配置查询响应
*/
export interface HostConfigQueryResponse {
id: number;
type: string;
version: number;
status: number;
config: Record<string, any>;
}
/**
* 主机别名更新请求
*/
export interface HostAliasUpdateRequest {
id?: number;
name?: string;
}
/**
* 创建主机
*/
@@ -126,38 +96,3 @@ export function getHostPage(request: HostQueryRequest) {
export function deleteHost(id: number) {
return axios.delete('/asset/host/delete', { params: { id } });
}
/**
* 修改主机别名
*/
export function updateHostAlias(request: HostAliasUpdateRequest) {
return axios.put('/asset/host/update-alias', request);
}
/**
* 查询主机配置
*/
export function getHostConfig(params: HostConfigRequest) {
return axios.get<HostConfigQueryResponse>('/asset/host/get-config', { params });
}
/**
* 查询主机配置 - 全部
*/
export function getHostConfigAll(params: HostConfigRequest) {
return axios.get<Array<HostConfigQueryResponse>>('/asset/host/get-config-all', { params });
}
/**
* 更新主机配置
*/
export function updateHostConfig(request: HostConfigRequest) {
return axios.put('/asset/host/update-config', request);
}
/**
* 更新主机配置状态
*/
export function updateHostConfigStatus(request: HostConfigRequest) {
return axios.put('/asset/host/update-config-status', request);
}

View File

@@ -33,7 +33,7 @@
import useVisible from '@/hooks/visible';
import useLoading from '@/hooks/loading';
import { Message } from '@arco-design/web-vue';
import { getHostConfigAll } from '@/api/asset/host';
import { getHostConfigList } from '@/api/asset/host-config';
import { useCacheStore, useDictStore } from '@/store';
import { dictKeys as sshDictKeys } from './ssh/types/const';
import SshConfigForm from './ssh/ssh-config-form.vue';
@@ -57,7 +57,7 @@
const dictStore = useDictStore();
await dictStore.loadKeys([...sshDictKeys]);
// 加载配置
const { data } = await getHostConfigAll({ hostId: record.value.id });
const { data } = await getHostConfigList(record.value.id);
data.forEach(s => {
config.value[s.type] = s;
});

View File

@@ -141,7 +141,7 @@
import type { FieldRule } from '@arco-design/web-vue';
import type { HostSshConfig } from './types/const';
import { reactive, ref, watch } from 'vue';
import { updateHostConfigStatus, updateHostConfig } from '@/api/asset/host';
import { updateHostConfigStatus, updateHostConfig } from '@/api/asset/host-config';
import { authTypeKey, AuthType } from './types/const';
import rules from './types/form.rules';
import { Message } from '@arco-design/web-vue';

View File

@@ -168,7 +168,7 @@
import { dataColor } from '@/utils';
import { tagColor } from '@/views/asset/host-list/types/const';
import { ref, nextTick } from 'vue';
import { updateHostAlias } from '@/api/asset/host';
import { updateHostAlias } from '@/api/asset/host-extra';
const props = defineProps<{
hostList: Array<HostQueryResponse>,

View File

@@ -1,3 +1,5 @@
-- replace regexp 'AUTO_INCREMENT = .*' to 'AUTO_INCREMENT = 1' --
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
@@ -76,7 +78,8 @@ CREATE TABLE `data_extra`
`user_id` bigint(0) NULL DEFAULT NULL COMMENT '用户id',
`rel_id` bigint(0) NULL DEFAULT NULL COMMENT '数据id',
`type` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据类型',
`extra_info` json NULL COMMENT '额外信息',
`item` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拓展项',
`value` json NULL COMMENT '拓展值',
`create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
@@ -88,7 +91,7 @@ CREATE TABLE `data_extra`
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '数据展信息表'
COLLATE = utf8mb4_general_ci COMMENT = '数据展信息表'
ROW_FORMAT = Dynamic;
-- ----------------------------
@@ -110,7 +113,7 @@ CREATE TABLE `data_group`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_type` (`type`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 29
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '数据分组'
ROW_FORMAT = Dynamic;
@@ -134,7 +137,7 @@ CREATE TABLE `data_group_rel`
INDEX `idx_group_rel` (`group_id`, `rel_id`) USING BTREE,
INDEX `idx_type` (`type`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 114
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '数据分组关联'
ROW_FORMAT = Dynamic;
@@ -160,7 +163,7 @@ CREATE TABLE `data_permission`
INDEX `idx_role_id` (`role_id`) USING BTREE,
INDEX `idx_type_rel` (`type`, `rel_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 166
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = Dynamic;
@@ -184,7 +187,7 @@ CREATE TABLE `dict_key`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_key` (`key_name`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 26
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '字典配置项'
ROW_FORMAT = Dynamic;
@@ -210,7 +213,7 @@ CREATE TABLE `dict_value`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_key_id` (`key_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 173
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '字典配置值'
ROW_FORMAT = Dynamic;
@@ -233,7 +236,7 @@ CREATE TABLE `favorite`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_type_user` (`type`, `user_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 92
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '收藏关联'
ROW_FORMAT = Dynamic;
@@ -254,7 +257,7 @@ CREATE TABLE `history_value`
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 26
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '历史归档表'
ROW_FORMAT = Dynamic;
@@ -276,7 +279,7 @@ CREATE TABLE `host`
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 8
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '主机'
ROW_FORMAT = Dynamic;
@@ -301,7 +304,7 @@ CREATE TABLE `host_config`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_host_type` (`host_id`, `type`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 14
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '主机配置'
ROW_FORMAT = Dynamic;
@@ -324,7 +327,7 @@ CREATE TABLE `host_identity`
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 6
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '主机身份'
ROW_FORMAT = Dynamic;
@@ -347,7 +350,7 @@ CREATE TABLE `host_key`
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 18
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '主机秘钥'
ROW_FORMAT = Dynamic;
@@ -381,7 +384,7 @@ CREATE TABLE `operator_log`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_user_id` (`user_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 759
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '操作日志'
ROW_FORMAT = Dynamic;
@@ -394,8 +397,9 @@ CREATE TABLE `preference`
(
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT 'id',
`user_id` bigint(0) NULL DEFAULT NULL COMMENT '用户id',
`type` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型',
`config` json NULL COMMENT '偏好配置',
`type` char(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '偏好类型',
`item` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '配置',
`value` json NULL COMMENT '配置值',
`create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '创建人',
@@ -404,7 +408,7 @@ CREATE TABLE `preference`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_user_type` (`user_id`, `type`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 9
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '用户偏好'
ROW_FORMAT = Dynamic;
@@ -435,7 +439,7 @@ CREATE TABLE `system_menu`
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 147
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '菜单表'
ROW_FORMAT = Dynamic;
@@ -457,7 +461,7 @@ CREATE TABLE `system_role`
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除 0未删除 1已删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 8
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '角色表'
ROW_FORMAT = Dynamic;
@@ -479,7 +483,7 @@ CREATE TABLE `system_role_menu`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_role` (`role_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 72
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '角色菜单表'
ROW_FORMAT = Dynamic;
@@ -507,7 +511,7 @@ CREATE TABLE `system_user`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_username` (`username`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 15
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '用户表'
ROW_FORMAT = Dynamic;
@@ -529,7 +533,7 @@ CREATE TABLE `system_user_role`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_user` (`user_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 48
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '用户角色关联表'
ROW_FORMAT = Dynamic;
@@ -551,7 +555,7 @@ CREATE TABLE `tag`
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_type` (`type`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 31
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '标签枚举'
ROW_FORMAT = Dynamic;
@@ -576,7 +580,7 @@ CREATE TABLE `tag_rel`
INDEX `idx_tag` (`tag_id`) USING BTREE,
INDEX `idx_type_rel` (`tag_type`, `rel_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 219
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '标签关联'
ROW_FORMAT = Dynamic;