资源简介
基于ssh的个人博客系统适合初学者参考使用
代码片段和文件信息
package Dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import Model.Blog;
import Model.Comment;
import Model.Count;
import Model.PageBean;
import Model.PageBean2;
import Model.User;
import Model.XinZuo;
import Util.DateUtil;
import Util.StringUtil;
public class BlogDao {
public List BlogList(Connection conPageBean pageBeanBlog s_blog) throws Exception
{
List BlogList=new ArrayList();
StringBuffer sb=new StringBuffer(“SELECT * FROM t_blog t1t_blogtype t2 t_user t3 WHERE t1.blogTypeId=t2.typeId AND t3.userId=t1.blogAuthorId “);
if(StringUtil.isNotEmpty(s_blog.getBlogtitle()))
{
sb.append(“ and t1.blogtitle like ‘%“+s_blog.getBlogtitle()+“%‘“);
}
if(s_blog.getBlogTypeId()!=-1)
{
sb.append(“ and t1.blogTypeId=“+s_blog.getBlogTypeId());
}
if(s_blog.getBlogAuthorId()!=-1)
{
sb.append(“ and t1.blogAuthorId=“+s_blog.getBlogAuthorId());
}
sb.append(“ order by t1.blogDate desc“);
if(pageBean!=null)
{
sb.append(“ limit “+pageBean.getStart()+““+pageBean.getPageSize());
}
PreparedStatement ps=con.prepareStatement(sb.toString());
ResultSet rs=ps.executeQuery();
while(rs.next())
{
Blog blog=new Blog();
blog.setBlogContent(rs.getString(“blogContent“));
blog.setBlogDate(DateUtil.formatString(rs.getString(“blogDate“)“yyyy-MM-dd HH:mm:ss“));
blog.setBlogtitle(rs.getString(“blogtitle“));
blog.setBlogAuthorId(rs.getInt(“blogAuthorId“));
blog.setBlogId(rs.getInt(“blogId“));
blog.setUserName(rs.getString(“userName“));
blog.setNickName(rs.getString(“nickName“));
BlogList.add(blog);
}
return BlogList;
}
public List BlogList2(Connection conBlog s_blog) throws Exception
{
List BlogList=new ArrayList();
StringBuffer sb=new StringBuffer(“SELECT * FROM t_blog t1t_blogtype t2 t_user t3 WHERE t1.blogTypeId=t2.typeId AND t3.userId=t1.blogAuthorId “);
if(StringUtil.isNotEmpty(s_blog.getBlogtitle()))
{
sb.append(“ and t1.blogtitle like ‘%“+s_blog.getBlogtitle()+“%‘“);
}
if(s_blog.getBlogTypeId()!=-1)
{
sb.append(“ and t1.blogTypeId=“+s_blog.getBlogTypeId());
}
if(s_blog.getBlogAuthorId()!=-1)
{
sb.append(“ and t1.blogAuthorId=“+s_blog.getBlogAuthorId());
}
sb.append(“ order by t1.blogDate desc“);
PreparedStatement ps=con.prepareStatement(sb.toString());
ResultSet rs=ps.executeQuery();
while(rs.next())
{
Blog blog=new Blog();
blog.setBlogContent(rs.getString(“blogContent“));
blog.setBlogDate(DateUtil.formatString(rs.getString(“blogDate“)“yyyy-MM-dd HH:mm:ss“));
blog.setBlogtitle(rs.getString(“blogtitle“));
blog.setBlogAuthorId(rs.getInt(“blogAuthorId“));
blog.setBlogId(rs.getInt(“blogId“));
blog.setUserName(rs.getString(“userName“));
blog.setNickName(rs.getString(“nickName“));
BlogList.add
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 20553 2014-04-18 11:25 _泪jsp博客系统(1)\bb.sql
文件 181572 2014-04-18 10:52 _泪jsp博客系统(1)\Desktop\QQ截图20140418105202.png
文件 851693 2014-04-18 10:52 _泪jsp博客系统(1)\Desktop\QQ截图20140418105235.png
文件 732104 2014-04-18 10:53 _泪jsp博客系统(1)\Desktop\QQ截图20140418105323.png
文件 624760 2014-04-18 10:54 _泪jsp博客系统(1)\Desktop\QQ截图20140418105418.png
文件 158085 2014-04-18 10:55 _泪jsp博客系统(1)\Desktop\QQ截图20140418105507.png
文件 175740 2014-04-18 10:57 _泪jsp博客系统(1)\Desktop\QQ截图20140418105736.png
文件 574143 2014-04-18 10:58 _泪jsp博客系统(1)\Desktop\QQ截图20140418105857.png
文件 548 2014-03-31 21:30 _泪jsp博客系统(1)\Desktop\WorkSpace2\.classpath
文件 1037 2014-04-02 20:40 _泪jsp博客系统(1)\Desktop\WorkSpace2\.project
文件 503 2014-03-26 09:21 _泪jsp博客系统(1)\Desktop\WorkSpace2\.settings\.jsdtscope
文件 100 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\.settings\com.genuitec.eclipse.core.prefs
文件 364 2014-03-26 09:21 _泪jsp博客系统(1)\Desktop\WorkSpace2\.settings\org.eclipse.jdt.core.prefs
文件 464 2014-04-02 20:40 _泪jsp博客系统(1)\Desktop\WorkSpace2\.settings\org.eclipse.wst.common.component
文件 305 2014-03-26 09:21 _泪jsp博客系统(1)\Desktop\WorkSpace2\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2014-03-26 09:21 _泪jsp博客系统(1)\Desktop\WorkSpace2\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2014-03-26 09:21 _泪jsp博客系统(1)\Desktop\WorkSpace2\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 210 2014-04-16 10:10 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\blog.properties
文件 13036 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Dao\BlogDao.class
文件 3318 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Dao\BlogTypeDao.class
文件 4019 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Dao\UserDao.class
文件 2507 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Filter\LoginFilter.class
文件 3547 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\Blog.class
文件 1013 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\BlogType.class
文件 1493 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\Comment.class
文件 646 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\Count.class
文件 799 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\PageBean.class
文件 809 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\PageBean2.class
文件 3936 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\User.class
文件 734 2014-07-01 15:52 _泪jsp博客系统(1)\Desktop\WorkSpace2\build\classes\Model\XinZuo.class
............此处省略124个文件信息
评论
共有 条评论