@@ -0,0 +1,1464 @@
+package com.qinxiandiqi.springdemo.demo1.dao;%0A%0Aimport com.qinxiandiqi.springdemo.demo1.domain.User;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.jdbc.core.JdbcTemplate;%0Aimport org.springframework.jdbc.core.RowCallbackHandler;%0Aimport org.springframework.stereotype.Repository;%0A%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0A%0A/**%0A * Created by Jianan on 9/23/15.%0A */%0A@Repository%0Apublic class UserDao %7B%0A%0A    @Autowired%0A    private JdbcTemplate jdbcTemplate;%0A%0A    public int getMatchCount(String userName, String password)%7B%0A        String sqlStr = %22SELECT count(*) FROM t_user WHERE user_name = ? and password = ?%22;%0A        return jdbcTemplate.queryForInt(sqlStr, userName, password);%0A    %7D%0A%0A    public User findUserByUserName(final String userName)%7B%0A        String sqlStr = %22SELECT user_id,user_name FROM t_user WHERE user_name = ?%22;%0A        final User user = new User();%0A        jdbcTemplate.query(sqlStr, new RowCallbackHandler() %7B%0A            public void processRow(ResultSet resultSet) throws SQLException %7B%0A                user.setUserId(resultSet.getInt(%22user_id%22));%0A                user.setUserName(userName);%0A            %7D%0A        %7D, userName);%0A        return user;%0A    %7D%0A%0A    public void updateLoginInfo(User user)%7B%0A        String sqlStr = %22UPDATE t_user SET last_visit=?,last_ip=? WHERE user_id=?%22;%0A        jdbcTemplate.update(sqlStr, user.getLastVisit(), user.getLastIp(), user.getUserId());%0A    %7D%0A%7D%0A

add userdao.