package com.palmnest.dao.lingling;

import com.palmnest.application.bean.Page;
import com.palmnest.application.dto.LingLingUserGroupDto;
import com.palmnest.dao.GenericDao;
import com.palmnest.model.estateserve.VisitorOrder;
import com.palmnest.model.lingling.*;

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

/**
 * Created by hxt on 2018/12/7.
 */
public interface LingLingDao extends GenericDao<Object, Long> {

	public LingLingDevice getByDeviceId(Integer deviceId,Integer orgId);

	public Page getDeviceList(Map<String, String> paramMap);

	public void deleteByGroupId(Long groupId);

	public Page getDeviceGroupList(Map<String, String> paramMap);

	public List<LingLingDevice> getDeviceList(Integer isEnable, Integer orgId);

	public LingLingDevice getById(Long id);

	public DevicePermGroup getDeviceGroupById(Long id);

	public void deleteUserGroupByGroupId(Long groupId);

	public List<DevicePermGroup> getDevicePermGroupByOrgId(Integer orgId, Integer groupType);

	public int deleteUserGroupByUserIds(String userIds);

	public LingLingCard getCardByCardId(String cardUid);

	Page getPassHistory(Map<String, String> params);

	public List<LingLingDevice> getDevicesByGroup(Long groupId, Integer isEnable);

	VisitorMachine getVisitorMachine(Long machineId);

	VisitorMachine getVisitorMachineByOrgId(Integer orgId);
	VisitorMachine getVisitorMachineByDeviceCode(String deviceCode);

	LingLingVisitorInfo getVisitorInfoByTelephone(String telephone);

	LingLingVisitorInfo getVisitorInfoByIdenNumber(String idenNumber);

	VisitorOrder getMachineVisitorInfo(String codeId);
	
	VisitorOrder getMachineVisitorByQr(String qrcodeKey);

	List<Integer> getUserIdsByGroupId(Long groupId);

	void deleteUserGroup(Integer userId, Long groupId);

	void saveUserGroup(Integer id, String groupId);

	DevicePermGroup getByUserInfo(Integer orgId);
	
	public LingLingDevice getByDeviceCode(String deviceCode);
	
	public String getDeviceIdsByMethedType(int methedType,Integer userId);
	
	
	List<Integer> getGroupIds(String userIds);
	
	int getGroupIdsByGroupAndUser(Integer userId,Integer groupId);
	
	LingLingDeveloper findByOrgId(Integer orgId);
	
	List<Integer> findOrgIds();
	
//	public LingLingDevice getByDeviceId(Integer deviceId,Integer orgId);
	
	String getDeviceIdsByGroupId(Integer groupId);
	
	String getSdkkeyByGroupId(Long groupId);
	
	String getLinglingIdsByGroupId(Long groupId);
	
	/**
	 * tr_perm_group_user 表的数据
	 * @param userId
	 * @return
	 */
	Map<String, Object> getUserGroupInfo(Integer userId);
	
	String getDeviceNamesByGroupId(String groupId);
	
	String getDeviceIdsByUserId(Integer userId);
	
	void saveCardAndUser(Integer userId,Long cardId);
	
//	String getUserIdsByGroupId(String groupId);
	
	List<Map<String, Object>> getGroupUser(String groupId);
	
	Map<String,Object> getUserCardInfo(Long cardId);
	
	DevicePermGroup getGroupByUserId(Integer userId);
	
	LingLingCard getCardByUserId(Integer userId);
	
	void delCardAndUser(Long cardId);

	void savePermGroupDevice(Long devicePermGroupId, Long deviceId);
	
	int updatePermGroupUser(Long groupId,String userIds,int type);
	
//	void saveUserGroupList(String lingLingIds, String groupId);
	
	List<Integer> getUserIdByLingLingIds(String linglingIds);
	
	List<Map<String, Object>> getExPassHistory(Map<String, String> params);
	/**
	 * 获取日报表
	 * @param params
	 * @return
	 */
	List<Map<String, Object>> getPassDate(Map<String, Object> params);
	
	/**
	 * 获取月报表
	 * @param params
	 * @return
	 */
	List<Map<String, Object>> getPassMonth(Map<String, Object> params);
	
	List<Map<String, Object>> getCardByUserIds(String userIds);

}
