104 lines
3.9 KiB
Java
104 lines
3.9 KiB
Java
package com.interplug.qcast.biz.object;
|
|
|
|
import com.interplug.qcast.biz.object.dto.*;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import java.util.List;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@Slf4j
|
|
@RestController
|
|
@RequestMapping("/api/object")
|
|
@RequiredArgsConstructor
|
|
@Tag(name = "ObjectController", description = "물건정보 관련 API")
|
|
public class ObjectController {
|
|
// @Autowired private ObjectService objectService;
|
|
private final ObjectService objectService;
|
|
|
|
@Operation(description = "물건정보 도도부현을 조회한다.2")
|
|
@GetMapping("/prefecture/list")
|
|
@ResponseStatus(HttpStatus.OK)
|
|
public List<PrefResponse> selectPrefList() throws Exception {
|
|
return objectService.selectPrefList();
|
|
}
|
|
|
|
@Operation(description = "물건정보 도도부현 발전시뮬레이션 지역을 조회한다.")
|
|
@GetMapping("/prefecture/{prefId}/list")
|
|
@ResponseStatus(HttpStatus.OK)
|
|
public List<PrefResponse> selectPrefAreaList(@PathVariable String prefId) throws Exception {
|
|
return objectService.selectPrefAreaList(prefId);
|
|
}
|
|
|
|
@Operation(description = "물건정보 지역 기준풍속을 조회한다.")
|
|
@GetMapping("/windSpeed/{city}/list")
|
|
@ResponseStatus(HttpStatus.OK)
|
|
public List<WindSpeedResponse> selectWindSpeedList(@PathVariable String city) throws Exception {
|
|
return objectService.selectWindSpeedList(city);
|
|
}
|
|
|
|
@Operation(description = "판매점 목록을 조회한다.")
|
|
@GetMapping("/saleStore/{saleStoreId}/list")
|
|
@ResponseStatus(HttpStatus.OK)
|
|
public List<SaleStoreResponse> selectSaleStoreList(@PathVariable String saleStoreId)
|
|
throws Exception {
|
|
return objectService.selectSaleStoreList(saleStoreId);
|
|
}
|
|
|
|
@Operation(description = "물건정보 목록을 조회한다.11")
|
|
@GetMapping("/list")
|
|
@ResponseStatus(HttpStatus.OK)
|
|
public List<ObjectResponse> selectObjectList(ObjectRequest objectRequest) throws Exception {
|
|
return objectService.selectObjectList(objectRequest);
|
|
}
|
|
|
|
@Operation(description = "물건정보 상세를 조회한다.")
|
|
@GetMapping("/{objectNo}/detail")
|
|
@ResponseStatus(HttpStatus.OK)
|
|
public ObjectResponse selectObjectDetail(@PathVariable String objectNo) throws Exception {
|
|
return objectService.selectObjectDetail(objectNo);
|
|
}
|
|
|
|
@Operation(description = "물건정보을 저장한다.")
|
|
@PostMapping("/save-object")
|
|
@ResponseStatus(HttpStatus.CREATED)
|
|
public ObjectResponse insertObject(@RequestBody ObjectRequest objectRequest) throws Exception {
|
|
return objectService.insertObject(objectRequest);
|
|
}
|
|
|
|
@Operation(description = "물건정보을 수정한다.")
|
|
@PutMapping("/save-object")
|
|
@ResponseStatus(HttpStatus.CREATED)
|
|
public ObjectResponse updateObject(@RequestBody ObjectRequest objectRequest) throws Exception {
|
|
return objectService.updateObject(objectRequest);
|
|
}
|
|
|
|
@Operation(description = "물건정보을 삭제한다.")
|
|
@DeleteMapping("/{objectNo}")
|
|
@ResponseStatus(HttpStatus.NO_CONTENT)
|
|
public void deleteObject(@PathVariable String objectNo) throws Exception {
|
|
objectService.deleteObject(objectNo);
|
|
}
|
|
|
|
@Operation(description = "물건정보의 플랜정보를 추가한다.")
|
|
@PostMapping("/add-plan")
|
|
@ResponseStatus(HttpStatus.CREATED)
|
|
public void insertPlan(@RequestBody PlanRequest planRequest) throws Exception {
|
|
objectService.insertPlan(planRequest);
|
|
}
|
|
|
|
@Operation(description = "물건정보의 플랜정보를 삭제한다.")
|
|
@DeleteMapping("/plan/{objectNo}/{planNo}")
|
|
@ResponseStatus(HttpStatus.NO_CONTENT)
|
|
public void deletePlan(@PathVariable String objectNo, @PathVariable String planNo)
|
|
throws Exception {
|
|
PlanRequest planRequest = new PlanRequest();
|
|
planRequest.setObjectNo(objectNo);
|
|
planRequest.setPlanNo(planNo);
|
|
|
|
objectService.deletePlan(planRequest);
|
|
}
|
|
}
|