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.AjaxResult;
import com.djhk.common.core.page.TableDataInfo;
import com.djhk.common.enums.BusinessType;
import com.djhk.system.service.ISysUserService;
import com.djhk.uav.uav.model.UavOperatorProfession;
import com.djhk.uav.uav.service.IUavOperatorProfessionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 专业情况 Controller
 *
 * @author jiachengshuai
 * @date 2022-08-30
 */
@RestController
@RequestMapping("/profession")
public class UavOperatorProfessionController extends BaseController
{
    @Autowired
    private IUavOperatorProfessionService uavOperatorProfessionService;
//    @Autowired
//    private RemoteUserService userService;
    @Autowired
    private ISysUserService userService;
    /**
     * 查询专业情况列表
     */
    @GetMapping("/list")
    public TableDataInfo list(UavOperatorProfession uavOperatorProfession)
    {
        startPage();
        List<UavOperatorProfession> list = uavOperatorProfessionService.selectUavOperatorList(uavOperatorProfession);
        return getDataTable(list);
    }

    /**
     * 获取专业情况详细信息
     */
//    @RequiresPermissions("uav:operator:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(uavOperatorProfessionService.selectUavOperatorById(id));
    }

    /**
     * 新增专业情况
     */
//    @RequiresPermissions("uav:operator:add")
    @Log(title = "专业情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UavOperatorProfession uavOperatorProfession)
    {

        return AjaxResult.success(uavOperatorProfessionService.insertUavOperator(uavOperatorProfession));
    }

    /**
     * 修改专业情况
     */
//    @RequiresPermissions("uav:operator:edit")
    @Log(title = "专业情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UavOperatorProfession uavOperatorProfession)
    {
        return AjaxResult.success(uavOperatorProfessionService.updateUavOperator(uavOperatorProfession));
    }

    /**
     * 删除专业情况
     */
//    @RequiresPermissions("uav:operator:remove")
    @Log(title = "专业情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(uavOperatorProfessionService.deleteUavOperatorByIds(ids));
    }
}
