refactor(用户组和权限): 优化用户组列表排序
This commit is contained in:
parent
c9792314cb
commit
63dbd06eef
|
@ -5,39 +5,43 @@
|
|||
|
||||
<select id="getGroupList" resultType="io.metersphere.dto.GroupDTO">
|
||||
select *,
|
||||
(select count(distinct ug.user_id) from user_group ug join user on ug.user_id = user.id where ug.group_id = temp.id) as memberSize
|
||||
(select count(distinct ug.user_id) from user_group ug join user on ug.user_id = user.id where ug.group_id =
|
||||
temp.id) as memberSize
|
||||
from (
|
||||
select g.*, o.name as scopeName from `group` g, organization o
|
||||
<where>
|
||||
and g.scope_id = o.id
|
||||
<if test="request.types != null and request.types.size() > 0">
|
||||
AND g.type in
|
||||
<foreach collection="request.types" item="type" separator="," open="(" close=")">
|
||||
#{type}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.scopes != null and request.scopes.size() > 0">
|
||||
AND g.scope_id in
|
||||
<foreach collection="request.scopes" item="scope" separator="," open="(" close=")">
|
||||
#{scope}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
union distinct
|
||||
select g.*, '全局' as scopeName from `group` g
|
||||
<where>
|
||||
g.scope_id = 'global'
|
||||
<if test="request.types != null and request.types.size() > 0">
|
||||
AND g.type in
|
||||
<foreach collection="request.types" item="type" separator="," open="(" close=")">
|
||||
#{type}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
select g.*, o.name as scopeName from `group` g, organization o
|
||||
<where>
|
||||
and g.scope_id = o.id
|
||||
<if test="request.types != null and request.types.size() > 0">
|
||||
AND g.type in
|
||||
<foreach collection="request.types" item="type" separator="," open="(" close=")">
|
||||
#{type}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.scopes != null and request.scopes.size() > 0">
|
||||
AND g.scope_id in
|
||||
<foreach collection="request.scopes" item="scope" separator="," open="(" close=")">
|
||||
#{scope}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
union distinct
|
||||
select g.*, '全局' as scopeName from `group` g
|
||||
<where>
|
||||
g.scope_id = 'global'
|
||||
<if test="request.types != null and request.types.size() > 0">
|
||||
AND g.type in
|
||||
<foreach collection="request.types" item="type" separator="," open="(" close=")">
|
||||
#{type}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) temp
|
||||
<if test="request.name != null and request.name!=''">
|
||||
where temp.name like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
<if test="request.orders == null or request.orders.size() == 0">
|
||||
order by field(temp.type, 'SYSTEM', 'ORGANIZATION', 'WORKSPACE', 'PROJECT'), temp.update_time
|
||||
</if>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
<foreach collection="request.orders" separator="," item="order">
|
||||
|
|
|
@ -314,7 +314,7 @@ public class GroupService {
|
|||
types = map.get(groupType);
|
||||
request.setTypes(types);
|
||||
request.setScopes(scopes);
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
// request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
List<GroupDTO> groups = extGroupMapper.getGroupList(request);
|
||||
return PageUtils.setPageInfo(page, groups);
|
||||
}
|
||||
|
|
|
@ -138,12 +138,15 @@ export function _sort(column, condition) {
|
|||
let field = humpToLine(column.column.columnKey ? column.column.columnKey : column.prop);
|
||||
if (column.order === 'descending') {
|
||||
column.order = 'desc';
|
||||
} else {
|
||||
} else if (column.order === 'ascending'){
|
||||
column.order = 'asc';
|
||||
}
|
||||
if (!condition.orders) {
|
||||
condition.orders = [];
|
||||
}
|
||||
if (column.order == null) {
|
||||
return;
|
||||
}
|
||||
let hasProp = false;
|
||||
condition.orders.forEach(order => {
|
||||
if (order.name === field) {
|
||||
|
|
Loading…
Reference in New Issue