package wk.dao.impl; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowCallbackHandler; import org.springframework.stereotype.Repository; import wk.dao.LoginUserDao; import wk.model.LoginUser; /** * 登陆用户信息操作数据库 * @author WangKun * */ @Repository public class LoginUserDaoImpl implements LoginUserDao { @Autowired private JdbcTemplate jdbcTemplate; @Override public LoginUser getLoginUser(String username, String password) { // TODO Auto-generated method stub String sql = "SELECT * FROM login_user WHERE username=? AND password=?"; final LoginUser loginUser = new LoginUser(); List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, username, password); jdbcTemplate.query(sql, new Object[] { username, password }, new RowCallbackHandler() { public void processRow(ResultSet rs) throws SQLException { loginUser.setUsername(rs.getString("username")); loginUser.setPassword(rs.getString("password")); } }); if (list.size() == 0) { return null; } return loginUser; } }
最近下载更多
李亮 LV19
2023年3月7日
微信网友_6263159342649344 LV7
2022年12月16日
a1677596408 LV23
2022年7月1日
莫回头 LV8
2022年5月20日
itlaolang LV6
2022年4月29日
1249756235 LV1
2022年4月6日
543666826 LV33
2021年11月28日
xxxjjj123 LV6
2021年3月2日
唯你不离不弃 LV5
2021年1月21日
我是helloworld LV23
2020年12月23日
最近浏览更多
gbyyyy
2023年11月12日
暂无贡献等级
bluebutterfly LV1
2023年10月19日
qkyyky
2023年9月27日
暂无贡献等级
你爹正在加载中 LV4
2023年8月3日
1379585889 LV11
2023年6月7日
ustian LV1
2023年4月3日
李亮 LV19
2023年3月7日
xiaobaitud LV13
2023年1月10日
微信网友_6263159342649344 LV7
2022年12月15日
ajdgqd LV3
2022年11月1日