Package com.skyline.base.mapper

Source Code of com.skyline.base.mapper.CommentMapper

package com.skyline.base.mapper;

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

import org.springframework.jdbc.core.RowMapper;

import com.skyline.base.model.Comment;


/**
* 评论的mapper
*
* @author Jairus Chan
* @version 0.1
* */
public class CommentMapper implements RowMapper<Comment> {
 
  private static final CommentMapper MAPPER = new CommentMapper();
  public static CommentMapper getMapper() {
    return MAPPER;
  }

  public Comment mapRow(ResultSet rs, int rowNum) throws SQLException {
    Comment c = new Comment();
    c.setId(rs.getLong("id"));
    c.setContent(rs.getString("content"));
    c.setCreateTime(rs.getTimestamp("createtime"));
    c.setCommenterId(rs.getLong("commenterId"));
    c.setCommenterNickname(rs.getString("commenterNickname"));
    c.setCommenterPortrait(rs.getString("commenterPortrait"));
    c.setRef(rs.getLong("ref"));
    c.setResourceId(rs.getLong("resourceId"));
    c.setOwnerId(rs.getLong("ownerId"));
    c.setAgreeNum(rs.getInt("agreeNum"));
    c.setDisagreeNum(rs.getInt("disagreeNum"));
    return c;
  }
}
TOP

Related Classes of com.skyline.base.mapper.CommentMapper

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.