|
|
|
@ -0,0 +1,48 @@ |
|
|
|
package com.srq.modules.board.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.srq.modules.board.dao.BoardMapper; |
|
|
|
import com.srq.modules.board.entity.BoardInData; |
|
|
|
import com.srq.modules.board.service.BoardService; |
|
|
|
import com.srq.modules.schedule.entity.SOScheduledRoutingOutData; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class BoardServiceImpl implements BoardService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private BoardMapper boardMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> scheduleBoard( BoardInData inData){ |
|
|
|
int pageIndex=inData.getNumber(); |
|
|
|
List<SOScheduledRoutingOutData> list =boardMapper.scheduleBoard(); |
|
|
|
double number=list.size(); |
|
|
|
int maxPage=(int)Math.ceil(number/18); |
|
|
|
if(pageIndex>maxPage){ |
|
|
|
pageIndex=1; |
|
|
|
} |
|
|
|
List<SOScheduledRoutingOutData> result =new ArrayList<>(); |
|
|
|
if(pageIndex<maxPage){ |
|
|
|
for(int i=0;i<18;i++){ |
|
|
|
result.add(list.get((pageIndex-1)*18+i)); |
|
|
|
} |
|
|
|
}else { |
|
|
|
for(int i=0;(pageIndex-1)*18+i<number;i++){ |
|
|
|
result.add(list.get((pageIndex-1)*18+i)); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("maxPage", maxPage); |
|
|
|
map.put("rows", result); |
|
|
|
map.put("total",result.size()); |
|
|
|
return map; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |