list2.add(rs.getInt(1));
list2.add(rs.getString(2));
list2.add(rs.getString(4));
list2.add(rs.getInt(5));
list2.add(rs.getInt(6));
list2.add(rs.getInt(7));
list.add(list2);
}
return list;
}catch(Exception e){
e.printStackTrace();
return list;
}finally{
dbo.close();
}
}
//delete manager
public int delManager(int id){
String sql = "delete from admin where id = '"+id+"'";
DBO dbo = new DBO();
dbo.open();
try{
int i = dbo.executeUpdate(sql);
if(i == 1)return Constant.SUCCESS;
else return Constant.SYSTEM_ERROR;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//delete login note
public int delLog(int id[]){
DBO dbo=new DBO();
dbo.open();
try{
for(int i = 0;i<id.length;i++){
dbo.executeUpdate("delete from adminlog where id = '"+id[i]+"'");
}
return Constant.SUCCESS;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
}
package com.bean;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.util.Constant;
import com.util.DBO;
/**** @author Administrator**/
public class AfficheBean {
private ResultSet rs;
private List list;
private String date=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
//增加
public int addAffiche(String title,String content,String adder,String ifhide){
String sql = "insert into affiche (title,content,addtime,adder,ifhide) " +
"values ('"+title+"','"+content+"','"+date+"','"+adder+"','"+ifhide+"')";
DBO dbo = new DBO();
dbo.open();
try{
int i = dbo.executeUpdate(sql);
if(i == 1){
return Constant.SUCCESS;
}
else{
return Constant.SYSTEM_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
// update affiche
public int updateAffiche(int id,String title,String content,String adder,String ifhide){
String sql = "update affiche set title = '"+title+"',content='"+content+"',addtime='"+date+"'," +
"adder='"+adder+"',ifhide='"+ifhide+"' where id = '"+id+"' ";
DBO dbo = new DBO();
dbo.open();
try{
int i = dbo.executeUpdate(sql);
if(i == 1){
return Constant.SUCCESS;
}
else{
return Constant.SYSTEM_ERROR;
}
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//delete affiche
public int delAffiche(int id[]){
DBO dbo = new DBO();
dbo.open();
try{
for(int i = 0;i<id.length;i++){
dbo.executeUpdate("delete from affiche where id = '"+id[i]+"'");
}
return Constant.SUCCESS;
}catch(Exception e){
e.printStackTrace();
return Constant.SYSTEM_ERROR;
}finally{
dbo.close();
}
}
//open.close affiche
public int hideAffiche(int id){
String sql = "update affiche set ifhide='1' where id='"+id+"'";
String sql2 = "update affiche set ifhide='0' where id='"+id+"'";
String sql3 = "select ifhide from affiche where id='"+id+"'";
DBO dbo = new DBO();
dbo.open();
try{
rs = dbo.executeQuery(sql3);
rs.next();
int i = rs.getInt(1);
if(i == 1){
int flag = dbo.executeUpdate(sql2);
if(flag == 1)
return Constant.SUCCESS;
else
return Constant.SYSTEM_ERROR;
}
else{
int flag = dbo.executeUpdate(sql);
推荐阅读
- 额定功率、实际功率 测小灯泡的电功率
- 行为偏差高中学生个案分析 学生个案分析
- 妇科炎症吃什么药好,辨清类型再开方 妇科炎症吃什么药好
- 今日立夏,为何立夏节气要吃鸡蛋 立夏为什么要吃蛋
- 2月杭州TOP10酒店 杭州酒店查询
- 最值得看的5部穿越剧 关于穿越时空的电视剧
- 野炊、露营、星空,这才是夏天最正确的玩法 野炊露营
- 2021最洋气的减龄发型图片 短发什么发型好看
- 可还记得QQ游戏大厅? qq游戏论坛