| | |
| | | import com.aps.core.mapper.ApsPartPlanMapper; |
| | | import com.aps.core.domain.ApsPartPlan; |
| | | import com.aps.core.service.IApsPartPlanService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 零件计划管理Service业务层处理 |
| | |
| | | return apsPartPlanMapper.deleteApsPartPlanById(id); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public int confirmPart(ApsPartPlanTemp apsPartPlanTemp) { |
| | | |
| | | apsPartPlanMapper.removeAllPartPlans(); |
| | | //查询临时表数据 |
| | | List<ApsPartPlanTemp> apsPartPlanTemps=apsPartPlanTempMapper.selectApsPartPlanTempList(apsPartPlanTemp); |
| | | int count=0; |
| | | String[] ids=new String[apsPartPlanTemps.size()]; |
| | | for (int i = 0; i <apsPartPlanTemps.size() ; i++) { |
| | | //记录临时表id |
| | | ids[i]=apsPartPlanTemps.get(i).getId(); |
| | | ApsPartPlan apsPartPlan=new ApsPartPlan(); |
| | | BeanUtils.copyProperties(apsPartPlanTemps.get(i), apsPartPlan); |
| | | apsPartPlan.setId(IdUtils.fastUUID()); |
| | | //插入正式表,并记录 |
| | | apsPartPlanMapper.insertApsPartPlan(apsPartPlan); |
| | | count++; |
| | | } |
| | | List<String> aids=apsPartPlanTemps.stream().map(ApsPartPlanTemp::getId).toList(); |
| | | String[] ids=aids.toArray(new String[0]); |
| | | // for (int i = 0; i <apsPartPlanTemps.size() ; i++) { |
| | | // //记录临时表id |
| | | // ids[i]=apsPartPlanTemps.get(i).getId(); |
| | | // ApsPartPlan apsPartPlan=new ApsPartPlan(); |
| | | // BeanUtils.copyProperties(apsPartPlanTemps.get(i), apsPartPlan); |
| | | // apsPartPlan.setId(IdUtils.fastUUID()); |
| | | // //插入正式表,并记录 |
| | | // apsPartPlanMapper.insertApsPartPlan(apsPartPlan); |
| | | // count++; |
| | | // } |
| | | count =apsPartPlanMapper.insertBatch(apsPartPlanTemps); |
| | | //插入数量与临时表查询一直则删除临时表数据 |
| | | if (count==apsPartPlanTemps.size()) { |
| | | apsPartPlanTempMapper.deleteApsPartPlanTempByIds(ids); |