shiyunteng
2025-03-27 4b35b69771432f970decd57bd8201d61a3b08887
platformx-device-biz/src/main/java/com/by4cloud/platformx/device/controller/DeviceDemandPlanController.java
@@ -7,8 +7,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.by4cloud.platformx.common.core.util.R;
import com.by4cloud.platformx.common.log.annotation.SysLog;
import com.by4cloud.platformx.device.constant.MaxSizeContant;
import com.by4cloud.platformx.device.entity.DeviceDemandPlan;
import com.by4cloud.platformx.device.service.DeviceDemandPlanService;
import com.by4cloud.platformx.device.service.JcMaxSizeService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.by4cloud.platformx.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -36,6 +38,7 @@
public class DeviceDemandPlanController {
    private final  DeviceDemandPlanService deviceDemandPlanService;
    private final JcMaxSizeService maxSizeService;
    /**
     * 分页查询
@@ -43,12 +46,14 @@
     * @param deviceDemandPlan 设备需求计划主表
     * @return
     */
    @Operation(summary = "分页查询" , description = "分页查询" )
    @Operation(summary = "本单位分页查询" , description = "本单位分页查询" )
    @GetMapping("/page" )
    @PreAuthorize("@pms.hasPermission('platformx_deviceDemandPlan_view')" )
    public R getDeviceDemandPlanPage(@ParameterObject Page page, @ParameterObject DeviceDemandPlan deviceDemandPlan) {
        LambdaQueryWrapper<DeviceDemandPlan> wrapper = Wrappers.lambdaQuery();
        return R.ok(deviceDemandPlanService.page(page, wrapper));
      wrapper.eq(deviceDemandPlan.getDeclareCompId() !=null,DeviceDemandPlan::getDeclareCompId,deviceDemandPlan.getDeclareCompId());
      wrapper.eq(deviceDemandPlan.getReleasePerson() !=null,DeviceDemandPlan::getReleasePerson,deviceDemandPlan.getReleasePerson());
      wrapper.eq(deviceDemandPlan.getYear() !=null,DeviceDemandPlan::getYear,deviceDemandPlan.getYear());
        return R.ok(deviceDemandPlanService.pageByScope(page, wrapper));
    }
@@ -74,6 +79,7 @@
    @PostMapping
    @PreAuthorize("@pms.hasPermission('platformx_deviceDemandPlan_add')" )
    public R save(@RequestBody DeviceDemandPlan deviceDemandPlan) {
      deviceDemandPlan.setNumber(maxSizeService.nextNo(MaxSizeContant.PLAN_NUM));
        return R.ok(deviceDemandPlanService.save(deviceDemandPlan));
    }