1、分页查询新增查询条件为''空字符串的判断处理

(cherry picked from commit 2f6f99f820)
This commit is contained in:
PushM
2024-05-09 15:40:33 +08:00
parent dc70c713b2
commit 986366fb72
5 changed files with 37 additions and 32 deletions

View File

@@ -28,6 +28,13 @@ public class UserFull {
return ""; return "";
} }
public String getOrgName() {
if (orgs.size() > 0) {
return orgs.get(0).orgName;
}
return "";
}
public String getRoleKey() { public String getRoleKey() {
if (roles.size() > 0) { if (roles.size() > 0) {
return roles.get(0).roleKey; return roles.get(0).roleKey;

View File

@@ -104,12 +104,12 @@
<select id="queryProtectObjectsTotalNum" resultType="java.lang.Integer"> <select id="queryProtectObjectsTotalNum" resultType="java.lang.Integer">
SELECT COUNT(protect_object_id) FROM t_protect_object SELECT COUNT(protect_object_id) FROM t_protect_object
<where> <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_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}, '%') AND protect_object_system_name LIKE CONCAT('%', #{proobj_system_name}, '%')
</if> </if>
<if test="proobj_ip != null"> <if test="proobj_ip != null and proobj_ip != '' ">
AND protect_object_id IN ( AND protect_object_id IN (
SELECT protect_object_id FROM t_protect_object_inet_addr_view tpo_view SELECT protect_object_id FROM t_protect_object_inet_addr_view tpo_view
WHERE tpo_view.protect_object_ip LIKE CONCAT('%', #{proobj_ip}, '%') WHERE tpo_view.protect_object_ip LIKE CONCAT('%', #{proobj_ip}, '%')
@@ -121,7 +121,7 @@
<if test="proobj_port_max != null"> <if test="proobj_port_max != null">
AND protect_object_port &lt;= #{proobj_port_max} AND protect_object_port &lt;= #{proobj_port_max}
</if> </if>
<if test="proobj_url != null"> <if test="proobj_url != null and proobj_url != '' ">
AND protect_object_url LIKE CONCAT('%', #{proobj_url}, '%') AND protect_object_url LIKE CONCAT('%', #{proobj_url}, '%')
</if> </if>
<if test="proobj_protocol != null"> <if test="proobj_protocol != null">

View File

@@ -79,29 +79,27 @@
<if test="task_type != null"> <if test="task_type != null">
AND task_type = #{task_type} AND task_type = #{task_type}
</if> </if>
<if test="task_name != null"> <if test="task_name != null and task_name != '' ">
AND task_name LIKE CONCAT('%', #{task_name}, '%') AND task_name LIKE CONCAT('%', #{task_name}, '%')
</if> </if>
<if test="task_creator != null"> <if test="task_creator != null and task_creator != '' ">
AND task_create_username LIKE CONCAT('%', #{task_creator}, '%') AND task_create_username LIKE CONCAT('%', #{task_creator}, '%')
</if> </if>
<if test="task_audit_status != null"> <if test="audit_status != null">
AND task_audit_status = #{task_audit_status} AND task_audit_status = #{audit_status}
</if> </if>
<if test="task_audit_status != null"> <if test="task_act != null and task_act != '' ">
AND task_audit_status = #{task_audit_status}
</if>
<if test="task_act != null">
AND task_act LIKE CONCAT('%', #{task_act}, '%') AND task_act LIKE CONCAT('%', #{task_act}, '%')
</if> </if>
<if test="task_auditor != null"> <if test="task_auditor != null and task_auditor != '' ">
AND task_audit_username LIKE CONCAT('%', #{task_auditor}, '%') AND task_audit_username LIKE CONCAT('%', #{task_auditor}, '%')
</if> </if>
<if test="task_source != null"> <if test="task_source != null and task_source != '' ">
AND task_source LIKE CONCAT('%', #{task_source}, '%') AND task_source LIKE CONCAT('%', #{task_source}, '%')
</if> </if>
</where> </where>
LIMIT ${(page - 1) * page_size}, #{page_size} LIMIT ${(page - 1) * page_size}, #{page_size}
</select> </select>
@@ -338,7 +336,7 @@
</select> </select>
<select id="queryTaskTotalNum" resultType="java.lang.Integer"> <select id="queryTaskTotalNum" resultType="java.lang.Integer">
SELECT COUNT(*) FROM t_task SELECT COUNT(*) FROM t_task
<if test="rule_name != null"> <if test="rule_name != null and creator != '' ">
LEFT JOIN t_static_rule ON t_task.task_id = t_static_rule.static_rule_used_task_id LEFT JOIN t_static_rule ON t_task.task_id = t_static_rule.static_rule_used_task_id
LEFT JOIN t_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id LEFT JOIN t_dynamic_rule ON t_task.task_id = t_dynamic_rule.dynamic_rule_used_task_id
WHERE WHERE
@@ -352,22 +350,22 @@
<if test="task_type != null"> <if test="task_type != null">
AND task_type = #{task_type} AND task_type = #{task_type}
</if> </if>
<if test="task_name != null"> <if test="task_name != null and task_name != '' ">
AND task_name LIKE CONCAT('%', #{task_name}, '%') AND task_name LIKE CONCAT('%', #{task_name}, '%')
</if> </if>
<if test="task_creator != null"> <if test="task_creator != null and task_creator != '' ">
AND task_create_username LIKE CONCAT('%', #{task_creator}, '%') AND task_create_username LIKE CONCAT('%', #{task_creator}, '%')
</if> </if>
<if test="audit_status != null"> <if test="audit_status != null">
AND task_audit_status = #{audit_status} AND task_audit_status = #{audit_status}
</if> </if>
<if test="task_act != null"> <if test="task_act != null and task_act != '' ">
AND task_act LIKE CONCAT('%', #{task_act}, '%') AND task_act LIKE CONCAT('%', #{task_act}, '%')
</if> </if>
<if test="task_auditor != null"> <if test="task_auditor != null and task_auditor != '' ">
AND task_audit_username LIKE CONCAT('%', #{task_auditor}, '%') AND task_audit_username LIKE CONCAT('%', #{task_auditor}, '%')
</if> </if>
<if test="task_source != null"> <if test="task_source != null and task_source != '' ">
AND task_source LIKE CONCAT('%', #{task_source}, '%') AND task_source LIKE CONCAT('%', #{task_source}, '%')
</if> </if>

View File

@@ -96,13 +96,13 @@
<select id="queryTemplates" resultMap="templateMap"> <select id="queryTemplates" resultMap="templateMap">
SELECT * FROM template_view SELECT * FROM template_view
<where> <where>
<if test="source_system != null"> <if test="source_system != null and source_system != '' ">
AND strategy_template_source_system = #{source_system} AND strategy_template_source_system = #{source_system}
</if> </if>
<if test="create_username != null"> <if test="create_username != null and create_username != '' ">
AND strategy_template_create_username = #{create_username} AND strategy_template_create_username = #{create_username}
</if> </if>
<if test="template_name != null"> <if test="template_name != null and template_name != '' ">
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%') AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
</if> </if>
<if test="template_id != null"> <if test="template_id != null">
@@ -130,13 +130,13 @@
<select id="queryTemplateTotalNum" resultType="java.lang.Integer"> <select id="queryTemplateTotalNum" resultType="java.lang.Integer">
SELECT COUNT(strategy_template_id) FROM t_strategy_template SELECT COUNT(strategy_template_id) FROM t_strategy_template
<where> <where>
<if test="source_system != null"> <if test="source_system != null and source_system != '' ">
AND strategy_template_source_system = #{source_system} AND strategy_template_source_system = #{source_system}
</if> </if>
<if test="create_username != null"> <if test="create_username != null and create_username != '' ">
AND strategy_template_create_username = #{create_username} AND strategy_template_create_username = #{create_username}
</if> </if>
<if test="template_name != null"> <if test="template_name != null and template_name != '' ">
AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%') AND strategy_template_name LIKE CONCAT('%', #{template_name}, '%')
</if> </if>
</where> </where>

View File

@@ -59,19 +59,19 @@
select *, INET_NTOA(white_list_ip) as white_list_ip_d select *, INET_NTOA(white_list_ip) as white_list_ip_d
from t_white_list from t_white_list
<where> <where>
<if test="whiteListName != null"> <if test="whiteListName != null and whiteListName != '' ">
white_list_name like concat('%', #{whiteListName}, '%') white_list_name like concat('%', #{whiteListName}, '%')
</if> </if>
<if test="whiteListId != null"> <if test="whiteListId != null">
and white_list_id = #{whiteListId} and white_list_id = #{whiteListId}
</if> </if>
<if test="systemName != null"> <if test="systemName != null and systemName != '' ">
and white_list_system_name like concat('%', #{systemName}, '%') and white_list_system_name like concat('%', #{systemName}, '%')
</if> </if>
<if test="auditStatus != null"> <if test="auditStatus != null">
and white_list_audit_status = #{auditStatus} and white_list_audit_status = #{auditStatus}
</if> </if>
<if test="creator != null"> <if test="creator != null and creator != '' ">
and create_username = #{creator} and create_username = #{creator}
</if> </if>
</where> </where>
@@ -231,19 +231,19 @@
select COUNT(*) select COUNT(*)
from t_white_list from t_white_list
<where> <where>
<if test="whiteListName != null"> <if test="whiteListName != null and whiteListName != '' ">
white_list_name like concat('%', #{whiteListName}, '%') white_list_name like concat('%', #{whiteListName}, '%')
</if> </if>
<if test="whiteListId != null"> <if test="whiteListId != null">
and white_list_id = #{whiteListId} and white_list_id = #{whiteListId}
</if> </if>
<if test="systemName != null"> <if test="systemName != null and systemName != '' ">
and white_list_system_name like concat('%', #{systemName}, '%') and white_list_system_name like concat('%', #{systemName}, '%')
</if> </if>
<if test="auditStatus != null"> <if test="auditStatus != null">
and white_list_audit_status = #{auditStatus} and white_list_audit_status = #{auditStatus}
</if> </if>
<if test="creator != null"> <if test="creator != null and creator != '' ">
and create_username = #{creator} and create_username = #{creator}
</if> </if>
</where> </where>