package org.jeecg.modules.checkData.dynamicStaticGeometricData.controller;


import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspectionEquipmentItem;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspectionEquipmentItemDetailVO;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspectionEquipmentItemVO;
import org.jeecg.modules.checkData.dynamicStaticGeometricData.service.IRailInspectionEquipmentItemService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 检查数据-动静态几何尺寸数据-轨检仪静态检查数据-检查项目 前端控制器
 * </p>
 *
 * @author hkl
 * @since 2023-07-16
 */
@RestController
@RequestMapping("/checkData/dynamicStaticGeometricData/railInspectionEquipmentItem")
@ApiOperation("检查数据-动静态几何尺寸数据-轨检仪静态检查数据-检查项目")
public class RailInspectionEquipmentItemController extends JeecgController<RailInspectionEquipmentItem, IRailInspectionEquipmentItemService> {

    @AutoLog(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目列表查询")
    @ApiOperation(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目列表查询", notes = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目列表查询")
    @GetMapping(value = "/list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "轨检仪静态检查数据id")
    })
    public Result<List<RailInspectionEquipmentItemVO>> queryList(String id) {
        List<RailInspectionEquipmentItemVO> record = this.service.queryList(id);
        return Result.OK(record);
    }

    @AutoLog(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目明细列表")
    @ApiOperation(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目明细列表", notes = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目明细列表")
    @GetMapping(value = "/detailList")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "itemId", value = "轨检仪静态检查项目id")
    })
    public Result<List<RailInspectionEquipmentItemDetailVO>> detailList(String itemId) {
        List<RailInspectionEquipmentItemDetailVO> record = this.service.detailList(itemId);
        return Result.OK(record);
    }


    @PostMapping(value = "/upload")
    @AutoLog(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-导入")
    @ApiOperation(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-导入", notes = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-导入")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "轨检仪静态检查数据id"),
            @ApiImplicitParam(name = "file", value = "文件"),
    })
    public Result<String> uploadFile(String id, MultipartFile file) {

        this.service.uploadFile(id, file);

        return Result.ok("操作成功");
    }

}
