1、jdk版本改为21,对应的打包脚本调整

2、安全组相关代码优化
This commit is contained in:
aoshiguchen
2023-12-10 16:42:52 +08:00
parent 1ad80a6d8b
commit 5ccf0d1936
26 changed files with 376 additions and 150 deletions
+49 -26
View File
@@ -1,24 +1,31 @@
import request from '@/utils/request' import request from '@/utils/request'
const baseUri = '/security'; export function fetchGroupPage(query) {
return request({
url: '/security/group/page',
method: 'get',
params: query
})
}
export function fetchGroupList() { export function fetchGroupList() {
return request({ return request({
url: `${baseUri}/group/list`, url: '/security/group/list',
method: 'get' method: 'get'
}) })
} }
export function fetchGroupOne(groupId) { export function fetchGroupDetail(query) {
return request({ return request({
url: `${baseUri}/group/detail?groupId=${groupId}`, url: '/security/group/detail',
method: 'get' method: 'get',
params: query
}) })
} }
export function createGroup(data) { export function createGroup(data) {
return request({ return request({
url: `${baseUri}/group/create`, url: `/security/group/create`,
method: 'post', method: 'post',
data data
}) })
@@ -26,43 +33,58 @@ export function createGroup(data) {
export function updateGroup(data) { export function updateGroup(data) {
return request({ return request({
url: `${baseUri}/group/update`, url: `/security/group/update`,
method: 'post', method: 'post',
data data
}) })
} }
export function deleteGroup(groupId) { export function deleteGroup(data) {
return request({ return request({
url: `${baseUri}/group/delete?groupId=${groupId}`, url: '/security/group/delete',
method: 'post' method: 'post',
data
}) })
} }
export function enableGroup(groupId) { export function updateGroupEnableStatus(id, enable) {
return request({ return request({
url: `${baseUri}/group/enable?groupId=${groupId}`, url: '/security/group/update/enable-status',
method: 'post' method: 'post',
data: {
id: id,
enable: enable
}
}) })
} }
export function disableGroup(groupId) { export function enableGroup(query) {
return request({ return request({
url: `${baseUri}/group/disable?groupId=${groupId}`, url: '/security/group/enable',
method: 'post' method: 'post',
params: query
}) })
} }
export function fetchRuleList(groupId) { export function disableGroup(query) {
return request({ return request({
url: `${baseUri}/rule/list?groupId=${groupId}`, url: '/security/group/disable',
method: 'get' method: 'post',
params: query
})
}
export function fetchRuleList(query) {
return request({
url: '/security/rule/list',
method: 'get',
params: query
}) })
} }
export function createRule(data) { export function createRule(data) {
return request({ return request({
url: `${baseUri}/rule/create`, url: `/security/rule/create`,
method: 'post', method: 'post',
data data
}) })
@@ -70,28 +92,29 @@ export function createRule(data) {
export function updateRule(data) { export function updateRule(data) {
return request({ return request({
url: `${baseUri}/rule/update`, url: `/security/rule/update`,
method: 'post', method: 'post',
data data
}) })
} }
export function deleteRule(ruleId) { export function deleteRule(query) {
return request({ return request({
url: `${baseUri}/rule/delete?ruleId=${ruleId}`, url: '/security/rule/delete',
method: 'post' method: 'post',
params: query
}) })
} }
export function enableRule(ruleId) { export function enableRule(ruleId) {
return request({ return request({
url: `${baseUri}/rule/enable?ruleId=${ruleId}`, url: `/security/rule/enable?ruleId=${ruleId}`,
method: 'post' method: 'post'
}) })
} }
export function disableRule(ruleId) { export function disableRule(ruleId) {
return request({ return request({
url: `${baseUri}/rule/disable?ruleId=${ruleId}`, url: `/security/rule/disable?ruleId=${ruleId}`,
method: 'post' method: 'post'
}) })
} }
@@ -99,8 +99,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{ $t('table.edit') }}</el-button> <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{ $t('table.edit') }}</el-button>
<el-button v-if="scope.row.enable == '1'" size="mini" type="danger" @click="handleModifyStatus(scope.row, 2)">{{$t('table.disable')}}</el-button> <el-button v-if="scope.row.enable == '1'" size="mini" type="danger" @click="handleModifyStatus(scope.row, 2)">{{$t('table.disable')}}</el-button>
<el-button v-if="scope.row.enable == '2'" size="mini" type="success" <el-button v-if="scope.row.enable == '2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)">{{ $t('table.enable') }}</el-button>
@click="handleModifyStatus(scope.row, 1)">{{ $t('table.enable') }}</el-button>
<!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>--> <!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px" /> <ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px" />
@@ -1,6 +1,12 @@
<template> <template>
<div class="app-container calendar-list-container"> <div class="app-container calendar-list-container">
<div class="filter-container"> <div class="filter-container">
<el-input v-model="listQuery.name" style="width:145px;margin-right:10px" placeholder="请输入名称" />
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{
$t('table.search') }}</el-button>
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button> <el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
</div> </div>
@@ -40,8 +46,7 @@
</el-table-column> </el-table-column>
<el-table-column class-name="status-col" :label="$t('table.enableStatus')"> <el-table-column class-name="status-col" :label="$t('table.enableStatus')">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="success" v-if="scope.row.enable == '启用'">{{scope.row.enable}}</el-tag> <el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
<el-tag type="danger" v-if="scope.row.enable == '禁用'">{{scope.row.enable}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" :label="$t('table.actions')" class-name="small-padding fixed-width" style="display:flex;justify-content:center"> <el-table-column align="center" :label="$t('table.actions')" class-name="small-padding fixed-width" style="display:flex;justify-content:center">
@@ -49,8 +54,8 @@
<div > <div >
<el-link :underline="false" type="primary" size="mini" @click="handleGoRulePage(scope.row)" style="font-size: 12px">{{$t('table.ruleConfig')}}</el-link> <el-link :underline="false" type="primary" size="mini" @click="handleGoRulePage(scope.row)" style="font-size: 12px">{{$t('table.ruleConfig')}}</el-link>
<el-link :underline="false" type="primary" size="mini" @click="handleUpdate(scope.row)" style="font-size: 12px">{{$t('table.edit')}}</el-link> <el-link :underline="false" type="primary" size="mini" @click="handleUpdate(scope.row)" style="font-size: 12px">{{$t('table.edit')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='启用'" size="mini" type="warning" @click="handleDisableStatus(scope.row)" style="font-size: 12px">{{$t('table.disable')}}</el-link> <el-link :underline="false" v-if="scope.row.enable =='1'" size="mini" type="warning" @click="handleModifyStatus(scope.row, 2)" style="font-size: 12px">{{$t('table.disable')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='禁用'" size="mini" type="success" @click="handleEnableStatus(scope.row)" style="font-size: 12px">{{$t('table.enable')}}</el-link> <el-link :underline="false" v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)" style="font-size: 12px">{{$t('table.enable')}}</el-link>
</div> </div>
<el-dropdown> <el-dropdown>
<span class="el-dropdown-link" style="font-size: 12px"> <span class="el-dropdown-link" style="font-size: 12px">
@@ -69,6 +74,13 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-pageInfo.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="120px" style='width: 500px; margin-left:10px;'> <el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="120px" style='width: 500px; margin-left:10px;'>
<el-form-item :label="$t('table.name')" prop="name"> <el-form-item :label="$t('table.name')" prop="name">
@@ -170,10 +182,9 @@
</template> </template>
<script> <script>
import {fetchGroupList, createGroup, updateGroup, deleteGroup, enableGroup, disableGroup} from '@/api/securityGroup' import {fetchGroupPage, createGroup, updateGroup, deleteGroup, updateGroupEnableStatus} from '@/api/securityGroup'
import { fetchList as fetchPortMappingList, portMappingBindSecurityGroup, portMappingUnbindSecurityGroup} from '@/api/portMapping' import { fetchList as fetchPortMappingList, portMappingBindSecurityGroup, portMappingUnbindSecurityGroup} from '@/api/portMapping'
import waves from '@/directive/waves' // 水波纹指令 import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import LinkPopover from '../../components/Link/linkPopover' import LinkPopover from '../../components/Link/linkPopover'
export default { export default {
@@ -188,6 +199,13 @@ import LinkPopover from '../../components/Link/linkPopover'
return { return {
tableKey: 0, tableKey: 0,
list: [], list: [],
total: null,
listQuery: {
current: 1,
size: 10,
name: undefined,
enable: undefined
},
listLoading: true, listLoading: true,
temp: { temp: {
id: undefined, id: undefined,
@@ -195,6 +213,10 @@ import LinkPopover from '../../components/Link/linkPopover'
description: '', description: '',
defaultPassType: undefined defaultPassType: undefined
}, },
selectObj: {
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }]
},
dialogFormVisible: false, dialogFormVisible: false,
dialogStatus: '', dialogStatus: '',
textMap: { textMap: {
@@ -257,11 +279,24 @@ import LinkPopover from '../../components/Link/linkPopover'
methods: { methods: {
getList() { getList() {
this.listLoading = true this.listLoading = true
fetchGroupList().then(response => { fetchGroupPage(this.listQuery).then(response => {
this.list = response.data.data this.list = response.data.data.records
this.total = response.data.data.total
this.listLoading = false this.listLoading = false
}) })
}, },
handleFilter() {
this.listQuery.current = 1
this.getList()
},
handleSizeChange(val) {
this.listQuery.size = val
this.getList()
},
handleCurrentChange(val) {
this.listQuery.current = val
this.getList()
},
getPortMappingList() { getPortMappingList() {
this.portMappingListLoading = true this.portMappingListLoading = true
fetchPortMappingList(this.portMappingListQuery).then(response => { fetchPortMappingList(this.portMappingListQuery).then(response => {
@@ -270,27 +305,16 @@ import LinkPopover from '../../components/Link/linkPopover'
this.portMappingListQuery.current = response.data.data.current this.portMappingListQuery.current = response.data.data.current
this.portMappingListLoading = false this.portMappingListLoading = false
}) })
},
handleEnableStatus(row) {
enableGroup(row.id).then(response => {
if (response.data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
this.getList()
}
})
}, },
handleDisableStatus(row) { handleModifyStatus(row, enable) {
disableGroup(row.id).then(response => { updateGroupEnableStatus(row.id, enable).then(response => {
if (response.data.code === 0) { if (response.data.data.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
type: 'success' type: 'success'
}) })
this.getList()
} }
this.getList()
}) })
}, },
resetTemp() { resetTemp() {
@@ -413,8 +437,3 @@ import LinkPopover from '../../components/Link/linkPopover'
} }
} }
</script> </script>
<style>
.filter-container {
text-align: right;
}
</style>
@@ -39,11 +39,11 @@
<el-tag type="info" v-if="scope.row.passType == 'deny'" effect="dark">拒绝</el-tag> <el-tag type="info" v-if="scope.row.passType == 'deny'" effect="dark">拒绝</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" :label="$t('table.priority')"> <!-- <el-table-column align="center" :label="$t('table.priority')">-->
<template slot-scope="scope"> <!-- <template slot-scope="scope">-->
<span>{{scope.row.priority}}</span> <!-- <span>{{scope.row.priority}}</span>-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
<el-table-column align="center" :label="$t('table.createTime')"> <el-table-column align="center" :label="$t('table.createTime')">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.createTime}}</span> <span>{{scope.row.createTime}}</span>
@@ -56,15 +56,14 @@
</el-table-column> </el-table-column>
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="150"> <el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag type="success" v-if="scope.row.enable == '启用'">{{scope.row.enable}}</el-tag> <el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
<el-tag type="warning" v-if="scope.row.enable == '禁用'">{{scope.row.enable}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" :label="$t('table.actions')" width="250" class-name="small-padding fixed-width"> <el-table-column align="center" :label="$t('table.actions')" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" :underline="false" size="mini" @click="handleUpdate(scope.row)" style="font-size:12px">{{$t('table.edit')}}</el-link> <el-link type="primary" :underline="false" size="mini" @click="handleUpdate(scope.row)" style="font-size:12px">{{$t('table.edit')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='启用'" size="mini" type="warning" @click="handleDisableStatus(scope.row)" style="font-size:12px">{{$t('table.disable')}}</el-link> <el-link :underline="false" v-if="scope.row.enable =='1'" size="mini" type="warning" @click="handleDisableStatus(scope.row)" style="font-size:12px">{{$t('table.disable')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='禁用'" size="mini" type="success" @click="handleEnableStatus(scope.row)" style="font-size:12px">{{$t('table.enable')}}</el-link> <el-link :underline="false" v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleEnableStatus(scope.row)" style="font-size:12px">{{$t('table.enable')}}</el-link>
<LinkPopover @handleCommitClick="handleDelete(scope.row)"/> <LinkPopover @handleCommitClick="handleDelete(scope.row)"/>
</template> </template>
</el-table-column> </el-table-column>
@@ -93,7 +92,7 @@
<div>每个类型中间以英文逗号分隔,形如 192.168.1.1,192.168.3.0/24 是正确的 </div> <div>每个类型中间以英文逗号分隔,形如 192.168.1.1,192.168.3.0/24 是正确的 </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item :label="$t('table.passType')" prop="passType"> <el-form-item :label="$t('table.passType')" prop="passType">
<el-tooltip class="item" effect="dark" :content="temp.passTypeTooltip" placement="right"> <el-tooltip class="item" effect="dark" :content="temp.passTypeTooltip" placement="right">
@@ -103,7 +102,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
<!-- <el-form-item :label="$t('table.priority')" prop="priority"> <!-- <el-form-item :label="$t('table.priority')" prop="priority">
@@ -132,7 +131,7 @@
</template> </template>
<script> <script>
import {fetchGroupOne, fetchRuleList, createRule, updateRule, deleteRule, enableRule, disableRule} from '@/api/securityGroup' import {fetchGroupDetail, fetchRuleList, createRule, updateRule, deleteRule, enableRule, disableRule} from '@/api/securityGroup'
import waves from '@/directive/waves' // 水波纹指令 import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
import LinkPopover from '../../components/Link/linkPopover' import LinkPopover from '../../components/Link/linkPopover'
@@ -206,7 +205,7 @@ import LinkPopover from '../../components/Link/linkPopover'
if (queryParam && typeof queryParam === 'object' && queryParam.groupId) { if (queryParam && typeof queryParam === 'object' && queryParam.groupId) {
this.groupId = queryParam.groupId this.groupId = queryParam.groupId
localStorage.setItem('groupId', this.groupId) localStorage.setItem('groupId', this.groupId)
this.getGroupOne() this.getGroupDetail()
this.getList() this.getList()
return return
} }
@@ -214,11 +213,11 @@ import LinkPopover from '../../components/Link/linkPopover'
const groupId = localStorage.getItem('groupId') const groupId = localStorage.getItem('groupId')
if (groupId) { if (groupId) {
this.groupId = parseInt(groupId) this.groupId = parseInt(groupId)
this.getGroupOne() this.getGroupDetail()
this.getList() this.getList()
return return
} }
this.$notify({ this.$notify({
title: '错误', title: '错误',
message: '没有获取到安全组信息', message: '没有获取到安全组信息',
@@ -228,8 +227,8 @@ import LinkPopover from '../../components/Link/linkPopover'
this.$router.push(`/system/securityGroup`) this.$router.push(`/system/securityGroup`)
}, },
methods: { methods: {
getGroupOne () { getGroupDetail () {
fetchGroupOne(this.groupId).then(response => { fetchGroupDetail({id: this.groupId}).then(response => {
this.group = response.data.data this.group = response.data.data
}) })
}, },
@@ -244,7 +243,7 @@ import LinkPopover from '../../components/Link/linkPopover'
return return
} }
this.listLoading = true this.listLoading = true
fetchRuleList(this.groupId).then(response => { fetchRuleList({groupId: this.groupId}).then(response => {
this.list = response.data.data this.list = response.data.data
this.listLoading = false this.listLoading = false
}) })
@@ -342,7 +341,7 @@ import LinkPopover from '../../components/Link/linkPopover'
}) })
}, },
handleDelete(row) { handleDelete(row) {
deleteRule(row.id).then(response => { deleteRule({ruleId: row.id}).then(response => {
if (response.data.code === 0) { if (response.data.code === 0) {
this.$notify({ this.$notify({
title: '成功', title: '成功',
@@ -67,7 +67,10 @@ public enum ExceptionConstant {
PORT_GROUP_NAME_ALREADY_EXIST(16000,"端口分组名称[{}]已经存在"), PORT_GROUP_NAME_ALREADY_EXIST(16000,"端口分组名称[{}]已经存在"),
PORT_GROUP_NAME_DOES_NOT_EXIST(16001,"端口分组不存在"), PORT_GROUP_NAME_DOES_NOT_EXIST(16001,"端口分组不存在"),
DEFAULT_GROUP_FORBID_DELETE(16002,"默认分组禁止删除") DEFAULT_GROUP_FORBID_DELETE(16002,"默认分组禁止删除"),
// 安全组管理(17000)
SECURITY_GROUP_NOT_EXIST(17000, "安全组不存在"),
; ;
private int code; private int code;
@@ -1,16 +1,17 @@
package org.dromara.neutrinoproxy.server.controller; package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum; import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupCreateReq; import org.dromara.neutrinoproxy.server.controller.req.system.*;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupUpdateReq; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupDetailRes;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleCreateReq; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupListRes;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleUpdateReq; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupUpdateEnableStatueRes;
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupRes;
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityRuleRes; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityRuleRes;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO; import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO;
import org.dromara.neutrinoproxy.server.service.PortMappingService; import org.dromara.neutrinoproxy.server.service.PortMappingService;
import org.dromara.neutrinoproxy.server.service.SecurityGroupService; import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.noear.solon.annotation.*; import org.noear.solon.annotation.*;
import java.util.List; import java.util.List;
@@ -29,17 +30,27 @@ public class SecurityController {
/** /**
* 获取当前用户权限下的安全组 * 获取当前用户权限下的安全组
*/ */
@Get
@Mapping("/group/page")
public PageInfo<SecurityGroupListRes> groupPage(PageQuery pageQuery, SecurityGroupListReq req) {
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
return groupService.groupPage(pageQuery, req);
}
@Get @Get
@Mapping("/group/list") @Mapping("/group/list")
public List<SecurityGroupRes> groupList() { public List<SecurityGroupListRes> groupList() {
List<SecurityGroupDO> groupDOList = groupService.queryGroupList(); return groupService.groupList();
return groupDOList.stream().map(SecurityGroupDO::toRes).collect(Collectors.toList());
} }
@Get @Get
@Mapping("/group/detail") @Mapping("/group/detail")
public SecurityGroupRes getGroupOne(Integer groupId) { public SecurityGroupDetailRes groupDetail(SecurityGroupDetailReq req) {
return groupService.queryGroupOne(groupId).toRes(); ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
return groupService.groupDetail(req);
} }
@Post @Post
@@ -65,15 +76,13 @@ public class SecurityController {
} }
@Post @Post
@Mapping("/group/enable") @Mapping("/group/update/enable-status")
public void enableGroup(Integer groupId) { public SecurityGroupUpdateEnableStatueRes updateGroupEnableStatueReq(SecurityGroupUpdateEnableStatueReq req) {
groupService.setGroupStatus(groupId, EnableStatusEnum.ENABLE); ParamCheckUtil.checkNotNull(req, "req");
} ParamCheckUtil.checkNotNull(req.getId(), "id");
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
@Post return groupService.updateGroupEnableStatueReq(req);
@Mapping("/group/disable")
public void disableGroup(Integer groupId) {
groupService.setGroupStatus(groupId, EnableStatusEnum.DISABLE);
} }
@Get @Get
@@ -0,0 +1,12 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityGroupDetailReq {
private Integer id;
}
@@ -0,0 +1,13 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* @author: wen.y
* @date: 2023/12/10
*/
@Data
public class SecurityGroupListReq {
private String name;
private Integer enable;
}
@@ -0,0 +1,19 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityGroupUpdateEnableStatueReq {
/**
* id
*/
private Integer id;
/**
* 启用状态
*/
private Integer enable;
}
@@ -5,11 +5,9 @@ import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum; import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum; import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import java.util.Date;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class SecurityGroupRes { public class SecurityGroupDetailRes {
private Integer id; private Integer id;
@@ -27,7 +25,7 @@ public class SecurityGroupRes {
* 启用状态 * 启用状态
* {@link EnableStatusEnum} * {@link EnableStatusEnum}
*/ */
private String enable; private Integer enable;
/** /**
* 默认放行类型 * 默认放行类型
@@ -0,0 +1,47 @@
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
@Data
@Accessors(chain = true)
public class SecurityGroupListRes {
private Integer id;
/**
* 组名
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* 默认放行类型
* {@link SecurityRulePassTypeEnum}
*/
private String defaultPassType;
/**
* 创建时间
*/
private String createTime;
/**
* 更新时间
*/
private String updateTime;
}
@@ -0,0 +1,12 @@
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityGroupUpdateEnableStatueRes {
}
@@ -54,7 +54,7 @@ public class SecurityRuleRes {
/** /**
* 启用状态 * 启用状态
*/ */
private String enable; private Integer enable;
/** /**
* 创建时间 * 创建时间
@@ -1,7 +1,25 @@
package org.dromara.neutrinoproxy.server.dal; package org.dromara.neutrinoproxy.server.dal;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingListReq;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupListReq;
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO; import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
import java.util.Date;
import java.util.List;
public interface SecurityGroupMapper extends BaseMapper<SecurityGroupDO> { public interface SecurityGroupMapper extends BaseMapper<SecurityGroupDO> {
List<SecurityGroupDO> selectByCondition(IPage<SecurityGroupDO> page, @Param("req") SecurityGroupListReq req);
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
this.update(null, new LambdaUpdateWrapper<SecurityGroupDO>()
.eq(SecurityGroupDO::getId, id)
.set(SecurityGroupDO::getEnable, enable)
.set(SecurityGroupDO::getUpdateTime, updateTime)
);
}
} }
@@ -11,7 +11,8 @@ import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum; import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum; import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupRes; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupDetailRes;
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupListRes;
import java.util.Date; import java.util.Date;
@@ -38,12 +39,11 @@ public class SecurityGroupDO {
* 用户id * 用户id
*/ */
private Integer userId; private Integer userId;
/** /**
* 启用状态 * 启用状态
* {@link EnableStatusEnum} * {@link EnableStatusEnum}
*/ */
private EnableStatusEnum enable; private Integer enable;
/** /**
* 默认放行类型 * 默认放行类型
@@ -60,15 +60,21 @@ public class SecurityGroupDO {
*/ */
private Date updateTime; private Date updateTime;
public SecurityGroupRes toRes() { public SecurityGroupListRes toListRes() {
SecurityGroupRes res = new SecurityGroupRes(); SecurityGroupListRes res = new SecurityGroupListRes();
BeanUtil.copyProperties(this, res); BeanUtil.copyProperties(this, res);
res.setEnable(enable.getDesc()) res.setDefaultPassType(defaultPassType.getDesc())
.setDefaultPassType(defaultPassType.getDesc())
.setCreateTime(DateUtil.format(this.getCreateTime(), DatePattern.NORM_DATETIME_FORMAT)) .setCreateTime(DateUtil.format(this.getCreateTime(), DatePattern.NORM_DATETIME_FORMAT))
.setUpdateTime(DateUtil.format(this.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT)); .setUpdateTime(DateUtil.format(this.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT));
return res; return res;
} }
public SecurityGroupDetailRes toDetailRes() {
SecurityGroupDetailRes res = new SecurityGroupDetailRes();
BeanUtil.copyProperties(this, res);
res.setDefaultPassType(defaultPassType.getDesc())
.setCreateTime(DateUtil.format(this.getCreateTime(), DatePattern.NORM_DATETIME_FORMAT))
.setUpdateTime(DateUtil.format(this.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT));
return res;
}
} }
@@ -71,7 +71,7 @@ public class SecurityRuleDO {
* 启用状态 * 启用状态
* {@link EnableStatusEnum} * {@link EnableStatusEnum}
*/ */
private EnableStatusEnum enable; private Integer enable;
/** /**
* 创建时间 * 创建时间
*/ */
@@ -149,7 +149,6 @@ public class SecurityRuleDO {
SecurityRuleRes res = new SecurityRuleRes(); SecurityRuleRes res = new SecurityRuleRes();
BeanUtil.copyProperties(this, res); BeanUtil.copyProperties(this, res);
res.setPassType(this.passType.getDesc()) res.setPassType(this.passType.getDesc())
.setEnable(this.getEnable().getDesc())
.setCreateTime(DateUtil.format(this.getCreateTime(), DatePattern.NORM_DATETIME_FORMAT)) .setCreateTime(DateUtil.format(this.getCreateTime(), DatePattern.NORM_DATETIME_FORMAT))
.setUpdateTime(DateUtil.format(this.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT)) .setUpdateTime(DateUtil.format(this.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT))
; ;
@@ -4,29 +4,37 @@ import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil; import cn.hutool.cache.CacheUtil;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jdk.jshell.Snippet; import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.solon.annotation.Db; import org.apache.ibatis.solon.annotation.Db;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder; import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum; import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum; import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupCreateReq; import org.dromara.neutrinoproxy.server.controller.req.system.*;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupUpdateReq; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupDetailRes;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleCreateReq; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupListRes;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleUpdateReq; import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupUpdateEnableStatueRes;
import org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper; import org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper;
import org.dromara.neutrinoproxy.server.dal.SecurityRuleMapper; import org.dromara.neutrinoproxy.server.dal.SecurityRuleMapper;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO; import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO; import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.noear.solon.annotation.Component; import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init; import org.noear.solon.annotation.Init;
import org.noear.solon.core.runtime.NativeDetector; import org.noear.solon.core.runtime.NativeDetector;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
@@ -45,6 +53,10 @@ public class SecurityGroupService {
@Init(index = 100) @Init(index = 100)
public synchronized void init() { public synchronized void init() {
// aot 阶段,不初始化
if (NativeDetector.isAotRuntime()) {
return;
}
securityGroupMap.clear(); securityGroupMap.clear();
List<SecurityGroupDO> groupDOList = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class) List<SecurityGroupDO> groupDOList = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
.eq(SecurityGroupDO::getEnable, EnableStatusEnum.ENABLE)); .eq(SecurityGroupDO::getEnable, EnableStatusEnum.ENABLE));
@@ -56,19 +68,41 @@ public class SecurityGroupService {
ipAllowControlCache.clear(); ipAllowControlCache.clear();
} }
public List<SecurityGroupDO> queryGroupList() { public PageInfo<SecurityGroupListRes> groupPage(PageQuery pageQuery, SecurityGroupListReq req) {
return securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class) if (StringUtils.isNotEmpty(req.getName())) {
.eq(SecurityGroupDO::getUserId, SystemContextHolder.getUserId())); //描述字段为模糊查询,在应用层处理,否则sqlite不支持
req.setName("%" + req.getName() + "%");
}
Page<SecurityGroupDO> page = new Page<>(pageQuery.getCurrent(), pageQuery.getSize());
List<SecurityGroupDO> list = securityGroupMapper.selectByCondition(page, req);
if (CollectionUtils.isEmpty(list)) {
PageInfo.of(null, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
}
List<SecurityGroupListRes> respList = list.stream().map(SecurityGroupDO::toListRes).collect(Collectors.toList());
return PageInfo.of(respList, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
} }
public SecurityGroupDO queryGroupOne(Integer groupId) { public List<SecurityGroupListRes> groupList() {
return securityGroupMapper.selectById(groupId); List<SecurityGroupDO> list = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
.eq(SecurityGroupDO::getUserId, SystemContextHolder.getUserId()));
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(SecurityGroupDO::toListRes).collect(Collectors.toList());
}
public SecurityGroupDetailRes groupDetail(SecurityGroupDetailReq req) {
SecurityGroupDO securityGroupDO = securityGroupMapper.selectById(req.getId());
if (null != securityGroupDO) {
return securityGroupDO.toDetailRes();
}
return null;
} }
public void createGroup(SecurityGroupCreateReq req) { public void createGroup(SecurityGroupCreateReq req) {
SecurityGroupDO groupDO = new SecurityGroupDO(); SecurityGroupDO groupDO = new SecurityGroupDO();
BeanUtil.copyProperties(req, groupDO); BeanUtil.copyProperties(req, groupDO);
groupDO.setEnable(EnableStatusEnum.ENABLE) groupDO.setEnable(EnableStatusEnum.ENABLE.getStatus())
.setUserId(SystemContextHolder.getUserId()) .setUserId(SystemContextHolder.getUserId())
.setCreateTime(new Date()) .setCreateTime(new Date())
.setUpdateTime(new Date()); .setUpdateTime(new Date());
@@ -87,16 +121,6 @@ public class SecurityGroupService {
init(); init();
} }
public void setGroupStatus(Integer groupId, EnableStatusEnum statusEnum) {
SecurityGroupDO groupDO = securityGroupMapper.selectById(groupId);
if (groupDO == null) {
throw new RuntimeException("指定的安全组不存在");
}
groupDO.setEnable(statusEnum);
securityGroupMapper.updateById(groupDO);
init();
}
/** /**
* 删除安全组,并级联删除安全组下的规则,删除后,需缓存 * 删除安全组,并级联删除安全组下的规则,删除后,需缓存
* @param groupId 安全组Id * @param groupId 安全组Id
@@ -108,6 +132,15 @@ public class SecurityGroupService {
init(); init();
} }
public SecurityGroupUpdateEnableStatueRes updateGroupEnableStatueReq(SecurityGroupUpdateEnableStatueReq req) {
SecurityGroupDO groupDO = securityGroupMapper.selectById(req.getId());
ParamCheckUtil.checkNotNull(groupDO, ExceptionConstant.SECURITY_GROUP_NOT_EXIST);
securityGroupMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
init();
return new SecurityGroupUpdateEnableStatueRes();
}
public List<SecurityRuleDO> queryRuleListByGroupId(Integer groupId) { public List<SecurityRuleDO> queryRuleListByGroupId(Integer groupId) {
return securityRuleMapper.selectList(Wrappers.lambdaQuery(SecurityRuleDO.class) return securityRuleMapper.selectList(Wrappers.lambdaQuery(SecurityRuleDO.class)
.eq(SecurityRuleDO::getGroupId, groupId) .eq(SecurityRuleDO::getGroupId, groupId)
@@ -120,7 +153,7 @@ public class SecurityGroupService {
BeanUtil.copyProperties(req, ruleDO); BeanUtil.copyProperties(req, ruleDO);
ruleDO.setUserId(SystemContextHolder.getUserId()) ruleDO.setUserId(SystemContextHolder.getUserId())
.setCreateTime(new Date()) .setCreateTime(new Date())
.setEnable(EnableStatusEnum.ENABLE) .setEnable(EnableStatusEnum.ENABLE.getStatus())
.setUpdateTime(new Date()); .setUpdateTime(new Date());
securityRuleMapper.insert(ruleDO); securityRuleMapper.insert(ruleDO);
clearCache(); clearCache();
@@ -140,7 +173,7 @@ public class SecurityGroupService {
public void setRuleStatus(Integer ruleId, EnableStatusEnum statusEnum) { public void setRuleStatus(Integer ruleId, EnableStatusEnum statusEnum) {
SecurityRuleDO ruleDO = securityRuleMapper.selectById(ruleId); SecurityRuleDO ruleDO = securityRuleMapper.selectById(ruleId);
ruleDO.setEnable(statusEnum); ruleDO.setEnable(statusEnum.getStatus());
ruleDO.setUpdateTime(new Date()); ruleDO.setUpdateTime(new Date());
securityRuleMapper.updateById(ruleDO); securityRuleMapper.updateById(ruleDO);
clearCache(); clearCache();
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper">
<select id="selectByCondition" resultType="org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO">
SELECT sg.* from security_group sg
<where>
<if test="req.name != null and req.name != '' ">
AND sg.name like #{req.name}
</if>
<if test="req.enable != null">
AND sg.enable like #{req.enable}
</if>
</where>
order by sg.id DESC
</select>
</mapper>
@@ -52,7 +52,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
`name` VARCHAR(20) NOT NULL, `name` VARCHAR(20) NOT NULL,
`description` VARCHAR(255), `description` VARCHAR(255),
`user_id` INTEGER NOT NULL, `user_id` INTEGER NOT NULL,
`enable` VARCHAR(20) NOT NULL, `enable` INTEGER NOT NULL,
`default_pass_type` VARCHAR(20) NOT NULL, `default_pass_type` VARCHAR(20) NOT NULL,
`create_time` TIMESTAMP NOT NULL, `create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL, `update_time` TIMESTAMP NOT NULL,
@@ -69,7 +69,7 @@ CREATE TABLE IF NOT EXISTS `security_rule` (
`pass_type` VARCHAR(20) NOT NULL, `pass_type` VARCHAR(20) NOT NULL,
`priority` INTEGER NOT NULL, `priority` INTEGER NOT NULL,
`user_id` INTEGER NOT NULL, `user_id` INTEGER NOT NULL,
`enable` VARCHAR(20) NOT NULL, `enable` INTEGER NOT NULL,
`create_time` TIMESTAMP NOT NULL, `create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL, `update_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
`name` VARCHAR(20) NOT NULL, `name` VARCHAR(20) NOT NULL,
`description` VARCHAR(255), `description` VARCHAR(255),
`user_id` INTEGER NOT NULL, `user_id` INTEGER NOT NULL,
`enable` VARCHAR(20) NOT NULL, `enable` INTEGER NOT NULL,
`default_pass_type` VARCHAR(20) NOT NULL, `default_pass_type` VARCHAR(20) NOT NULL,
`create_time` TIMESTAMP NOT NULL, `create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL, `update_time` TIMESTAMP NOT NULL,
@@ -21,10 +21,10 @@ CREATE TABLE IF NOT EXISTS `security_rule` (
`pass_type` VARCHAR(20) NOT NULL, `pass_type` VARCHAR(20) NOT NULL,
`priority` INTEGER NOT NULL, `priority` INTEGER NOT NULL,
`user_id` INTEGER NOT NULL, `user_id` INTEGER NOT NULL,
`enable` VARCHAR(20) NOT NULL, `enable` INTEGER NOT NULL,
`create_time` TIMESTAMP NOT NULL, `create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL, `update_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
); );
CREATE INDEX IF NOT EXISTS I_security_rule_group_id ON security_rule(group_id); CREATE INDEX IF NOT EXISTS I_security_rule_group_id ON security_rule(group_id);
ALTER TABLE `port_mapping` ADD COLUMN IF NOT EXISTS `security_group_id` INTEGER DEFAULT 0; ALTER TABLE `port_mapping` ADD COLUMN `security_group_id` INTEGER DEFAULT 0;
@@ -56,7 +56,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
`name` varchar(20) NOT NULL COMMENT '安全组名称', `name` varchar(20) NOT NULL COMMENT '安全组名称',
`description` varchar(255) COMMENT '安全组描述', `description` varchar(255) COMMENT '安全组描述',
`user_id` int NOT NULL COMMENT '用户ID', `user_id` int NOT NULL COMMENT '用户ID',
`enable` varchar(20) NOT NULL COMMENT '启用状态', `enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`default_pass_type` varchar(20) NOT NULL COMMENT '默认放行类型', `default_pass_type` varchar(20) NOT NULL COMMENT '默认放行类型',
`create_time` datetime(3) NOT NULL COMMENT '创建时间', `create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间', `update_time` datetime(3) NOT NULL COMMENT '更新时间',
@@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `security_rule` (
`pass_type` varchar(20) NOT NULL COMMENT '放行类型', `pass_type` varchar(20) NOT NULL COMMENT '放行类型',
`priority` int(1) NOT NULL COMMENT '优先级', `priority` int(1) NOT NULL COMMENT '优先级',
`user_id` int NOT NULL COMMENT '用户ID', `user_id` int NOT NULL COMMENT '用户ID',
`enable` varchar(20) NOT NULL COMMENT '启用状态', `enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间', `create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间', `update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
@@ -56,7 +56,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
`name` varchar(20) NOT NULL COMMENT '安全组名称', `name` varchar(20) NOT NULL COMMENT '安全组名称',
`description` varchar(255) COMMENT '安全组描述', `description` varchar(255) COMMENT '安全组描述',
`user_id` int NOT NULL COMMENT '用户ID', `user_id` int NOT NULL COMMENT '用户ID',
`enable` varchar(20) NOT NULL COMMENT '启用状态', `enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`default_pass_type` varchar(20) NOT NULL COMMENT '默认放行类型', `default_pass_type` varchar(20) NOT NULL COMMENT '默认放行类型',
`create_time` datetime(3) NOT NULL COMMENT '创建时间', `create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间', `update_time` datetime(3) NOT NULL COMMENT '更新时间',
@@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `security_rule` (
`pass_type` varchar(20) NOT NULL COMMENT '放行类型', `pass_type` varchar(20) NOT NULL COMMENT '放行类型',
`priority` int(1) NOT NULL COMMENT '优先级', `priority` int(1) NOT NULL COMMENT '优先级',
`user_id` int NOT NULL COMMENT '用户ID', `user_id` int NOT NULL COMMENT '用户ID',
`enable` varchar(20) NOT NULL COMMENT '启用状态', `enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间', `create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间', `update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
`name` varchar(20) NOT NULL COMMENT '安全组名称', `name` varchar(20) NOT NULL COMMENT '安全组名称',
`description` varchar(255) COMMENT '安全组描述', `description` varchar(255) COMMENT '安全组描述',
`user_id` int NOT NULL COMMENT '用户ID', `user_id` int NOT NULL COMMENT '用户ID',
`enable` varchar(20) NOT NULL COMMENT '启用状态', `enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`default_pass_type` varchar(20) NOT NULL COMMENT '默认放行类型', `default_pass_type` varchar(20) NOT NULL COMMENT '默认放行类型',
`create_time` datetime(3) NOT NULL COMMENT '创建时间', `create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间', `update_time` datetime(3) NOT NULL COMMENT '更新时间',
@@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS `security_rule` (
`pass_type` varchar(20) NOT NULL COMMENT '放行类型', `pass_type` varchar(20) NOT NULL COMMENT '放行类型',
`priority` int(1) NOT NULL COMMENT '优先级', `priority` int(1) NOT NULL COMMENT '优先级',
`user_id` int NOT NULL COMMENT '用户ID', `user_id` int NOT NULL COMMENT '用户ID',
`enable` varchar(20) NOT NULL COMMENT '启用状态', `enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间', `create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间', `update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
+1 -1
View File
@@ -30,7 +30,7 @@
<native.version>0.9.28</native.version> <native.version>0.9.28</native.version>
<java.version>17</java.version> <java.version>21</java.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-flatten.version>1.1.0</maven-flatten.version> <maven-flatten.version>1.1.0</maven-flatten.version>
</properties> </properties>
+2 -2
View File
@@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# 中微子代理客户端编译打包脚本,基础参数请自行修改 # 中微子代理客户端编译打包脚本,基础参数请自行修改
#export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home #export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1 export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
+2 -2
View File
@@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# 中微子代理服务端编译打包脚本,基础参数请自行修改 # 中微子代理服务端编译打包脚本,基础参数请自行修改
#export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home #export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1 export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin