项目排序

This commit is contained in:
shiziyuan9527 2020-06-02 14:50:39 +08:00
parent 8e52fc7266
commit 4f3aa4b8ae
4 changed files with 22 additions and 4 deletions

View File

@ -15,7 +15,12 @@
and w.id = #{proRequest.workspaceId}
</if>
</where>
order by p.update_time desc
<if test="proRequest.orders != null and proRequest.orders.size() > 0">
order by
<foreach collection="proRequest.orders" separator="," item="order">
p.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="getProjectIdByWorkspaceId" resultType="java.lang.String">
select id

View File

@ -3,9 +3,12 @@ package io.metersphere.controller.request;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class ProjectRequest {
private String workspaceId;
private String name;
private List<OrderRequest> orders;
}

View File

@ -10,6 +10,7 @@ import io.metersphere.base.mapper.LoadTestMapper;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.base.mapper.ext.*;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ProjectRequest;
import io.metersphere.dto.ProjectDTO;
@ -81,6 +82,7 @@ public class ProjectService {
if (StringUtils.isNotBlank(request.getName())) {
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
}
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return extProjectMapper.getProjectWithWorkspace(request);
}

View File

@ -6,7 +6,7 @@
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="search" @create="create"
:create-tip="btnTips" :title="title"/>
</template>
<el-table :data="items" style="width: 100%">
<el-table :data="items" style="width: 100%" @sort-change="sort">
<el-table-column prop="name" :label="$t('commons.name')">
<template v-slot:default="scope">
<el-link type="info" @click="link(scope.row)">{{ scope.row.name }}</el-link>
@ -15,6 +15,8 @@
<el-table-column prop="description" :label="$t('commons.description')"/>
<!--<el-table-column prop="workspaceName" :label="$t('project.owning_workspace')"/>-->
<el-table-column
sortable
prop="createTime"
:label="$t('commons.create_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
@ -22,6 +24,8 @@
</template>
</el-table-column>
<el-table-column
sortable
prop="updateTime"
:label="$t('commons.update_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
@ -67,7 +71,7 @@
import MsTableHeader from "../common/components/MsTableHeader";
import MsTableOperator from "../common/components/MsTableOperator";
import MsDialogFooter from "../common/components/MsDialogFooter";
import {getCurrentUser} from "../../../common/js/utils";
import {_sort, getCurrentUser} from "../../../common/js/utils";
import MsContainer from "../common/components/MsContainer";
import MsMainContainer from "../common/components/MsMainContainer";
@ -228,7 +232,11 @@
path: '/api/test/list/' + row.id
})
}
}
},
sort(column) {
_sort(column, this.condition);
this.list();
},
}
}
</script>