Merge pull request 'Bug修复' (#574) from otto/microservices:dev_PMS into dev_PMS

This commit is contained in:
otto 2024-05-31 09:21:48 +08:00
commit fe4e06e33f
8 changed files with 68 additions and 9 deletions

View File

@ -101,4 +101,22 @@ public interface PmsProductModuleMapper
Integer selectPmsProductModuleCountByNameAndProjectId(@Param("moduleName") String moduleName, @Param("pmsProjectId") Long pmsProjectId);
List<PmsProjectModuleStatistics> selectModuleStatisticsByTestCaseIds(@Param("testSheetIds") Long[] testSheetIds, @Param("testCaseIds") Long[] testCaseIds);
/**
* 根据名称和产品标识获取模块列表
*
* @param moduleName 模块名称
* @param pmsProductIdentifier 产品标识
* @return 模块列表
*/
List<PmsProductModule> selectPmsProductModuleListByNameAndProductIdentifier(@Param("moduleName") String moduleName, @Param("pmsProductIdentifier") String pmsProductIdentifier);
/**
* 根据名称和项目id获取模块列表
*
* @param moduleName 模块名称
* @param pmsProjectId 项目id
* @return 模块列表
*/
List<PmsProductModule> selectPmsProductModuleListByNameAndProjectId(@Param("moduleName") String moduleName, @Param("pmsProjectId") Long pmsProjectId);
}

View File

@ -194,15 +194,15 @@ public class PmsProductModuleServiceImpl implements IPmsProductModuleService
}
private void checkNameDuplicates(PmsProductModule pmsProductModule) {
Integer count;
List<PmsProductModule> duplicatesNamepmsProductModuleList;
if (PmsConstants.PRODUCT_TAG_AND_MODULE_TYPE.equals(pmsProductModule.getType())) {
count = pmsProductModuleMapper.selectPmsProductModuleCountByNameAndProductIdentifier(pmsProductModule.getModuleName(), pmsProductModule.getPmsProductIdentifier());
duplicatesNamepmsProductModuleList = pmsProductModuleMapper.selectPmsProductModuleListByNameAndProductIdentifier(pmsProductModule.getModuleName(), pmsProductModule.getPmsProductIdentifier());
} else {
count = pmsProductModuleMapper.selectPmsProductModuleCountByNameAndProjectId(pmsProductModule.getModuleName(), pmsProductModule.getPmsProjectId());
duplicatesNamepmsProductModuleList = pmsProductModuleMapper.selectPmsProductModuleListByNameAndProjectId(pmsProductModule.getModuleName(), pmsProductModule.getPmsProjectId());
}
if (count > 0) {
throw new ServiceException("该模块名称已存在(模块名称[%s])", pmsProductModule.getModuleName());
// 仅同一父节点下不允许存在重名模块
if (duplicatesNamepmsProductModuleList.stream().anyMatch(x -> x.getParentId().equals(pmsProductModule.getParentId()))) {
throw new ServiceException("父模块下已存在该模块名称(模块名称[%s])", pmsProductModule.getModuleName());
}
}

View File

@ -86,4 +86,11 @@ public interface PmsProjectTestsheetIssuesMapper
* @return 缺陷id列表
*/
List<Long> selectAllDistinctIssueId();
/**
* 根据issueId列表删除测试单关联
*
* @param issueIds issueId列表
*/
void deletePmsProjectTestsheetIssuesByIssueIds(@Param("issueIds") Long[] issueIds);
}

View File

@ -90,4 +90,6 @@ public interface IPmsProjectTestsheetIssuesService
* @return 缺陷id列表
*/
List<Long> selectAllDistinctIssueId();
void deletePmsProjectTestsheetIssuesByIssueIds(Long[] issueIds);
}

View File

@ -47,6 +47,10 @@ public class PmsProjectIssuesService {
@Lazy
private IPmsProjectService pmsProjectService;
@Autowired
@Lazy
private IPmsProjectTestsheetIssuesService pmsProjectTestsheetIssuesService;
public JSONObject selectPmsProjectIssuesList(PmsProjectIssuesSearchVo pmsProjectIssuesSearchVo) {
pmsProjectService.selectAndCheckPmsProjectById(pmsProjectIssuesSearchVo.getPmProjectId());
@ -102,6 +106,8 @@ public class PmsProjectIssuesService {
}
public JSONObject deletePmsProjectIssueByIds(Long[] ids, Long pmProjectId) {
// 删除缺陷与测试单关联关系
pmsProjectTestsheetIssuesService.deletePmsProjectTestsheetIssuesByIssueIds(ids);
pmsProjectService.selectAndCheckPmsProjectById(pmProjectId);
if (ids != null && ids.length == 1 && ids[0] != -1) {
return gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ISSUE(ids[0], pmProjectId));
@ -111,11 +117,12 @@ public class PmsProjectIssuesService {
}
JSONArray jsonArray = new JSONArray();
if (ids != null) {
jsonArray = new JSONArray(Arrays.asList(ids)); // 使用Arrays.asList直接转换为JSONArray
// 使用Arrays.asList直接转换为JSONArray
jsonArray = new JSONArray(Arrays.asList(ids));
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("ids", jsonArray); // 将JSONArray放入JSONObject
// 将JSONArray放入JSONObject
jsonObject.put("ids", jsonArray);
return gitLinkRequestHelper.doDelete(PmsGitLinkRequestUrl.DELETE_ISSUES_BATCH(pmProjectId), jsonObject);
}

View File

@ -199,6 +199,11 @@ public class PmsProjectTestsheetIssuesServiceImpl implements IPmsProjectTestshee
return pmsProjectTestsheetIssuesMapper.selectAllDistinctIssueId();
}
@Override
public void deletePmsProjectTestsheetIssuesByIssueIds(Long[] issueIds) {
pmsProjectTestsheetIssuesMapper.deletePmsProjectTestsheetIssuesByIssueIds(issueIds);
}
private PmsProjectTestsheetCaseVo toPmsProjectTestsheetCaseDataVo(PmsProjectTestsheetCases pmsProjectTestsheetCases) {
PmsProjectTestsheetCaseVo dataVo = new PmsProjectTestsheetCaseVo();

View File

@ -174,6 +174,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY
moduleName;
</select>
<select id="selectPmsProductModuleListByNameAndProductIdentifier" resultMap="PmsProductModuleResult">
<include refid="selectPmsProductModuleVo"/>
<where>
module_name = #{moduleName}
and pms_product_identifier=#{pmsProductIdentifier}
</where>
</select>
<select id="selectPmsProductModuleListByNameAndProjectId" resultMap="PmsProductModuleResult">
<include refid="selectPmsProductModuleVo"/>
<where>
module_name = #{moduleName}
and pms_project_id=#{pmsProjectId}
</where>
</select>
<insert id="insertPmsProductModule" parameterType="PmsProductModule" useGeneratedKeys="true" keyProperty="id">
insert into pms_product_module

View File

@ -76,6 +76,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deletePmsProjectTestsheetIssuesByIssueIds">
delete from pms_project_testsheet_issues where pms_project_testsheet_issues.project_issue_id in
<foreach item="id" collection="issueIds" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectIssueIdsByTestSheetCaseIds" resultType="java.lang.Long">
select project_issue_id