package com.dao;
import java.sql.*;
import java.util.Collection;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import com.core.Database;
import com.core.FinalConstants;
import com.core.ParamUtils;
import com.model.User;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: MR</p>
* @author BWM
* @version 1.0
*/
public class Dbuser extends User {
private User u = new User();
//不使初始化select
public Dbuser(){}
//使用数据库始化update
public Dbuser(String sql) {
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = Database.getConnection();
ps = con.prepareStatement(FinalConstants.SELECT_USER+sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs = ps.executeQuery();
if (rs.next()) {
u.setUid(ParamUtils.getSqlString(rs.getString("uid")));
u.setPassword(ParamUtils.getSqlString(rs.getString("password")));
u.setName(ParamUtils.getSqlString(rs.getString("name")));
u.setRegqu(ParamUtils.getSqlString(rs.getString("regqu")));
u.setReganswer(ParamUtils.getSqlString(rs.getString("reganswer")));
u.setIid(ParamUtils.getSqlString(rs.getString("iid")));
u.setSex(rs.getInt("sex"));
u.setAge(rs.getInt("age"));
u.setTel(ParamUtils.getSqlString(rs.getString("tel")));
u.setEmail(ParamUtils.getSqlString(rs.getString("email")));
u.setQq(ParamUtils.getSqlString(rs.getString("qq")));
u.setRegtime(ParamUtils.getSqlString(rs.getString("regtime")));
u.setAddress(ParamUtils.getSqlString(rs.getString("address")));
u.setHttp(ParamUtils.getSqlString(rs.getString("http")));
u.setStatus(rs.getInt("status"));
u.setState(rs.getInt("state"));
u.setResume(ParamUtils.getSqlString(rs.getString("resume")));
}
} catch (SQLException e) {
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
System.out.println(ps+" Dbuser(String sql) "+u.getUid());
try {
if (ps != null) {
ps.close();
ps = null;
}
} catch (SQLException e) {
ps = null;
}
try {
if (con != null) {
con.close();
con = null;
}
} catch (SQLException e) {
con = null;
}
}
}
//使用内建对像初始化insert
public Dbuser(HttpServletRequest request) {
u.setUid(ParamUtils.getRequestString(request, "uid"));
u.setPassword(ParamUtils.getRequestString(request, "password"));
u.setName(ParamUtils.getRequestString(request, "name"));
u.setRegqu(ParamUtils.getRequestString(request, "regqu"));
u.setReganswer(ParamUtils.getRequestString(request, "reganswer"));
u.setSex(ParamUtils.getIntParameter(request, "sex"));
u.setAge(ParamUtils.getIntParameter(request, "age"));
u.setIid(ParamUtils.getRequestString(request, "iid"));
u.setTel(ParamUtils.getRequestString(request, "tel"));
u.setEmail(ParamUtils.getRequestString(request, "email"));
u.setQq(ParamUtils.getRequestString(request, "qq"));
u.setAddress(ParamUtils.getRequestString(request, "address"));
u.setHttp(ParamUtils.getRequestString(request, "http"));
u.setStatus(ParamUtils.getIntParameter(request, "status"));
u.setState(ParamUtils.getIntParameter(request, "state"));
u.setResume(ParamUtils.getRequestString(request, "resume"));
}
//注册时间插入系统时间
public boolean Insert() {
boolean b = false;
Connection con = null;
PreparedStatement ps = null;
try {
con = Database.getConnection();
ps = con.prepareStatement(FinalConstants.INSERT_USER);
System.out.println("Dbuser.java中:"+FinalConstants.INSERT_USER+"结束");
ps.setString(1, u.getUid());
ps.setString(2, u.getPassword());
ps.setString(3, u.getName());
ps.setString(4, u.getRegqu());
ps.setString(5, u.getReganswer());
ps.setString(6, u.getIid());
ps.setInt(7, u.getSex());
ps.setInt(8, u.getAge());
ps.setString(9, u.getTel());
ps.setString(10, u.getEmail());
ps.setString(11, u.getQq());
ps.setString(12, u.getAddress());
ps.setString(13, u.getHttp());
ps.setInt(14, u.getStatus());
ps.setInt(15, u.getState());
ps.setString(16, u.getResume());
if (ps.executeUpdate() > 0) {
b = true;
} else {
b = false;
}
} catch (SQLException e) {
b = false;
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
System.out.println(ps+" Dbuser.Insert()");
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
ps = null;
}
try {
if (con != null) {
con.close();
}
} catch (SQLException e) {
con = null;
}
}
return b;
}
private boolean Update() {
boolean b = false;
Connection con = null;
PreparedStatement ps = null;
try {
con = Database.getConnection();
ps = con.prepareStatement(FinalConstants.UPDATE_USER);
ps.setString(1, u.getPassword());
ps.setString(2, u.getName());
ps.setString(3, u.getIid());
ps.setInt(4, u.getSex());
ps.setInt(5, u.getAge());
ps.setString(6, u.getTel());
ps.setString(7, u.getEmail());
ps.setString(8, u.getQq());
ps.setString(9, u.getAddress());
ps.setString(10, u.getHttp());
ps.setInt(11, u.getStatus());
ps.setInt(12, u.getState());
ps.setString(13, u.getResume());
ps.setString(14, u.getUid());
if (ps.executeUpdate() > 0) {
b = true;
} else {
b = false;
}
} catch (SQLException e) {
b = false;
e.printStackTrace();
} finally {
System.out.println(ps+" Dbuser.Update() ");
try {
if (ps != null) {
ps.close();
}
} catch (SQLException e) {
ps = null;
}
try {
if (con != null) {
con.close();
}
} catch (SQLException e) {
con = null;
}
}
return b;
}
private boolean Update_m() {
boolean b = false;
Connection con = null;
PreparedStatement ps = null;
try {
con = Database.getConnection();
ps = con.prepareStatement(FinalConstants.UPDATE_USER_M);
ps.setInt(1, u.getStatus());
ps.setInt(2, u.getState());
ps.setString(3, u.getUid());
if (ps.executeUpdate() > 0) {
b = true;
} else {
b = false;
}
} catch (SQLException e) {
没有合适的资源?快使用搜索试试~ 我知道了~
【项目源码】java企业门户网站项目 配置源程序 MySQL数据库.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共244个文件
jsp:89个
gif:58个
class:35个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 122 浏览量
2024-05-16
14:26:31
上传
评论
收藏 2.01MB ZIP 举报
温馨提示
【项目源码】java企业门户网站项目 配置源程序 MySQL数据库.zip
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/DOC.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
共 244 条
- 1
- 2
- 3
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/3b152e7ef79f41c093ee2152a38bf133_weixin_42132177.jpg!1)
处处清欢
- 粉丝: 174
- 资源: 2563
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- STN4526S8RG-VB一款N-Channel沟道SOP8的MOSFET晶体管参数介绍与应用说明
- CANalyzer 使用指南
- STN4480S8RG-VB一款N-Channel沟道SOP8的MOSFET晶体管参数介绍与应用说明
- 政务信息化项目 验收材料编制指南
- dirent.h用于读取和操作目录项的函数声明和数据类型定义
- 儿童节快乐html网页.zip
- 编译原理 - Compilers - Principles, Techniques, & Tools
- PDMS平面出图-BFDrawing智能出图系统说明文档
- 后缀表达式求值-多语言版(c++ java python等).doc
- Ansible 角色管理 docker-ce 安装并通过 daemon.json 进行配置
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)