forked from github/dataease
fix: 移动端搜索出不存在的目录
This commit is contained in:
parent
6f7345e859
commit
eec895b8c8
@ -12,16 +12,18 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DirService {
|
public class DirService {
|
||||||
|
|
||||||
|
private static final String[] filterDirNames = { "i18n_panel_list", "i18n_default_panel" };
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MobileDirMapper mobileDirMapper;
|
private MobileDirMapper mobileDirMapper;
|
||||||
|
|
||||||
|
|
||||||
public List<String> permissions() {
|
public List<String> permissions() {
|
||||||
CurrentUserDto user = AuthUtils.getUser();
|
CurrentUserDto user = AuthUtils.getUser();
|
||||||
Long userId = user.getUserId();
|
Long userId = user.getUserId();
|
||||||
@ -43,13 +45,14 @@ public class DirService {
|
|||||||
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
||||||
List<PanelEntity> panelEntities = new ArrayList<>();
|
List<PanelEntity> panelEntities = new ArrayList<>();
|
||||||
if (StringUtils.isNotBlank(request.getName())) {
|
if (StringUtils.isNotBlank(request.getName())) {
|
||||||
panelEntities = mobileDirMapper.queryWithName(request.getName(),userId);
|
panelEntities = mobileDirMapper.queryWithName(request.getName(), userId);
|
||||||
}else {
|
} else {
|
||||||
panelEntities = mobileDirMapper.query(request.getPid(),userId);
|
panelEntities = mobileDirMapper.query(request.getPid(), userId);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(panelEntities)) return null;
|
if (CollectionUtils.isEmpty(panelEntities))
|
||||||
|
return null;
|
||||||
List<DirItemDTO> dtos = panelEntities.stream().map(data -> {
|
List<String> filterLists = Arrays.asList(filterDirNames);
|
||||||
|
List<DirItemDTO> dtos = panelEntities.stream().filter(dto -> !filterLists.contains(dto.getText())).map(data -> {
|
||||||
DirItemDTO dirItemDTO = new DirItemDTO();
|
DirItemDTO dirItemDTO = new DirItemDTO();
|
||||||
dirItemDTO.setId(data.getId());
|
dirItemDTO.setId(data.getId());
|
||||||
dirItemDTO.setText(data.getText());
|
dirItemDTO.setText(data.getText());
|
||||||
@ -63,5 +66,4 @@ public class DirService {
|
|||||||
return CommonBeanFactory.getBean(DirService.class);
|
return CommonBeanFactory.getBean(DirService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ export default {
|
|||||||
const param = {name: val}
|
const param = {name: val}
|
||||||
requestDir(param).then(res => {
|
requestDir(param).then(res => {
|
||||||
let dataObj = res.data
|
let dataObj = res.data
|
||||||
dataObj.map(item => {
|
dataObj && dataObj.map(item => {
|
||||||
item.name = item.text
|
item.name = item.text
|
||||||
return util.dataHandle(item, val);
|
return util.dataHandle(item, val);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user