use of com.itrus.portal.db.MobileLogmanagementLogExample in project portal by ixinportal.
the class MobileAffaireEnregistrerLogController method list.
// 列表展示
@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "appName", required = false) String appName, @RequestParam(value = "userId", required = false) String userId, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "contenu", required = false) String contenu, @RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
if (queryDate1 == null && queryDate2 == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
calendar.add(Calendar.MILLISECOND, -1);
queryDate2 = calendar.getTime();
calendar.add(Calendar.MILLISECOND, 1);
calendar.add(Calendar.MONTH, -1);
queryDate1 = calendar.getTime();
}
if (page == null || page < 1) {
page = 1;
}
if (size == null || size < 1) {
size = 10;
}
MobileLogmanagementLogExample example = new MobileLogmanagementLogExample();
MobileLogmanagementLogExample.Criteria eam = example.createCriteria();
if (StringUtils.isNotBlank(appName)) {
eam.andAppNameLike("%" + appName + "%");
}
if (StringUtils.isNotBlank(userId)) {
eam.andUserNameLike("%" + userId + "%");
}
if (StringUtils.isNotBlank(type)) {
eam.andServiceTypeLike("%" + type + "%");
}
if (StringUtils.isNotBlank(contenu)) {
eam.andContenuLike("%" + contenu + "+");
}
if (queryDate1 != null) {
eam.andCreateTimeGreaterThanOrEqualTo(queryDate1);
}
if (queryDate2 != null) {
eam.andCreateTimeLessThanOrEqualTo(queryDate2);
}
Integer count = sqlSession.selectOne("com.itrus.portal.db.MobileLogmanagementLogMapper.countByExample", example);
uiModel.addAttribute("count", count);
if (page > 1 && size * (page - 1) >= count) {
page = (count + size - 1) / size;
}
Integer offset = size * (page - 1);
example.setOffset(offset);
example.setLimit(size);
example.setOrderByClause("create_time desc");
List<MobileLogmanagementLog> logmanagementLogs = sqlSession.selectList("com.itrus.portal.db.MobileLogmanagementLogMapper.selectByExample", example);
uiModel.addAttribute("logmanagementLogs", logmanagementLogs);
uiModel.addAttribute("appName", appName);
uiModel.addAttribute("userId", userId);
uiModel.addAttribute("type", type);
uiModel.addAttribute("contenu", contenu);
uiModel.addAttribute("queryDate1", queryDate1);
uiModel.addAttribute("queryDate2", queryDate2);
uiModel.addAttribute("page", page);
uiModel.addAttribute("pages", (count + size - 1) / size);
uiModel.addAttribute("size", size);
return "mobileaffaireenregistrerlog/list";
}
Aggregations