| | |
| | | package org.jeecg.modules.system.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.system.entity.MdcProduction; |
| | | import org.jeecg.modules.system.entity.MdcUserProduction; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.mapper.MdcUserProductionMapper; |
| | | import org.jeecg.modules.system.model.ProductionIdModel; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.IMdcUserProductionService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | |
| | | public List<String> queryProductionIdsByUserId(String userId) { |
| | | return this.baseMapper.queryProductionIdsByUserId(userId); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean removeByCollection(List<MdcUserProduction> mdcUserProductions) { |
| | | if(mdcUserProductions == null || mdcUserProductions.isEmpty()) |
| | | return false; |
| | | if(mdcUserProductions.size() == 1){ |
| | | return super.removeById(mdcUserProductions.get(0).getId()); |
| | | } |
| | | List<String> ids = new ArrayList<>(); |
| | | mdcUserProductions.forEach(item -> { |
| | | ids.add(item.getId()); |
| | | }); |
| | | return super.removeByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * 获取已分配的用户列表 |
| | | * @param proId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysUser> getUserPermsByGroupId(String proId){ |
| | | return super.getBaseMapper().getUserPermsByGroupId(proId); |
| | | } |
| | | |
| | | /** |
| | | * 获取未分配的用户列表 |
| | | * @param proId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysUser> getUserNonPermsByGroupId(String proId){ |
| | | return super.getBaseMapper().getUserNonPermsByGroupId(proId); |
| | | } |
| | | |
| | | /** |
| | | * 获取未分配的用户 |
| | | * @param proId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysUser> getUserNonPermsByDeviceId(String proId){ |
| | | return super.getBaseMapper().getUserNonPermsByDeviceId(proId); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUser> getUserPermsByDeviceId(String proId) { |
| | | return super.getBaseMapper().getUserPermsByDeviceId(proId); |
| | | } |
| | | |
| | | @Override |
| | | public MdcUserProduction getByUserIdAndGroupId(String userId, String proId){ |
| | | if(StrUtil.isNotEmpty(userId) || !StrUtil.isNotEmpty(proId)) |
| | | return null; |
| | | List<MdcUserProduction> list = super.lambdaQuery().eq(MdcUserProduction::getUserId, userId).eq(MdcUserProduction::getProId, proId).list(); |
| | | if(list == null || list.isEmpty()) |
| | | return null; |
| | | return list.get(0); |
| | | } |
| | | } |