package com.skr.mdm.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skr.mdm.bean.qo.LargeScreenMessageQO;
import com.skr.mdm.bean.qo.controller.LargeScreenQO;
import com.skr.mdm.bean.vo.equipment.AppInstallVO;
import com.skr.mdm.bean.vo.statistics.AppInstallCountVO;
import com.skr.mdm.entity.AppInstallDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

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


/**
 * 应用安装表(AppInstall)表数据库访问层
 *
 * @author nfq
 * @since 2020-07-31 18:37:25
 */
@Repository
public interface AppInstallDao extends BaseMapper<AppInstallDO> {

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

    /**
     * 获取表数据量
     * @return 总数
     */
    Integer countAll();

    /**
     * 获取超出限制的数据ID
     * @param delCount 超出限制的数量
     * @return 超出限制的数据ID
     */
    List<Integer> listDelId(Integer delCount);

    /**
     * 批量插入
     * @param appInstallDOList
     * @return
     */
    int insertBatch(@Param("list") List<AppInstallDO> appInstallDOList);

	ArrayList<LargeScreenMessageQO> selectTop5ByBo(LargeScreenQO largeScreenQO);

    List<AppInstallVO> selectListByEquipmentId(@Param("deviceId") Integer deviceId);

    /**
     * 应用安装数统计
     * @param companyId
     * @param startTime
     * @param endTime
     * @param limit
     * @return
     */
	List<AppInstallCountVO> listAppInstallCount(@Param("companyId") Integer companyId, @Param("startTime") String startTime,
                                                @Param("endTime") String endTime, @Param("limit") Integer limit);

}