| | |
| | | import com.ycl.service.user.UmsDepartManageService; |
| | | import com.ycl.vo.depart.DepartVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void userUpdateDepart(Long id, List<UmsDepartManage> departIds) { |
| | | umsDepartManageMapper.delete(new LambdaQueryWrapper<UmsDepartManage>().eq(UmsDepartManage::getUserId,id)); |
| | | departIds |
| | | .stream() |
| | | .forEach(item->{ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void userUpdateDepart(Long userId,Long departId) { |
| | | umsDepartManageMapper.delete(new LambdaQueryWrapper<UmsDepartManage>().eq(UmsDepartManage::getUserId,userId)); |
| | | UmsDepartManage umsDepartManage = new UmsDepartManage(); |
| | | umsDepartManage.setDepartId(item.getDepartId()); |
| | | umsDepartManage.setUserId(id); |
| | | umsDepartManage.setIsLeader(item.getIsLeader()); |
| | | umsDepartManage.setUserId(userId); |
| | | umsDepartManage.setCreateTime(new Date()); |
| | | umsDepartManage.setDepartId(departId); |
| | | umsDepartManageMapper.insert(umsDepartManage); |
| | | }); |
| | | UmsAdmin umsAdmin = new UmsAdmin(); |
| | | umsAdmin.setDepartmentId(departId); |
| | | umsAdmin.setId(userId); |
| | | umsAdminService.updateById(umsAdmin); |
| | | } |
| | | } |