1、防护对象查询、白名单新建bug解决

(cherry picked from commit 268f7654b1)
This commit is contained in:
PushM
2024-05-09 16:39:52 +08:00
parent 986366fb72
commit e94cc70a74
3 changed files with 17 additions and 11 deletions

View File

@@ -55,24 +55,24 @@
,protect_object_display_id
FROM t_protect_object
<where>
<if test="proobj_name != null">AND protect_object_name LIKE CONCAT('%', #{proobj_name}, '%')</if>
<if test="proobj_name != null and proobj_name != '' ">AND protect_object_name LIKE CONCAT('%', #{proobj_name}, '%')</if>
<if test="proobj_id != null">AND protect_object_id = #{proobj_id}</if>
<if test="proobj_system_name != null">
<if test="proobj_system_name != null and proobj_system_name != '' ">
AND protect_object_system_name LIKE CONCAT('%', #{proobj_system_name}, '%')
</if>
<if test="proobj_ip != null">
<if test="proobj_ip != null and proobj_ip != '' ">
AND protect_object_id IN (
SELECT protect_object_id FROM t_protect_object_inet_addr_view tpo_view
WHERE tpo_view.protect_object_ip LIKE CONCAT('%', #{proobj_ip}, '%')
SELECT protect_object_id FROM t_protect_object_inet_addr_view tpo_view
WHERE tpo_view.protect_object_ip LIKE CONCAT('%', #{proobj_ip}, '%')
)
</if>
<if test="proobj_port_min != null">
AND protect_object_port &gt; #{proobj_port_min}
AND protect_object_port &gt;= #{proobj_port_min}
</if>
<if test="proobj_port_max != null">
AND protect_object_port &lt; #{proobj_port_max}
AND protect_object_port &lt;= #{proobj_port_max}
</if>
<if test="proobj_url != null">
<if test="proobj_url != null and proobj_url != '' ">
AND protect_object_url LIKE CONCAT('%', #{proobj_url}, '%')
</if>
<if test="proobj_protocol != null">

View File

@@ -9,13 +9,13 @@
white_list_ip, white_list_port,
white_list_url, white_list_protocol,
white_list_audit_status, create_time, white_list_display_id,
white_list_create_username, white_list_create_depart,
white_list_create_user_id)
create_username, create_user_department,
create_user_id)
values (#{object.whiteListName}, #{object.whiteListSystemName},
INET_ATON(#{object.whiteListIP}), #{object.whiteListPort},
#{object.whiteListUrl}, #{object.whiteListProtocol},
0, NOW(), #{object.whiteListDisplayId},
#{object.createUsername}, #{object.createDepart},
#{object.createUserName}, #{object.createUserDepartment},
#{object.createUserId})
</insert>

View File

@@ -47,6 +47,12 @@ class WhiteListServiceTest extends ProtectionApplicationTests {
void testNewWhiteList() {
WhiteListObject object = new WhiteListObject();
object.setWhiteListName("test");
object.setWhiteListSystemName("china");
object.setWhiteListIP("1.1.1.1");
object.setWhiteListPort(80);
object.setWhiteListUrl("www.baidu.com");
object.setWhiteListProtocol("TCP");
Integer objectId = whiteListService.newWhiteListObject(object);
assertTrue(objectId > 0);