package cn.iocoder.yudao.module.system.controller.admin.extra;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.controller.admin.extra.vo.ElderlyAbilityEvaluationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.extra.vo.ElderlyAbilityEvaluationRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.extra.ElderlyExtraElderlyAbilityEvaluationDO;
import cn.iocoder.yudao.module.system.service.extra.ElderlyExtraElderlyAbilityEvaluationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 老年人能力综合评估结果")
@RestController @RequestMapping("/elderly/extra/elderlyAbilityEvaluation") @Validated
public class ElderlyExtraElderlyAbilityEvaluationController {
    @Resource private ElderlyExtraElderlyAbilityEvaluationService service;
    @PostMapping("/create") @Operation(summary = "创建老年人能力综合评估结果") public CommonResult<Long> create(@Valid @RequestBody ElderlyExtraElderlyAbilityEvaluationDO r) { return success(service.create(r)); }
    @PostMapping("/update") @Operation(summary = "编辑老年人能力综合评估结果") public CommonResult<Boolean> update(@Valid @RequestBody ElderlyExtraElderlyAbilityEvaluationDO r) { service.update(r); return success(true); }
    @DeleteMapping("/delete") @Operation(summary = "删除老年人能力综合评估结果") @Parameter(name = "id", required = true) public CommonResult<Boolean> delete(@RequestParam("id") Long id) { service.delete(id); return success(true); }
    @GetMapping("/findPage") @Operation(summary = "老年人能力综合评估结果分页列表") public CommonResult<PageResult<ElderlyAbilityEvaluationRespVO>> findPage(@Valid ElderlyAbilityEvaluationPageReqVO r) { return success(BeanUtils.toBean(service.findPage(r), ElderlyAbilityEvaluationRespVO.class)); }
    @GetMapping("/getListByElderId") @Operation(summary = "根据长者ID获取老年人能力综合评估结果列表") @Parameter(name = "elderId", required = true) public CommonResult<List<ElderlyExtraElderlyAbilityEvaluationDO>> getListByElderId(@RequestParam("elderId") Long elderId) { return success(service.getListByElderId(elderId)); }
    @GetMapping("/getDetail") @Operation(summary = "获取老年人能力综合评估结果详情") @Parameter(name = "id", required = true) public CommonResult<ElderlyExtraElderlyAbilityEvaluationDO> getDetail(@RequestParam("id") Long id) { return success(service.getDetail(id)); }
}
