mirror of
https://github.com/thousmile/molly-multi-tenant.git
synced 2025-12-30 04:32:26 +00:00
1.修复 getKeywordsQueryWrapper 方法like添加 and条件
2.修复 CascaderDept 传递数据,为空! 3.修复 reflectionFill 如果当前操作的是默认租户,就只查一遍!
This commit is contained in:
@@ -18,7 +18,7 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const cascaderOptions = flatTreeToCascaderOption(props.options, { value: "deptId", label: "deptName" })
|
||||
const cascaderOptions = computed(() => flatTreeToCascaderOption(props.options, { value: "deptId", label: "deptName" }))
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "update:modelValue", value: Number): void
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.xaaef.molly.perms.api.impl;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.xaaef.molly.common.consts.MbpConst;
|
||||
import com.xaaef.molly.common.util.TenantUtils;
|
||||
import com.xaaef.molly.internal.api.ApiOperateUserService;
|
||||
import com.xaaef.molly.internal.api.ApiSysTenantService;
|
||||
import com.xaaef.molly.internal.dto.OperateUserDTO;
|
||||
@@ -67,6 +68,7 @@ public class ApiOperateUserServiceImpl implements ApiOperateUserService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<Long, OperateUserDTO> mapOperateUser(Set<Long> userIds) {
|
||||
var operateUserMaps = new HashMap<Long, OperateUserDTO>();
|
||||
@@ -76,14 +78,18 @@ public class ApiOperateUserServiceImpl implements ApiOperateUserService {
|
||||
if (!defaultTenantUser.isEmpty()) {
|
||||
operateUserMaps.putAll(defaultTenantUser);
|
||||
}
|
||||
// 从 当前租户中,获取 用户信息
|
||||
var currentTenantUser = listOperateUser(userIds);
|
||||
if (!currentTenantUser.isEmpty()) {
|
||||
operateUserMaps.putAll(currentTenantUser);
|
||||
// 如果当前是 非默认租户,
|
||||
if (!(defaultTenantId).equals(TenantUtils.getTenantId())) {
|
||||
// 从 当前租户中,获取 用户信息
|
||||
var currentTenantUser = listOperateUser(userIds);
|
||||
if (!currentTenantUser.isEmpty()) {
|
||||
operateUserMaps.putAll(currentTenantUser);
|
||||
}
|
||||
}
|
||||
return operateUserMaps;
|
||||
}
|
||||
|
||||
|
||||
private Map<Long, OperateUserDTO> listOperateUser(Set<Long> userIds) {
|
||||
var wrapper = new LambdaQueryWrapper<PmsUser>()
|
||||
.select(List.of(PmsUser::getUserId, PmsUser::getAvatar, PmsUser::getNickname))
|
||||
|
||||
@@ -116,7 +116,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
|
||||
public IPage<SysTenant> simplePageKeywords(SearchPO params) {
|
||||
var wrapper = super.getKeywordsQueryWrapper(
|
||||
params,
|
||||
List.of(SysTenant::getName, SysTenant::getLinkman, SysTenant::getAddress)
|
||||
List.of(SysTenant::getTenantId, SysTenant::getName, SysTenant::getLinkman)
|
||||
);
|
||||
wrapper.lambda().select(
|
||||
List.of(SysTenant::getTenantId, SysTenant::getLogo, SysTenant::getName, SysTenant::getLinkman)
|
||||
|
||||
@@ -122,14 +122,17 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> exte
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(params.getKeywords()) && columns != null && !columns.isEmpty()) {
|
||||
var index = 0;
|
||||
for (SFunction<T, ?> column : columns) {
|
||||
if (index == 0)
|
||||
wrapper.lambda().like(column, params.getKeywords());
|
||||
else
|
||||
wrapper.lambda().or().like(column, params.getKeywords());
|
||||
index++;
|
||||
}
|
||||
wrapper.and(childWrapper -> {
|
||||
var index = 0;
|
||||
for (SFunction<T, ?> column : columns) {
|
||||
if (index == 0) {
|
||||
childWrapper.lambda().like(column, params.getKeywords());
|
||||
} else {
|
||||
childWrapper.lambda().or().like(column, params.getKeywords());
|
||||
}
|
||||
index++;
|
||||
}
|
||||
});
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const props = defineProps({
|
||||
}
|
||||
})
|
||||
|
||||
const cascaderOptions = flatTreeToCascaderOption(props.options, { value: "deptId", label: "deptName" })
|
||||
const cascaderOptions = computed(() => flatTreeToCascaderOption(props.options, { value: "deptId", label: "deptName" }))
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "update:modelValue", value: Number): void
|
||||
|
||||
Reference in New Issue
Block a user