package org.jeecg.modules.system.service.impl; 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.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 javax.annotation.Resource; import java.util.ArrayList; import java.util.List; /** * @Description: 用户产线表 * @author: LiuS * @create: 2023-03-27 11:58 */ @Service public class MdcUserProductionServiceImpl extends ServiceImpl implements IMdcUserProductionService { @Resource private IMdcProductionService mdcProductionService; /** * 根据用户id查询产线信息 */ @Override public List queryProductionIdsOfUser(String userId) { LambdaQueryWrapper queryUserPro = new LambdaQueryWrapper<>(); LambdaQueryWrapper queryPro = new LambdaQueryWrapper<>(); try { queryUserPro.eq(MdcUserProduction::getUserId, userId); List proIdList = new ArrayList<>(); List proIdModelList = new ArrayList<>(); List userProList = this.list(queryUserPro); if (userProList != null && !userProList.isEmpty()) { for (MdcUserProduction userProduction : userProList) { proIdList.add(userProduction.getProId()); } queryPro.in(MdcProduction::getId, proIdList); List proList = mdcProductionService.list(queryPro); if (proList != null && !proList.isEmpty()) { for (MdcProduction mdcProduction : proList) { proIdModelList.add(new ProductionIdModel().convertByUserProduction(mdcProduction)); } } return proIdModelList; } } catch (Exception e) { e.fillInStackTrace(); } return null; } /** * 根据指定用户id查询产线id集合 */ @Override public List queryProductionIdsByUserId(String userId) { return this.baseMapper.queryProductionIdsByUserId(userId); } }