package com.bonus.app.controller;

import com.bonus.app.service.IAppSafetyHatService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.entity.app.AppParamsDto;
import com.bonus.common.entity.app.vo.SafetyHatDataVo;
import com.bonus.common.entity.app.vo.SafetyHatVo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @className:AppSafetyHatController
 * @author:cwchen
 * @date:2024-08-07-15:37
 * @version:1.0
 * @description:APP-智能安全帽
 */
@RestController
@RequestMapping("/appSafetyHat/")
@Slf4j
public class AppSafetyHatController extends BaseController {

    @Resource(name = "IAppSafetyHatService")
    private IAppSafetyHatService service;

    //    @RequiresPermissions("app:safetyHat:list")
    @GetMapping("list")
    @SysLog(title = "智能安全帽", businessType = OperaType.QUERY,logType = 0,module = "智能安全帽->设备列表",details ="查询智能安全帽列表")
    public TableDataInfo list(AppParamsDto dto) {
        startPage();
        List<SafetyHatVo> list = service.getSafetyHatLists(dto);
        return getDataTable(list);
    }

    //    @RequiresPermissions("app:safetyHat:distributionHelmet")
    @PostMapping("distributionHelmet")
    @SysLog(title = "智能安全帽", businessType = OperaType.UPDATE,logType = 0,module = "智能安全帽->分配设备",details ="分配设备")
    public AjaxResult distributionHelmet(@RequestBody SafetyHatDataVo vo){
        return service.distributionHelmet(vo);
    }

    //    @RequiresPermissions("app:safetyHat:returnHelmet")
    @PostMapping("returnHelmet")
    @SysLog(title = "智能安全帽", businessType = OperaType.UPDATE,logType = 0,module = "智能安全帽->分配设备",details ="归还设备")
    public AjaxResult returnHelmet(@RequestBody AppParamsDto vo){
        return service.returnHelmet(vo);
    }

}
