package com.talentcard.server.business.admin;
|
|
import java.time.LocalDate;
|
import java.util.Map;
|
|
import com.talentcard.server.business.PageResult;
|
import com.talentcard.server.common.ApiResponse;
|
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PatchMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
@RestController
|
@RequestMapping("/api/admin/cards/child-applications")
|
public class ChildInformationAdminController {
|
|
private final ChildInformationAdminService service;
|
|
public ChildInformationAdminController(ChildInformationAdminService service) {
|
this.service = service;
|
}
|
|
@GetMapping
|
public ApiResponse<PageResult<Map<String, Object>>> page(
|
@RequestParam(required = false) String childKeyword,
|
@RequestParam(required = false) String talentKeyword,
|
@RequestParam(required = false) String cardLevel,
|
@RequestParam(required = false) String status,
|
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate applyStart,
|
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate applyEnd,
|
@RequestParam(defaultValue = "1") int page,
|
@RequestParam(defaultValue = "10") int size
|
) {
|
return ApiResponse.success(service.page(
|
childKeyword,
|
talentKeyword,
|
cardLevel,
|
status,
|
applyStart,
|
applyEnd,
|
page,
|
size
|
));
|
}
|
|
@GetMapping("/{id}")
|
public ApiResponse<Map<String, Object>> detail(@PathVariable Long id) {
|
return ApiResponse.success(service.detail(id));
|
}
|
|
@PatchMapping("/{id}/audit")
|
public ApiResponse<Map<String, Object>> audit(
|
@PathVariable Long id,
|
@RequestBody Map<String, String> body
|
) {
|
return ApiResponse.success(service.audit(id, body.get("status"), body.get("auditRemark")));
|
}
|
}
|