Search in sources :

Example 1 with DChargeAdminVo

use of com.code.server.login.vo.DChargeAdminVo in project summer by foxsugar.

the class DemoAction method findCharges.

@DemoChecker
@RequestMapping("/findCharges")
public AgentResponse findCharges(int curPage) {
    if (curPage > 0) {
        curPage--;
    }
    Page<Charge> page = homeService.findCharges(new PageRequest(curPage, 20));
    List<DChargeAdminVo> list = new ArrayList<>();
    page.getContent().stream().forEach(x -> {
        DChargeAdminVo dChargeAdminVo = new DChargeAdminVo();
        BeanUtils.copyProperties(x, dChargeAdminVo);
        list.add(dChargeAdminVo);
    });
    Long count = homeService.chargesCount();
    AgentResponse agentResponse = new AgentResponse();
    Map<String, Object> rs = new HashMap<>();
    rs.put("list", list);
    rs.put("total", count);
    agentResponse.setData(rs);
    return agentResponse;
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) DChargeAdminVo(com.code.server.login.vo.DChargeAdminVo) DemoChecker(com.code.server.login.anotation.DemoChecker) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DemoChecker (com.code.server.login.anotation.DemoChecker)1 DChargeAdminVo (com.code.server.login.vo.DChargeAdminVo)1 PageRequest (org.springframework.data.domain.PageRequest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1