|
|
@@ -4,6 +4,7 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
|
|
@@ -29,4 +30,20 @@ public class CommonDao {
|
|
|
return this.jdbcTemplate.queryForList(sql, args, elementType);
|
|
|
}
|
|
|
|
|
|
+ public <T> List<T> queryForList(String sql, Class<T> elementType, Object... args) {
|
|
|
+ return this.jdbcTemplate.queryForList(sql, elementType, args);
|
|
|
+ }
|
|
|
+
|
|
|
+ public <T> List<T> query(String sql, Object[] args, Class<T> elementType) {
|
|
|
+ return this.jdbcTemplate.query(sql, args, new BeanPropertyRowMapper<T>(elementType));
|
|
|
+ }
|
|
|
+
|
|
|
+ public <T> List<T> query(String sql, Class<T> elementType) {
|
|
|
+ return this.jdbcTemplate.query(sql, new BeanPropertyRowMapper<T>(elementType));
|
|
|
+ }
|
|
|
+
|
|
|
+ public <T> List<T> query(String sql, Class<T> elementType, Object... args) {
|
|
|
+ return this.jdbcTemplate.query(sql, new BeanPropertyRowMapper<T>(elementType), args);
|
|
|
+ }
|
|
|
+
|
|
|
}
|