This commit is contained in:
chenjianxing 2020-11-30 14:41:47 +08:00
commit 4d52439cfb
21 changed files with 327 additions and 3 deletions

View File

@ -0,0 +1,21 @@
package io.metersphere.api.controller;
import io.metersphere.api.service.ApiAutomationService;
import io.metersphere.commons.constants.RoleConstants;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping(value = "/api/automation")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER}, logical = Logical.OR)
public class ApiAutomationController {
@Resource
ApiAutomationService apiAutomationService;
}

View File

@ -0,0 +1,15 @@
package io.metersphere.api.service;
import io.metersphere.base.mapper.ApiDefinitionHistoryMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiAutomationService {
@Resource
private ApiDefinitionHistoryMapper apiDefinitionHistoryMapper;
}

View File

@ -0,0 +1,20 @@
package io.metersphere.api.service;
import io.metersphere.base.domain.ApiDefinitionHistory;
import io.metersphere.base.mapper.ApiDefinitionHistoryMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiDefinitionHistoryService {
@Resource
private ApiDefinitionHistoryMapper apiDefinitionHistoryMapper;
public List<ApiDefinitionHistory> selectByApiDefinitionId(String id){
return apiDefinitionHistoryMapper.selectByApiDefinitionId(id);
}
}

View File

@ -0,0 +1,22 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiDefinitionHistory implements Serializable {
private String id;
private String apiDefinitionId;
private String content;
private String userId;
private Long createTime;
private Long updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,28 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiScenario implements Serializable {
private String id;
private String apiScenarioId;
private String name;
private String description;
private Long createTime;
private Long updateTime;
private String status;
private String userId;
private String triggerMode;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,25 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiScenarioModule implements Serializable {
private String id;
private String projectId;
private String name;
private String userId;
private String parentId;
private String level;
private Long createTime;
private Long updateTime;
}

View File

@ -0,0 +1,34 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiScenarioReport implements Serializable {
private String id;
private String projectId;
private String name;
private String scenarioId;
private String level;
private String status;
private String principal;
private String followPeople;
private String description;
private String scenarioDefinition;
private String userId;
private Long createTime;
private Long updateTime;
}

View File

@ -0,0 +1,16 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiScenarioReportDetail implements Serializable {
private String reportId;
private String apiScenarioId;
private byte[] content;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,22 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class ApiTag implements Serializable {
private String id;
private String projectId;
private String name;
private String userId;
private Long createTime;
private Long updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,5 @@
package io.metersphere.base.mapper;
public interface ApiAutomationMapper {
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ApiAutomationMapper">
</mapper>

View File

@ -0,0 +1,15 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiDefinitionHistory;
import java.util.List;
public interface ApiDefinitionHistoryMapper {
int deleteByApiDefinitionId(String id);
int insert(ApiDefinitionHistory record);
List<ApiDefinitionHistory> selectByApiDefinitionId(String id);
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.ApiDefinitionHistoryMapper">
<delete id="deleteByApiDefinitionId" parameterType="java.lang.String">
delete from api_definition_history where api_definition_id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionHistory">
insert into api_definition_history
(id, api_definition_id,content, user_id, create_time, update_time)
values
(#{id,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
</insert>
<select id="selectByApiDefinitionId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionHistory">
select * from api_definition_history where api_definition_id = #{id,jdbcType=VARCHAR}
</select>
</mapper>

View File

@ -0,0 +1,21 @@
<template>
<div> apiAutomation</div>
</template>
<script>
export default {
name: "ApiAutomation",
components: {},
comments: {},
data() {
return {}
},
watch: {},
methods: {}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,21 @@
<template>
<div> ApiReport</div>
</template>
<script>
export default {
name: "ApiReport",
components: {},
comments: {},
data() {
return {}
},
watch: {},
methods: {}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,21 @@
<template>
<div> EditApiScenario</div>
</template>
<script>
export default {
name: "EditApiScenario",
components: {},
comments: {},
data() {
return {}
},
watch: {},
methods: {}
}
</script>
<style scoped>
</style>

View File

@ -1,7 +1,7 @@
<template>
<div id="menu-bar" v-if="isRouterAlive">
<el-row type="flex">
<el-col :span="8">
<el-col :span="10">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
<el-menu-item :index="'/api/home'">
{{ $t("i18n.home") }}
@ -11,6 +11,10 @@
{{ $t("i18n.definition") }}
</el-menu-item>
<el-menu-item :index="'/api/automation'">
{{ $t("i18n.automation") }}
</el-menu-item>
<el-submenu :class="{'deactivation':!isProjectActivation}" v-permission="['test_manager','test_user','test_viewer']" index="3">
<template v-slot:title>{{ $t('commons.project') }}</template>
<ms-recent-list ref="projectRecent" :options="projectRecent"/>
@ -43,7 +47,7 @@
<ms-create-test :to="'/api/test/create'"/>
</el-row>
</el-col>
<el-col :span="8"/>
<el-col :span="6"/>
</el-row>
</div>

View File

@ -43,6 +43,11 @@ export default {
path: "definition",
name: "ApiDefinition",
component: () => import('@/business/components/api/definition/ApiDefinition'),
},
{
path: "automation",
name: "ApiAutomation",
component: () => import('@/business/components/api/automation/ApiAutomation'),
}
]
}

View File

@ -1069,7 +1069,8 @@ export default {
},
i18n: {
home: 'Home',
definition: 'ApiDefinition',
definition: 'Api Definition',
automation: 'Api Automation',
},
ldap: {
url: 'LDAP URL',

View File

@ -1072,6 +1072,7 @@ export default {
i18n: {
home: '首页',
definition: '接口定义',
automation: '接口自动化',
},
ldap: {
url: 'LDAP地址',

View File

@ -1070,6 +1070,7 @@ export default {
i18n: {
home: '首頁',
definition: '接口定義',
automation: '接口自動化',
},
ldap: {
url: 'LDAP地址',