后台登录首页的统计数据

目录

  • 效果图
  • UserService:返回用户总数
  • DatabaseBakService:返回备份总数
  • OperatorLogService:返回日志总数
  • 控制器下:SystemController
  • 前端文件:admin/system/index

效果图

后台登录首页的统计数据_第1张图片

UserService:返回用户总数

public long total(){
		return userDao.count();
}

DatabaseBakService:返回备份总数

public long total(){
		return databaseBakDao.count();
}

OperatorLogService:返回日志总数

public long total(){
		return operatorLogDao.count();
}

控制器下:SystemController

@RequestMapping(value="/index")
public String index(Model model){
	model.addAttribute("operatorLogs", operaterLogService.findLastestLog(10));
	model.addAttribute("userTotal", userService.total());
	model.addAttribute("operatorLogTotal", operaterLogService.total());
	model.addAttribute("databaseBackupTotal", databaseBakService.total());
	model.addAttribute("onlineUserTotal", SessionListener.onlineUserCount);
	return "admin/system/index";
}

前端文件:admin/system/index

<div class="row">
	<div class="col-sm-6 col-lg-3">
	   <div class="card bg-primary">
	     <div class="card-body clearfix">
	       <div class="pull-right">
	         <p class="h6 text-white m-t-0">备份文件</p>
	         <p class="h3 text-white m-b-0">${databaseBackupTotal!"0"}</p>
	       </div>
	       <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-database fa-1-5x"></i></span> </div>
	     </div>
	   </div>
	 </div>
          
	<div class="col-sm-6 col-lg-3">
	   <div class="card bg-danger">
	     <div class="card-body clearfix">
	       <div class="pull-right">
	         <p class="h6 text-white m-t-0">用户总数</p>
	         <p class="h3 text-white m-b-0">${userTotal!"0"}</p>
	       </div>
	       <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-account fa-1-5x"></i></span> </div>
	     </div>
	   </div>
	 </div>
          
     <div class="col-sm-6 col-lg-3">
       <div class="card bg-success">
         <div class="card-body clearfix">
           <div class="pull-right">
             <p class="h6 text-white m-t-0">当前在线用户</p>
             <p class="h3 text-white m-b-0">${onlineUserTotal!"0"}</p>
           </div>
           <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-account-multiple fa-1-5x"></i></span> </div>
         </div>
       </div>
     </div>
          
     <div class="col-sm-6 col-lg-3">
       <div class="card bg-purple">
         <div class="card-body clearfix">
           <div class="pull-right">
             <p class="h6 text-white m-t-0">操作日志</p>
             <p class="h3 text-white m-b-0">${operatorLogTotal!"0"}</p>
           </div>
           <div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-keyboard-close fa-1-5x"></i></span> </div>
         </div>
       </div>
     </div>
</div>

你可能感兴趣的:(编程语言---JAVA,java,eclipse,spring)