fix(用例管理): 修复获取需求列表问题
This commit is contained in:
parent
b2210479d8
commit
5bebf4fe7c
|
@ -18,7 +18,7 @@ public class DemandDTO implements Serializable {
|
||||||
@Schema(description = "需求ID")
|
@Schema(description = "需求ID")
|
||||||
private String demandId;
|
private String demandId;
|
||||||
|
|
||||||
@Schema(description = "需求ID")
|
@Schema(description = "父需求ID")
|
||||||
private String parent;
|
private String parent;
|
||||||
|
|
||||||
@Schema(description = "需求标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "需求标题", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package io.metersphere.functional.mapper;
|
package io.metersphere.functional.mapper;
|
||||||
|
|
||||||
import io.metersphere.functional.domain.FunctionalCaseDemand;
|
|
||||||
import io.metersphere.functional.dto.FunctionalDemandDTO;
|
import io.metersphere.functional.dto.FunctionalDemandDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -11,7 +10,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ExtFunctionalCaseDemandMapper {
|
public interface ExtFunctionalCaseDemandMapper {
|
||||||
|
|
||||||
List<FunctionalDemandDTO> selectGroupByKeyword(@Param("keyword") String keyword, @Param("caseId") String caseId);
|
List<FunctionalDemandDTO> selectParentDemandByKeyword(@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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!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">
|
<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
|
SELECT
|
||||||
*
|
*
|
||||||
FROM functional_case_demand
|
FROM functional_case_demand
|
||||||
|
@ -14,33 +14,6 @@
|
||||||
(functional_case_demand.demand_name LIKE CONCAT('%', #{keyword}, '%'))
|
(functional_case_demand.demand_name LIKE CONCAT('%', #{keyword}, '%'))
|
||||||
)
|
)
|
||||||
</if>
|
</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>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -60,14 +60,14 @@ public class FunctionalCaseDemandService {
|
||||||
* @return List<FunctionalCaseDemand>
|
* @return List<FunctionalCaseDemand>
|
||||||
*/
|
*/
|
||||||
public List<FunctionalDemandDTO> listFunctionalCaseDemands(QueryDemandListRequest request) {
|
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)) {
|
if (CollectionUtils.isEmpty(parentDemands)) {
|
||||||
return new ArrayList<>();
|
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();
|
List<String> ids = parentDemands.stream().map(FunctionalCaseDemand::getId).toList();
|
||||||
FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
||||||
functionalCaseDemandExample.createCriteria().andIdNotIn(ids);
|
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);
|
List<FunctionalCaseDemand> functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
|
||||||
int lastSize = 0;
|
int lastSize = 0;
|
||||||
while (CollectionUtils.isNotEmpty(functionalCaseDemands) && functionalCaseDemands.size() != lastSize) {
|
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.controller.handler.ResultHolder;
|
||||||
import io.metersphere.system.domain.SystemParameter;
|
import io.metersphere.system.domain.SystemParameter;
|
||||||
import io.metersphere.system.log.constants.OperationLogType;
|
import io.metersphere.system.log.constants.OperationLogType;
|
||||||
import io.metersphere.system.mapper.ServiceIntegrationMapper;
|
|
||||||
import io.metersphere.system.mapper.SystemParameterMapper;
|
import io.metersphere.system.mapper.SystemParameterMapper;
|
||||||
import io.metersphere.system.utils.Pager;
|
import io.metersphere.system.utils.Pager;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -59,8 +58,6 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
|
||||||
@Resource
|
@Resource
|
||||||
private SystemParameterMapper systemParameterMapper;
|
private SystemParameterMapper systemParameterMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private ServiceIntegrationMapper serviceIntegrationMapper;
|
|
||||||
@Resource
|
|
||||||
private BasePluginTestService basePluginTestService;
|
private BasePluginTestService basePluginTestService;
|
||||||
@Resource
|
@Resource
|
||||||
private MockServerClient mockServerClient;
|
private MockServerClient mockServerClient;
|
||||||
|
|
Loading…
Reference in New Issue