Search in sources :

Example 1 with RaAccountExample

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

the class RaAccountController method list.

// 列表所有信息
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "message", required = false) Integer message, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, 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.RaAccountMapper.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);
    RaAccountExample raAccountex = new RaAccountExample();
    // projectex.or().andIdIsNotNull();
    raAccountex.setOffset(offset);
    raAccountex.setLimit(size);
    List raaccountall = sqlSession.selectList("com.itrus.portal.db.RaAccountMapper.selectByExample", raAccountex);
    uiModel.addAttribute("raaccounts", raaccountall);
    // itemcount
    uiModel.addAttribute("itemcount", raaccountall.size());
    uiModel.addAttribute("message", message == null ? "" : "要删除的RA配置存在关联,无法删除");
    return "raaccount/list";
}
Also used : List(java.util.List) RaAccountExample(com.itrus.portal.db.RaAccountExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with RaAccountExample

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

the class RaAccountServiceImpl method getRaByAccountHash.

public RaAccount getRaByAccountHash(String accountHash) {
    RaAccountExample example = new RaAccountExample();
    RaAccountExample.Criteria criteria = example.or();
    criteria.andAccountHashEqualTo(accountHash);
    example.setLimit(1);
    RaAccount raAccount = sqlSession.selectOne("com.itrus.portal.db.RaAccountMapper.selectByExample", example);
    return raAccount;
}
Also used : RaAccount(com.itrus.portal.db.RaAccount) RaAccountExample(com.itrus.portal.db.RaAccountExample)

Aggregations

RaAccountExample (com.itrus.portal.db.RaAccountExample)2 RaAccount (com.itrus.portal.db.RaAccount)1 List (java.util.List)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1