DocTempletFieldsManager.java
资源名称:OA.rar [点击查看]
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:11k
源码类别:
OA系统
开发平台:
Java
- package com.gforce.gfoa;
- /**
- * <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 2.0
- * DATE : 2003-12-04
- * 公文模板字段管理类
- */
- import com.gforce.currency.database.*;
- import java.util.*;
- import com.gforce.currency.*;
- public class DocTempletFieldsManager
- extends RecordManager
- {
- public DocTempletFieldsManager()
- {}
- protected final static String TableName = "DocTempletFields"; //定义声明本类操作表名称
- protected final static String IDFieldName = "ID"; //定义声明主键或者可以确定唯一记录的字段名称为“ID”,必须为自增整型
- protected final static String[] NumericFieldsName =
- {
- "OrderNumber", "IsMustFill", "IsUseful", "TempletID", "MaxLength"}; //声明数值型字段名称
- protected final static String[] DatetimeFieldsName =
- {}; //声明日期时间型字段名称
- protected final static String[] StringFieldsName =
- {
- "FieldName", "FieldType", "EnglishAb", "Event", "Options",
- "FieldContent", "WritableUserIDs", "ReadableUserIDs",
- "SearchType", "SearchFieldsInForm", "DefaultValue"}; //声明字符型字段名称
- 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;
- }
- /**
- * 获取符合指定条件的公文模板字段记录集
- * @param strID 公文模板字段信息唯一标识
- * @param strFieldName 公文模板字段名称
- * @param strFieldType 公文模板字段类型
- * @param strEnglishAb 公文模板字段英文缩写
- * @param strOrderNumber 公文模板字段排序编号
- * @param strEvent 公文模板字段激活事件
- * @param strOptions 公文模板字段选项内容
- * @param strFieldContent 公文模板字段填写说明
- * @param strIsMustFill 公文模板字段信息-是否必须填写
- * @param strWritableUserIDs 公文模板字段信息-可写用户IDs
- * @param strReadableUserIDs 公文模板字段信息-可读用户IDs
- * @param strIsUseful 公文模板字段信息-是否可用
- * @param strSearchType 公文模板字段搜索类型
- * @param strSearchFieldsInForm 公文模板字段信息-搜索对应字段
- * @param strTempletID 公文模板字段信息-模板ID
- * @param strTempletName 公文模板字段信息-模板名称
- * @param strMaxLength 公文模板字段最大长度
- * @param strDefaultValue 公文模板字段默认值
- * @param strOrderBy 排序字段
- * @param strIsDesc 是否降序排序
- * @return 符合条件记录向量集
- */
- public static Vector getRecordBySearch(String strID, String strFieldName,
- String strFieldType,
- String strEnglishAb,
- String strOrderNumber, String strEvent,
- String strOptions,
- String strFieldContent,
- String strIsMustFill,
- String strWritableUserIDs,
- String strReadableUserIDs,
- String strIsUseful,
- String strSearchType,
- String strSearchFieldsInForm,
- String strTempletID,
- String strTempletName,
- String strMaxLength,
- String strDefaultValue,
- String strOrderBy, String strIsDesc)
- {
- String strSQL =
- "SELECT a.[ID],a.[FieldName],a.[FieldType],a.[EnglishAb],a.[OrderNumber]," +
- "a.[Event],a.[Options],a.[FieldContent],a.[IsMustFill],a.[WritableUserIDs]," +
- "a.[ReadableUserIDs],a.[IsUseful],a.[SearchType],a.[SearchFieldsInForm]," +
- "a.[TempletID],a.[MaxLength],a.[DefaultValue],b.[TempletName] FROM [" +
- TableName + "] as a " +
- "left outer join [DocumentTemplet] as b on (a.TempletID = b.ID) WHERE a.[ID] > 0";
- if (strID.trim().length() > 0)
- {
- strSQL += " and (a.[ID] in (" + strID + "))";
- }
- if (strFieldName.trim().length() > 0)
- {
- strSQL += " and a.[FieldName] like '%" + strFieldName + "%'";
- }
- if (strFieldType.trim().length() > 0)
- {
- strSQL += " and a.[FieldType] like '%" + strFieldType + "%'";
- }
- if (strEnglishAb.trim().length() > 0)
- {
- strSQL += " and a.[EnglishAb] like '%" + strEnglishAb + "%'";
- }
- if (strOrderNumber.trim().length() > 0)
- {
- strSQL += " and (a.[OrderNumber] in (" + strOrderNumber + "))";
- }
- if (strEvent.trim().length() > 0)
- {
- strSQL += " and a.[Event] like '%" + strEvent + "%'";
- }
- if (strOptions.trim().length() > 0)
- {
- strSQL += " and a.[Options] like '%" + strOptions + "%'";
- }
- if (strFieldContent.trim().length() > 0)
- {
- strSQL += " and a.[FieldContent] like '%" + strFieldContent + "%'";
- }
- if (strIsMustFill.trim().length() > 0)
- {
- if (strIsMustFill.equalsIgnoreCase("True"))
- {
- strSQL += " and a.[IsMustFill] = 1";
- }
- else if (strIsMustFill.equalsIgnoreCase("False"))
- {
- strSQL += " and a.[IsMustFill] = 0";
- }
- }
- if (strWritableUserIDs.trim().length() > 0)
- {
- strSQL += " and a.[WritableUserIDs] like '%" + strWritableUserIDs + "%'";
- }
- if (strReadableUserIDs.trim().length() > 0)
- {
- strSQL += " and a.[ReadableUserIDs] like '%" + strReadableUserIDs + "%'";
- }
- if (strIsUseful.trim().length() > 0)
- {
- if (strIsUseful == "True")
- {
- strSQL += " and a.[IsUseful] = 1";
- }
- else if (strIsUseful == "False")
- {
- strSQL += " and a.[IsUseful] = 0";
- }
- }
- if (strSearchType.trim().length() > 0)
- {
- strSQL += " and a.[SearchType] like '%" + strSearchType + "%'";
- }
- if (strSearchFieldsInForm.trim().length() > 0)
- {
- strSQL += " and a.[SearchFieldsInForm] like '%" + strSearchFieldsInForm +
- "%'";
- }
- if (strTempletID.trim().length() > 0)
- {
- strSQL += " and (a.[TempletID] in (" + strTempletID + "))";
- }
- if (strTempletName.trim().length() > 0)
- {
- strSQL += " and b.[TempletName] = " + strTempletName;
- }
- if (strMaxLength.trim().length() > 0)
- {
- strSQL += " and (a.[MaxLength] in (" + strMaxLength + "))";
- }
- if (strDefaultValue.trim().length() > 0)
- {
- strSQL += " and a.[DefaultValue] like '%" + strDefaultValue + "%'";
- }
- if (strOrderBy.trim().length() > 0)
- {
- if (strIsDesc.equalsIgnoreCase("True"))
- {
- strSQL += " Order by " + strOrderBy + " desc";
- }
- else
- {
- strSQL += " Order by " + strOrderBy + "";
- }
- }
- else
- {
- strSQL += " Order by OrderNumber";
- }
- Vector vt = SQLManager.GetResultSet(strSQL);
- return vt;
- }
- /*重载getRecordBySearch方法,按ID主键返回*/
- public static Vector getRecordBySearch(String strID)
- {
- Vector vt = getRecordBySearch(strID, "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "");
- return vt;
- }
- /**
- * 追加更新字段权限
- * @param strPurview 权限值
- * @param strTempletID 公文模板ID
- * @return String 操作结果标志
- */
- public static String CheckedUpdate(String strPurview, String strUserIDs,
- String strTempletID, String OpType,
- String strOpKind, String strIntersection)
- {
- Vector vt = getRecordBySearch(strPurview, "", "", "", "", "", "", "", "", "", "",
- "", "", "", strTempletID, "", "", "", "", "");
- if (vt.size() < 1)
- {
- return "DataInitError";
- }
- else
- {
- if (strOpKind.equalsIgnoreCase("0"))
- { //单字段操作,直接Update
- if (OpType.equalsIgnoreCase("Writeable"))
- {
- SQLManager.ExcuteSQL(
- "UPDATE DocTempletFields SET WritableUserIDs = '" + strUserIDs +
- "' where ID = (" + strPurview + ")");
- }
- else if (OpType.equalsIgnoreCase("Readable"))
- {
- SQLManager.ExcuteSQL(
- "UPDATE DocTempletFields SET ReadableUserIDs = '" + strUserIDs +
- "' where ID = (" + strPurview + ")");
- }
- }
- else
- { //多字段操作
- if (OpType.equalsIgnoreCase("Writeable"))
- {
- for (int i = 0; i < vt.size(); i++)
- {
- SQLManager.ExcuteSQL(
- "UPDATE DocTempletFields SET WritableUserIDs = '" +
- StringNew.getMergeOfIDs(StringNew.getSubtractOfIDs( ( (Vector)
- vt.get(i)).get(9).toString(), strIntersection), strUserIDs) +
- "' where ID = (" + ( (Vector) vt.get(i)).get(0) + ")");
- }
- }
- else if (OpType.equalsIgnoreCase("Readable"))
- {
- for (int i = 0; i < vt.size(); i++)
- {
- SQLManager.ExcuteSQL(
- "UPDATE DocTempletFields SET ReadableUserIDs = '" +
- StringNew.getMergeOfIDs(StringNew.getSubtractOfIDs( ( (Vector)
- vt.get(i)).get(10).toString(), strIntersection), strUserIDs) +
- "' where ID = (" + ( (Vector) vt.get(i)).get(0) + ")");
- }
- }
- }
- }
- return "Success";
- }
- }