package com.db.service.mapper;

import com.db.service.model.TTest;
import org.springframework.jdbc.core.RowMapper;

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

/**
 * 测试mapper处理对象
 *
 * @author Liukx
 * @create 2018-05-07 10:12
 * @email liukx@elab-plus.com
 **/
public class TestRowMapper implements RowMapper<TTest> {


    @Override
    public TTest mapRow(ResultSet resultSet, int i) throws SQLException {
        TTest test = new TTest();
        int id = resultSet.getInt("id");
        String username = resultSet.getString("username");
        String name = resultSet.getString("name");
        test.setId(id);
        test.setUsername(username);
        test.setName(name);
        System.out.println("==============处理完成===============");
        return test;
    }
}
