首页>代码>JSP struts2开发都市供求信息网源代码下载>/都市供求信息网/15/src/com/yxq/action/IndexAction.java
package com.yxq.action;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;

import com.yxq.actionSuper.MySuperAction;
import com.yxq.dao.OpDB;

public class IndexAction extends MySuperAction {	
	public static TreeMap typeMap;					
	public static TreeMap searchMap;				

	public String execute() throws Exception {
		/* 查询所有收费信息,按发布时间降序排列 */
		OpDB myOp=new OpDB();
		String sql1="select * from tb_info where (info_state='1') and (info_payfor = '1') order by info_date desc";
		List payforlist=myOp.OpListShow(sql1,null);
		request.setAttribute("payforlist",payforlist);		

		/* 查询免费信息,按发布时间降序排列 */
		List allsublist=new ArrayList();
		if(typeMap!=null&&typeMap.size()!=0){
			Iterator itype=typeMap.keySet().iterator();			
			String sql2="SELECT TOP 5 * FROM tb_info WHERE (info_type = ?) AND (info_state='1') AND (info_payfor = '0') ORDER BY info_date DESC";			
			while(itype.hasNext()){
				Integer sign=(Integer)itype.next();
				Object[] params={sign};
				List onesublist=myOp.OpListShow(sql2, params);
				allsublist.add(onesublist);				
			}
			
		}
		request.setAttribute("allsublist",allsublist);
		session.put("typeMap",typeMap);
		session.put("searchMap",searchMap);		
		
		return SUCCESS;
	}
	
	static{
		OpDB myOp=new OpDB();
		
		/* 获取所有信息类别 */
		String sql="select * from tb_type order by type_sign";
		typeMap=myOp.OpGetListBox(sql,null);
		if(typeMap==null)
			typeMap=new TreeMap();

		/* 初始化搜索功能的下拉列表 */
		searchMap=new TreeMap();
		searchMap.put("ID值","id");
		searchMap.put("信息标题","info_title");
		searchMap.put("信息内容","info_content");
		searchMap.put("联系人","info_linkman");
		searchMap.put("联系电话","info_phone");
		searchMap.put("E-mail地址","info_email");
	}
}
最近下载更多
qq2528732622  LV8 2020年6月18日
泡泡雨  LV8 2020年6月14日
张三aa  LV9 2020年5月27日
dafengche  LV8 2020年3月19日
13674731037  LV2 2020年2月15日
Cqi小七  LV9 2019年6月28日
18937165893  LV2 2019年6月23日
花花yayayaya  LV2 2019年6月16日
vvcvv_cool  LV8 2019年5月28日
qq_1344127185  LV27 2019年4月5日
最近浏览更多
fire1234  LV2 3月11日
uni-code_0123  LV1 2023年11月29日
Joe___  LV1 2023年11月15日
adminadminsqwqe  LV7 2023年3月21日
tczsss  LV2 2022年12月1日
dasdascccf  LV10 2022年6月15日
1306878374  LV13 2022年4月11日
joker_001  LV1 2022年3月7日
暂无贡献等级
15095376924  LV1 2021年12月25日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友