package com.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * 统计信息类(会员、商品总数等)
 * @author Administrator
 *
 */
public class SumInfoCrtl {
	/**
	 * 会员总数
	 * @return
	 */
	public int UserCount(){	
		int userCount = 0;//获取到User的总数
		Connection conn = ConnDB.getConn();
		Statement stmt = null;
		ResultSet rs = null;
		String sql = "select count(*) as UserCount from UserInfo ";
		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql);
			if(rs.next()){
				userCount = rs.getInt("UserCount");
			}			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			ConnDB.close(rs, stmt, conn);
		}
		return userCount;
	}
	/**
	 * 订单总数
	 * @return
	 */
	public int OrderCount(){	
		int orderCount = 0;//获取到order的总数
		Connection conn = ConnDB.getConn();
		Statement stmt = null;
		ResultSet rs = null;
		String sql = "select count(*) as OrderCount from OrderInfo ";
		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql);
			if(rs.next()){
				orderCount = rs.getInt("OrderCount");
			}			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			ConnDB.close(rs, stmt, conn);
		}
		return orderCount;
	}
	/**
	 * 新闻总数
	 * @return
	 */
	public int NewsCount(){	
		int newsCount = 0;//获取到order的总数
		Connection conn = ConnDB.getConn();
		Statement stmt = null;
		ResultSet rs = null;
		String sql = "select count(*) as NewsCount from NewsInfo ";
		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql);
			if(rs.next()){
				newsCount = rs.getInt("NewsCount");
			}			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			ConnDB.close(rs, stmt, conn);
		}
		return newsCount;
	}

}
最近下载更多
524109  LV5 2023年4月11日
Mayoubin2001  LV21 2022年3月30日
人工智能4708  LV11 2022年3月12日
tangjj7260  LV18 2021年12月8日
wodiaonima  LV4 2021年11月23日
马123456  LV8 2021年10月5日
SWU商贸  LV3 2021年7月13日
black8angel  LV4 2021年6月4日
世间各有所得  LV3 2021年3月17日
落霞孤鹜飞呀飞  LV2 2021年2月14日
最近浏览更多
412685265123 4月12日
暂无贡献等级
zhangkk  LV7 2月8日
夏培肃 2024年12月17日
暂无贡献等级
微信网友_7290996505972736  LV4 2024年12月11日
暂无贡献等级
y1214435276  LV9 2024年9月26日
lyh1989  LV34 2024年7月21日
曾显示  LV6 2024年7月7日
郭宇航裹裹  LV5 2024年6月9日
wjh007  LV5 2024年3月4日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友