refactor(项目设置): 优化环境接口

This commit is contained in:
wxg0103 2024-03-07 20:09:48 +08:00 committed by Craftsman
parent a0bcb9f31c
commit e05341c4e0
7 changed files with 15 additions and 12 deletions

View File

@ -54,7 +54,7 @@
FROM api_debug
WHERE create_user = #{userId}
ORDER BY pos ASC
ORDER BY pos DESC
</select>
<select id="countModuleIdByKeywordAndProtocol" resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT f.module_id AS moduleId, count(f.id) AS dataCount

View File

@ -46,7 +46,7 @@
FROM api_definition
where api_definition.deleted = #{deleted}
<include refid="queryWhereCondition"/>
ORDER BY pos ASC
ORDER BY pos DESC
</select>
<select id="countModuleIdByRequest" resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT module_id AS moduleId, count(id) AS dataCount

View File

@ -39,4 +39,8 @@ public abstract class MsAssertion {
*/
@Size(max = 100)
private String name;
/**
* id
*/
private String id;
}

View File

@ -27,8 +27,6 @@ public class EnvironmentRequest implements Serializable {
private String name;
@Schema(description = "环境配置")
private EnvironmentConfig config;
@Schema(description = "是否是mock环境")
private Boolean mock;
@Schema(description = "描述")
private String description;

View File

@ -19,7 +19,7 @@
)
</if>
ORDER BY pos asc
ORDER BY pos DESC
</select>
<select id="groupList" resultType="io.metersphere.sdk.domain.EnvironmentGroup">
SELECT
@ -33,7 +33,7 @@
)
</if>
ORDER BY pos asc
ORDER BY pos DESC
</select>
<select id="getPos" resultType="java.lang.Long">
SELECT pos

View File

@ -307,6 +307,7 @@ public class EnvironmentService {
environment.setUpdateUser(userId);
environment.setProjectId(request.getProjectId());
environment.setName(request.getName());
environment.setDescription(request.getDescription());
checkEnvironmentExist(environment);
environment.setUpdateTime(System.currentTimeMillis());
environmentMapper.updateByPrimaryKeySelective(environment);

View File

@ -419,26 +419,26 @@
const params = {
projectId: appStore.currentProjectId,
targetId: type === EnvAuthTypeEnum.ENVIRONMENT ? envList.value[_newIndex].id : evnGroupList.value[_newIndex].id,
moveId: '',
moveId: type === EnvAuthTypeEnum.ENVIRONMENT ? envList.value[_newIndex].id : evnGroupList.value[_newIndex].id,
targetId: '',
moveMode: 'AFTER',
};
if (type === EnvAuthTypeEnum.ENVIRONMENT) {
if (envList.value[_newIndex + 1].id) {
params.moveMode = 'BEFORE';
params.moveId = envList.value[_newIndex + 1].id;
params.targetId = envList.value[_newIndex + 1].id;
} else if (envList.value[_newIndex - 1].id && !envList.value[_newIndex + 1].id) {
params.moveMode = 'AFTER';
params.moveId = envList.value[_newIndex - 1].id;
params.targetId = envList.value[_newIndex - 1].id;
}
}
if (type === EnvAuthTypeEnum.ENVIRONMENT_GROUP) {
if (evnGroupList.value[_newIndex + 1].id) {
params.moveMode = 'AFTER';
params.moveId = evnGroupList.value[_newIndex + 1].id;
params.targetId = evnGroupList.value[_newIndex + 1].id;
} else if (evnGroupList.value[_newIndex - 1].id && !evnGroupList.value[_newIndex + 1].id) {
params.moveMode = 'BEFORE';
params.moveId = evnGroupList.value[_newIndex - 1].id;
params.targetId = evnGroupList.value[_newIndex - 1].id;
}
}