@@ -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 > #{proobj_port_min}
|
||||
AND protect_object_port >= #{proobj_port_min}
|
||||
</if>
|
||||
<if test="proobj_port_max != null">
|
||||
AND protect_object_port < #{proobj_port_max}
|
||||
AND protect_object_port <= #{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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user