Skip to content

Commit

Permalink
[Improve] query sql bug fixed. (#4106)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfboys authored Oct 23, 2024
1 parent 64ab963 commit 34f6509
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,22 @@
from t_resource v
inner join t_user u
on v.creator_id = u.user_id
and v.team_id = ${resource.teamId}
and v.team_id = #{resource.teamId}
<if test="resource.resourceName != null and resource.resourceName != ''">
and v.resourceName like concat('%', '${resource.resourceName}', '%')
<if test="_databaseId == 'mysql'">
and v.resourceName like concat('%', #{resource.resourceName},'%')
</if>
<if test="_databaseId == 'pgsql'">
and v.resourceName like '%' || #{resource.resourceName} || '%'
</if>
</if>
<if test="resource.description != null and resource.description != ''">
and v.description like concat('%', '${resource.description}', '%')
<if test="_databaseId == 'mysql'">
and v.description like concat('%', #{resource.description},'%')
</if>
<if test="_databaseId == 'pgsql'">
and v.description like '%' || #{resource.description} || '%'
</if>
</if>
</select>

Expand All @@ -40,7 +50,7 @@
END
from t_resource
where creator_id = #{userId}
limit 1
limit 1
</select>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@
and t.deploy_mode = #{app.deployMode}
</if>
<if test="app.appName != null and app.appName != ''">
and t.app_name like concat('%', '${app.appName}', '%')
<if test="_databaseId == 'mysql'">
and t.app_name like concat('%', #{app.appName},'%')
</if>
<if test="_databaseId == 'pgsql'">
and t.app_name like '%' || #{app.appName} || '%'
</if>
</if>
<if test="app.clusterId != null and app.clusterId != ''">
and t.cluster_id = #{app.clusterId}
Expand All @@ -63,7 +68,12 @@
and t.user_id = #{app.userId}
</if>
<if test="app.tags != null and app.tags != ''">
and t.tags like concat('%', '${app.tags}', '%')
<if test="_databaseId == 'mysql'">
and t.tags like concat('%', #{app.tags},'%')
</if>
<if test="_databaseId == 'pgsql'">
and t.tags like '%' || #{app.tags} || '%'
</if>
</if>
</where>
</select>
Expand Down

0 comments on commit 34f6509

Please sign in to comment.