package com.bonus.app.mapper;

import com.bonus.common.entity.app.AppParamsDto;
import com.bonus.common.entity.bracelet.BraceletParamsDto;
import com.bonus.common.entity.bracelet.vo.EquipmentReqDataVo;
import com.bonus.common.entity.bracelet.vo.EquipmentReqVo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @className:AppEquipmentReqMapper
 * @author:cwchen
 * @date:2024-08-06-15:52
 * @version:1.0
 * @description:APP-设备领用
 */
@Repository(value = "AppEquipmentReqMapper")
public interface AppEquipmentReqMapper {
    /**
     * 设备领用列表-项目部角色
     * @param dto
     * @return List<EquipmentReqVo>
     * @author cwchen
     * @date 2024/8/6 16:10
     */
    List<EquipmentReqVo> getEquipmentReqLists(AppParamsDto dto);

    /**
     * 添加设备领用数据
     *
     * @param vo
     * @return void
     * @author cwchen
     * @date 2024/8/5 16:26
     */
    void addDevUseData(EquipmentReqDataVo vo);

    /**
     * 添加设备领用详情数据
     *
     * @param vo
     * @return void
     * @author cwchen
     * @date 2024/8/5 16:34
     */
    void addDevUseDetailData(EquipmentReqDataVo vo);

    /**
     * 更新手环箱状态
     *
     * @param vo
     * @param equipment
     * @return void
     * @author cwchen
     * @date 2024/8/5 17:02
     */
    void updateDeviceData(@Param("vo") EquipmentReqDataVo vo, @Param("equipment") EquipmentReqDataVo.Equipment equipment, @Param("type")int type);

    /**
     * 判断设备是否已经归还
     *
     * @param equipment
     * @return Integer
     * @author cwchen
     * @date 2024/8/5 17:28
     */
    Integer isHasUseDevice(EquipmentReqDataVo.Equipment equipment);

    /**
     * 获取未领用的设备
     * @param dto
     * @return List<Map<String,Object>>
     * @author cwchen
     * @date 2024/8/5 18:08
     */
    @MapKey("devId")
    List<Map<String, Object>> getUseDevices(AppParamsDto dto);

    /**
     * 更新手环箱/设备状态
     * @param dto
     * @return void
     * @author cwchen
     * @date 2024/8/6 9:16
     */
    void updateReturnDeviceData(@Param("params") AppParamsDto dto,@Param("type") int type);

    /**
     * 更新设备归还状态
     * @param dto
     * @return void
     * @author cwchen
     * @date 2024/8/6 9:19
     */
    void returnDevice(AppParamsDto dto);

    /**
     * 判断设备是否全部归还
     * @param dto
     * @return int
     * @author cwchen
     * @date 2024/8/6 11:10
     */
    int isAllDeviceReturn(@Param("params") AppParamsDto dto,@Param("type") int type);

    /**
     * 获取绑定班组的班组长
     * @param vo
     * @return Long
     * @author cwchen
     * @date 2024/8/7 14:53
     */
    Long getTeamLeader(EquipmentReqDataVo vo);
}
