package com.djhk.uav.uav.controller;

import com.djhk.common.annotation.Log;
import com.djhk.common.core.controller.BaseController;
import com.djhk.common.core.domain.R;
import com.djhk.common.enums.BusinessType;
import com.djhk.common.utils.StringUtils;
import com.djhk.uav.uav.model.UavRepairSub;
import com.djhk.uav.uav.service.IUavRepairSubService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description 维护记录管理
 * @author mayongkai
 * @date 2023/3/11 19:16:58
 * @version 1.0
 */
@RestController
@RequestMapping("/repair/sub")
public class UavRepairSubController extends BaseController
{
    @Autowired
    private IUavRepairSubService uavRepairSubService;

    /**
     * 查询列表
     */
//    @RequiresPermissions("uav:info:list")
//    @GetMapping("/list")
//    public TableDataInfo list(@RequestParam Map<String, Object> param)
//    {
//        return uavRepairSubService.selectUavRepairSubList(param);
//    }

    /**
     * 新增
     */
//    @RequiresPermissions("uav:Repair:add")
    @Log(title = "维护记录信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public R add(@RequestBody UavRepairSub uavRepairSub)
    {
        if(StringUtils.isEmpty(uavRepairSub.getUavNum())){
            return R.fail("无人机编号不能为空");
        }
        return uavRepairSubService.insertUavRepairSub(uavRepairSub);
    }

}
