2025.4.21

// ConstructionApplicationController.java
package com.itheima.smartbuild.controller;

import com.itheima.smartbuild.dto.ConstructionApplicationDTO;
import com.itheima.smartbuild.model.ConstructionPlan;
import com.itheima.smartbuild.service.ConstructionApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/applications")
public class ConstructionApplicationController {

private final ConstructionApplicationService applicationService;

@Autowired
public ConstructionApplicationController(ConstructionApplicationService applicationService) {
    this.applicationService = applicationService;
}

/**
 * 提交施工申请
 */
@PostMapping
public ResponseEntity<ConstructionPlan> submitApplication(@RequestBody ConstructionApplicationDTO applicationDTO) {
    ConstructionPlan plan = applicationService.submitApplication(applicationDTO);
    return ResponseEntity.ok(plan);
}

/**
 * 获取申请详情
 */
@GetMapping("/{planId}")
public ResponseEntity<ConstructionApplicationDTO> getApplicationDetail(@PathVariable Integer planId) {
    ConstructionApplicationDTO application = applicationService.getApplicationDetail(planId);
    return ResponseEntity.ok(application);
}

}今天完成了controller数据库控制类代码的编译

posted @ 2025-04-21 21:34  古明源  阅读(18)  评论(0)    收藏  举报