VoteManager.java
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:5k
源码类别:
OA系统
开发平台:
Java
- package com.gforce.gfoa;
- import com.gforce.currency.*;
- import com.gforce.currency.database.*;
- import java.sql.*;
- import java.util.*;
- /**
- * <p>Title: 吉力科技办公自动化系统</p>
- * <p>Description: 吉力科技办公自动化系统</p>
- * <p>Copyright: 版权所有 2003 (c) 西安吉力科技发展有限公司 Copyright (c) 2003 GForce Sceince & Technology</p>
- * <p>Company: 西安吉力科技发展有限公司 (GForce Sceince & Technology)</p>
- * @author 王江涛
- * @version 1.0
- */
- public class VoteManager
- extends RecordManager
- {
- public VoteManager()
- {
- }
- protected final static String TableName = "VoteInfo"; //定义声明本类操作表名称为
- protected final static String IDFieldName = "ID"; //定义声明主键或者可以确定唯一记录的字段名称为“ID”,必须为自增整型
- protected final static String[] NumericFieldsName =
- {"IsRadio", "SysDirID", "VoteTimes", "PublishUserID"}; //声明数值型字段名称
- protected final static String[] StringFieldsName =
- {"VoteName"}; //声明字符型字段名称
- protected final static String[] DatetimeFieldsName =
- {"StartTime", "EndTime", "PublishTime"}; //声明日期时间型字段名称
- protected final static String[] TextFieldsName =
- {}; //声明大字符串型字段名称
- /**
- * 根据字段名称获取插入数据时表单元素名称
- * @param strFieldName 字段名称
- * @return 表单素名称
- */
- protected String InsertParament(String strFieldName)
- {
- return "" + strFieldName + ""; //可以根据需要加前缀、后缀
- }
- /**
- * 根据字段名称获取修改数据时表单元素名称
- * @param strFieldName 字段名称
- * @return 表单素名称
- */
- protected String UpdateParament(String strFieldName)
- {
- return "" + strFieldName + ""; //可以根据需要加前缀、后缀
- }
- /**
- * 获取本类操作表名称
- * @return 表名称
- */
- public String getTableName()
- { //获取本类操作表名称
- return TableName;
- }
- protected String getIDFieldName()
- { //获取主键或者可以确定唯一记录的字段名称
- return IDFieldName;
- }
- protected String[] getNumericFieldsName()
- { //获取数值型字段名称
- return NumericFieldsName;
- }
- protected String[] getStringFieldsName()
- { //获取字符型字段名称
- return StringFieldsName;
- }
- protected String[] getDatetimeFieldsName()
- { //获取日期时间型字段名称
- return DatetimeFieldsName;
- }
- protected String[] getTextFieldsName()
- { //获取大字符串型字段名称
- return TextFieldsName;
- }
- /**
- * 获取所有记录的向量集
- * @return 所有记录的向量集
- */
- public static Vector getAllRecord(int intSysDirID)
- {
- Vector vc = new Vector();
- String strSQL = ""; //如果没有系统ID默认返回所有记录的向量集。
- if (intSysDirID == 0)
- {
- strSQL = ("select * from " + TableName);
- }
- else
- {
- strSQL = ("select a.*,c.Name from " + TableName + " as a left outer join UserInfo as b on (a.PublishUserID = b.ID) left outer join PersonnelInfo as c on (b.PersonnelID=c.ID) where a.SysDirID = " +
- intSysDirID + " order by a.PublishTime desc,a.ID desc");
- }
- vc = SQLManager.GetResultSet(strSQL);
- return vc;
- }
- /**
- * 获取指定ID的数据集
- * @param ID 要检索的ID
- * @return 指定ID的数据集
- */
- public static Vector getRecordByID(int intID)
- {
- Vector vc = new Vector();
- vc = SQLManager.GetResultSet("select * from " + TableName + " WHERE ID = " + intID);
- return vc;
- }
- /**
- * 获取属于指定系统目录下的现时间段有效的记录向量集
- * @param iSysDirID 系统目录ID
- * @return 指定系统目录下的现时间段有效的记录向量集
- */
- public static Vector getUsefullRecordBySysDirID(int iSysDirID)
- {
- java.util.Date dateCurrentTime = new java.util.Date();
- String strCurrentDate = StringNew.GetDateString(dateCurrentTime,"yyyy-MM-dd");
- Vector vt = SQLManager.GetResultSet("SELECT * FROM " + TableName + " WHERE (SysDirID=" + iSysDirID +
- " or SysDirID in (Select ID from SystemDirectory where Station like ((select Station from SystemDirectory where ID = " +
- iSysDirID + ")+'" + iSysDirID + "_%'))) and ((StartTime is null or StartTime<='" + strCurrentDate + "') and (EndTime is null or EndTime>='" + strCurrentDate+ "')) order by PublishTime desc,ID desc");
- return vt;
- }
- /**
- * 获取属于指定系统目录下的记录向量集
- * @param iSysDirID 系统目录ID
- * @return 指定系统目录下的记录向量集
- */
- public static Vector getRecordBySysDirID(int iSysDirID)
- {
- Vector vt = SQLManager.GetResultSet("SELECT a.*,c.name FROM " + TableName + " as a left outer join UserInfo as b on (a.PublishUserID = b.ID) left outer join PersonnelInfo as c on (b.PersonnelID=c.ID) WHERE a.SysDirID=" + iSysDirID +
- " order by a.PublishTime desc,a.ID desc");
- return vt;
- }
- /**
- * 将指定记录的浏览次数加1
- * @param intID 记录ID
- */
- public static void UpdateReocordView(int iID,String sValueIDs)
- {
- if(sValueIDs.length()>0)
- {
- SQLManager.ExcuteSQL("Update " + TableName + " set VoteTimes=(VoteTimes+1) where ID = " + iID);
- SQLManager.ExcuteSQL("Update VoteOptionsInfo set Times=(Times+1) where ID in (" + sValueIDs + ")");
- }
- }
- }