package com.java1234.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.java1234.model.User;
public class UserDao {
public User login(Connection con,User user)throws Exception{
User resultUser=null;
String sql="select * from t_user where userName=? and password=?";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1, user.getUserName());
pstmt.setString(2, user.getPassword());
ResultSet rs=pstmt.executeQuery();
if(rs.next()){
resultUser=new User();
resultUser.setUserId(rs.getInt("userId"));
resultUser.setUserName(rs.getString("userName"));
resultUser.setPassword(rs.getString("password"));
}
return resultUser;
}
}
最近下载更多
pangzhihui LV14
2024年3月14日
syczzxj LV10
2023年6月6日
微信网友_5975606834761728 LV3
2023年3月21日
2716804680 LV9
2023年3月10日
Roninljy LV1
2023年2月16日
1721281527 LV2
2022年12月28日
zhang123zz LV1
2022年10月30日
benbosn LV15
2022年8月31日
李海洋 LV12
2022年5月31日
ewan007 LV30
2022年3月11日

最近浏览