From 99beb9e8323fd572b5f2196d1995c3497913785d Mon Sep 17 00:00:00 2001 From: sfd <sun.sunshine@163.com> Date: 星期三, 14 五月 2025 18:44:45 +0800 Subject: [PATCH] 修改计划管理与查询周期配置查询关系 --- aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlanManagementServiceImpl.java | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlanManagementServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlanManagementServiceImpl.java index 6cb0efd..90ec925 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlanManagementServiceImpl.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlanManagementServiceImpl.java @@ -1,14 +1,17 @@ package com.aps.core.service.impl; import java.util.List; +import java.util.Objects; import com.aps.common.core.utils.DateUtils; +import com.aps.common.security.utils.SecurityUtils; import com.aps.core.domain.ApsPlanCycle; import com.aps.core.domain.ApsPlanManagement; import com.aps.core.mapper.ApsPlanCycleMapper; import com.aps.core.mapper.ApsPlanManagementMapper; import com.aps.core.service.IApsPlanManagementService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.simpleframework.xml.core.Resolve; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,7 +25,7 @@ */ @Service public class ApsPlanManagementServiceImpl extends ServiceImpl<ApsPlanManagementMapper, ApsPlanManagement> implements IApsPlanManagementService { - @Autowired + @Resolve private ApsPlanManagementMapper apsPlanManagementMapper; @Autowired @@ -47,7 +50,17 @@ */ @Override public List<ApsPlanManagement> selectApsPlanManagementList(ApsPlanManagement apsPlanManagement) { - return apsPlanManagementMapper.selectApsPlanManagementList(apsPlanManagement); + List<ApsPlanManagement> items = apsPlanManagementMapper.selectApsPlanManagementList(apsPlanManagement); + List<ApsPlanCycle> cycles = apsPlanCycleMapper.selectByPlanIds(items.stream().map(ApsPlanManagement::getId).toList()); + cycles.forEach(cycle -> { + for (ApsPlanManagement item : items) { + if (Objects.equals(item.getId(), cycle.getPlanId())) { + item.setCycle(cycle); + break; + } + } + }); + return items; } /** @@ -59,6 +72,7 @@ @Override public int insertApsPlanManagement(ApsPlanManagement apsPlanManagement) { apsPlanManagement.setCreateTime(DateUtils.getNowDate()); + apsPlanManagement.setCreateBy(SecurityUtils.getUsername()); return apsPlanManagementMapper.insertApsPlanManagement(apsPlanManagement); } @@ -71,6 +85,7 @@ @Override public int updateApsPlanManagement(ApsPlanManagement apsPlanManagement) { apsPlanManagement.setUpdateTime(DateUtils.getNowDate()); + apsPlanManagement.setUpdateBy(SecurityUtils.getUsername()); return apsPlanManagementMapper.updateApsPlanManagement(apsPlanManagement); } @@ -101,9 +116,13 @@ public void updateApsPlanCycle(ApsPlanCycle apsPlanCycle) { ApsPlanCycle planCycle = apsPlanCycleMapper.selectByPlanId(apsPlanCycle.getPlanId()); if (planCycle == null) { + apsPlanCycle.setCreateBy(SecurityUtils.getUsername()); + apsPlanCycle.setCreateTime(DateUtils.getNowDate()); apsPlanCycleMapper.insert(apsPlanCycle); } else { BeanUtils.copyProperties(apsPlanCycle, planCycle, "id", "planId"); + planCycle.setUpdateBy(SecurityUtils.getUsername()); + planCycle.setUpdateTime(DateUtils.getNowDate()); apsPlanCycleMapper.updateById(planCycle); } } -- Gitblit v1.9.3