fix(用例管理): 修复获取需求列表问题
This commit is contained in:
parent
b2210479d8
commit
5bebf4fe7c
|
@ -18,7 +18,7 @@ public class DemandDTO implements Serializable {
|
|||
@Schema(description = "需求ID")
|
||||
private String demandId;
|
||||
|
||||
@Schema(description = "需求ID")
|
||||
@Schema(description = "父需求ID")
|
||||
private String parent;
|
||||
|
||||
@Schema(description = "需求标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.metersphere.functional.mapper;
|
||||
|
||||
import io.metersphere.functional.domain.FunctionalCaseDemand;
|
||||
import io.metersphere.functional.dto.FunctionalDemandDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -11,7 +10,6 @@ import java.util.List;
|
|||
*/
|
||||
public interface ExtFunctionalCaseDemandMapper {
|
||||
|
||||
List<FunctionalDemandDTO> selectGroupByKeyword(@Param("keyword") String keyword, @Param("caseId") String caseId);
|
||||
List<FunctionalCaseDemand> selectByKeyword(@Param("keyword") String keyword, @Param("caseId") String caseId, @Param("platforms") List<String> platforms, @Param("ids") List<String> ids);
|
||||
List<FunctionalDemandDTO> selectParentDemandByKeyword(@Param("keyword") String keyword, @Param("caseId") String caseId);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.functional.mapper.ExtFunctionalCaseDemandMapper">
|
||||
|
||||
<select id="selectGroupByKeyword" resultType="io.metersphere.functional.dto.FunctionalDemandDTO">
|
||||
<select id="selectParentDemandByKeyword" resultType="io.metersphere.functional.dto.FunctionalDemandDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM functional_case_demand
|
||||
|
@ -14,33 +14,6 @@
|
|||
(functional_case_demand.demand_name LIKE CONCAT('%', #{keyword}, '%'))
|
||||
)
|
||||
</if>
|
||||
GROUP BY functional_case_demand.demand_platform
|
||||
</select>
|
||||
|
||||
<select id="selectByKeyword" resultType="io.metersphere.functional.domain.FunctionalCaseDemand">
|
||||
SELECT
|
||||
*
|
||||
FROM functional_case_demand
|
||||
WHERE functional_case_demand.case_id = #{caseId}
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
functional_case_demand.demand_id = #{keyword} OR
|
||||
(functional_case_demand.demand_name LIKE CONCAT('%', #{keyword}, '%'))
|
||||
)
|
||||
</if>
|
||||
<if test="platforms != null and platforms.size() > 0">
|
||||
and functional_case_demand.demand_platform in
|
||||
<foreach collection="platforms" item="platform" open="(" separator="," close=")">
|
||||
#{platform}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
and functional_case_demand.id not in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY functional_case_demand.update_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -60,14 +60,14 @@ public class FunctionalCaseDemandService {
|
|||
* @return List<FunctionalCaseDemand>
|
||||
*/
|
||||
public List<FunctionalDemandDTO> listFunctionalCaseDemands(QueryDemandListRequest request) {
|
||||
List<FunctionalDemandDTO> parentDemands = extFunctionalCaseDemandMapper.selectGroupByKeyword(request.getKeyword(), request.getCaseId());
|
||||
List<FunctionalDemandDTO> parentDemands = extFunctionalCaseDemandMapper.selectParentDemandByKeyword(request.getKeyword(), request.getCaseId());
|
||||
if (CollectionUtils.isEmpty(parentDemands)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Map<String, FunctionalDemandDTO> functionalCaseDemandMap = parentDemands.stream().filter(t -> StringUtils.isNotBlank(t.getDemandId())).collect(Collectors.toMap(FunctionalCaseDemand::getDemandId, t -> t));
|
||||
List<String> ids = parentDemands.stream().map(FunctionalCaseDemand::getId).toList();
|
||||
FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
||||
functionalCaseDemandExample.createCriteria().andIdNotIn(ids);
|
||||
Map<String, FunctionalDemandDTO> functionalCaseDemandMap = parentDemands.stream().filter(t -> StringUtils.isNotBlank(t.getDemandId())).collect(Collectors.toMap(FunctionalCaseDemand::getDemandId, t -> t));
|
||||
List<FunctionalCaseDemand> functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
|
||||
int lastSize = 0;
|
||||
while (CollectionUtils.isNotEmpty(functionalCaseDemands) && functionalCaseDemands.size() != lastSize) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import io.metersphere.system.base.BaseTest;
|
|||
import io.metersphere.system.controller.handler.ResultHolder;
|
||||
import io.metersphere.system.domain.SystemParameter;
|
||||
import io.metersphere.system.log.constants.OperationLogType;
|
||||
import io.metersphere.system.mapper.ServiceIntegrationMapper;
|
||||
import io.metersphere.system.mapper.SystemParameterMapper;
|
||||
import io.metersphere.system.utils.Pager;
|
||||
import jakarta.annotation.Resource;
|
||||
|
@ -59,8 +58,6 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
|
|||
@Resource
|
||||
private SystemParameterMapper systemParameterMapper;
|
||||
@Resource
|
||||
private ServiceIntegrationMapper serviceIntegrationMapper;
|
||||
@Resource
|
||||
private BasePluginTestService basePluginTestService;
|
||||
@Resource
|
||||
private MockServerClient mockServerClient;
|
||||
|
|
Loading…
Reference in New Issue