1、jdk版本改为21,对应的打包脚本调整
2、安全组相关代码优化
This commit is contained in:
+4
-1
@@ -67,7 +67,10 @@ public enum ExceptionConstant {
|
||||
|
||||
PORT_GROUP_NAME_ALREADY_EXIST(16000,"端口分组名称[{}]已经存在"),
|
||||
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;
|
||||
|
||||
+28
-19
@@ -1,16 +1,17 @@
|
||||
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.controller.req.system.SecurityGroupCreateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupUpdateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleCreateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleUpdateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupDetailRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupListRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupUpdateEnableStatueRes;
|
||||
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.service.PortMappingService;
|
||||
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.*;
|
||||
|
||||
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
|
||||
@Mapping("/group/list")
|
||||
public List<SecurityGroupRes> groupList() {
|
||||
List<SecurityGroupDO> groupDOList = groupService.queryGroupList();
|
||||
return groupDOList.stream().map(SecurityGroupDO::toRes).collect(Collectors.toList());
|
||||
public List<SecurityGroupListRes> groupList() {
|
||||
return groupService.groupList();
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/group/detail")
|
||||
public SecurityGroupRes getGroupOne(Integer groupId) {
|
||||
return groupService.queryGroupOne(groupId).toRes();
|
||||
public SecurityGroupDetailRes groupDetail(SecurityGroupDetailReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
|
||||
return groupService.groupDetail(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@@ -65,15 +76,13 @@ public class SecurityController {
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/group/enable")
|
||||
public void enableGroup(Integer groupId) {
|
||||
groupService.setGroupStatus(groupId, EnableStatusEnum.ENABLE);
|
||||
}
|
||||
@Mapping("/group/update/enable-status")
|
||||
public SecurityGroupUpdateEnableStatueRes updateGroupEnableStatueReq(SecurityGroupUpdateEnableStatueReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
|
||||
|
||||
@Post
|
||||
@Mapping("/group/disable")
|
||||
public void disableGroup(Integer groupId) {
|
||||
groupService.setGroupStatus(groupId, EnableStatusEnum.DISABLE);
|
||||
return groupService.updateGroupEnableStatueReq(req);
|
||||
}
|
||||
|
||||
@Get
|
||||
|
||||
+12
@@ -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;
|
||||
}
|
||||
+13
@@ -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;
|
||||
}
|
||||
+19
@@ -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;
|
||||
}
|
||||
+2
-4
@@ -5,11 +5,9 @@ import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SecurityGroupRes {
|
||||
public class SecurityGroupDetailRes {
|
||||
|
||||
private Integer id;
|
||||
|
||||
@@ -27,7 +25,7 @@ public class SecurityGroupRes {
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private String enable;
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 默认放行类型
|
||||
+47
@@ -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;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+12
@@ -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 {
|
||||
|
||||
}
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class SecurityRuleRes {
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private String enable;
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
||||
+18
@@ -1,7 +1,25 @@
|
||||
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.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 java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-8
@@ -11,7 +11,8 @@ import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
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;
|
||||
|
||||
@@ -38,12 +39,11 @@ public class SecurityGroupDO {
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private EnableStatusEnum enable;
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 默认放行类型
|
||||
@@ -60,15 +60,21 @@ public class SecurityGroupDO {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
public SecurityGroupRes toRes() {
|
||||
SecurityGroupRes res = new SecurityGroupRes();
|
||||
public SecurityGroupListRes toListRes() {
|
||||
SecurityGroupListRes res = new SecurityGroupListRes();
|
||||
BeanUtil.copyProperties(this, res);
|
||||
res.setEnable(enable.getDesc())
|
||||
.setDefaultPassType(defaultPassType.getDesc())
|
||||
res.setDefaultPassType(defaultPassType.getDesc())
|
||||
.setCreateTime(DateUtil.format(this.getCreateTime(), DatePattern.NORM_DATETIME_FORMAT))
|
||||
.setUpdateTime(DateUtil.format(this.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT));
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -71,7 +71,7 @@ public class SecurityRuleDO {
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private EnableStatusEnum enable;
|
||||
private Integer enable;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@@ -149,7 +149,6 @@ public class SecurityRuleDO {
|
||||
SecurityRuleRes res = new SecurityRuleRes();
|
||||
BeanUtil.copyProperties(this, res);
|
||||
res.setPassType(this.passType.getDesc())
|
||||
.setEnable(this.getEnable().getDesc())
|
||||
.setCreateTime(DateUtil.format(this.getCreateTime(), DatePattern.NORM_DATETIME_FORMAT))
|
||||
.setUpdateTime(DateUtil.format(this.getUpdateTime(), DatePattern.NORM_DATETIME_FORMAT))
|
||||
;
|
||||
|
||||
+56
-23
@@ -4,29 +4,37 @@ import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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 jdk.jshell.Snippet;
|
||||
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupCreateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupUpdateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleCreateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleUpdateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupDetailRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupListRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupUpdateEnableStatueRes;
|
||||
import org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.SecurityRuleMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
|
||||
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.Init;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -45,6 +53,10 @@ public class SecurityGroupService {
|
||||
|
||||
@Init(index = 100)
|
||||
public synchronized void init() {
|
||||
// aot 阶段,不初始化
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
securityGroupMap.clear();
|
||||
List<SecurityGroupDO> groupDOList = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
|
||||
.eq(SecurityGroupDO::getEnable, EnableStatusEnum.ENABLE));
|
||||
@@ -56,19 +68,41 @@ public class SecurityGroupService {
|
||||
ipAllowControlCache.clear();
|
||||
}
|
||||
|
||||
public List<SecurityGroupDO> queryGroupList() {
|
||||
return securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
|
||||
.eq(SecurityGroupDO::getUserId, SystemContextHolder.getUserId()));
|
||||
public PageInfo<SecurityGroupListRes> groupPage(PageQuery pageQuery, SecurityGroupListReq req) {
|
||||
if (StringUtils.isNotEmpty(req.getName())) {
|
||||
//描述字段为模糊查询,在应用层处理,否则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) {
|
||||
return securityGroupMapper.selectById(groupId);
|
||||
public List<SecurityGroupListRes> groupList() {
|
||||
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) {
|
||||
SecurityGroupDO groupDO = new SecurityGroupDO();
|
||||
BeanUtil.copyProperties(req, groupDO);
|
||||
groupDO.setEnable(EnableStatusEnum.ENABLE)
|
||||
groupDO.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setUserId(SystemContextHolder.getUserId())
|
||||
.setCreateTime(new Date())
|
||||
.setUpdateTime(new Date());
|
||||
@@ -87,16 +121,6 @@ public class SecurityGroupService {
|
||||
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
|
||||
@@ -108,6 +132,15 @@ public class SecurityGroupService {
|
||||
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) {
|
||||
return securityRuleMapper.selectList(Wrappers.lambdaQuery(SecurityRuleDO.class)
|
||||
.eq(SecurityRuleDO::getGroupId, groupId)
|
||||
@@ -120,7 +153,7 @@ public class SecurityGroupService {
|
||||
BeanUtil.copyProperties(req, ruleDO);
|
||||
ruleDO.setUserId(SystemContextHolder.getUserId())
|
||||
.setCreateTime(new Date())
|
||||
.setEnable(EnableStatusEnum.ENABLE)
|
||||
.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setUpdateTime(new Date());
|
||||
securityRuleMapper.insert(ruleDO);
|
||||
clearCache();
|
||||
@@ -140,7 +173,7 @@ public class SecurityGroupService {
|
||||
|
||||
public void setRuleStatus(Integer ruleId, EnableStatusEnum statusEnum) {
|
||||
SecurityRuleDO ruleDO = securityRuleMapper.selectById(ruleId);
|
||||
ruleDO.setEnable(statusEnum);
|
||||
ruleDO.setEnable(statusEnum.getStatus());
|
||||
ruleDO.setUpdateTime(new Date());
|
||||
securityRuleMapper.updateById(ruleDO);
|
||||
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,
|
||||
`description` VARCHAR(255),
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` VARCHAR(20) NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`default_pass_type` VARCHAR(20) NOT NULL,
|
||||
`create_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,
|
||||
`priority` INTEGER NOT NULL,
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` VARCHAR(20) NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
|
||||
@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`name` VARCHAR(20) NOT NULL,
|
||||
`description` VARCHAR(255),
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` VARCHAR(20) NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`default_pass_type` VARCHAR(20) NOT NULL,
|
||||
`create_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,
|
||||
`priority` INTEGER NOT NULL,
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` VARCHAR(20) NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`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 '安全组名称',
|
||||
`description` varchar(255) COMMENT '安全组描述',
|
||||
`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 '默认放行类型',
|
||||
`create_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 '放行类型',
|
||||
`priority` int(1) NOT NULL COMMENT '优先级',
|
||||
`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 '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@@ -56,7 +56,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`name` varchar(20) NOT NULL COMMENT '安全组名称',
|
||||
`description` varchar(255) COMMENT '安全组描述',
|
||||
`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 '默认放行类型',
|
||||
`create_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 '放行类型',
|
||||
`priority` int(1) NOT NULL COMMENT '优先级',
|
||||
`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 '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`name` varchar(20) NOT NULL COMMENT '安全组名称',
|
||||
`description` varchar(255) COMMENT '安全组描述',
|
||||
`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 '默认放行类型',
|
||||
`create_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 '放行类型',
|
||||
`priority` int(1) NOT NULL COMMENT '优先级',
|
||||
`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 '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
Reference in New Issue
Block a user