Refactor(SQL): Optimize query sorting
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
from t_s_group
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="searchName != null">
|
||||
<if test="searchName != null and searchName != ''">
|
||||
<choose>
|
||||
<when test="searchRegex == true">
|
||||
and t_s_group.name regexp #{searchName}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
from t_s_role
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="searchName != null">
|
||||
<if test="searchName != null and searchName != ''">
|
||||
<choose>
|
||||
<when test="searchRegex == true">
|
||||
and t_s_role.name regexp #{searchName}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
left join (select * from t_s_user_info where deleted = 0) as tsui on t_s_user.id = tsui.user_id
|
||||
<where>
|
||||
t_s_user.deleted = 0
|
||||
<if test="searchValue != null">
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
<choose>
|
||||
<when test="searchType == 'ID'">
|
||||
<choose>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
separator="," close=")" nullable="true">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="searchRequestUrl != null">
|
||||
<if test="searchRequestUrl != null and searchRequestUrl != ''">
|
||||
and ((t_l_sys_log.request_server_address || t_l_sys_log.request_uri ||
|
||||
(case when length(t_l_sys_log.request_params) != 0 then '?' || t_l_sys_log.request_params else '' end))
|
||||
like #{searchRequestUrl})
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
close=")" nullable="true">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="searchValue != null">
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
<choose>
|
||||
<when test="searchType == 'NAME'">
|
||||
<choose>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
) as temp1
|
||||
left join json_table(json_extract(temp1.keywords, '$[*]'), '$[*]' columns (keyword varchar(50) path '$')) as tk on true
|
||||
<where>
|
||||
<if test="searchValue != null">
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
and (
|
||||
temp1.name like concat('%', #{searchValue}, '%')
|
||||
or tk.keyword like concat('%', #{searchValue}, '%')
|
||||
@@ -25,7 +25,7 @@
|
||||
</if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="searchValue != null">
|
||||
<when test="searchValue != null and searchValue != ''">
|
||||
order by instr(temp1.name, #{searchValue}) = 0,
|
||||
char_length(temp1.name),
|
||||
instr(temp1.name, #{searchValue}),
|
||||
|
||||
Reference in New Issue
Block a user