package com.bonus.bracelet.mapper;

import com.bonus.common.entity.bracelet.BraceletParamsDto;
import com.bonus.common.entity.bracelet.vo.TeamPeopleVo;
import com.bonus.common.entity.bracelet.vo.TeamVo;
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:TeamMgeMapper
 * @author:cwchen
 * @date:2024-07-16-10:38
 * @version:1.0
 * @description:班组管理-Mapper
 */
@Repository(value = "TeamMgeMapper")
public interface TeamMgeMapper {

    /**
     * 班组列表
     *
     * @param dto
     * @return List<TeamVo>
     * @author cwchen
     * @date 2024/7/17 13:51
     */
    List<TeamVo> getTeamLists(BraceletParamsDto dto);

    /**
     * 获取班组在施和未施人数
     *
     * @param teamId
     * @return List<Integer>
     * @author cwchen
     * @date 2024/7/17 14:04
     */
    List<Integer> getWorkNum(Long teamId);

    /**
     * 判断班组名称是否存在
     *
     * @param vo
     * @return int
     * @author cwchen
     * @date 2024/7/17 14:41
     */
    int isExist(TeamVo vo);

    /**
     * 添加班组
     *
     * @param vo
     * @return void
     * @author cwchen
     * @date 2024/7/17 14:44
     */
    void addTeam(TeamVo vo);

    /**
     * 修改班组
     *
     * @param vo
     * @return void
     * @author cwchen
     * @date 2024/7/17 14:56
     */
    void updateTeam(TeamVo vo);

    /**
     * 解散班组
     *
     * @param dto
     * @return void
     * @author cwchen
     * @date 2024/7/17 15:06
     */
    void dissolutionTeam(BraceletParamsDto dto);

    /**
     * 班组是否存在人员
     *
     * @param dto
     * @return int
     * @author cwchen
     * @date 2024/7/17 15:48
     */
    int isExistPerson(BraceletParamsDto dto);

    /**
     * 删除班组
     *
     * @param dto
     * @return void
     * @author cwchen
     * @date 2024/7/17 15:49
     */
    void delTeam(BraceletParamsDto dto);

    /**
     * 查询人员列表
     *
     * @param dto
     * @return List<Map < String, Object>>
     * @author cwchen
     * @date 2024/7/17 16:12
     */
    @MapKey("id")
    List<Map<String, Object>> getPersonList(BraceletParamsDto dto);

    /**
     * 班组详情
     *
     * @param dto
     * @return TeamVo
     * @author cwchen
     * @date 2024/7/17 16:37
     */
    TeamVo getTeamInfo(BraceletParamsDto dto);

    /**
     * 班组分配人员
     *
     * @param userIdArr
     * @param teamId
     * @return void
     * @author cwchen
     * @date 2024/7/17 16:54
     */
    void updatePersonsByTeam(@Param("list") Long[] userIdArr, @Param("teamId") Long teamId);

    /**
     * 清空班组已分配的班组人员
     *
     * @param vo
     * @return void
     * @author cwchen
     * @date 2024/7/17 17:01
     */
    void updatePersonsByTeamId(TeamVo vo);

    /**
     * 班组在施和未施人员
     * @param dto
     * @return List<TeamPeopleVo>
     * @author cwchen
     * @date 2024/7/17 18:37
     */
    List<TeamPeopleVo> getWorkPersonList(BraceletParamsDto dto);

    int existworkPerson(BraceletParamsDto dto);
}
