|
@@ -61,7 +61,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
|
|
public IPage<SysCustomResult> query(Page<Map> iPage, ProductTypeEnum type, Long managerId, String name, Long levelId) {
|
|
public IPage<SysCustomResult> query(Page<Map> iPage, ProductTypeEnum type, Long managerId, String name, Long levelId) {
|
|
IPage<SysCustomResult> sysCustomResultIPage = this.baseMapper.query(iPage, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(managerId) ? managerId : null, name, Objects.nonNull(levelId) ? levelId : null);
|
|
IPage<SysCustomResult> sysCustomResultIPage = this.baseMapper.query(iPage, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(managerId) ? managerId : null, name, Objects.nonNull(levelId) ? levelId : null);
|
|
sysCustomResultIPage.getRecords().forEach(e -> {
|
|
sysCustomResultIPage.getRecords().forEach(e -> {
|
|
- if(e.getLevelId()!=null)e.setRoleList(sysLevelRoleService.getList(e.getLevelId()));
|
|
|
|
|
|
+ if(e.getLevelId()!=null) {
|
|
|
|
+ e.setRoleList(sysLevelRoleService.getList(e.getLevelId()));
|
|
|
|
+ }
|
|
e.setAddrList(sysCustomAddrService.list(new QueryWrapper<SysCustomAddr>().lambda().eq(SysCustomAddr::getCustomId,e.getId())));
|
|
e.setAddrList(sysCustomAddrService.list(new QueryWrapper<SysCustomAddr>().lambda().eq(SysCustomAddr::getCustomId,e.getId())));
|
|
});
|
|
});
|
|
return sysCustomResultIPage;
|
|
return sysCustomResultIPage;
|
|
@@ -88,8 +90,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
|
|
e.setCustomId(sysCustom.getId());
|
|
e.setCustomId(sysCustom.getId());
|
|
sysCustomAddrService.saveOrUpdate(e);
|
|
sysCustomAddrService.saveOrUpdate(e);
|
|
});
|
|
});
|
|
- if(Objects.isNull(sysCustom.getLevelId()))
|
|
|
|
|
|
+ if(Objects.isNull(sysCustom.getLevelId())) {
|
|
return saveOrUpdate(sysCustom,new LambdaUpdateWrapper<SysCustom>().set(SysCustom::getLevelId,null).eq(SysCustom::getId,sysCustom.getId()));
|
|
return saveOrUpdate(sysCustom,new LambdaUpdateWrapper<SysCustom>().set(SysCustom::getLevelId,null).eq(SysCustom::getId,sysCustom.getId()));
|
|
|
|
+ }
|
|
return saveOrUpdate(sysCustom);
|
|
return saveOrUpdate(sysCustom);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
if (e instanceof DuplicateKeyException) {
|
|
if (e instanceof DuplicateKeyException) {
|
|
@@ -111,8 +114,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
|
|
@Transactional
|
|
@Transactional
|
|
public void delete(Long id) {
|
|
public void delete(Long id) {
|
|
List<TBCrm> list = tbCrmService.list(new LambdaQueryWrapper<TBCrm>().eq(TBCrm::getCustomId, id));
|
|
List<TBCrm> list = tbCrmService.list(new LambdaQueryWrapper<TBCrm>().eq(TBCrm::getCustomId, id));
|
|
- if(!list.isEmpty())
|
|
|
|
|
|
+ if(!list.isEmpty()) {
|
|
throw ExceptionResultEnum.ERROR.exception("该客户下已有业务,不能删除");
|
|
throw ExceptionResultEnum.ERROR.exception("该客户下已有业务,不能删除");
|
|
|
|
+ }
|
|
this.removeById(id);
|
|
this.removeById(id);
|
|
}
|
|
}
|
|
|
|
|