feat(系统设置): 项目选择器中的备选项目更换排序方法:当前使用项目排第一,其余按照名称排序
【github#29170 切换项目列表,当前项目默认排第一,其它项目按首字母排序】 https://www.tapd.cn/55049933/prong/stories/view/1155049933001014513
This commit is contained in:
parent
c72d43e15d
commit
b8ca3b5e96
|
@ -153,6 +153,7 @@
|
||||||
AND p.name LIKE #{proRequest.name, jdbcType=VARCHAR}
|
AND p.name LIKE #{proRequest.name, jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY CONVERT(p.name USING gbk) COLLATE gbk_chinese_ci ASC
|
||||||
</select>
|
</select>
|
||||||
<select id="getSystemIdByProjectId" resultType="java.lang.String">
|
<select id="getSystemIdByProjectId" resultType="java.lang.String">
|
||||||
SELECT system_id
|
SELECT system_id
|
||||||
|
|
|
@ -116,7 +116,16 @@ public class BaseProjectService {
|
||||||
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
|
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
|
||||||
}
|
}
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
return baseProjectMapper.getUserProject(request);
|
List<Project> returnList = baseProjectMapper.getUserProject(request);
|
||||||
|
int ownerProjectIndex = 0;
|
||||||
|
for (int i = 0; i < returnList.size(); i++) {
|
||||||
|
if (StringUtils.equals(returnList.get(i).getId(), SessionUtils.getCurrentProjectId())) {
|
||||||
|
ownerProjectIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.swap(returnList, 0, ownerProjectIndex);
|
||||||
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Project> getProjectByIds(List<String> ids) {
|
public List<Project> getProjectByIds(List<String> ids) {
|
||||||
|
|
Loading…
Reference in New Issue