sensoritem paging sorting

This commit is contained in:
insanity 2017-08-28 16:07:27 +09:00
parent 55d1b7ec4f
commit 52f553a9b9
2 changed files with 4 additions and 4 deletions

View File

@ -2,16 +2,15 @@ package com.loafle.overflow.module.sensor.dao;
import com.loafle.overflow.module.sensor.model.Sensor; import com.loafle.overflow.module.sensor.model.Sensor;
import com.loafle.overflow.module.sensor.model.SensorItem; import com.loafle.overflow.module.sensor.model.SensorItem;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* Created by root on 17. 6. 9. * Created by root on 17. 6. 9.
*/ */
@Repository @Repository
public interface SensorItemDAO extends JpaRepository<SensorItem, Long> { public interface SensorItemDAO extends JpaRepository<SensorItem, Long> {
List<SensorItem> findAllBySensor(Sensor sensor, Pageable pageable); Page<SensorItem> findAllBySensor(Sensor sensor, Pageable pageable);
} }

View File

@ -6,6 +6,7 @@ import com.loafle.overflow.module.sensor.dao.SensorItemDAO;
import com.loafle.overflow.module.sensor.model.Sensor; import com.loafle.overflow.module.sensor.model.Sensor;
import com.loafle.overflow.module.sensor.model.SensorItem; import com.loafle.overflow.module.sensor.model.SensorItem;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -31,7 +32,7 @@ public class SensorItemService {
return this.sensorItemDAO.findOne(Long.valueOf(id)); return this.sensorItemDAO.findOne(Long.valueOf(id));
} }
public List<SensorItem> readAllBySensor(Sensor sensor, PageParams pageParams) { public Page<SensorItem> readAllBySensor(Sensor sensor, PageParams pageParams) {
return this.sensorItemDAO.findAllBySensor(sensor, PageUtil.getPageRequest(pageParams)); return this.sensorItemDAO.findAllBySensor(sensor, PageUtil.getPageRequest(pageParams));
} }