if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
// get one affiche to update
public List getOneAffiche(int id){
String sql = "select * from affiche where id = '"+id+"'";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
list.add(rs.getInt(1));
list.add(rs.getString(2));
list.add(rs.getString(3));
list.add(rs.getString(4));
list.add(rs.getString(5));
list.add(rs.getString(6));
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
//首页显示所有
public List getAllAffiche(){
String sql = "select id,content,addtime from affiche where ifhide='1' order by addtime desc ";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
List list2=new ArrayList();
list2.add(rs.getInt(1));
list2.add(rs.getString(2));
list2.add(rs.getString(3));
list.add(list2);
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
public List getAllAfficheManage(){
String sql = "select id,title,addtime,adder,ifhide from affiche order by addtime desc ";
DBO dbo = new DBO();
list = new ArrayList();
dbo.open();
try{
rs = dbo.executeQuery(sql);
while(rs.next()){
List list2=new ArrayList();
list2.add(rs.getInt("id"));
list2.add(rs.getString("title"));
list2.add(rs.getString("addtime"));
list2.add(rs.getString("adder"));
list2.add(rs.getInt("ifhide"));
list.add(list2);
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
public int addVote(String title,String ifhide ,String item1,String item2,String item3,String item4,String item5,String item6,
String tick1,String tick2 ,String tick3 ,String tick4,String tick5,String tick6 ){
String sql = "insert into vote ( title, ifhide , item1, item2, item3, item4,item5,item6,tick1, tick2 , tick3 , tick4,tick5,tick6,addtime ) " +
"values( '"+title+"', '"+ifhide+"' , '"+item1+"', '"+item2+"', '"+item3+"', '"+item4+"','"+item5+"','"+item6+"','"+tick1+"', '"+tick2+"' ," +
" '"+tick3+"' , '"+tick4+"' , '"+tick5+"' , '"+tick6+"' , '"+date+"' )";
DBO dbo = new DBO();
dbo.open();
try{
if(ifhide.equals("1")){
dbo.executeUpdate("update vote set ifhide='0' ");
}
int flag = dbo.executeUpdate(sql);
if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
// 修改 public int updateVote(int id,String title,String ifhide ,String item1,String item2,String item3,String item4,String item5,String item6,
String tick1,String tick2 ,String tick3 ,String tick4,String tick5,String tick6 ){
String sql = "update vote set title='"+title+"', ifhide='"+ifhide+"' , item1='"+item1+"', item2='"+item2+"'," +
" item3='"+item3+"', item4='"+item4+"',item5='"+item5+"',item6='"+item6+"',tick1='"+tick1+"', tick2='"+tick2+"' ,tick3='"+tick3+"' , " +
"tick4='"+tick4+"',tick5='"+tick5+"',tick6='"+tick6+"' where id='"+id+"'";
DBO dbo = new DBO();
dbo.open();
try{
if(ifhide.equals("1")){
dbo.executeUpdate("update vote set ifhide='0' ");
}
int flag = dbo.executeUpdate(sql);
if(flag == 1)
推荐阅读
- 额定功率、实际功率 测小灯泡的电功率
- 行为偏差高中学生个案分析 学生个案分析
- 妇科炎症吃什么药好,辨清类型再开方 妇科炎症吃什么药好
- 今日立夏,为何立夏节气要吃鸡蛋 立夏为什么要吃蛋
- 2月杭州TOP10酒店 杭州酒店查询
- 最值得看的5部穿越剧 关于穿越时空的电视剧
- 野炊、露营、星空,这才是夏天最正确的玩法 野炊露营
- 2021最洋气的减龄发型图片 短发什么发型好看
- 可还记得QQ游戏大厅? qq游戏论坛