<%@ page language="java" contentType="text/html; charset=GBK"%>
<%@page import="com.ehwa.article.ArticleManager"%>
<%@page import="java.util.List"%>
<%@page import="com.ehwa.sql.result.DataSet"%>
<%@page import="com.ehwa.util.DataSetHelper"%>
<%@page import="com.ehwa.resource.ResourceConfig"%>
<%@page import="com.ehwa.util.StringHelper"%>
<%!
private String getDataSQL(int catalogId)
{
StringBuffer buffer = new StringBuffer();
//选取某个栏目已经发布的文章信息
buffer.append("select a.id,a.title,a.show_title,a.brief,a.pubdate,a.type,a.is_picture,a.link_picture,a.link_url,a.link_document,r.link,a.stress_title,a.stress_brief,a.title_font from article a,sys_resource r where a.id=r.object_id and r.type=1");
buffer.append(" and r.category=" + catalogId);
buffer.append(" and r.pubstate=" + ResourceConfig.PUBSTATE_PUBLISH);
buffer.append(" and a.garbage=0");
buffer.append(" order by r.is_top desc,r.orderline desc");
return buffer.toString();
}
private String getDataSQL(int[] catalogIds){
StringBuffer buffer = new StringBuffer();
//选取某个栏目已经发布的文章信息
buffer.append("select a.id,a.title,a.show_title,a.brief,a.pubdate,a.type,a.is_picture,a.link_picture,a.link_url,a.link_document,r.link,a.stress_title,a.stress_brief,a.title_font from article a,sys_resource r where a.id=r.object_id and r.type=1");
buffer.append(" and r.category in("+catalogIds[0]);
for(int i = 1 ; i < catalogIds.length ; i++){
buffer.append(","+catalogIds[i]);
}
buffer.append(")");
buffer.append(" and r.pubstate=" + ResourceConfig.PUBSTATE_PUBLISH);
buffer.append(" and a.garbage=0");
buffer.append(" order by r.is_top desc,a.is_picture desc,r.orderline desc");
return buffer.toString();
}
private String getDataSQLisPic(int catalogId)
{
StringBuffer buffer = new StringBuffer();
//选取某个栏目已经发布的文章信息
buffer.append("select a.id,a.title,a.show_title,a.brief,a.pubdate,a.type,a.is_picture,a.link_picture,a.link_url,a.link_document,r.link,a.stress_title,a.stress_brief,a.title_font from article a,sys_resource r where a.id=r.object_id and r.type=1");
buffer.append(" and r.category=" + catalogId);
buffer.append(" and r.pubstate=" + ResourceConfig.PUBSTATE_PUBLISH);
buffer.append(" and a.garbage=0");
buffer.append(" and is_picture=1");
buffer.append(" order by r.is_top desc,r.orderline desc");
return buffer.toString();
}
%>
<%
final int catalogNews = 6882;
final int catalogReport = 6883;
final int[] catalogIds = {6882,6883};
ArticleManager am = new ArticleManager();
List articleNews = am.list(getDataSQL(catalogIds),5);
List articlePic = am.list(getDataSQLisPic(catalogNews),1);
String picPath = "";
if(articlePic!=null&&articlePic.size()>0){
picPath = ((DataSet)articlePic.get(0)).getString("link_picture");
}
%>