package com.skr.mdm.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skr.mdm.bean.bo.ContentBO;
import com.skr.mdm.entity.ContentDocumentDO;
import com.skr.mdm.entity.ContentDocumentUserDO;
import com.skr.mdm.bean.qo.RoleOfPeopleQO;
import com.skr.mdm.bean.vo.content.ContentUserMessageInfoVO;
import com.skr.mdm.bean.vo.content.DeviceContentInfoVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;


/**
 * 文档作用人(ContentDocumentUser)表数据库访问层
 *
 * @author nfq
 * @since 2020-08-03 17:48:52
 */
@Repository
public interface ContentDocumentUserDao extends BaseMapper<ContentDocumentUserDO> {

	/**
	 * 根据设备ID删除
	 * @param equipmentIdList 设备ID集合
	 */
	void deleteByEquipmentIdList(@Param("equipmentIdList") List<Integer> equipmentIdList);
	List<Integer> selectAlreadyDeviceIds(@Param("contentId") Integer contentId, @Param("deviceIdList") List<Integer> deviceIdList, @Param("sendPushTime") String sendPushTime);

	void updateContentStatus(ContentBO contentBO);

	void insertContent(ContentBO contentBO);

	List<DeviceContentInfoVO> selectContentInfoList(@Param("equipmentId") Integer equipmentId);

	ArrayList<Integer> selectDeviceEquipmentIdList(@Param("contentId") Integer contentId);

	List<RoleOfPeopleQO> selectRoleOfPeopleQOById(@Param("fileId") Integer fileId);

	List<ContentUserMessageInfoVO> listStrategyUser(@Param("strategyId") Integer strategyId,
													@Param("searchType") Integer searchType,
													@Param("searchValue") String searchValue);

	void insertContentList(ContentDocumentDO contentDocumentDO);

	List<Integer> selectIsGlobalEquipmentIdList(@Param("deviceId") Integer deviceId, @Param("companyId") Integer companyId);

	List<String> selectSendPushTimeList(@Param("contentId") Integer contentId);

	/**
	 * 获取文档作用人设备ID
	 * @param list
	 * @return
	 */
	List<Integer> listEquipmentIdByStrategyIds(@Param("list") List<Integer> list);

	void insertBatch(@Param("list") List<ContentDocumentUserDO> list);
}