package com.securitycontrol.background.mapper;

import com.securitycontrol.entity.background.dto.ParamDto;
import com.securitycontrol.entity.background.vo.HumanManageVo;
import com.securitycontrol.entity.background.vo.TeamManageVo;
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;

/**
 * 班组数据库访问层
 *
 * @author 10488
 */
@Repository(value = "TeamManageMapper")
public interface TeamManageMapper {


    /**
     * DD
     *
     * @param vo
     * @return
     */
    int addTeam(TeamManageVo vo);

    /**
     * sssd
     *
     * @param vo
     * @return
     */
    int updateTeam(TeamManageVo vo);

    /**
     * 获取班组列表
     *
     * @param dto
     * @return List<TeamManageVo>
     * @description
     * @author cwchen
     * @date 2024/3/21 9:45
     */
    List<TeamManageVo> getTeamLists(ParamDto dto);

    /**
     * 新增/修改班组
     *
     * @param vo
     * @description
     * @author cwchen
     * @date 2024/3/21 10:21
     */
    void addOrUpdateTeam(TeamManageVo vo);

    /**
     * 班组是否存在
     *
     * @param vo
     * @return List<Map < String, String>>
     * @description
     * @author cwchen
     * @date 2024/3/21 10:24
     */
    @MapKey("id")
    List<Map<String, String>> isTeamExist(TeamManageVo vo);

    /**
     * 班组详情
     *
     * @param dto
     * @return TeamManageVo
     * @description
     * @author cwchen
     * @date 2024/3/21 10:42
     */
    TeamManageVo getTeamDetailById(ParamDto dto);

    /**
     * 删除班组
     *
     * @param dto
     * @description
     * @author cwchen
     * @date 2024/3/21 10:47
     */
    void delTeam(ParamDto dto);

    /**
     * 班组是否存在班组人员
     *
     * @param dto
     * @return int
     * @description
     * @author cwchen
     * @date 2024/3/21 10:48
     */
    int isPeopleByTeam(ParamDto dto);

    /**
     * 班组人员数量
     *
     * @param teamId
     * @return int
     * @description
     * @author cwchen
     * @date 2024/3/22 9:59
     */
    int getTeamUserNum(String teamId);

    /**
     * 获取班组人员列表
     *
     * @param dto
     * @return List<HumanManageVo>
     * @description
     * @author cwchen
     * @date 2024/3/22 10:04
     */
    List<HumanManageVo> getTeamUserLists(ParamDto dto);

    /**
     * 移出班组人员
     *
     * @param dto
     * @description
     * @author cwchen
     * @date 2024/3/22 10:13
     */
    void removeTeamUser(ParamDto dto);

    /**
     * 获取班组组员和未加入班组人员
     *
     * @param dto
     * @return List<Map < String>>
     * @description
     * @author cwchen
     * @date 2024/3/22 10:35
     */
    @MapKey("id")
    List<Map<String, String>> getTeamUserAndNoBandingUser(ParamDto dto);

    /**
     * 添加班组人员
     * @param userId
     * @param teamId
     * @param type
     * @description
     * @author cwchen
     * @date 2024/3/22 10:52
     */
    void addTeamUser(@Param("userId") String userId, @Param("teamId") String teamId, @Param("type") int type);
}
