package com.community.huiju.dao;

import com.community.huiju.model.TpMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface TpMessageMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(TpMessage record);

    int insertSelective(TpMessage record);

    TpMessage selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TpMessage record);

    int updateByPrimaryKey(TpMessage record);
    
    Map<String, Object> getMessageTotal(@Param(value = "userId") Integer userId,@Param(value = "communityId") Integer communityId);
    
    List<TpMessage> getMessages(@Param(value = "userId") Integer userId,@Param(value = "communityId") Integer communityId, @Param(value = "modelType") Integer modelType);

    void updateReadStatus(@Param(value = "communityId")Integer communityId, @Param(value = "userId")Integer userId);

    /**
     * 查询工单消息
     *
     *  根据 工单ID,模板类型, 消息类型 进行查询
     *
     * @param tpMessage
     * @return
     */
    TpMessage selectTicketMessage(TpMessage tpMessage);

    /**
     * 维护物业端消息推送
     */
    void updateTickMessage(@Param("message") TpMessage message);

    /**
     * 查询工单id是否为空
     */
    Integer selectTicket(@Param(value = "communityId") Integer ticketId);

    /**
     * 根据条件查询消息
     * @param map
     * @return
     */
    TpMessage selectConditionsTpMessage(@Param("map")Map<String, Object> map);

    /**
     * 根据条件查询 消息代办
     * @param map
     * @return
     */
    TpMessage selectBillinvoiceMessage(@Param("map") Map<String, Object> map);
}