package com.jw.app.userbase.action;

import java.sql.SQLException;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.gaowj.business.action.BasicAction;
import com.gaowj.business.comp.BusinessManager;
import com.gaowj.business.exception.BusinessException;
import com.gaowj.business.util.RequestUtils;
import com.jw.app.business.UserBaseBusiness;
import com.jw.app.business.UserBusiness;

import net.sf.json.JSONObject;

public class dataAction extends BasicAction{
	private static final long serialVersionUID = 6785649922437416652L;
	private JSONObject jsonObject = new JSONObject();
	private int rows = 20;// 每页显示的记录数
    private int page = 1;// 当前第几页

	public JSONObject getJsonObject() {
		return jsonObject;
	}

	public void setJsonObject(JSONObject jsonObject) {
		this.jsonObject = jsonObject;
	}

	public int getRows() {
		rows = getPageSize();
		return rows;
	}

	public void setRows(int rows) {
		setPageSize(rows);
		this.rows = getPageSize();
	}

	public int getPage() {
		page = getPageNo();
		return page;
	}

	public void setPage(int page) {
		setPageNo(page);
		this.page = getPageNo();
	}
	
	public String listUserBaseDel() throws BusinessException{
		UserBaseBusiness business = BusinessManager.getBusiness(UserBaseBusiness.class);
		List<Map<String, Object>> list = business.list_userbase_del();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("DELETE_FLAG", "1");
		int listDataCount = business.listCount_userbase(map);
		Map<String, Object> data = new HashMap<String, Object>();
		data.put("rowSet", list);
		data.put("pageNo", 1);
		data.put("pageSize", listDataCount);
		data.put("pageCount", listDataCount);
		data.put("rows", data.get("rowSet"));
		data.put("total", listDataCount);
		jsonObject = new JSONObject();
		jsonObject.putAll(data);	
		return "json";	
	}
    
	public String listUserBaseLeave() throws BusinessException{
		UserBaseBusiness business = BusinessManager.getBusiness(UserBaseBusiness.class);
		List<Map<String, Object>> list = business.list_userbase_leave();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("LEAVE_FLAG", "1");
		int listDataCount = business.listCount_userbase(map);
		Map<String, Object> data = new HashMap<String, Object>();
		data.put("rowSet", list);
		data.put("pageNo", 1);
		data.put("pageSize", listDataCount);
		data.put("pageCount", listDataCount);
		data.put("rows", data.get("rowSet"));
		data.put("total", listDataCount);
		jsonObject = new JSONObject();
		jsonObject.putAll(data);	
		return "json";	
	}
}
