sfd
2025-05-14 99beb9e8323fd572b5f2196d1995c3497913785d
修改计划管理与查询周期配置查询关系
已修改4个文件
58 ■■■■ 文件已修改
aps-modules/aps-core/src/main/java/com/aps/core/controller/ApsPlanManagementController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlanManagement.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlanCycleMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlanManagementServiceImpl.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aps-modules/aps-core/src/main/java/com/aps/core/controller/ApsPlanManagementController.java
@@ -6,7 +6,6 @@
import com.aps.common.core.web.page.TableDataInfo;
import com.aps.common.log.annotation.Log;
import com.aps.common.log.enums.BusinessType;
import com.aps.common.security.annotation.RequiresPermissions;
import com.aps.core.domain.ApsPlanCycle;
import com.aps.core.domain.ApsPlanManagement;
import com.aps.core.service.IApsPlanManagementService;
@@ -21,7 +20,7 @@
/**
 * 计划管理Controller
 * 
 * @author ruoyi
 * @author sfd
 * @date 2025-05-13
 */
@@ -37,7 +36,7 @@
     * 查询计划管理列表
     */
    @Operation(summary = "查询计划管理列表", description = "分页查询")
    @RequiresPermissions("aps:management:list")
//    @RequiresPermissions("aps:management:list")
    @GetMapping("/list")
    public TableDataInfo list(ApsPlanManagement apsPlanManagement)
    {
@@ -50,7 +49,7 @@
     * 导出计划管理列表
     */
    @Operation(summary = "导出计划管理列表", description = "导出")
    @RequiresPermissions("aps:management:export")
//    @RequiresPermissions("aps:management:export")
    @Log(title = "计划管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApsPlanManagement apsPlanManagement)
@@ -64,7 +63,7 @@
     * 获取计划管理详细信息
     */
    @Operation(summary = "获取计划管理详细信息", description = "根据id获取")
    @RequiresPermissions("aps:management:query")
//    @RequiresPermissions("aps:management:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
@@ -75,7 +74,7 @@
     * 新增计划管理
     */
    @Operation(summary = "新增计划管理", description = "单个新增")
    @RequiresPermissions("aps:management:add")
//    @RequiresPermissions("aps:management:add")
    @Log(title = "计划管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApsPlanManagement apsPlanManagement)
@@ -87,7 +86,7 @@
     * 修改计划周期管理
     */
    @Operation(summary = "修改计划周期管理", description = "修改计划周期管理")
    @RequiresPermissions("aps:planCycle:edit")
//    @RequiresPermissions("aps:planCycle:edit")
    @Log(title = "修改计划周期管理", businessType = BusinessType.UPDATE)
    @PutMapping("cycle")
    public AjaxResult edit(@RequestBody ApsPlanCycle apsPlanCycle)
@@ -100,7 +99,7 @@
     * 修改计划管理
     */
    @Operation(summary = "修改计划管理", description = "单个修改")
    @RequiresPermissions("aps:management:edit")
//    @RequiresPermissions("aps:management:edit")
    @Log(title = "计划管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApsPlanManagement apsPlanManagement)
@@ -112,7 +111,7 @@
     * 删除计划管理
     */
    @Operation(summary = "删除计划管理", description = "批量删除")
    @RequiresPermissions("aps:management:remove")
//    @RequiresPermissions("aps:management:remove")
    @Log(title = "计划管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlanManagement.java
@@ -1,7 +1,9 @@
package com.aps.core.domain;
import com.aps.common.core.web.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aps.common.core.annotation.Excel;
@@ -12,6 +14,7 @@
 * @author ruoyi
 * @date 2025-05-13
 */
@Data
@Schema(description = "计划管理实体类")
public class ApsPlanManagement extends BaseEntity
{
@@ -41,6 +44,9 @@
    @Schema(description = "计划排产规则")
    private String rule;
    @TableField(exist = false)
    private ApsPlanCycle cycle;
    public void setId(Long id) 
    {
        this.id = id;
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlanCycleMapper.java
@@ -18,4 +18,16 @@
    @Select("select * from aps_plan_cycle where plan_id = #{planId}")
    ApsPlanCycle selectByPlanId(Long planId);
    @Select("""
        <script>
            select * from aps_plan_cycle where 1 = 0
            <if test="!planIds.isEmpty()">or plan_id in
                <foreach collection="planIds" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        </script>
    """)
    List<ApsPlanCycle> selectByPlanIds(List<Long> planIds);
}
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);
        }
    }