package com.om.controller.admin;


import com.om.entity.dto.DiaMenuQueryPageDTO;
import com.om.entity.dto.DiagnosticMenuDTO;
import com.om.entity.vo.DiaMenuQueryPageVO;
import com.om.entity.vo.DiaMenuUploadVO;
import com.om.service.IDiagnosticMenuService;
import com.om.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bmmx
 * @since 2024-03-05
 */
@RestController
@Api(tags = "诊断菜单相关接口")
@RequestMapping("/web/diagnostic-menu")
public class DiagnosticMenuController {

    @Resource
    private IDiagnosticMenuService diagnosticMenuService;

    @PostMapping("create")
    @ApiOperation("新增诊断菜单")
    public Result createDiaMenu(@RequestBody DiagnosticMenuDTO dto){
        return diagnosticMenuService.createDiaMenu(dto);
    }

    @PostMapping("upload")
    @ApiOperation("上传诊断菜单文件")
    public Result<DiaMenuUploadVO> uploadDiaMenu(MultipartFile file){
        return diagnosticMenuService.uploadDiaMenu(file);
    }

    @GetMapping("delete")
    @ApiOperation("根据id删除诊断菜单文件")
    public Result deleteDiaMenu(@RequestParam Integer id){
        return diagnosticMenuService.deleteDiaMenu(id);
    }

    @GetMapping("updateStatus")
    @ApiOperation("修改诊断菜单")
    public Result updateStatus(@RequestParam("id") Integer id,@RequestParam("status") Integer status){
        return diagnosticMenuService.updateStatus(id,status);
    }

    @PostMapping("getPageList")
    @ApiOperation("分页查询诊断菜单列表")
    public Result<DiaMenuQueryPageVO> getPageList(@RequestBody DiaMenuQueryPageDTO dto){
        return diagnosticMenuService.getPageList(dto);
    }


}
