use of com.itrus.portal.db.PersonInfo in project portal by ixinportal.
the class PersonInfoController method detail.
/**
* 查看个人用户详情
* @param id
* 个人用户id
* @param item
* 个人用户关联的项(0认证、1订单)
* @param page
* @param size
* @param uiModel
* @return
*/
@RequestMapping("/detail")
public String detail(@RequestParam(value = "id", required = true) Long id, @RequestParam(value = "item", required = false) Integer item, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
PersonInfo personinfo = personInfoService.getSelectById(id);
uiModel.addAttribute("personinfo", personinfo);
// 得到属于个人的认证等级
Map prama = new HashMap();
prama.put("type", 1);
List certificationList = certificationService.getCertificationList(prama);
uiModel.addAttribute("certificationList", certificationList);
// page,size
if (page == null || page < 1) {
page = 1;
}
if (size == null || size < 1) {
size = 10;
}
Integer offset = size * (page - 1);
// 总记录数
Integer count = 0;
// 当前页记录数
Integer itemcount = 0;
if (null == item || 0 == item) {
// 得到用户关联的银行卡信息
BankcardInfoExample bankcardInfoExample = new BankcardInfoExample();
BankcardInfoExample.Criteria be = bankcardInfoExample.createCriteria();
be.andUniqueIdEqualTo(id);
bankcardInfoExample.setOrderByClause("create_time desc");
bankcardInfoExample.setOffset(offset);
bankcardInfoExample.setLimit(size);
List bankcardInfoList = bankcardInfoService.getSelectByExample(bankcardInfoExample);
count = bankcardInfoService.getSelectCountByExample(bankcardInfoExample);
uiModel.addAttribute("bankcardInfoList", bankcardInfoList);
} else if (1 == item) {
// 得到用户关联的订单
PersonalBillExample personalBillExample = new PersonalBillExample();
PersonalBillExample.Criteria pe = personalBillExample.createCriteria();
pe.andUniqueIdEqualTo(id);
personalBillExample.setOrderByClause("create_time desc");
personalBillExample.setOffset(offset);
personalBillExample.setLimit(size);
List personalBillList = personalBillBillService.getSelectByExample(personalBillExample);
count = personalBillBillService.getSelectCountByExample(personalBillExample);
uiModel.addAttribute("personalBillList", personalBillList);
Map<Long, List<Product>> productMap = productService.getProductByMap();
Map<Long, List<Project>> projectMap = projectService.getProjectByMap();
uiModel.addAttribute("productMap", productMap);
uiModel.addAttribute("projectMap", projectMap);
}
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
uiModel.addAttribute("count", count);
uiModel.addAttribute("pages", (count + size - 1) / size);
uiModel.addAttribute("page", page);
uiModel.addAttribute("size", size);
uiModel.addAttribute("item", item);
return "personinfo/detail";
}
Aggregations