package com.yxq.action;
import java.util.List;
import com.yxq.actionSuper.AdminSuperAction;
import com.yxq.dao.OpDB;
import com.yxq.model.CreatePage;
public class AdminAction extends AdminSuperAction {
/** 功能:管理员操作-进行列表显示信息 */
public String ListShow(){
request.setAttribute("mainPage","../info/listshow.jsp");
session.remove("adminOP");
int infoType=showType.getInfoType();
String stateType=showType.getStateType();
String payforType=showType.getPayforType();
session.put("infoType",Integer.valueOf(infoType)); //保存已选择的“信息类别”的选项
session.put("payforType",payforType); //保存已选择的“付费状态”的选项
session.put("stateType",stateType); //保存已选择的“审核状态”的选项
String sqlall="";
String sqlsub="";
Object[] params=null;
String mark="";
int perR=8;
if(!stateType.equals("all")&&!payforType.equals("all")){ //没有同时选择“付费状态”与“审核状态”中的“全部”选项
mark="1";
sqlall="SELECT * FROM tb_info WHERE (info_type=?) AND (info_state=?) AND (info_payfor=?) ORDER BY info_date DESC";
sqlsub="SELECT TOP "+perR+" * FROM tb_info WHERE (info_type=?) AND (info_state=?) AND (info_payfor=?) ORDER BY info_date DESC";
params=new Object[3];
params[0]=Integer.valueOf(infoType);
params[1]=stateType;
params[2]=payforType;
}else if(stateType.equals("all")&&payforType.equals("all")){ //同时选择了“付费状态”与“审核状态”中的“全部”选项
mark="2";
sqlall="SELECT * FROM tb_info WHERE (info_type=?) ORDER BY info_date DESC";
sqlsub="SELECT TOP "+perR+" * FROM tb_info WHERE (info_type=?) ORDER BY info_date DESC";
params=new Object[1];
params[0]=Integer.valueOf(infoType);
}else if(payforType.equals("all")){ //选择了“付费状态”中的“全部”选项,“审核状态”选项任意
mark="3";
sqlall="SELECT * FROM tb_info WHERE (info_type=?) AND (info_state=?) ORDER BY info_date DESC";
sqlsub="SELECT TOP "+perR+" * FROM tb_info WHERE (info_type=?) AND (info_state=?) ORDER BY info_date DESC";
params=new Object[2];
params[0]=Integer.valueOf(infoType);
params[1]=stateType;
}
else if(stateType.equals("all")){ //选择了“审核状态”中的“全部”选项,“付费状态”选项任意
mark="4";
sqlall="SELECT * FROM tb_info WHERE (info_type=?) AND (info_payfor=?) ORDER BY info_date DESC";
sqlsub="SELECT TOP "+perR+" * FROM tb_info WHERE (info_type=?) AND (info_payfor=?) ORDER BY info_date DESC";
params=new Object[2];
params[0]=Integer.valueOf(infoType);
params[1]=payforType;
}
String strCurrentP=request.getParameter("showpage");
String gowhich="admin_ListShow.action";
OpDB myOp=new OpDB();
CreatePage createPage=myOp.OpCreatePage(sqlall, params,perR,strCurrentP,gowhich); //调用OpDB类中的OpCreatePage()方法计算出总记录数、总页数,并且设置当前页码,这些信息都封装到了createPage对象中
int currentP=createPage.getCurrentP();
if(currentP>1){
int top=(currentP-1)*perR;
if(mark.equals("1")){
sqlsub="SELECT TOP "+perR+" * FROM tb_info i WHERE (info_type = ?) AND (info_payfor = ?) AND (info_state = ?) AND (info_date < (SELECT MIN(info_date) FROM (SELECT TOP "+top+" (info_date) FROM tb_info WHERE (info_type = i.info_type) AND (info_payfor = i.info_payfor) AND (info_state = i.info_state) ORDER BY info_date DESC) AS mindate)) ORDER BY info_date DESC";
}
else if(mark.equals("2")){
sqlsub="SELECT TOP "+perR+" * FROM tb_info i WHERE (info_type = ?) AND (info_date < (SELECT MIN(info_date) FROM (SELECT TOP "+top+" (info_date) FROM tb_info WHERE (info_type = i.info_type) ORDER BY info_date DESC) AS mindate)) ORDER BY info_date DESC";
}
else if(mark.equals("3")){
sqlsub="SELECT TOP "+perR+" * FROM tb_info i WHERE (info_type = ?) AND (info_state = ?) AND (info_date < (SELECT MIN(info_date) FROM (SELECT TOP "+top+" (info_date) FROM tb_info WHERE (info_type = i.info_type) AND (info_state = i.info_state) ORDER BY info_date DESC) AS mindate)) ORDER BY info_date DESC";
}
else if(mark.equals("4")){
sqlsub="SELECT TOP "+perR+" * FROM tb_info i WHERE (info_type = ?) AND (info_payfor = ?) AND (info_date < (SELECT MIN(info_date) FROM (SELECT TOP "+top+" (info_date) FROM tb_info WHERE (info_type = i.info_type) AND (info_payfor = i.info_payfor) ORDER BY info_date DESC) AS mindate)) ORDER BY info_date DESC";
}
}
List adminlistshow=myOp.OpListShow(sqlsub, params);
request.setAttribute("adminlistshow",adminlistshow);
request.setAttribute("createpage",createPage);
return SUCCESS;
}
/** 功能:管理员操作-显示要审核的信息 */
public String CheckShow(){
request.setAttribute("mainPage","../info/checkshow.jsp");
comebackState();
String sql="SELECT * FROM tb_info WHERE (id = ?)";
String checkID=request.getParameter("checkID");
if(checkID==null||checkID.equals(""))
checkID="-1";
Object[] params={checkID};
OpDB myOp=new OpDB();
infoSingle=myOp.OpSingleShow(sql, params);
if(infoSingle==null){ //信息不存在
request.setAttribute("mainPage","/pages/error.jsp");
addFieldError("AdminShowNoExist",getText("city.singleshow.no.exist"));
}
return SUCCESS;
}
/** 功能:管理员操作-审核信息(更新数据库) */
public String Check(){
session.put("adminOP","Check"); //记录当前操作为“审核信息”
String checkID=request.getParameter("checkID");
String sql="UPDATE tb_info SET info_state = 1 WHERE (id = ?)";
Object[] params={checkID};
OpDB myOp=new OpDB();
int i=myOp.OpUpdate(sql, params);
if(i>0){ //审核信息成功
return "checkSuccess";
}
else{ //审核信息失败
comebackState();
addFieldError("AdminCheckUnSuccess",getText("city.admin.check.no.success"));
request.setAttribute("mainPage","/pages/error.jsp");
return "UnSuccess";
}
}
/** 功能:管理员操作-删除信息(更新数据库) */
public String Delete(){
session.put("adminOP","Delete"); //记录当前操作为“删除信息”
String deleteID=request.getParameter("deleteID");
String sql="DELETE tb_info WHERE (id = ?)";
Object[] params={deleteID};
OpDB myOp=new OpDB();
int i=myOp.OpUpdate(sql, params);
if(i>0){ //删除信息成功
return "deleteSuccess";
}
else{ //删除信息失败
comebackState();
addFieldError("AdminDeleteUnSuccess",getText("city.admin.delete.no.success"));
request.setAttribute("mainPage","/pages/error.jsp");
return "UnSuccess";
}
}
/** 功能:管理员操作-显示要进行付费设置的信息 */
public String SetMoneyShow(){
request.setAttribute("mainPage","../info/moneyshow.jsp");
String moneyID=request.getParameter("moneyID");
if(moneyID==null||moneyID.equals(""))
moneyID="-1";
String sql="SELECT * FROM tb_info WHERE (id = ?)";
Object[] params={moneyID};
OpDB myOp=new OpDB();
infoSingle=myOp.OpSingleShow(sql, params);
if(infoSingle==null){ //信息不存在
request.setAttribute("mainPage","/pages/error.jsp");
addFieldError("AdminShowNoExist",getText("city.singleshow.no.exist"));
}
return SUCCESS;
}
/** 功能:管理员操作-设置已付费信息(更新数据库) */
public String SetMoney(){
String moneyID=request.getParameter("moneyID");
if(moneyID==null||moneyID.equals(""))
moneyID="-1";
String sql="UPDATE tb_info SET info_payfor=1 WHERE (id = ?)";
Object[] params={Integer.valueOf(moneyID)};
OpDB myOp=new OpDB();
int i=myOp.OpUpdate(sql, params);
if(i>0){ //信息付费设置成功
addFieldError("AdminSetMoneySuccess",getText("city.admin.setmoney.success"));
request.setAttribute("mainPage","/pages/error.jsp");
return "setMoneySuccess";
}
else{ //信息付费设置失败
addFieldError("AdminSetMoneyUnSuccess",getText("city.admin.setmoney.no.success"));
request.setAttribute("mainPage","/pages/error.jsp");
return "UnS
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目源码】java都市供求信息网 SQLServer2005数据库 (1)将MR\01\WebRoot\Database文件夹中的数据库文件拷贝到本地机器中。 (2)打开SQLServer2005企业管理器,展开“数据库”节点,点击鼠标右键选择“附加”,即可打开附加数据库窗体,单击该窗体中的“附加”按钮,打开选择附加文件对话框,选择本项目数据库地址选择db_CityInfo_Data.MDF文件。单击“确定”按钮。即可完成数据库的复制。 将程序导入到MyEclipse中,并发布运行 (1)将“MR\01\”文件夹拷贝到MyEclipse的工作空间中。 (2)启动MyEclipse,在左侧的“包资源管理器”中,单击鼠标右键,选择“Import”菜单项,在弹出的对话框中,展开General节点,并选择“Existing Projects into Workspace”子节点。
资源推荐
资源详情
资源评论
收起资源包目录
项目源码java都市供求信息网 (106个子文件)
InfoAction.class 10KB
AdminAction.class 9KB
OpDB.class 5KB
CreatePage.class 3KB
DB.class 3KB
IndexAction.class 3KB
InfoSingle.class 3KB
LogInOutAction.class 2KB
MySuperAction.class 1KB
DoString.class 1KB
AdminSuperAction.class 1024B
AdminShowType.class 968B
SearchInfo.class 938B
InfoSuperAction.class 911B
UserSingle.class 751B
.classpath 967B
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 582B
程序使用说明.doc 76KB
logon_top.gif 32KB
logo.gif 7KB
menu.gif 6KB
b_logon.gif 2KB
b_reset.gif 2KB
admin_exit.gif 2KB
admin_index.gif 2KB
m_index.gif 1KB
logon_middle.gif 574B
logon_end.gif 262B
back.gif 51B
struts2-core-2.0.11.jar 2.22MB
freemarker-2.3.8.jar 784KB
xwork-2.0.4.jar 445KB
msbase.jar 280KB
ognl-2.6.11.jar 164KB
mssqlserver.jar 66KB
msutil.jar 58KB
commons-logging-1.0.4.jar 37KB
AdminAction.java 11KB
InfoAction.java 11KB
OpDB.java 4KB
CreatePage.java 2KB
DB.java 2KB
IndexAction.java 2KB
InfoSingle.java 2KB
LogInOutAction.java 1KB
MySuperAction.java 868B
DoString.java 651B
AdminSuperAction.java 646B
AdminShowType.java 557B
InfoSuperAction.java 540B
SearchInfo.java 506B
UserSingle.java 408B
admin_top.jpg 68KB
pcard1.jpg 62KB
end.jpg 28KB
default_m.jpg 24KB
pcard2.jpg 23KB
admin_menu.jpg 19KB
default_e.jpg 16KB
leftD.jpg 1KB
default_t.jpg 1KB
leftS.jpg 937B
InputCheck.js 367B
DeleteCheck.js 68B
.jsdtscope 500B
addInfo.jsp 5KB
listshow.jsp 5KB
right.jsp 4KB
default.jsp 4KB
listshow.jsp 4KB
checkshow.jsp 4KB
singleshow.jsp 3KB
moneyshow.jsp 3KB
calendar.jsp 3KB
left.jsp 3KB
searchshow.jsp 3KB
top.jsp 3KB
Login.jsp 2KB
IndexTemp.jsp 1KB
AdminTemp.jsp 1KB
main.jsp 1008B
top.jsp 683B
error.jsp 529B
page.jsp 500B
default.jsp 390B
end.jsp 333B
end.jsp 333B
index.jsp 104B
db_CityInfo_log.LDF 504KB
db_CityInfo_Data.MDF 1.88MB
MANIFEST.MF 36B
.mymetadata 279B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.jdt.core.prefs 330B
.project 1KB
package.properties 3KB
package.properties 3KB
struts.properties 27B
struts.properties 27B
共 106 条
- 1
- 2
资源评论
西攻城狮北
- 粉丝: 8416
- 资源: 434
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功