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 javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class DirService {
|
||||
|
||||
private static final String[] filterDirNames = { "i18n_panel_list", "i18n_default_panel" };
|
||||
|
||||
@Resource
|
||||
private MobileDirMapper mobileDirMapper;
|
||||
|
||||
|
||||
public List<String> permissions() {
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
Long userId = user.getUserId();
|
||||
@ -43,13 +45,14 @@ public class DirService {
|
||||
String userId = String.valueOf(AuthUtils.getUser().getUserId());
|
||||
List<PanelEntity> panelEntities = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(request.getName())) {
|
||||
panelEntities = mobileDirMapper.queryWithName(request.getName(),userId);
|
||||
}else {
|
||||
panelEntities = mobileDirMapper.query(request.getPid(),userId);
|
||||
panelEntities = mobileDirMapper.queryWithName(request.getName(), userId);
|
||||
} else {
|
||||
panelEntities = mobileDirMapper.query(request.getPid(), userId);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(panelEntities)) return null;
|
||||
|
||||
List<DirItemDTO> dtos = panelEntities.stream().map(data -> {
|
||||
if (CollectionUtils.isEmpty(panelEntities))
|
||||
return null;
|
||||
List<String> filterLists = Arrays.asList(filterDirNames);
|
||||
List<DirItemDTO> dtos = panelEntities.stream().filter(dto -> !filterLists.contains(dto.getText())).map(data -> {
|
||||
DirItemDTO dirItemDTO = new DirItemDTO();
|
||||
dirItemDTO.setId(data.getId());
|
||||
dirItemDTO.setText(data.getText());
|
||||
@ -63,5 +66,4 @@ public class DirService {
|
||||
return CommonBeanFactory.getBean(DirService.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ export default {
|
||||
const param = {name: val}
|
||||
requestDir(param).then(res => {
|
||||
let dataObj = res.data
|
||||
dataObj.map(item => {
|
||||
dataObj && dataObj.map(item => {
|
||||
item.name = item.text
|
||||
return util.dataHandle(item, val);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user