【Java开源代码栏目提醒】:网学会员在Java开源代码频道为大家收集整理了ArticleBean.java提供大家参考,希望对大家有所帮助!
/**********************************************************
All rights reserved.
Filename: ArticleBean.java
Version 1.0
Date:2003-10-21
Description:查询发表文章时所须的信息及增加记录、修改记录、删除记录
Other:
Variable List:
1.int strID //文章编号
Function List:
1.public ArticleBean()//构造函数
2.public void setID(String o)//设置文章编号
4.public Hashtable getOneData() //取得一篇文章的信息
5. public Vector getOnePage(String flag,int page,int records)//
6.public int addArticle(Hashtable hash)//增加文章表数据记录
public Vector getOrg(String uid) //获得个人能发表文章的部门
public Vector getWzlx(String orgid) //获得个人能发表文章的可选类型
public Vector getkybm(String uid) //获得个人能发表文章的可用版面
public Hashtable getbmqx(String uid) //获得个人有管理员权限的所有版面
public Hashtable getorgqx(String uid) //获得个人可发表文章和可管理的部门
public int updateCZQX(qx,zgbh)//修改ZZ_ZGB的 LRSF 柳美
public int updateWZQX(qx,zgbh)//修改ZZ_ZGZWB的 WZQX 柳美
public Vector getwzly()//从字典表取得文章来源 柳美
History:
***********************************************************/
package oa.bean;
import java.text.*;
import java.util.*;
import java.util.Date;
import java.lang.*;
import java.io.*;
import java.io.File;
import java.sql.*;
import oa.main.*;
public class ArticleBean extends ParentBean
{
int strID = -1; //文章编号
public void setID(String o)//设置文章编号
{
strID = Integer.parseInt(o);
}
public Hashtable getorgqx(String uid)//获得个人可发表文章和可管理的部门
{
Hashtable hash = new Hashtable();
String lr = "";//可发表到的部门
String gl = "";//可管理的部门
String sql = "";
sql = "select news.zz_fbxwb.BMBH,news.zz_fbxwb.SFGL from news.zz_fbxwb,news.zz_bmb where zgbh='"+uid+"' and lb=2 and news.zz_fbxwb.BMBH=news.zz_bmb.BMBH order by news.zz_bmb.JBXH";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try{
while(rs.next())
{
String bmbh = ds.toString(rs.getString(1));
String sfgl = ds.toString(rs.getString(2));
if(!lr.equals(""))
{
lr = lr + ",";
}
lr = lr + bmbh;
if(sfgl.equals("1"))
{
if(!gl.equals(""))
{
gl = gl + ",";
}
gl = gl + bmbh;
}
}
}catch(Exception e){System.out.println("AticleBean.getorgqx(String)处理时出错了:"+e);}
finally{
if(rs != null) try{stmt = rs.getStatement();rs.close();}catch(Exception e){System.out.println("AticleBean.getorgqx(String)试图释放记录集rs时出错:"+e);}
if(stmt != null)try{stmt.close();}catch(Exception e){System.out.println("AticleBean.getorgqx(String)试图释放声明Statement时出错:"+e);}
}
hash.put("LR",lr);
hash.put("GL",gl);
return hash;
}
public Hashtable getbmqx(String uid)//获得个人有管理员权限的所有版面
{
String showqx1 = "";//所有可审批的位于menu表中的版面
String showqx2 = "";//所有可审批的位于menuchild表中的版面
String imgqx1 = "";//所有可审批图片的位于menu表中的版面
String imgqx2 = "";//所有可审批图片的位于menuchild表中的版面
String headqx1 = "";//所有可审批首页的位于menu表中的版面
String headqx2 = "";//所有可审批首页的位于menuchild表中的版面
String goodqx1 = "";//所有可审批焦点的位于menu表中的版面
String goodqx2 = "";//所有可审批焦点的位于menuchild表中的版面
Hashtable ht = new Hashtable();
ResultSet rs= null;
MenuBean mb = null;
Statement stmt = null;
try{
mb = new MenuBean();
String sql = "select dxbh,cz,whichtable from news.zz_fbxwb where zgbh='"+uid+"' and lb='1' and sf='2' ";
rs = selectRecord(sql);
while(rs.next())
{
String dxbh = ds.toString(rs.getString(1));
String cz = ds.toString(rs.getString(2));
String whichtable = ds.toString(rs.getString(3));
String str1 = "";//保存中间结果
String str2 = "";//保存中间结果
String sql_1 = "";
ResultSet rs_1 = null;
String id1="",id2="",id3="";
if(whichtable.equals("1"))//在menu表中
{
sql_1 = "select id,id1,id2,id3 from news.menu where id = "+dxbh;
rs_1 = selectRecord(sql_1);
try{
if(!rs_1.next())
return ht;
id1 = ds.toString(rs_1.getString(2));
id2 = ds.toString(rs_1.getString(3));
id3 = ds.toString(rs_1.getString(4));
}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)运行时出错:"+e);}
finally{
if(rs_1!=null)try{ stmt = rs_1.getStatement(); rs_1.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭声明时statement出错"+e);}
}
if(id2.equals("0"))//一级菜单
{
sql_1 = "select id from news.menu where id1='"+id1+"'";
rs_1 = selectRecord(sql_1);
try{
while(rs_1.next())
{
if(!str1.equals(""))
{
str1 = str1 + ",";
}
str1 = str1 + ds.toString(rs_1.getString(1));
}
}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)运行时出错:"+e);}
finally{
if(rs_1!=null)try{ stmt = rs_1.getStatement(); rs_1.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭声明时statement出错"+e);}
}
sql_1 = "select id from news.menuchild where idparent in ("+str1+") and isthis='0'";
rs_1 = selectRecord(sql_1);
try{
while(rs_1.next())
{
if(!str2.equals(""))
{
str2 = str2 + ",";
}
str2 = str2 + ds.toString(rs_1.getString(1));
}
}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)运行时出错:"+e);}
finally{
if(rs_1!=null)try{ stmt = rs_1.getStatement(); rs_1.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭声明时statement出错"+e);}
}
}
if(id3.equals("0")&&!id2.equals("0"))//二级菜单
{
sql_1 = "select id from news.menu where id1='"+id1+"' and id2='"+id2+"'";
rs_1 = selectRecord(sql_1);
try{
while(rs_1.next())
{
if(!str1.equals(""))
{
str1 = str1 + ",";
}
str1 = str1 + ds.toString(rs_1.getString(1));
}
}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)运行时出错:"+e);}
finally{
if(rs_1!=null)try{ stmt = rs_1.getStatement(); rs_1.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭记录集rs时出错"+e);}
if(stmt!=null) try{stmt.close();}catch(Exception e){System.out.println("ArticleBean.getbmqx(String)关闭声明时statement出错"+e);}
}
s
上一篇:
ArticleAction.java
下一篇:
还记得,那年的风车吗?