Package com.skyline.user.mapper

Source Code of com.skyline.user.mapper.AccountInfoMapper

package com.skyline.user.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.skyline.user.model.User;

//TODO:加注释
public class AccountInfoMapper implements RowMapper<User> {
 
  private final static String COLUMN_AUTHORITY = "authority";
  private final static String COLUMN_EMAIL = "email";
  private final static String COLUMN_SECURITY_EMAIL = "securityEmail";
  private final static String COLUMN_SECURITY_ANSWER = "securityAnswer";
  private final static String COLUMN_SECURITY_QUESTION = "securityQuestion";
  private final static String COLUMN_ID = "id";

 
  private final static AccountInfoMapper MAPPER = new AccountInfoMapper();

  public static AccountInfoMapper getMapper() {
    return MAPPER;
  }

  public User mapRow(ResultSet rs, int rowNum) throws SQLException {
    User user = new User();
    try {
      user.setAuthority(rs.getInt(COLUMN_AUTHORITY));
    } catch (SQLException e) {
      user.setAuthority(null);
    }
    try {
      user.setSecurityEmail(rs.getString(COLUMN_SECURITY_EMAIL));
    } catch (SQLException e) {
      user.setSecurityEmail(null);
    }
    try {
      user.setSecurityAnswer(rs.getString(COLUMN_SECURITY_ANSWER));
    } catch (SQLException e) {
      user.setSecurityAnswer(null);
    }
    try {
      user.setSecurityQuestion(rs.getString(COLUMN_SECURITY_QUESTION));
    } catch (SQLException e) {
      user.setSecurityQuestion(null);
    }
    user.setEmail(rs.getString(COLUMN_EMAIL));
    user.setId(rs.getLong(COLUMN_ID));
    return user;
  }
}
TOP

Related Classes of com.skyline.user.mapper.AccountInfoMapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.