package cn.iocoder.yudao.module.inspection.controller.app;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.inspection.service.InspectionStaffService;
import cn.iocoder.yudao.module.inspection.service.InspectionStepInfoService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.security.PermitAll;

@Tag(name = "小程序 - 检测")
@RestController
@RequestMapping("/inspection")
@RequiredArgsConstructor
public class AppInspectionController {

    private final InspectionStaffService inspectionStaffService;

    /**
     * 根据唯一码查询检测人员
     *
     * @param uniqueCode 唯一码
     * @return 检测人员
     */
    @RequestMapping("/getInspectionStaffByUniqueCode")
    @TenantIgnore
    @PermitAll
    public CommonResult<?> getInspectionStaffByUniqueCode(@RequestParam("uniqueCode") String uniqueCode) {
        return CommonResult.success(inspectionStaffService.getInspectionStaffByUniqueCode(uniqueCode));
    }

    /**
     * 根据唯一码查询业务
     *
     * @param uniqueCode 唯一码
     * @return 业务
     */
    @RequestMapping("/getBusinessByUniqueCode")
    @TenantIgnore
    public CommonResult<?> getBusinessByUniqueCode(@RequestParam("uniqueCode") String uniqueCode) {
        return CommonResult.success(inspectionStaffService.getBusinessByUniqueCode(uniqueCode));
    }
}
