您的位置:首页 > 数据库

jpa使用原生sql

2016-12-12 10:28 344 查看
package com.boco.gaia.service.mockalarm.dao;import org.springframework.data.domain.Page;import org.springframework.data.domain.Pageable;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.data.jpa.repository.JpaSpecificationExecutor;import
org.springframework.data.jpa.repository.Query;import org.springframework.data.repository.query.Param;import com.boco.gaia.service.mockalarm.dao.entity.TfaAlarm;import com.boco.gaia.service.mockalarm.dao.entity.TfaAlarmActPK;/** * 告警表操作DAO类 * @author 许凯勋 *
@date 2016年12月9日 下午2:58:04 */ public interface TfaAlarmDao extends JpaRepository, JpaSpecificationExecutor { /** * 查询告警总数 * @author 许凯勋 * @date 2016年12月9日 下午2:50:18 * @param startTime 开始时间 * @param endTime 结束时间 * @return 告警总数 */ @Query("select count(fp0) from
TfaAlarm where event_time > to_date(:startTime, 'yyyy-mm-dd hh24:mi:ss') and event_time < to_date(:endTime, 'yyyy-mm-dd hh24:mi:ss')") public long getAlarmsCount(@Param("startTime")String startTime, @Param("endTime")String endTime); /** * 分页查询告警 * @author
许凯勋 * @date 2016年12月9日 下午2:56:29 * @param startTime 开始时间 * @param endTime 结束时间 * @param pageable 分页信息 * @return 分页查询结果 */ @Query("select alarm from TfaAlarm alarm where event_time > to_date(:startTime, 'yyyy-mm-dd hh24:mi:ss') and event_time < to_date(:endTime,
'yyyy-mm-dd hh24:mi:ss')") public Page getAlarmsPages(@Param("startTime")String startTime, @Param("endTime")String endTime, Pageable pageable);}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: