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;
}
}