⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 queinfobo.java

📁 日志管理源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.log.bo;

import com.log.util.Constant;
import com.log.util.DateUtil;
import com.lzc.util.db.DBManager;

public class QueInfoBo {
	private static QueInfoBo instance = null;

	public static QueInfoBo getInstance() {
		if (instance == null) {
			synchronized (new Object()) {
				if (instance == null) {
					instance = new QueInfoBo();
				}
			}
		}
		return instance;
	}

	public static void main(String[] args) throws Exception {
		QueInfoBo bo = QueInfoBo.getInstance();
		String[][] data=bo.queryQueInfo("","","",0,"","");
		
		System.out.println(data);
	}
	
	
	public String[][] queryQueInfo(String id,String wordGroup,String inputMan,int state,String beginTime,String endTime ) throws Exception {
		String[][] data=null;
		try {
			String sql = "exec sp_QueryQuestionInfo "+id+",'" + wordGroup + "','"
					+ inputMan + "',"+state+",'" + beginTime + "','" + endTime + "'";
			data = DBManager.getNewInstance("infomgr").query(sql, 5, 1);
		} catch (Exception e) {
			System.out.println("Error in QueryQueInfo:" + e);
		}
		return data;
	}
	
	public boolean updateQueryQueInfo(String id,String inputMan,String state,String namephone,String causeinfo,String remark ) throws Exception {
		boolean flag=false;
		try {
			String sql = "exec sp_UpdateQuestionInfo "+id+",'" + inputMan + "','"
					+ namephone + "','" + causeinfo + "',"+state+",'" + remark + "'";
			flag = DBManager.getNewInstance("infomgr").update(sql);
			System.out.println(sql);
			System.out.println(flag);
		} catch (Exception e) {
			System.out.println("Error in updateQueryQueInfo:" + e);
		}
		return flag;
	}
	public boolean updateQueryQueInfoHurry(String id,String inputMan,String state,String namephone,String causeinfo,String remark,String hurryflag,String hurrytime ) throws Exception {
		boolean flag=false;
		try {
			String sql = "exec sp_UpdateQuestionInfo "+id+",'" + inputMan + "','"
					+ namephone + "','" + causeinfo + "',"+state+",'" + remark + "',"+hurryflag+",'"+hurrytime+"'";;
			flag = DBManager.getNewInstance("infomgr").update(sql);
			System.out.println(sql);
			System.out.println(flag);
		} catch (Exception e) {
			System.out.println("Error in updateQueryQueInfo:" + e);
		}
		return flag;
	}
	public boolean updateAllQueryQueInfo(String[] ids,String inputMan,String state,String namephone,String causeinfo,String remark ) throws Exception {
		boolean flag=false;
		try {
			for(int i=0;i<ids.length;i++){
				String sql = "exec sp_UpdateQuestionInfo "+ids[i]+",'" + inputMan + "','"
				+ namephone + "','" + causeinfo + "',"+state+",'" + remark + "'";
				flag = DBManager.getNewInstance("infomgr").update(sql);
			}
			
		} catch (Exception e) {
			System.out.println("Error in updateAllQueryQueInfo:" + e);
		}
		return flag;
	}

	public String searchStaff(String workno, String name, String phone,
			String department) throws Exception {
		String sql = "select* from staffinfo";
		try {
			if (!workno.equals("") || !name.equals("") || !phone.equals("")
					|| !department.equals("")) {
				sql += " where ";
				int i = 0;
				if (!workno.equals("")) {
					i++;
					sql += " workno like '%" + workno + "%'";
				}
				if (!name.equals("")) {
					if (i > 0) {
						sql += " and ";
					}
					i++;
					sql += " name like '%" + name + "%'";
				}
				if (!phone.equals("")) {
					if (i > 0) {
						sql += " and ";
					}
					i++;
					sql += " phone like '%" + phone + "%'";
				}
				if (!department.equals("")) {
					if (i > 0) {
						sql += " and ";
					}
					i++;
					sql += " department like '%" + department + "%'";
				}
			}
			// System.out.println("sql:" + sql);
		} catch (Exception e) {
			System.out.println("Error in searchStaff:" + e);
		}
		return sql;
	}

	public boolean delStaffInfo(String[] paramVal) throws Exception {
		boolean flag = false;
		try {
			String sql = "delete from staffinfo where id=?";
			flag = DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			flag = false;
			System.out.println("Error in delStaffInfo:" + e);
		}
		return flag;
	}

	public boolean editStaffInfo(String[] paramVal) throws Exception {
		boolean flag = false;
		try {
			String sql = "update staffinfo set workno=?,name=?,phone=?,idcard=?,sex=?,department=? where id=?";
			flag = DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			flag = false;
			System.out.println("Error in editStaffInfo:" + e);
		}
		return flag;
	}

	public String[][] getStaffinfoByID(String id) throws Exception {
		String[][] data = null;
		try {
			String sql = "select * from staffinfo where id=" + id;
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getStaffinfoByID:" + e);
		}
		return data;
	}

	public String[][] getStaffinfoByID(String id, String workno)
			throws Exception {
		String[][] data = null;
		try {
			String sql = "select * from staffinfo where id <>" + id
					+ " and workno=" + workno;
			data = DBManager.getNewInstance("szhtp").query(sql, 10, 1);
		} catch (Exception e) {
			System.out.println("Error in getStaffinfoByID:" + e);
		}
		return data;
	}

	public String[][] getStaffinfoByNo(String workno) throws Exception {
		String[][] data = null;
		try {
			String sql = "select * from staffinfo where workno=" + workno;
			data = DBManager.getNewInstance("szhtp").query(sql, 10, 1);
		} catch (Exception e) {
			System.out.println("Error in getStaffinfoByNo:" + e);
		}
		return data;
	}

	public boolean addStaffInfo(String[] paramVal) throws Exception {
		boolean flag = false;
		try {
			String sql = "insert into staffinfo(workno,name,phone,idcard,sex,department)values(?,?,?,?,?,?)";
			flag = DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			flag = false;
			System.out.println("Error in addStaffInfo:" + e);
		}
		return flag;
	}

	public String[][] getSysTypeByCode(String sysCode) throws Exception {
		String[][] data = null;
		try {
			String sql = "select * from SystemType where syscode='" + sysCode
					+ "'";
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getSysTypeByCode:" + e);
		}
		return data;
	}

	public String[][] getSysTypeList() throws Exception {
		String[][] data = null;
		try {
			String sql = "select * from SystemType";
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getSysTypeList:" + e);
		}
		return data;
	}

	public void addSysType(String[] paramVal) throws Exception {
		try {
			String sql = "insert into SystemType(syscode,name)values(?,?)";
			DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			System.out.println("Error in addSysType:" + e);
		}
	}

	public void editSysType(String[] paramVal) throws Exception {
		try {
			String sql = "update SystemType set name=? where syscode=?";
			DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			System.out.println("Error in editSysType:" + e);
		}
	}

	public void delSysType(String[] paramVal) throws Exception {
		try {
			String sql = "delete from SystemType where syscode=?";
			DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			System.out.println("Error in delSysType:" + e);
		}
	}

	public String[][] getLogTypeByCode(String code) throws Exception {
		String[][] data = null;
		try {
			String sql = "select * from logtype where code='" + code + "'";
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getLogTypeByCode:" + e);
		}
		return data;
	}

	public String[][] getLogTypeList() throws Exception {
		String[][] data = null;
		try {
			String sql = "select * from logtype ";
			data = DBManager.getNewInstance("szhtp").query(sql, -1, 1);
		} catch (Exception e) {
			System.out.println("Error in getLogTypeList:" + e);
			return null;
		}
		return data;
	}

	public void addLogType(String[] paramVal) throws Exception {
		try {
			String sql = "insert into logtype(code,name,syscode)values(?,?,?)";
			DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			System.out.println("Error in addLogType:" + e);
		}
	}

	public void editLogType(String[] paramVal) throws Exception {
		try {
			String sql = "update logtype set name=?,syscode=? where code=?";
			DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			System.out.println("Error in editLogType:" + e);
		}
	}

	public void delLogType(String[] paramVal) throws Exception {
		try {
			String sql = "delete from logtype where code=?";
			DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			System.out.println("Error in delLogType:" + e);
		}
	}

	public void getLogInfoList(String logType, String logUser) throws Exception {
		try {
			String sql = "select * from SysLogInfo";
			if ((null != logType && !"".equals(logType))
					|| (null != logUser && !"".equals(logUser))) {
				sql += " where ";
				if (null != logType && !"".equals(logType)) {
					sql += " logtype like '%" + logType + "%'";
				}
				if (null != logUser && !"".equals(logUser)) {
					sql += " and logUser like '%" + logUser + "%'";
				}
			}
		} catch (Exception e) {
			System.out.println("Error in getLogInfoList:" + e);
		}
	}

	public boolean addLogInfo(String[] paramVal) throws Exception {
		boolean flag = false;
		try {
			// System.out.println("paramVal:"+paramVal);
			// for(int i=0;i<paramVal.length;i++){
			// System.out.println(":::::"+paramVal[i]);
			// }
			String sql = "insert into SysLogInfo(logtype,logcontent,loguser)values(?,?,?)";
			flag = DBManager.getNewInstance("szhtp").update(sql, paramVal);
		} catch (Exception e) {
			System.out.println("Error in addLogInfo:" + e);
		}
		return flag;
	}

	public boolean addLogInfo(String logType, String content, String logUser)
			throws Exception {
		boolean flag = false;
		try {
			// System.out.println("paramVal:"+paramVal);
			// for(int i=0;i<paramVal.length;i++){
			// System.out.println(":::::"+paramVal[i]);
			// }
			// String sql = "insert into
			// SysLogInfo(logtype,logcontent,loguser)values(?,?,?)";
			String sql = "exec sp_InsertSysLogInfo '" + logType + "','"
					+ content + "','" + logUser + "'";
			flag = DBManager.getNewInstance("szhtp").update(sql);
		} catch (Exception e) {
			System.out.println("Error in addLogInfo:" + e);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -