|
@@ -182,14 +182,14 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMappe
|
|
|
//4.如果是待修改审核 能登录 user是能登录的 status = 0
|
|
//4.如果是待修改审核 能登录 user是能登录的 status = 0
|
|
|
SupplierContact add = MapstructUtils.convert(bo, SupplierContact.class);
|
|
SupplierContact add = MapstructUtils.convert(bo, SupplierContact.class);
|
|
|
// ====== 主联系人唯一控制 ======
|
|
// ====== 主联系人唯一控制 ======
|
|
|
-// if ("1".equals(add.getIsPrimaryContact())) {
|
|
|
|
|
-//
|
|
|
|
|
-// LambdaUpdateWrapper<SupplierContact> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
|
-// updateWrapper.eq(SupplierContact::getSupplierId, add.getSupplierId())
|
|
|
|
|
-// .set(SupplierContact::getIsPrimaryContact, "0");
|
|
|
|
|
-//
|
|
|
|
|
-// baseMapper.update(null, updateWrapper);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ if ("1".equals(add.getIsPrimaryContact())) {
|
|
|
|
|
+
|
|
|
|
|
+ LambdaUpdateWrapper<SupplierContact> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
|
+ updateWrapper.eq(SupplierContact::getSupplierId, add.getSupplierId())
|
|
|
|
|
+ .set(SupplierContact::getIsPrimaryContact, "0");
|
|
|
|
|
+
|
|
|
|
|
+ baseMapper.update(null, updateWrapper);
|
|
|
|
|
+ }
|
|
|
List<SupplierContact> supplierContacts = baseMapper.selectList(new LambdaQueryWrapper<SupplierContact>().eq(SupplierContact::getSupplierId, add.getSupplierId()).eq(SupplierContact::getIsPrimaryContact, SysPlatformYesNo.YES.getCode()));
|
|
List<SupplierContact> supplierContacts = baseMapper.selectList(new LambdaQueryWrapper<SupplierContact>().eq(SupplierContact::getSupplierId, add.getSupplierId()).eq(SupplierContact::getIsPrimaryContact, SysPlatformYesNo.YES.getCode()));
|
|
|
if (ObjectUtil.isNotEmpty(supplierContacts) && supplierContacts.size() > 0) {
|
|
if (ObjectUtil.isNotEmpty(supplierContacts) && supplierContacts.size() > 0) {
|
|
|
add.setIsPrimaryContact(SysPlatformYesNo.NO.getCode());
|
|
add.setIsPrimaryContact(SysPlatformYesNo.NO.getCode());
|
|
@@ -247,15 +247,15 @@ public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMappe
|
|
|
public Boolean updateByBo(SupplierContactBo bo) {
|
|
public Boolean updateByBo(SupplierContactBo bo) {
|
|
|
SupplierContact update = MapstructUtils.convert(bo, SupplierContact.class);
|
|
SupplierContact update = MapstructUtils.convert(bo, SupplierContact.class);
|
|
|
// ====== 主联系人唯一控制 ======
|
|
// ====== 主联系人唯一控制 ======
|
|
|
-// if ("1".equals(update.getIsPrimaryContact())) {
|
|
|
|
|
-//
|
|
|
|
|
-// LambdaUpdateWrapper<SupplierContact> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
|
-// updateWrapper.eq(SupplierContact::getSupplierId, update.getSupplierId())
|
|
|
|
|
-// .ne(SupplierContact::getId, update.getId()) // 排除自己
|
|
|
|
|
-// .set(SupplierContact::getIsPrimaryContact, "0");
|
|
|
|
|
-//
|
|
|
|
|
-// baseMapper.update(null, updateWrapper);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ if ("1".equals(update.getIsPrimaryContact())) {
|
|
|
|
|
+
|
|
|
|
|
+ LambdaUpdateWrapper<SupplierContact> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
|
|
+ updateWrapper.eq(SupplierContact::getSupplierId, update.getSupplierId())
|
|
|
|
|
+ .ne(SupplierContact::getId, update.getId()) // 排除自己
|
|
|
|
|
+ .set(SupplierContact::getIsPrimaryContact, "0");
|
|
|
|
|
+
|
|
|
|
|
+ baseMapper.update(null, updateWrapper);
|
|
|
|
|
+ }
|
|
|
if (update.getUserId() != null) {
|
|
if (update.getUserId() != null) {
|
|
|
RemoteUserBo remoteUserBo = new RemoteUserBo();
|
|
RemoteUserBo remoteUserBo = new RemoteUserBo();
|
|
|
remoteUserBo.setNickName(bo.getUserName());
|
|
remoteUserBo.setNickName(bo.getUserName());
|