Commit 1872eb0c by zhiwj

分组名

parent 2e621477
package com.gic.cloud.dao.mapper;
import com.gic.cloud.entity.TabIndexGroup;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -55,5 +56,5 @@ public interface TabIndexGroupMapper {
TabIndexGroup getBySelective(TabIndexGroup indexGroup);
List<TabIndexGroup> listIndexGroup();
List<TabIndexGroup> listIndexGroup(@Param("ids") List<Integer> indexGroupIdList);
}
\ No newline at end of file
......@@ -22,4 +22,6 @@ public interface IndexGroupService {
void delete(Integer indexGroupId);
List<TabIndexGroup> listIndexGroup();
String getNameByIds(List<Integer> indexGroupIdList);
}
......@@ -8,8 +8,11 @@ import com.gic.commons.util.EntityUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author zhiwj
......@@ -59,6 +62,13 @@ public class IndexGroupServiceImpl implements IndexGroupService {
@Override
public List<TabIndexGroup> listIndexGroup() {
return tabIndexGroupMapper.listIndexGroup();
return tabIndexGroupMapper.listIndexGroup(null);
}
@Override
public String getNameByIds(List<Integer> indexGroupIdList) {
List<TabIndexGroup> indexGroupList = tabIndexGroupMapper.listIndexGroup(indexGroupIdList);
return Optional.ofNullable(indexGroupList).orElse(Collections.emptyList())
.stream().map(TabIndexGroup::getIndexGroupName).collect(Collectors.joining("\\"));
}
}
......@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author zhiwj
......@@ -125,10 +126,10 @@ public class IndexApiServiceImpl implements IndexApiService {
return indexGroupName;
}
TabIndexGroup indexGroup = indexGroupService.getById(indexGroupId);
// List<Integer> indexGroupId = Stream.of(indexGroup.getGroupChain().split("_")).map(Integer::valueOf).collect(Collectors.toList());
return null;
List<Integer> indexGroupIdList = Stream.of(indexGroup.getGroupChain().split("_")).map(Integer::valueOf).collect(Collectors.toList());
String groupName = indexGroupService.getNameByIds(indexGroupIdList);
cache.put(indexGroupId, groupName);
return groupName;
}
@Override
......
......@@ -135,5 +135,11 @@
select
<include refid="Base_Column_List" />
from tab_index_group where status = 1
<if test="null != ids and ids.size > 0">
and index_group_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment