imeeting/backend/src/main/java/com/imeeting/mapper/biz/MeetingMapper.java

52 lines
1.8 KiB
Java

package com.imeeting.mapper.biz;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.imeeting.entity.biz.Meeting;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDateTime;
@Mapper
public interface MeetingMapper extends BaseMapper<Meeting> {
@InterceptorIgnore(tenantLine = "true")
@Select("SELECT * FROM biz_meetings WHERE id = #{id} AND is_deleted = 0")
Meeting selectByIdIgnoreTenant(@Param("id") Long id);
@InterceptorIgnore(tenantLine = "true")
@Select("""
<script>
SELECT COUNT(1)
FROM biz_meetings
WHERE tenant_id = #{tenantId}
AND source_device_code = #{deviceCode}
AND is_deleted = 0
<if test="resetAt != null">
AND created_at &gt;= #{resetAt}
</if>
</script>
""")
Long countByDeviceSince(@Param("tenantId") Long tenantId,
@Param("deviceCode") String deviceCode,
@Param("resetAt") LocalDateTime resetAt);
@InterceptorIgnore(tenantLine = "true")
@Select("""
<script>
SELECT COALESCE(SUM(COALESCE(effective_audio_duration_seconds, 0)), 0)
FROM biz_meetings
WHERE tenant_id = #{tenantId}
AND source_device_code = #{deviceCode}
AND is_deleted = 0
<if test="resetAt != null">
AND created_at &gt;= #{resetAt}
</if>
</script>
""")
Long sumMeetingDurationSecondsByDeviceSince(@Param("tenantId") Long tenantId,
@Param("deviceCode") String deviceCode,
@Param("resetAt") LocalDateTime resetAt);
}