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

📄 op_punish.java

📁 考勤管理系统是针对学校每个月的考勤的报表进行总结
💻 JAVA
字号:
package action;

import java.sql.SQLException;
import java.util.Vector;

import util.Punish;

public class Op_punish extends DBOption {
	private Punish apunish = null;
	private Vector<Punish> punlist = null;
	
	private String sqlStr = "";
	
	public String msg = "";
	
	public Op_punish() {
		this.setPoolName("kaoqin");
	}
	
	/**
	 * 获取所有处罚方式
	 * @return
	 */
	public Vector getAllPunish() {
		sqlStr = "select * from Punish order by P_scope_low";
		
		try {
			this.rs = this.query(sqlStr);
			this.punlist = new Vector<Punish>();
			
			while (rs.next()) {
				this.apunish = new Punish();
				this.apunish.setP_id(rs.getLong("P_ID"));
				this.apunish.setP_low(rs.getFloat("P_scope_low"));
				this.apunish.setP_top(rs.getFloat("P_scope_top"));
				this.apunish.setP_punish(rs.getString("P_punish"));
				this.punlist.addElement(apunish);
			}
			rs.close();
			this.freeConn();
			if (punlist.size() == 0) {
				this.msg = "暂时没有处罚方式信息!";
				return null;
			}
			return punlist;
		} catch (SQLException e) {
			this.msg = "取出所有考勤处分设置时出错";
			this.freeConn();
			Log.writeLog(e, "action.Op_punish.getAllPunish:\n\t"+msg);
			return null;
		}
	}
	
	public String getPun(String low, String top) {
		if ((low == null && top == null) || 
				(low.equals("") && top.equals(""))) {
			return "";
		} else if (low == null) {
			low = "";
		} else if (low == null) {
			top = "";
		}
		String pun = "";
		sqlStr = "select * from Punish where 1=1";
		if (!low.equals("")) 
			sqlStr = sqlStr + " and P_scope_low = " + low;
		if (!top.equals(""))
			sqlStr = sqlStr + " and P_scope_top = " + top;
		try {
			rs = this.query(sqlStr);
			if (rs.next())
				pun = rs.getString("P_punish");
			rs.close();
			freeConn();
			return pun;
		} catch (SQLException e) {
			this.msg = "查找处罚名称时出错!";
			Log.writeLog(e, "action.Op_punish.getPun:\n\t"+sqlStr);
			freeConn();
			return pun;
		}
	}
}

⌨️ 快捷键说明

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