Merge pull request '校验组织内是否存在同名知识库逻辑修复' (#806) from wanjia9506/microservices:kanban_refact into product_refact
This commit is contained in:
commit
83f65cfd3d
|
|
@ -79,7 +79,7 @@ public interface PmsDocumentMapper
|
|||
|
||||
int countChildDocByIds(@Param("ids") Long[] ids);
|
||||
|
||||
int countDocumentByNameAndTypeAndParenId(@Param("name") String name, @Param("docType") Integer docType, @Param("parenId") Long parenId, @Param("pmsProjectId") Long pmsProjectId);
|
||||
int countDocumentByNameAndTypeAndParenId(@Param("name") String name, @Param("docType") Integer docType, @Param("parenId") Long parenId, @Param("pmsProjectId") Long pmsProjectId, @Param("pmsEnterpriseId") Long pmsEnterpriseId);
|
||||
|
||||
int deletePmsDocumentByIdWithoutAuthCheck(@Param("docId") Long docId);
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
checkPmsProjectById(pmsDocument.getPmsProjectId());
|
||||
checkAuthAndReturnAdminStatus(pmsDocument.getPmsEnterpriseId());
|
||||
String currentUserName = SecurityUtils.getUsername();
|
||||
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId());
|
||||
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId(), pmsDocument.getPmsEnterpriseId());
|
||||
pmsDocument.setCreateTime(DateUtils.getNowDate());
|
||||
pmsDocument.setCreateBy(currentUserName);
|
||||
return pmsDocumentMapper.insertPmsDocument(pmsDocument);
|
||||
|
|
@ -311,7 +311,7 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
pmsDocument.setCreateTime(DateUtils.getNowDate());
|
||||
pmsDocument.setUpdateTime(DateUtils.getNowDate());
|
||||
pmsDocument.setCreateBy(currentUserName);
|
||||
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId());
|
||||
checkForSameDocumentExistence(pmsDocument.getName(), pmsDocument.getDocType(), pmsDocument.getParentId(), pmsDocument.getPmsProjectId(), pmsDocument.getPmsEnterpriseId());
|
||||
pmsDocumentList.add(pmsDocument);
|
||||
}
|
||||
return pmsDocumentMapper.batchInsertPmsDocument(pmsDocumentList);
|
||||
|
|
@ -324,8 +324,8 @@ public class PmsDocumentServiceImpl implements IPmsDocumentService
|
|||
}
|
||||
}
|
||||
|
||||
private void checkForSameDocumentExistence(String name, Integer docType, Long parentId, Long pmsProjectId) {
|
||||
if (pmsDocumentMapper.countDocumentByNameAndTypeAndParenId(name, docType, parentId, pmsProjectId) > 0) {
|
||||
private void checkForSameDocumentExistence(String name, Integer docType, Long parentId, Long pmsProjectId, Long pmsEnterpriseId) {
|
||||
if (pmsDocumentMapper.countDocumentByNameAndTypeAndParenId(name, docType, parentId, pmsProjectId, pmsEnterpriseId) > 0) {
|
||||
throw new ServiceException("当前目录已存在同名文档:[%s]", name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where `name` = #{name}
|
||||
and doc_type = #{docType}
|
||||
and pms_project_id = #{pmsProjectId}
|
||||
and pms_enterprise_id = #{pmsEnterpriseId}
|
||||
<if test="docType != 4">
|
||||
and parent_id = #{parenId}
|
||||
</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue