3 changed files with 69 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||
package com.xtong.zhbs.service; |
|||
|
|||
import com.xtong.zhbs.bean.PassengerFlow; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 客流服务接口 |
|||
*/ |
|||
public interface PassengerFlowService { |
|||
/** |
|||
* 分页查询客流列表 |
|||
* @param page |
|||
* @param pagesize |
|||
* @return |
|||
*/ |
|||
List<PassengerFlow> getPassengerFlowList(int page, int pagesize); |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.xtong.zhbs.service.impl; |
|||
|
|||
import com.xtong.zhbs.bean.PassengerFlow; |
|||
import com.xtong.zhbs.mapper.PassengerFlowMapper; |
|||
import com.xtong.zhbs.service.PassengerFlowService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class PassengerFlowServiceImpl implements PassengerFlowService { |
|||
@Autowired |
|||
private PassengerFlowMapper passengerFlowMapper; |
|||
|
|||
@Override |
|||
public List<PassengerFlow> getPassengerFlowList(int page, int pagesize) { |
|||
int start = page-1>0?(page-1)*pagesize:0; |
|||
return passengerFlowMapper.getPassFlowList(start,pagesize); |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package com.xtong.zhbs.service; |
|||
|
|||
import com.xtong.zhbs.bean.PassengerFlow; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.test.context.SpringBootTest; |
|||
import org.springframework.test.context.junit4.SpringRunner; |
|||
|
|||
import java.util.List; |
|||
|
|||
import static org.junit.Assert.*; |
|||
|
|||
@SpringBootTest |
|||
@RunWith(SpringRunner.class) |
|||
public class PassengerFlowServiceTest { |
|||
@Autowired |
|||
private PassengerFlowService passengerFlowService; |
|||
|
|||
@Test |
|||
public void getPassengerFlowList() { |
|||
int page=1; |
|||
int limit=10; |
|||
List<PassengerFlow> psflowlist = passengerFlowService.getPassengerFlowList(page,limit); |
|||
psflowlist.stream().forEach(item->{ |
|||
System.out.println(item.getGroupName()); |
|||
}); |
|||
|
|||
} |
|||
} |
|||
Loading…
Reference in new issue