package com.skyline.spot.mapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
import com.skyline.base.type.Activity;
import com.skyline.spot.model.SpotCharacteristic;
public class SpotCharacteristicMapper implements RowMapper<SpotCharacteristic> {
private final static String COLUMN_ID = "id";
private final static String COLUMN_PORTRAIT = "portrait";
private final static String COLUMN_SPOT_ID = "spotid";
private final static String COLUMN_SPOT_NAME = "spotname";
private final static String COLUMN_SPOT_PORTRAIT = "spotPortrait";
private final static String COLUMN_OWNER_ID = "ownerid";
private final static String COLUMN_OWNER_NICKNAME = "ownerNickname";
private final static String COLUMN_OWNER_PORTRAIT = "ownerPortrait";
private final static String COLUMN_CREATOR_ID = "creatorId";
private final static String COLUMN_CREATOR_NICKNAME = "creatorNickname";
private final static String COLUMN_CREATOR_PORTRAIT = "creatorPortrait";
private final static String COLUMN_CHARA_TITLE = "characteristicTitle";
private final static String COLUMN_CHARA_DETAIL = "characteristicDetail";
private final static String COLUMN_CONSUME = "consume";
private final static String COLUMN_ALBUM_ID = "albumId";
private final static String COLUMN_STAR = "star";
private final static String COLUMN_VOTES = "votes";
private final static String COLUMN_CREATETIME = "createTime";
private final static String COLUMN_UPDATETIME = "updateTime";
private final static String COLUMN_ACTIVITY = "activity";
private final static SpotCharacteristicMapper MAPPER = new SpotCharacteristicMapper();
public static SpotCharacteristicMapper getMapper() {
return MAPPER;
}
public SpotCharacteristic mapRow(ResultSet rs, int rowNum)
throws SQLException {
SpotCharacteristic sc = new SpotCharacteristic();
sc.setId(Long.valueOf(rs.getString(COLUMN_ID)));
sc.setPortrait(rs.getString(COLUMN_PORTRAIT));
sc.setSpotId(rs.getLong(COLUMN_SPOT_ID));
sc.setSpotName(rs.getString(COLUMN_SPOT_NAME));
sc.setSpotPortrait(rs.getString(COLUMN_SPOT_PORTRAIT));
sc.setOwnerId(Long.valueOf(rs.getString(COLUMN_OWNER_ID)));
sc.setOwnerNickname(rs.getString(COLUMN_OWNER_NICKNAME));
sc.setOwnerPortrait(rs.getString(COLUMN_OWNER_PORTRAIT));
sc.setCreatorId(Long.valueOf(rs.getString(COLUMN_CREATOR_ID)));
sc.setCreatorNickname(rs.getString(COLUMN_CREATOR_NICKNAME));
sc.setCreatorPortrait(rs.getString(COLUMN_CREATOR_PORTRAIT));
sc.setCharacteristicTitle(rs.getString(COLUMN_CHARA_TITLE));
sc.setCharacteristicDetail(rs.getString(COLUMN_CHARA_DETAIL));
sc.setConsume(rs.getInt(COLUMN_CONSUME));
sc.setAlbumId(rs.getLong(COLUMN_ALBUM_ID));
sc.setStar(rs.getFloat(COLUMN_STAR));
sc.setVotes(rs.getInt(COLUMN_VOTES));
sc.setCreateTime(rs.getDate(COLUMN_CREATETIME));
sc.setUpdateTime(rs.getDate(COLUMN_UPDATETIME));
sc.setActivity(Activity.valueOf((rs.getString(COLUMN_ACTIVITY))));
return sc;
}
}