• 大小: 1.52MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-02
  • 语言: Java
  • 标签: 相册  Web  

资源简介

这是一个电子相册,可实现用户注册,登录,验证码验证,本地图片上传在线浏览等功能

资源截图

代码片段和文件信息

package com.ea.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import com.ea.model.Photo;
import com.ea.model.User;

public class PhotoDao {

public List photoList(Connection conUser user) throws Exception {
// import java.util.List;
List photoList= new ArrayList();
Photo photo=null;
String sql =null;
String level=user.getLevel();
if(“high“.equals(level)){
sql = “select * from t_photo order by id desc“;
}else{
int u_id=user.getUserId();
sql = “select * from t_photo pt_user u where u_id=userId and u_id=“+u_id+“ order by id desc“;
}
PreparedStatement pstmt=con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
while(rs.next()){
photo=new Photo();
photo.setId(rs.getInt(1));
photo.setPhotoAddress(rs.getString(2));
photo.setPhotoDescription(rs.getString(3));
photo.setPhtoTime(rs.getString(4));
// photo.setU_id(rs.getInt(5));
photoList.add(photo);
}
return photoList;


public int photoDelete(Connection con Photo photo) throws Exception {
String sql = “delete from t_photo where id=‘“ + photo.getId() + “‘“;
PreparedStatement pstmt=con.prepareStatement(sql);
return pstmt.executeUpdate();
}

public int photoAdd(Connection con Photo photo) throws Exception {
String sql = “insert into t_photo values (null‘“
+ photo.getPhotoAddress() + “‘‘“
+ photo.getPhotoDescription() + “‘‘“
+ photo.getPhotoTime() + “‘‘“
+ photo.getU_id() + “‘)“;
PreparedStatement pstmt=con.prepareStatement(sql);
return pstmt.executeUpdate();
}


public Photo queryPhoto(Connection conint id) throws Exception {
Photo photo = null;
String sql = “select * from t_photo where id=‘“ + id + “‘“;
PreparedStatement pstmt=con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
photo = new Photo();
photo.setId(Integer.valueOf(rs.getString(1)));
photo.setPhotoAddress(rs.getString(2));
photo.setPhotoDescription(rs.getString(3));
photo.setPhtoTime(rs.getString(4));
}
return photo;
}

public int MaxQueryID(Connection con) throws Exception {
String sql = “select max(id) as id from t_photo“;
PreparedStatement pstmt=con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery(sql);
rs.next();
int maxID = rs.getInt(“id“); 
return maxID;

}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        4748  2013-08-24 16:04  db.sql
     目录           0  2014-07-23 10:07  ElectronicAlbum\
     文件         723  2013-08-22 16:11  ElectronicAlbum\.classpath
     文件        1048  2013-08-14 22:31  ElectronicAlbum\.project
     目录           0  2014-07-23 10:07  ElectronicAlbum\.settings\
     文件         503  2013-08-14 22:31  ElectronicAlbum\.settings\.jsdtscope
     文件         105  2013-08-16 20:37  ElectronicAlbum\.settings\org.eclipse.core.resources.prefs
     文件         395  2013-08-14 22:31  ElectronicAlbum\.settings\org.eclipse.jdt.core.prefs
     文件         475  2013-08-14 22:31  ElectronicAlbum\.settings\org.eclipse.wst.common.component
     文件         345  2013-08-14 22:31  ElectronicAlbum\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2013-08-14 22:31  ElectronicAlbum\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2013-08-14 22:31  ElectronicAlbum\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\classes\
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\classes\com\
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\classes\com\ea\
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\classes\com\ea\dao\
     文件        3652  2013-08-24 10:51  ElectronicAlbum\build\classes\com\ea\dao\PhotoDao.class
     文件        2162  2013-08-24 14:23  ElectronicAlbum\build\classes\com\ea\dao\UserDao.class
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\classes\com\ea\model\
     文件        1471  2013-08-24 10:22  ElectronicAlbum\build\classes\com\ea\model\Photo.class
     文件        2503  2013-08-24 14:17  ElectronicAlbum\build\classes\com\ea\model\User.class
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\classes\com\ea\util\
     文件         647  2013-08-22 16:11  ElectronicAlbum\build\classes\com\ea\util\CountTime.class
     文件        1669  2013-08-22 16:11  ElectronicAlbum\build\classes\com\ea\util\DbUtil.class
     文件        2882  2013-08-24 14:38  ElectronicAlbum\build\classes\com\ea\util\MyPagination.class
     文件        1974  2013-08-24 10:00  ElectronicAlbum\build\classes\com\ea\util\ScanPagination.class
     文件         518  2013-08-22 16:11  ElectronicAlbum\build\classes\com\ea\util\StringUtil.class
     目录           0  2014-07-23 10:07  ElectronicAlbum\build\classes\com\ea\web\
     文件        1717  2013-08-24 00:54  ElectronicAlbum\build\classes\com\ea\web\linkUrl.class
     文件        3838  2013-08-24 12:20  ElectronicAlbum\build\classes\com\ea\web\LoginAction.class
............此处省略97个文件信息

评论

共有 条评论