Search in sources :

Example 1 with TransferExample

use of com.itrus.portal.db.TransferExample in project portal by ixinportal.

the class TransferController method list.

@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "message", required = false) Integer message, @RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "page2", required = false) Integer page2, @RequestParam(value = "size2", required = false) Integer size2, Model uiModel) throws Exception {
    // page,size
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    // count,pages
    Integer count = sqlSession.selectOne("com.itrus.portal.db.TransferMapper.countByExample", null);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    // page, size
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    // query data
    Integer offset = size * (page - 1);
    TransferExample transferex = new TransferExample();
    // projectex.or().andIdIsNotNull();
    transferex.setOffset(offset);
    transferex.setLimit(size);
    List transferall = sqlSession.selectList("com.itrus.portal.db.TransferMapper.selectByExample", transferex);
    uiModel.addAttribute("transfers", transferall);
    // itemcount
    uiModel.addAttribute("itemcount", transferall.size());
    uiModel.addAttribute("message", message == null ? "" : "要删除的发票存在关联,无法删除");
    // page,size
    if (page2 == null || page2 < 1)
        page2 = 1;
    if (size2 == null || size2 < 1)
        size2 = 10;
    // count,pages
    Integer count2 = sqlSession.selectOne("com.itrus.portal.db.OnlinePayMapper.countByExample", null);
    uiModel.addAttribute("count2", count2);
    uiModel.addAttribute("pages2", (count2 + size2 - 1) / size2);
    // page, size
    if (page2 > 1 && size2 * (page2 - 1) >= count2) {
        page2 = (count2 + size2 - 1) / size;
    }
    uiModel.addAttribute("page2", page2);
    uiModel.addAttribute("size2", size2);
    // query data
    Integer offset2 = size2 * (page2 - 1);
    OnlinePayExample onlinepayex = new OnlinePayExample();
    // projectex.or().andIdIsNotNull();
    onlinepayex.setOffset(offset2);
    onlinepayex.setLimit(size2);
    List onlinepayexall = sqlSession.selectList("com.itrus.portal.db.OnlinePayMapper.selectOnlinePays", onlinepayex);
    uiModel.addAttribute("onlinepays", onlinepayexall);
    PayConfigExample payconfigex = new PayConfigExample();
    Map<Long, PayConfig> payconfigmap = sqlSession.selectMap("com.itrus.portal.db.PayConfigMapper.selectByExample", payconfigex, "id");
    uiModel.addAttribute("payconfigmap", payconfigmap);
    // itemcount
    uiModel.addAttribute("itemcount", onlinepayexall.size());
    uiModel.addAttribute("message", message == null ? "" : "要删除的发票存在关联,无法删除");
    uiModel.addAttribute("status", status);
    return "transfer/list";
}
Also used : TransferExample(com.itrus.portal.db.TransferExample) PayConfig(com.itrus.portal.db.PayConfig) OnlinePayExample(com.itrus.portal.db.OnlinePayExample) List(java.util.List) PayConfigExample(com.itrus.portal.db.PayConfigExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

OnlinePayExample (com.itrus.portal.db.OnlinePayExample)1 PayConfig (com.itrus.portal.db.PayConfig)1 PayConfigExample (com.itrus.portal.db.PayConfigExample)1 TransferExample (com.itrus.portal.db.TransferExample)1 List (java.util.List)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1