Package com.skyline.spot.mapper

Source Code of com.skyline.spot.mapper.RatyMapper

package com.skyline.spot.mapper;

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

import org.springframework.jdbc.core.RowMapper;

import com.skyline.base.type.RatyObjType;
import com.skyline.spot.model.Raty;

public class RatyMapper implements RowMapper<Raty> {

  private final static String COLUMN_ID = "id";
  private final static String COLUMN_OBJID = "objid";
  private final static String COLUMN_OBJTYPE = "objtype";
  private final static String COLUMN_USERID = "userid";
  private final static String COLUMN_RATYSTAR = "ratystar";
  private final static String COLUMN_RATYTIME = "ratytime";

  private final static RatyMapper MAPPER = new RatyMapper();

  public static RatyMapper getMapper() {
    return MAPPER;
  }

  public Raty mapRow(ResultSet rs, int rowNum) throws SQLException {
    Raty raty = new Raty();
    try {
      raty.setId(rs.getLong(COLUMN_ID));
      raty.setObjId(rs.getLong(COLUMN_OBJID));
      raty.setType(RatyObjType.valueOf(rs.getString(COLUMN_OBJTYPE)));
      raty.setUserId(rs.getLong(COLUMN_USERID));
      raty.setRatyStar(rs.getInt(COLUMN_RATYSTAR))
      raty.setRatyTime(rs.getDate(COLUMN_RATYTIME));
     
    } catch (Exception e) {
        return null;
    }
    return raty;
  }

}
TOP

Related Classes of com.skyline.spot.mapper.RatyMapper

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.