diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java index 4d664c5de9..baca3e2468 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.java @@ -5,17 +5,21 @@ import io.metersphere.api.dto.definition.ApiDefinitionMockDTO; import io.metersphere.api.dto.definition.ApiMockWithBlob; import io.metersphere.api.dto.definition.ApiTestCaseBatchRequest; import io.metersphere.api.dto.definition.request.ApiDefinitionMockPageRequest; +import io.metersphere.system.interceptor.BaseConditionFilter; import org.apache.ibatis.annotations.Param; import java.util.List; public interface ExtApiDefinitionMockMapper { + @BaseConditionFilter List list(@Param("request") ApiDefinitionMockPageRequest request); List getIdsByApiIds(@Param("ids") List ids); - List getIds(@Param("request")ApiTestCaseBatchRequest request); + @BaseConditionFilter + List getIds(@Param("request") ApiTestCaseBatchRequest request); + List getTagsByIds(@Param("ids") List ids); List getMockInfoByIds(@Param("ids") List ids); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml index 02f6bc4599..e34d3dbedc 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml @@ -108,6 +108,9 @@ + + + @@ -144,13 +147,9 @@ - - - - - - - + + + @@ -174,56 +173,52 @@ - - and m.name - - - - - - - and m.update_time - - - - - - - and m.create_time - - - - - - - and m.create_user - - - - - - - and m.enable - - - - - - - and (m.tags is null or m.tags - - - - ) - - - - and m.tags - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java index ab47548910..0394f3a5a9 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java @@ -12,6 +12,7 @@ import io.metersphere.request.AssociateOtherCaseRequest; import io.metersphere.request.TestCasePageProviderRequest; import io.metersphere.system.dto.sdk.BaseTreeNode; import io.metersphere.system.dto.sdk.OptionDTO; +import io.metersphere.system.interceptor.BaseConditionFilter; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -26,8 +27,10 @@ public interface ExtApiTestCaseMapper { Long getPos(@Param("projectId") String projectId); + @BaseConditionFilter List listByRequest(@Param("request") ApiTestCasePageRequest request, @Param("deleted") boolean deleted, @Param("isRepeat") boolean isRepeat, @Param("testPlanId") String testPlanId); + @BaseConditionFilter List getIds(@Param("request") ApiTestCaseBatchRequest request, @Param("deleted") boolean deleted); void batchMoveGc(@Param("ids") List ids, @Param("userId") String userId, @Param("deleteTime") long deleteTime); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml index 5f8de80517..6392be0c4f 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml @@ -486,6 +486,9 @@ + + + @@ -521,6 +524,9 @@ + + + @@ -573,6 +579,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + atc.id in ( + select atcr.api_test_case_id as id + from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id + group by atcr.api_test_case_id + ) + + + atc.id not in ( + select atcr.api_test_case_id as id + from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id + group by atcr.api_test_case_id + ) + + + 1=2 + + + atc.id in ( + select atcr.api_test_case_id as id, format(sum(if(ar.`status` = 'success', 1, 0)) / count(ar.id) * 100, 2) as passRate + from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id + group by atcr.api_test_case_id having + + + + + ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${versionTable}.version_id = #{request.versionId} diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java index 6145bdc4e7..19d61df4f9 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.java @@ -7,6 +7,7 @@ import io.metersphere.bug.dto.response.BugTagEditDTO; import io.metersphere.dto.BugProviderDTO; import io.metersphere.request.AssociateBugRequest; import io.metersphere.request.BugPageProviderRequest; +import io.metersphere.system.interceptor.BaseConditionFilter; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -20,6 +21,7 @@ public interface ExtBugMapper { * @param sort 排序参数 * @return 缺陷列表 */ + @BaseConditionFilter List list(@Param("request") BugPageRequest request, @Param("sort") String sort); /** @@ -28,6 +30,7 @@ public interface ExtBugMapper { * @param request 请求查询参数 * @return 缺陷列表 */ + @BaseConditionFilter List getIdsByPageRequest(@Param("request") BugPageRequest request); /** @@ -95,6 +98,7 @@ public interface ExtBugMapper { * @param deleted 是否删除 * @return 缺陷集合 */ + @BaseConditionFilter List listByProviderRequest(@Param("table") String sourceType, @Param("sourceName") String sourceName, @Param("bugColumnName") String bugColumnName, @Param("request") BugPageProviderRequest bugPageProviderRequest, @Param("deleted") boolean deleted); /** @@ -103,5 +107,6 @@ public interface ExtBugMapper { * @param deleted 是否删除 * @return 缺陷ID集合 */ + @BaseConditionFilter List getIdsByProvider(@Param("request") AssociateBugRequest request, @Param("deleted") boolean deleted); } diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml index 8687424058..ac6134682b 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml @@ -159,9 +159,9 @@ - - - + + + @@ -224,181 +224,109 @@ - - and ( - - - - - - - - - - b.num - - - - - - - - - - b.title - - - - - - - - - - b.platform - - - - - - - - - - b.handle_user - - - - - - - - - - b.status - - - - - - - - - - b.create_user - - - - - - - - - - b.create_time - - - - - - - - - - - - - - - - - + + + + + + + + - - b.id not in ( - - - b.id in ( - - select bug_id from bug_custom_field where field_id = #{custom.id} and + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - JSON_CONTAINS(`value`, JSON_ARRAY(#{val})) - + + b.id in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' + ) - - left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13) - - - + + b.id not in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' + ) + + + 1=2 - trim(both '"' from `value`) - - - + + b.id not in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' + ) + + OR + + + + b.id in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' group b.id having + + + + + ) + - ) + + + + + + + + + - ) - - - - - - - 1 = 1 - - - 1 = 2 - - - - - - - - and - - - or - - - - - - - - - - - ( - b.tags is null or b.tags = '[]' or - - !JSON_CONTAINS(b.tags, JSON_ARRAY(#{tag})) - - ) - - - - - - - - JSON_CONTAINS(b.tags, JSON_ARRAY(#{tag})) - - - - - - - - (b.tags is null or b.tags = '[]') - + + @@ -414,8 +342,9 @@ - - + + + diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java b/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java index 1f2a4358af..61919c22a0 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java @@ -21,7 +21,15 @@ public enum UserViewType implements ValueEnum { List.of(InternalUserView.ALL_DATA, InternalUserView.MY_REVIEW, InternalUserView.MY_CREATE)), API_DEFINITION("api-definition", List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)), - ; + API_CASE("api-case", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)), + API_MOCK("api-mock", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + API_SCENARIO("api-scenario", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)), + BUG("bug", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)); + private String value; private List internalViews;