package com.docus.server.controller;

import com.docus.infrastructure.web.request.SearchDTO;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.api.segmentation.OcrBasicApi;
import com.docus.server.dto.segmentation.ocrbasic.AddOcrBasicDTO;
import com.docus.server.dto.segmentation.ocrbasic.DeleteOcrBasicDTO;
import com.docus.server.dto.segmentation.ocrbasic.EditOcrBasicDTO;
import com.docus.server.service.IOcrBasicService;
import com.docus.server.vo.segmentation.ocrbasic.OcrBasicVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 患者信息表 控制器类
 *
 * @author AutoGenerator
 * @since 2023-08-29
 */
@Api(value = "患者信息表", tags = "患者信息表")
@RestController
public class OcrBasicController implements OcrBasicApi {
    @Resource
    private IOcrBasicService iOcrBasicService;

    /**
     * 按主键查询
     *
     * @param id 主键Id
     * @return 实体
     */
    @ApiOperation("按主键查询")
    @Override
    public OcrBasicVO findById(Long id) {
        return iOcrBasicService.findById(id);
    }

    /**
     * 查询所有
     *
     * @return 实体
     */
    @ApiOperation("查询所有")
    @Override
    public List<OcrBasicVO> findAll() {
        return iOcrBasicService.findAll();
    }

    /**
     * 关键字搜索
     *
     * @param searchDTO 搜索参数
     * @return 分页列表
     */
    @ApiOperation("关键字搜索")
    @Override
    public PageResult<OcrBasicVO> search(SearchDTO searchDTO) {
        return iOcrBasicService.search(searchDTO);
    }

    /**
     * 新增
     *
     * @param addOcrBasicDTO 编辑参数
     */
    @ApiOperation("新增")
    @Override
    public void add(AddOcrBasicDTO addOcrBasicDTO) {
        iOcrBasicService.add(addOcrBasicDTO);
    }

    /**
     * 编辑
     *
     * @param editOcrBasicDTO 编辑参数
     */
    @ApiOperation("编辑")
    @Override
    public void edit(EditOcrBasicDTO editOcrBasicDTO) {
        iOcrBasicService.edit(editOcrBasicDTO);
    }

    /**
     * 批量删除
     *
     * @param deleteOcrBasicDTO 删除参数
     * @return 成功或失败
     */
    @ApiOperation("批量删除")
    @Override
    public int delete(DeleteOcrBasicDTO deleteOcrBasicDTO) {
        return iOcrBasicService.delete(deleteOcrBasicDTO);
    }
}
