📄 bugliebiao.java~13~
字号:
package xiangmu;
import java.util.Vector;
import db.*;
import java.sql.Statement;
import java.sql.ResultSet;
import java.util.Iterator;
public class bugliebiao {
public Vector bugitems=new Vector(); //bug列表集合
public bugliebiao() {
}
//把所有的bug添加到bug列表中
public void addbug()throws Exception
{
//连接数据库
Db db1=new Db();
db1.getCon("bugBarrier");
//获得表中数据
Statement stmt=db1.conn.createStatement();
ResultSet rs=stmt.executeQuery("execute addbug11");//把所有的bug添加到记录集中
while(rs.next())
{
bug b=new bug();
b=this.zhuanbian(rs);
bugitems.add(b);
}
db1.closeConnection();
}
//把某项目中的所有的bug添加到bug列表中
public void addbug(String xiangmuid)throws Exception
{
//连接数据库
Db db1=new Db();
db1.getCon("bugBarrier");
//获得表中数据
Statement stmt=db1.conn.createStatement();
ResultSet rs=stmt.executeQuery("execute addbug22 "+xiangmuid);//把所有的bug添加到记录集中
while(rs.next())
{
bug b=new bug();
b=this.zhuanbian(rs);
bugitems.add(b);
}
db1.closeConnection();
}
//把自定义查询后的所有的bug添加到bug列表中 15个查询条件,
public void addbug(String bugid,String bugzhuangtaiid,String bugbiaoti,String bugchuangjianzheid,
String bugsuoshuxiangmuid,String bugliebieid,String bugsuoshumokuaiid,String caozuoxitongid,
String banbenhao,String bugYanzhongchengduid,String bugchuangjianshijian,String bugyujiezhishijian,
String bugchulizheid,String bugchulizheleixing,String bugchulishijian
)throws Exception
{
//生成查询字符串
String s=new String();
//基础字符串
s=" select b.bugyujiezhishijian, b.bugid , bz.bugZhuangtaiZhi,b.bugBiaoti, y1.a1 as 'bugChuangjianzhe1' ,x.xiangmumingcheng,bl.bugleibiezhi,m.mokuaiZhi,c.caozuoxitongzhi,b.banbenhao,byz.bugyanzhongchengduzhi,b.bugchuangjianshijian,b.bugMiaoshu,y2.a2 as 'bugChulizhe1',b.bugChulileixing,b.bugChulishijian,b.bugChulimiaoshu from dbo.bug b,dbo.bugZhuangtai bz,dbo.yonghu y,dbo.xiangmu x,dbo.bugleibie bl,dbo.mokuai m,dbo.caozuoxitong c,dbo.bugyanzhongchengdu byz,(select y.yonghuming a1,b.bugid id1 from yonghu y,bug b where y.yonghuId=b.bugChuangjianzheId) y1,(select y.yonghuming a2,b.bugid id2 from yonghu y,bug b where y.yonghuId=b.bugChulizheId) y2 where b.bugZhuangtaiId=bz.bugZhuangtaiId and b.bugChuangjianzheId=y.yonghuId and b.bugSuoshuxiangmuId=x.xiangmuId and b.bugLeibieId=bl.bugleibieid and b.bugsuoshumokuaiid=m.mokuaiid and c.caozuoxitongid=b.caozuoxitongid and b.bugyanzhongchengduid=byz.bugyanzhongchengduid and y1.id1=y2.id2 and y2.id2=b.bugId";
//查询字符串
if(!bugid.trim().equals(""))
s=s+" and b.bugid='"+bugid.trim()+"' ";
if(!bugzhuangtaiid.trim().equals(""))
s=s+" and b.bugZhuangtaiId='"+bugzhuangtaiid.trim()+"' ";
if(!bugbiaoti.trim().equals(""))
s=s+" and b.bugBiaoti='"+bugbiaoti.trim()+"' ";
if(!bugchuangjianzheid.trim().equals(""))
s=s+" and b.bugChuangjianzheId='"+bugchuangjianzheid.trim()+"' ";
if(!bugsuoshuxiangmuid.trim().equals(""))
s=s+" and b.bugSuoshuxiangmuId='"+bugsuoshuxiangmuid.trim()+"' ";
if(!bugliebieid.trim().equals(""))
s=s+" and b.bugLeibieId='"+bugliebieid.trim()+"' ";
if(!bugsuoshumokuaiid.trim().equals(""))
s=s+" and b.bugSuoshumokuaiId='"+bugsuoshumokuaiid.trim()+"' ";
if(!caozuoxitongid.trim().equals(""))
s=s+" and b.caozuoxitongid='"+caozuoxitongid.trim()+"' ";
if(!banbenhao.trim().equals(""))
s=s+" and b.banbenhao='"+banbenhao.trim()+"' ";
if(!bugYanzhongchengduid.trim().equals(""))
s=s+" and b.bugYanzhongchengduId='"+bugYanzhongchengduid.trim()+"' ";
if(!bugchuangjianshijian.trim().equals(""))
s=s+" and b.bugChuangjianshijian='"+bugchuangjianshijian.trim()+"' ";
if(!bugyujiezhishijian.trim().equals(""))
s=s+" and b.bugYujiezhishijian<'"+bugyujiezhishijian.trim()+"' ";
if(!bugchulizheid.trim().equals(""))
s=s+" and b.bugChulizheId='"+bugchulizheid.trim()+"' ";
if(!bugchulizheleixing.trim().equals(""))
s=s+" and b.bugChulileixing='"+bugchulizheleixing.trim()+"' ";
if(!bugchulishijian.trim().equals(""))
s=s+" and b.bugChulishijian='"+bugchulishijian.trim()+"' ";
//连接数据库
Db db1=new Db();
db1.getCon("bugBarrier");
//获得表中数据
Statement stmt=db1.conn.createStatement();
System.out.println(s);
ResultSet rs=stmt.executeQuery(s);//把所有的bug添加到记录集中
System.out.println("s2222222222222222");
while(rs.next())
{
bug b=this.zhuanbian(rs);
bugitems.add(b);
}
db1.closeConnection();
}
//把某项目中的 个角色需要的bug添加到bug列表中
public void jueseaddbug(String xiangmuid,String yonghuid,String jueseid,String mokuaiid)throws Exception
{
//连接数据库
Db db1=new Db();
db1.getCon("bugBarrier");
//获得表中数据
Statement stmt=db1.conn.createStatement();
//查询字符串
String s=new String();
if(jueseid.equals("1")) //测试人员
{
s="select b.bugyujiezhishijian, b.bugid , bz.bugZhuangtaiZhi,b.bugBiaoti, y1.a1 as 'bugChuangjianzhe1' ,x.xiangmumingcheng,bl.bugleibiezhi,m.mokuaiZhi,c.caozuoxitongzhi,b.banbenhao,byz.bugyanzhongchengduzhi,b.bugchuangjianshijian,b.bugMiaoshu,y2.a2 as 'bugChulizhe1',b.bugChulileixing,b.bugChulishijian,b.bugChulimiaoshu from dbo.bug b,dbo.bugZhuangtai bz,dbo.yonghu y,dbo.xiangmu x,dbo.bugleibie bl,dbo.mokuai m,dbo.caozuoxitong c,dbo.bugyanzhongchengdu byz,(select y.yonghuming a1,b.bugid id1 from yonghu y,bug b where y.yonghuId=b.bugChuangjianzheId) y1,(select y.yonghuming a2,b.bugid id2 from yonghu y,bug b where y.yonghuId=b.bugChulizheId) y2 where b.bugZhuangtaiId=bz.bugZhuangtaiId and b.bugChuangjianzheId=y.yonghuId and b.bugSuoshuxiangmuId=x.xiangmuId and b.bugLeibieId=bl.bugleibieid and b.bugsuoshumokuaiid=m.mokuaiid and c.caozuoxitongid=b.caozuoxitongid and b.bugyanzhongchengduid=byz.bugyanzhongchengduid and y1.id1=y2.id2 and y2.id2=b.bugId and b.bugSuoshuxiangmuId='"+xiangmuid+"' and b.bugChuangjianzheId='"+yonghuid+"' and (b.bugZhuangtaiId='3' or b.bugZhuangtaiId='4' or b.bugZhuangtaiId='5')";
}
else if(jueseid.equals("2"))//开发人员
{
s="select b.bugyujiezhishijian, b.bugid , bz.bugZhuangtaiZhi,b.bugBiaoti, y1.a1 as 'bugChuangjianzhe1' ,x.xiangmumingcheng,bl.bugleibiezhi,m.mokuaiZhi,c.caozuoxitongzhi,b.banbenhao,byz.bugyanzhongchengduzhi,b.bugchuangjianshijian,b.bugMiaoshu,y2.a2 as 'bugChulizhe1',b.bugChulileixing,b.bugChulishijian,b.bugChulimiaoshu from dbo.bug b,dbo.bugZhuangtai bz,dbo.yonghu y,dbo.xiangmu x,dbo.bugleibie bl,dbo.mokuai m,dbo.caozuoxitong c,dbo.bugyanzhongchengdu byz,(select y.yonghuming a1,b.bugid id1 from yonghu y,bug b where y.yonghuId=b.bugChuangjianzheId) y1,(select y.yonghuming a2,b.bugid id2 from yonghu y,bug b where y.yonghuId=b.bugChulizheId) y2 where b.bugZhuangtaiId=bz.bugZhuangtaiId and b.bugChuangjianzheId=y.yonghuId and b.bugSuoshuxiangmuId=x.xiangmuId and b.bugLeibieId=bl.bugleibieid and b.bugsuoshumokuaiid=m.mokuaiid and c.caozuoxitongid=b.caozuoxitongid and b.bugyanzhongchengduid=byz.bugyanzhongchengduid and y1.id1=y2.id2 and y2.id2=b.bugId and b.bugSuoshuxiangmuId='"+xiangmuid+"' and b.bugChulizheId='"+yonghuid+"' and (b.bugZhuangtaiId='1' or b.bugZhuangtaiId='2')";
}
else //项目组长
{
s="select b.bugyujiezhishijian,b.bugid , bz.bugZhuangtaiZhi,b.bugBiaoti, y1.a1 as 'bugChuangjianzhe1' ,x.xiangmumingcheng,bl.bugleibiezhi,m.mokuaiZhi,c.caozuoxitongzhi,b.banbenhao,byz.bugyanzhongchengduzhi,b.bugchuangjianshijian,b.bugMiaoshu,y2.a2 as 'bugChulizhe1',b.bugChulileixing,b.bugChulishijian,b.bugChulimiaoshu from dbo.bug b,dbo.bugZhuangtai bz,dbo.yonghu y,dbo.xiangmu x,dbo.bugleibie bl,dbo.mokuai m,dbo.caozuoxitong c,dbo.bugyanzhongchengdu byz,(select y.yonghuming a1,b.bugid id1 from yonghu y,bug b where y.yonghuId=b.bugChuangjianzheId) y1,(select y.yonghuming a2,b.bugid id2 from yonghu y,bug b where y.yonghuId=b.bugChulizheId) y2 where b.bugZhuangtaiId=bz.bugZhuangtaiId and b.bugChuangjianzheId=y.yonghuId and b.bugSuoshuxiangmuId=x.xiangmuId and b.bugLeibieId=bl.bugleibieid and b.bugsuoshumokuaiid=m.mokuaiid and c.caozuoxitongid=b.caozuoxitongid and b.bugyanzhongchengduid=byz.bugyanzhongchengduid and y1.id1=y2.id2 and y2.id2=b.bugId and b.bugSuoshuxiangmuId='"+xiangmuid+"' and( b.bugYujiezhishijian<getdate() or b.bugZhuangtaiId='7')";
}
if(!mokuaiid.equals(""))
s=s+" and b.bugSuoshumokuaiId='"+mokuaiid+"'";
ResultSet rs=stmt.executeQuery(s);//把所有的bug添加到记录集中
while(rs.next())
{
bug b=this.zhuanbian(rs);
bugitems.add(b);
}
db1.closeConnection();
}
//把一个rs转变为一个bug对象
public bug zhuanbian(ResultSet rs) throws Exception
{
//声明一个bug对象
bug b=new bug();
System.out.println("aaaaa111111111111");
b.setBugYujiezhishijian(rs.getString("bugYujiezhishijian"));
b.setBugId(rs.getString("bugid"));
b.setBugZhuangtai(rs.getString("bugZhuangtaiZhi"));
b.setBugBiaoti(rs.getString("bugBiaoti"));
b.setBugChuangjianzhe(rs.getString("bugChuangjianzhe1"));
b.setBugSuoshuxiangmu(rs.getString("xiangmumingcheng"));
b.setBugLeibie(rs.getString("bugleibiezhi"));
System.out.println("aaaaa22222222222222");
b.setBugSuoshumokuai(rs.getString("mokuaiZhi"));
b.setCaozuoxitong(rs.getString("caozuoxitongzhi"));
b.setBanbenhao(rs.getString("banbenhao"));
b.setBugYanzhongchengdu(rs.getString("bugyanzhongchengduzhi"));
b.setBugChuangjianshijian(rs.getString("bugchuangjianshijian"));
b.setBugMiaoshu(rs.getString("bugMiaoshu"));
System.out.println("aaaaa3333333333");
b.setBugChulizhe(rs.getString("bugChulizhe1"));
b.setBugChulileixing(rs.getString("bugChulileixing"));
b.setBugChulishijian(rs.getString("bugChulishijian"));
b.setBugChulimiaoshu(rs.getString("bugChulimiaoshu"));
return b;
}
public static void main(String args[])throws Exception
{
bugliebiao b1=new bugliebiao();
//b1.addbug();
//b1.addbug("1");
b1.addbug("1","","","","","","","","","","","","","","");
//b1.jueseaddbug("1","7","1","4");
//b1.jueseaddbug("2","3","2","");
//b1.jueseaddbug("2","5","4","");
Iterator i1=b1.bugitems.iterator();
while(i1.hasNext())
{
bug b=new bug();
b=((bug)i1.next());
System.out.println(b.getBugYujiezhishijian());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -