diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestPlanCaseMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestPlanCaseMapper.xml
index f812a590..307b4ea8 100644
--- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestPlanCaseMapper.xml
+++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestPlanCaseMapper.xml
@@ -28,6 +28,14 @@
and c.pbranch_id=#{pbranchId}
+
+ and exists ( select 1 from xm_menu m
+ where m.iteration_id=#{linkIterationId} and c.menu_id=m.menu_id
+
+ and m.product_id=#{productId}
+
+ )
+
@@ -103,9 +111,31 @@
(
SELECT sum(if(res.case_id is null ,0,1)) as use_times,c.id FROM xm_test_case c left join xm_test_plan_case res
on c.id=res.case_id
+
+ and res.project_id=#{projectId}
+
+
+ and res.exec_date between #{startExecDate} and #{endExecDate}
+
-
-
+
+ and c.casedb_id=#{casedbId}
+
+
+
+ and c.product_id=#{productId}
+
+
+ and c.pbranch_id=#{pbranchId}
+
+
+ and exists ( select 1 from xm_menu m
+ where m.iteration_id=#{linkIterationId} and c.menu_id=m.menu_id
+
+ and m.product_id=#{productId}
+
+ )
+
group by c.id ) as ret
group by ret.use_times