kongdeqiang
2025-04-02 286e7ec66098f4f7deeae806781d6faab5ad0d21
fix: 租赁计划修改page方法
2个文件已修改
17 ■■■■■ 已修改文件
platformx-device-api/src/main/java/com/by4cloud/platformx/device/entity/DeviceDemandPlan.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
platformx-device-api/src/main/java/com/by4cloud/platformx/device/entity/DeviceDemandPlan.java
@@ -1,5 +1,6 @@
package com.by4cloud.platformx.device.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.by4cloud.platformx.common.data.mybatis.BaseModel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -9,7 +10,9 @@
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * @author kdq
@@ -72,4 +75,8 @@
    @Schema(description = "上报时间")
    @Column(columnDefinition = "datetime comment '上报时间'")
    private Date sendDate;
    @Transient
    @TableField(exist = false)
    private List<DeviceDemandTotal> totalList;
}
platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java
@@ -14,6 +14,7 @@
import com.by4cloud.platformx.device.entity.Device;
import com.by4cloud.platformx.device.entity.DeviceDemandPlan;
import com.by4cloud.platformx.device.entity.DeviceDemandSub;
import com.by4cloud.platformx.device.entity.DeviceDemandTotal;
import com.by4cloud.platformx.device.service.*;
import com.by4cloud.platformx.device.util.NumUtils;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -63,7 +64,14 @@
        wrapper.eq(deviceDemandPlan.getYear() !=null,DeviceDemandPlan::getYear,deviceDemandPlan.getYear());
        wrapper.eq(DeviceDemandPlan::getType2,0);
        wrapper.orderByDesc(DeviceDemandPlan::getCreateTime);
        return R.ok(deviceDemandPlanService.pageByScope(page, wrapper));
        Page<DeviceDemandPlan> page1 = deviceDemandPlanService.pageByScope(page, wrapper);
        for (DeviceDemandPlan record : page1.getRecords()) {
            LambdaQueryWrapper<DeviceDemandTotal> totalWrapper = Wrappers.lambdaQuery();
            totalWrapper.eq(DeviceDemandTotal::getPlanId,record.getId());
            List<DeviceDemandTotal> list = deviceDemandTotalService.list(totalWrapper);
            record.setTotalList(list);
        }
        return R.ok(page1);
    }
    /**