60 lines
3.3 KiB
Java
60 lines
3.3 KiB
Java
package com.xiaowang.messagehub.mapper;
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.xiaowang.messagehub.entity.PushLog;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import org.apache.ibatis.annotations.Update;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface PushLogMapper extends BaseMapper<PushLog> {
|
|
|
|
@Select("SELECT * FROM push_log WHERE source_system = #{sourceSystem} ORDER BY create_time DESC LIMIT #{limit}")
|
|
List<PushLog> selectBySourceSystemWithLimit(@Param("sourceSystem") String sourceSystem, @Param("limit") int limit);
|
|
|
|
@Select("SELECT * FROM push_log WHERE receiver = #{receiver} ORDER BY create_time DESC LIMIT #{limit}")
|
|
List<PushLog> selectByReceiverWithLimit(@Param("receiver") String receiver, @Param("limit") int limit);
|
|
|
|
@Select("SELECT * FROM push_log WHERE channel_type = #{channelType} ORDER BY create_time DESC LIMIT #{limit}")
|
|
List<PushLog> selectByChannelTypeWithLimit(@Param("channelType") String channelType, @Param("limit") int limit);
|
|
|
|
@Select("SELECT * FROM push_log WHERE status = #{status} ORDER BY create_time DESC LIMIT #{limit}")
|
|
List<PushLog> selectByStatusWithLimit(@Param("status") Integer status, @Param("limit") int limit);
|
|
|
|
@Select("SELECT * FROM push_log WHERE source_system = #{sourceSystem} AND status = #{status} ORDER BY create_time DESC")
|
|
List<PushLog> selectBySourceSystemAndStatus(@Param("sourceSystem") String sourceSystem, @Param("status") Integer status);
|
|
|
|
@Select("SELECT * FROM push_log WHERE unique_id = #{uniqueId}")
|
|
PushLog selectByUniqueId(@Param("uniqueId") String uniqueId);
|
|
|
|
@Update("UPDATE push_log SET status = #{status}, retry_count = retry_count + 1, fail_reason = #{failReason} WHERE id = #{id}")
|
|
int updateRetryStatus(@Param("id") String id, @Param("status") Integer status, @Param("failReason") String failReason);
|
|
|
|
@Update("UPDATE push_log SET send_time = #{sendTime} WHERE id = #{id}")
|
|
int updateSendTime(@Param("id") String id, @Param("sendTime") LocalDateTime sendTime);
|
|
|
|
@Select("SELECT COUNT(*) FROM push_log WHERE source_system = #{sourceSystem}")
|
|
long countBySourceSystem(@Param("sourceSystem") String sourceSystem);
|
|
|
|
@Select("SELECT COUNT(*) FROM push_log WHERE status = #{status}")
|
|
long countByStatus(@Param("status") Integer status);
|
|
|
|
@Select("SELECT * FROM push_log ORDER BY create_time DESC")
|
|
IPage<PushLog> selectPage(Page<PushLog> page);
|
|
|
|
@Select("SELECT * FROM push_log WHERE source_system = #{sourceSystem} ORDER BY create_time DESC")
|
|
IPage<PushLog> selectPageBySourceSystem(Page<PushLog> page, @Param("sourceSystem") String sourceSystem);
|
|
|
|
@Select("SELECT * FROM push_log WHERE create_time >= #{startTime} AND create_time <= #{endTime} ORDER BY create_time DESC")
|
|
List<PushLog> selectByTimeRange(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
|
|
|
|
@Select("SELECT * FROM push_log WHERE final_content LIKE CONCAT('%', #{keyword}, '%') ORDER BY create_time DESC LIMIT #{limit}")
|
|
List<PushLog> searchByContent(@Param("keyword") String keyword, @Param("limit") int limit);
|
|
}
|