由于搜索速度慢,给租户管理去掉角色的查询条件

This commit is contained in:
jishenghua 2025-01-01 00:39:22 +08:00
parent 1d0cb1d904
commit a20f92890f
5 changed files with 16 additions and 46 deletions

View File

@ -10,7 +10,6 @@ public interface TenantMapperEx {
List<TenantEx> selectByConditionTenant( List<TenantEx> selectByConditionTenant(
@Param("loginName") String loginName, @Param("loginName") String loginName,
@Param("roleId") Long roleId,
@Param("type") String type, @Param("type") String type,
@Param("enabled") String enabled, @Param("enabled") String enabled,
@Param("remark") String remark, @Param("remark") String remark,
@ -19,7 +18,6 @@ public interface TenantMapperEx {
Long countsByTenant( Long countsByTenant(
@Param("loginName") String loginName, @Param("loginName") String loginName,
@Param("roleId") Long roleId,
@Param("type") String type, @Param("type") String type,
@Param("enabled") String enabled, @Param("enabled") String enabled,
@Param("remark") String remark); @Param("remark") String remark);

View File

@ -34,22 +34,20 @@ public class TenantComponent implements ICommonQuery {
private List<?> getTenantList(Map<String, String> map)throws Exception { private List<?> getTenantList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName"); String loginName = StringUtil.getInfo(search, "loginName");
Long roleId = StringUtil.parseStrLong(StringUtil.getInfo(search, "roleId"));
String type = StringUtil.getInfo(search, "type"); String type = StringUtil.getInfo(search, "type");
String enabled = StringUtil.getInfo(search, "enabled"); String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark"); String remark = StringUtil.getInfo(search, "remark");
return tenantService.select(loginName, roleId, type, enabled, remark, QueryUtils.offset(map), QueryUtils.rows(map)); return tenantService.select(loginName, type, enabled, remark, QueryUtils.offset(map), QueryUtils.rows(map));
} }
@Override @Override
public Long counts(Map<String, String> map)throws Exception { public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH); String search = map.get(Constants.SEARCH);
String loginName = StringUtil.getInfo(search, "loginName"); String loginName = StringUtil.getInfo(search, "loginName");
Long roleId = StringUtil.parseStrLong(StringUtil.getInfo(search, "roleId"));
String type = StringUtil.getInfo(search, "type"); String type = StringUtil.getInfo(search, "type");
String enabled = StringUtil.getInfo(search, "enabled"); String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark"); String remark = StringUtil.getInfo(search, "remark");
return tenantService.countTenant(loginName, roleId, type, enabled, remark); return tenantService.countTenant(loginName, type, enabled, remark);
} }
@Override @Override

View File

@ -75,11 +75,11 @@ public class TenantService {
return list; return list;
} }
public List<TenantEx> select(String loginName, Long roleId, String type, String enabled, String remark, int offset, int rows)throws Exception { public List<TenantEx> select(String loginName, String type, String enabled, String remark, int offset, int rows)throws Exception {
List<TenantEx> list= new ArrayList<>(); List<TenantEx> list= new ArrayList<>();
try{ try{
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) { if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
list = tenantMapperEx.selectByConditionTenant(loginName, roleId, type, enabled, remark, offset, rows); list = tenantMapperEx.selectByConditionTenant(loginName, type, enabled, remark, offset, rows);
if (null != list) { if (null != list) {
for (TenantEx tenantEx : list) { for (TenantEx tenantEx : list) {
tenantEx.setCreateTimeStr(Tools.getCenternTime(tenantEx.getCreateTime())); tenantEx.setCreateTimeStr(Tools.getCenternTime(tenantEx.getCreateTime()));
@ -93,11 +93,11 @@ public class TenantService {
return list; return list;
} }
public Long countTenant(String loginName, Long roleId, String type, String enabled, String remark)throws Exception { public Long countTenant(String loginName, String type, String enabled, String remark)throws Exception {
Long result=null; Long result=null;
try{ try{
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) { if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
result = tenantMapperEx.countsByTenant(loginName, roleId, type, enabled, remark); result = tenantMapperEx.countsByTenant(loginName, type, enabled, remark);
} }
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);

View File

@ -18,15 +18,11 @@
where ub.type='UserRole' and ub.key_id=t.tenant_id limit 0,1) roleName, where ub.type='UserRole' and ub.key_id=t.tenant_id limit 0,1) roleName,
(select count(jsh_user.id) from jsh_user where jsh_user.status='0' and jsh_user.delete_flag=0 and jsh_user.tenant_id=t.tenant_id) userCount (select count(jsh_user.id) from jsh_user where jsh_user.status='0' and jsh_user.delete_flag=0 and jsh_user.tenant_id=t.tenant_id) userCount
from jsh_tenant t from jsh_tenant t
left join jsh_user_business ub on ub.key_id = t.tenant_id and ifnull(ub.delete_flag,'0') !='1' where 1=1
where ub.type='UserRole'
<if test="loginName != null"> <if test="loginName != null">
<bind name="bindLoginName" value="'%'+loginName+'%'"/> <bind name="bindLoginName" value="'%'+loginName+'%'"/>
and t.login_name like #{bindLoginName} and t.login_name like #{bindLoginName}
</if> </if>
<if test="roleId != null and roleId != ''">
and ub.value = concat("[",#{roleId},"]")
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and t.type = #{type} and t.type = #{type}
</if> </if>
@ -48,15 +44,11 @@
select select
count(t.id) count(t.id)
from jsh_tenant t from jsh_tenant t
left join jsh_user_business ub on ub.key_id = t.tenant_id and ifnull(ub.delete_flag,'0') !='1' where 1=1
where ub.type='UserRole'
<if test="loginName != null"> <if test="loginName != null">
<bind name="bindLoginName" value="'%'+loginName+'%'"/> <bind name="bindLoginName" value="'%'+loginName+'%'"/>
and t.login_name like #{bindLoginName} and t.login_name like #{bindLoginName}
</if> </if>
<if test="roleId != null and roleId != ''">
and ub.value = concat("[",#{roleId},"]")
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and t.type = #{type} and t.type = #{type}
</if> </if>

View File

@ -11,15 +11,6 @@
<a-input placeholder="输入登录名称模糊查询" v-model="queryParam.loginName"></a-input> <a-input placeholder="输入登录名称模糊查询" v-model="queryParam.loginName"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="24">
<a-form-item label="租户角色" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="queryParam.roleId" placeholder="请选择租户角色">
<a-select-option v-for="(item,index) in tenantRoleList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<a-form-item label="租户类型" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="租户类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="queryParam.type" placeholder="请选择租户类型"> <a-select v-model="queryParam.type" placeholder="请选择租户类型">
@ -28,6 +19,14 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="24">
<a-form-item label="租户状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="queryParam.enabled" placeholder="请选择操作状态">
<a-select-option value="1">启用</a-select-option>
<a-select-option value="0">禁用</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery">查询</a-button> <a-button type="primary" @click="searchQuery">查询</a-button>
@ -39,14 +38,6 @@
</span> </span>
</a-col> </a-col>
<template v-if="toggleSearchStatus"> <template v-if="toggleSearchStatus">
<a-col :md="6" :sm="24">
<a-form-item label="租户状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="queryParam.enabled" placeholder="请选择操作状态">
<a-select-option value="1">启用</a-select-option>
<a-select-option value="0">禁用</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24"> <a-col :md="6" :sm="24">
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol"> <a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-model="queryParam.remark" placeholder="请输入备注"></a-input> <a-input v-model="queryParam.remark" placeholder="请输入备注"></a-input>
@ -125,7 +116,6 @@
enabled: '', enabled: '',
remark: '' remark: ''
}, },
tenantRoleList: [], //租户角色列表
columns: [ columns: [
{ {
title: '#', title: '#',
@ -165,16 +155,8 @@
} }
}, },
created () { created () {
this.getTenantRoleList()
}, },
methods: { methods: {
getTenantRoleList() {
getTenantRoleList().then((res)=>{
if(res) {
this.tenantRoleList = res
}
})
}
} }
} }
</script> </script>