src/com/movie/dao/ReplyDao.java

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.movie.dao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.movie.pojo.Reply;

public class ReplyDao extends Dao{
	int flag=0;

	/**
	 * 查询commentid的回复记录
	 * @return 记录集合list
	 */
	public List<Reply> getReply(String typeId){
		List<Reply> list = new ArrayList<Reply>();
    	try{
    	  this.getConnection();
    	  String sql="select * from v_reply where commentId='"+typeId+"'";
    	  if(typeId.equals("sum")){
    		  sql="select * from v_reply";
    	  }
    	 
    	  pstat=cn.prepareStatement(sql);
    	  rs=pstat.executeQuery();
    	  while(rs.next()){
    		  Reply reply=new Reply();
    		  reply.setId(rs.getString(1));
    		  reply.setReplyTitle(rs.getString("replyTitle"));
    		  reply.setReplyContent(rs.getString("replyContent"));
    		  reply.setReplyTime(rs.getString("replyTime"));
    		  reply.setCommentName(rs.getString("commentTitle"));
    		  reply.setCommentId(rs.getString("commentId"));
    		  reply.setUserName(rs.getString("userName"));
    		  list.add(reply);
    	  }
    	}catch(SQLException e){
    		e.printStackTrace();
    	}
    	return list;
    }

	/**
	 * 删除一条回复记录
	 * @param id
	 * @return 标识flag
	 */
	public int replyDelete(String id){
    	
    	try{
    	  this.getConnection();
    	  String sql="delete tb_reply where id=?";
    	  pstat=cn.prepareStatement(sql);
    	  pstat.setString(1, id);
    	  flag=pstat.executeUpdate();
    	}catch(SQLException e){
    		e.printStackTrace();
    	}
    	return flag;
后面还有 26 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。