联络人管理部门名称+标准化工程师+联络人+部门联络人主管级领导唯一

This commit is contained in:
梁琦涛
2024-01-31 13:54:38 +08:00
parent 3aac821b17
commit b1c65f30f7
@@ -116,6 +116,17 @@ public class LawsContactManageServiceImpl extends ServiceImpl<LawsContactManageM
*/
@Override
public void add(LawsContactManage lawsContactManage) {
// 验证 部门名称+标准化工程师+联络人+部门联络人主管级领导唯一
LambdaQueryWrapper<LawsContactManage> queryLawsContactManage = new LambdaQueryWrapper<>();
queryLawsContactManage.eq(LawsContactManage::getDepartId,lawsContactManage.getDepartId());
queryLawsContactManage.eq(LawsContactManage::getEngineerId,lawsContactManage.getEngineerId());
queryLawsContactManage.eq(LawsContactManage::getContactId,lawsContactManage.getContactId());
queryLawsContactManage.eq(LawsContactManage::getLeaderId,lawsContactManage.getLeaderId());
long l = count(queryLawsContactManage);
if(l > 0){
throw new JeroBootException("部门名称+标准化工程师+联络人+部门联络人主管级领导已存在");
}
Date now = new Date();
lawsContactManage.setCreateTime(now);
lawsContactManage.setUpdateTime(now);
@@ -130,6 +141,17 @@ public class LawsContactManageServiceImpl extends ServiceImpl<LawsContactManageM
*/
@Override
public void editById(LawsContactManage lawsContactManage) {
// 验证 部门名称+标准化工程师+联络人+部门联络人主管级领导唯一
LambdaQueryWrapper<LawsContactManage> queryLawsContactManage = new LambdaQueryWrapper<>();
queryLawsContactManage.eq(LawsContactManage::getDepartId,lawsContactManage.getDepartId());
queryLawsContactManage.eq(LawsContactManage::getEngineerId,lawsContactManage.getEngineerId());
queryLawsContactManage.eq(LawsContactManage::getContactId,lawsContactManage.getContactId());
queryLawsContactManage.eq(LawsContactManage::getLeaderId,lawsContactManage.getLeaderId());
queryLawsContactManage.ne(LawsContactManage::getId,lawsContactManage.getId());
long l = count(queryLawsContactManage);
if(l > 0){
throw new JeroBootException("部门名称+标准化工程师+联络人+部门联络人主管级领导已存在");
}
Date now = new Date();
lawsContactManage.setUpdateTime(now);
saveOrUpdate(lawsContactManage);