From cc6ee8e7461b7959b0917ed260afa47c99cd98ea Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期五, 28 十月 2022 11:13:37 +0800
Subject: [PATCH] 店铺上传bug解决和用户添加用户类型bug解决
---
ycl-common/src/main/java/com/ycl/service/depart/impl/UmsDepartServiceImpl.java | 49 ++++++++++++++++++++++---------------------------
1 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/ycl-common/src/main/java/com/ycl/service/depart/impl/UmsDepartServiceImpl.java b/ycl-common/src/main/java/com/ycl/service/depart/impl/UmsDepartServiceImpl.java
index 5979651..11614e3 100644
--- a/ycl-common/src/main/java/com/ycl/service/depart/impl/UmsDepartServiceImpl.java
+++ b/ycl-common/src/main/java/com/ycl/service/depart/impl/UmsDepartServiceImpl.java
@@ -1,14 +1,10 @@
package com.ycl.service.depart.impl;
-import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ycl.dto.user.AdminDepartDTO;
import com.ycl.entity.depart.UmsDepart;
-import com.ycl.entity.dict.DataDictionary;
-import com.ycl.entity.user.UmsDepartManage;
+import com.ycl.entity.user.UmsAdmin;
import com.ycl.enums.common.ResultCode;
import com.ycl.exception.ApiException;
import com.ycl.mapper.depart.UmsDepartMapper;
@@ -17,7 +13,6 @@
import com.ycl.service.depart.UmsDepartService;
import com.ycl.service.user.UmsAdminService;
import com.ycl.service.user.UmsDepartManageService;
-import com.ycl.utils.common.PojoUtils;
import com.ycl.vo.depart.DepartVO;
import com.ycl.vo.depart.UmsDepartVO;
import org.apache.commons.lang3.StringUtils;
@@ -27,7 +22,6 @@
import javax.annotation.Resource;
import java.time.LocalDateTime;
-import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -86,27 +80,20 @@
@Transactional(rollbackFor = Exception.class)
public void update(DepartVO.UpdateDepartVO updateDepartVO) {
UmsDepart sccgDepart = this.queryByName(updateDepartVO.getDepartName());
- if (null != sccgDepart && sccgDepart.getId() != updateDepartVO.getId()) {
+ if (null != sccgDepart && !sccgDepart.getId().equals(updateDepartVO.getId())) {
throw new ApiException(ResultCode.RECORD_ALREADY_EXISTS);
}
- UmsDepart depart = this.getById(updateDepartVO.getId());
+ UmsDepart depart = new UmsDepart();
BeanUtils.copyProperties(updateDepartVO, depart);
- List<Long> userIds = updateDepartVO.getUserIds();
- if (CollUtil.isNotEmpty(userIds)) {
- Long departId = updateDepartVO.getId();
- List<UmsDepartManage> departList = umsAdminDepartService.queryByDepartId(departId);
- if (CollUtil.isNotEmpty(departList)) {
- umsAdminDepartService.deletedByDepartId(departId);
- }
- userIds.forEach(e -> {
- UmsDepartManage adminDepart = new UmsDepartManage();
- adminDepart.setDepartId(departId);
- adminDepart.setUserId(e);
- umsAdminDepartService.save(adminDepart);
- });
- }
- if (sccgDepartMapper.updateById(depart) != 1) {
- throw new ApiException(ResultCode.RECORD_UPDATE_FAIL);
+ umsDepartService.updateById(depart);
+ if (updateDepartVO.getDepartManagerList().size() > 0) {
+ iDepartManagerService.deleteByDepartId(depart.getId());
+ updateDepartVO.getDepartManagerList()
+ .forEach(item -> {
+ item.setCreateTime(LocalDateTime.now());
+ item.setDepartId(depart.getId());
+ });
+ iDepartManagerService.saveBatch(updateDepartVO.getDepartManagerList());
}
}
@@ -160,6 +147,15 @@
}
}
+ @Override
+ public List<UmsAdmin> selectSurplusUser() {
+ return sccgDepartMapper.selectSurplusUser();
+ }
+
+ @Override
+ public List<UmsAdmin> selectSurplusUserAndExistUser(Long id) {
+ return sccgDepartMapper.selectSurplusUserAndExistUser(id);
+ }
/**
* 鍒╃敤閫掑綊灏嗘渶鍚庝竴绾х┖闆嗗悎鍙樹负null锛屽墠绔仈绾ч�夋嫨鍣ㄦ渶鍚庢墠涓嶄細鍑虹幇 鏆傛棤鏁版嵁鐨刡ug
@@ -202,5 +198,4 @@
UmsDepart sccgDepart = this.sccgDepartMapper.selectOne(queryWrapper);
return sccgDepart;
}
-
-}
+}
\ No newline at end of file
--
Gitblit v1.8.0