Skip to content

Commit

Permalink
Optimize mapper queries
Browse files Browse the repository at this point in the history
Signed-off-by: Zzm0809 <[email protected]>
  • Loading branch information
Zzm0809 committed Sep 15, 2024
1 parent 131ded5 commit 725930f
Show file tree
Hide file tree
Showing 25 changed files with 24 additions and 29 deletions.
1 change: 0 additions & 1 deletion dinky-admin/src/main/resources/mapper/AlertGroupMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from
dinky_alert_group a
<where>
1=1
<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from
dinky_alert_history a
<where>
1=1
<if test='param.jobInstanceId!=null and param.jobInstanceId!=""'>
and a.job_instance_id = #{param.jobInstanceId}
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from
dinky_alert_instance a
<where>
1=1
<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/CatalogueMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from
dinky_catalogue a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from
dinky_cluster_configuration a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from
dinky_cluster a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/DataBaseMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from
dinky_database a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/DocumentMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from
dinky_flink_document a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from
dinky_fragment a
<where>
1=1

<if test='param.id!=null'>
and a.id = #{param.id}
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/GitProjectMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from
dinky_git_project a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/JobHistoryMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from
dinky_job_history a
<where>
1=1

<if test='param.id!=null and param.id!=""'>
and a.id = #{param.id}
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
left join dinky_history dh on a.history_id = dh.id
left join dinky_task dt on a.task_id = dt.id
<where>
1=1

<if test='param.status!=null and param.status!=""'>
and a.status = #{param.status}
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/MenuMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
from
dinky_sys_menu a
<where>
1=1

<if test='param.path!=null and param.path!=""'>
and a.path like concat('%', #{param.path}, '%')
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/OperateLogMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from
dinky_sys_operate_log a
<where>
1=1

<if test='param.userId!=null and param.userId!=""'>
and a.operate_user_id = #{param.userId}
</if>
Expand Down
4 changes: 2 additions & 2 deletions dinky-admin/src/main/resources/mapper/RoleMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
a.*
from dinky_role a
<where>
1=1

<if test='param.tenantId!=null and param.tenantId!=""'>
and tenant_id = #{param.tenantId}
</if>
Expand Down Expand Up @@ -81,7 +81,7 @@
,update_time
from dinky_role
<where>
1=1

<if test='tenantId!=null and tenantId!=""'>
and tenant_id = #{tenantId}
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
dinky_row_permissions a
join dinky_role b on b.id = a.role_id
<where>
1=1

<if test='param.roleCode!=null and param.roleCode!=""'>
and b.role_code like concat('%',#{param.roleCode},'%')
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/SavepointsMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from
dinky_savepoints a
<where>
1=1

<if test='param.taskId!=null'>
and a.task_id = #{param.taskId}
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/SysConfigMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from
dinky_sys_config a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/TaskMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from
dinky_task a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and a.name like concat('%',#{param.name},'%')
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from
dinky_task_version a
<where>
1=1

<if test='param.versionId!=null and param.versionId!=""'>
and a.version_id = #{param.versionId}
</if>
Expand Down
4 changes: 1 addition & 3 deletions dinky-admin/src/main/resources/mapper/TenantMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from
dinky_tenant a
<where>
1=1
<if test='param.tenantCode!=null and param.tenantCode!=""'>
and tenant_code like concat('%',#{param.tenantCode},'%')
</if>
Expand All @@ -36,8 +35,7 @@
,create_time
,update_time
from dinky_tenant a
where 1=1
and id in
where id in
<foreach collection="tenantIds" item="id" separator="," open="(" close=")" index="">
#{id}
</foreach>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/TokenMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
join dinky_role c on a.role_id = c.id
join dinky_tenant d on a.tenant_id = d.id
<where>
1=1

<if test='param.tokenValue!=null and param.tokenValue!=""'>
and a.token_value like concat('%',#{param.tokenValue},'%')
</if>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from
dinky_udf_template a
<where>
1=1

<if test='param.name!=null and param.name!=""'>
and `name` like concat('%',#{param.name},'%')
</if>
Expand Down
4 changes: 2 additions & 2 deletions dinky-admin/src/main/resources/mapper/UserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from
dinky_user a
<where>
1=1

<if test='param.username!=null and param.username!=""'>
and a.username like concat('%',#{param.username},'%')
</if>
Expand Down Expand Up @@ -40,7 +40,7 @@
join dinky_user du on a.user_id = du.id
join dinky_tenant c on a.tenant_id = c.id
<where>
1=1 and du.tenant_admin_flag = 1
du.tenant_admin_flag = 1
<if test='tenantId!=null and tenantId!=""'>
and a.tenant_id = #{tenantId}
</if>
Expand Down
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/mapper/UserRoleMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from
dinky_user_role
<where>
1=1

<if test='param.userId!=null and param.userId!=""'>
and user_id = #{param.userId}
</if>
Expand Down

0 comments on commit 725930f

Please sign in to comment.