1414import java .util .Collections ;
1515import java .util .List ;
1616
17- import org .apache .log4j .Logger ;
18-
1917import openthinks .libs .sql .dao .BaseDao ;
2018import openthinks .libs .sql .data .DefaultRow ;
2119import openthinks .libs .sql .data .Row ;
2725import openthinks .libs .sql .lang .reflect .ReflectEngine ;
2826import openthinks .libs .utilities .Checker ;
2927
28+ import org .apache .log4j .Logger ;
29+
3030/**
3131 * BaseDao接口默认实现类
3232 *
@@ -54,8 +54,7 @@ public BaseDaoImpl() {
5454 setLogger (logger );
5555 }
5656 if (configurator == null ) {
57- Configurator config = ConfiguratorFactory
58- .getDefaultInstance (this .getClass ());
57+ Configurator config = ConfiguratorFactory .getDefaultInstance (this .getClass ());
5958 if (config != null )
6059 setConfigurator (config );
6160 }
@@ -111,10 +110,8 @@ public void setConfigurator(Configurator configurator) {
111110 this .configurator = configurator ;
112111 }
113112
114- /*
115- * (non-Javadoc)
116- *
117- * @see sql.dao.BaseDao#isUsePool()
113+ /**
114+ * {@inheritDoc}
118115 */
119116 @ Override
120117 public boolean isUsePool () {
@@ -159,8 +156,7 @@ public ResultSet executeQuery(String sql, String[] params) {
159156 */
160157 @ Override
161158 public ResultSet executeQuery (Condition condition ) {
162- return condition == null ? null : executeQuery (Condition
163- .getFullSql (condition ));
159+ return condition == null ? null : executeQuery (Condition .getFullSql (condition ));
164160 }
165161
166162 /**
@@ -198,8 +194,7 @@ public Object executeScalar(String sql, String[] params) {
198194 */
199195 @ Override
200196 public Object executeScalar (Condition condition ) {
201- return condition == null ? null : executeScalar (Condition
202- .getFullSql (condition ));
197+ return condition == null ? null : executeScalar (Condition .getFullSql (condition ));
203198 }
204199
205200 /**
@@ -251,8 +246,8 @@ public int executeSql(Condition condition) {
251246 @ Override
252247 public Connection getConn () throws ClassNotFoundException , SQLException {
253248 Class .forName (configurator .getDriver ());
254- Connection conn = DriverManager .getConnection (configurator .getUrl (),
255- configurator .getUserName (), configurator . getUserPwd ());
249+ Connection conn = DriverManager .getConnection (configurator .getUrl (), configurator . getUserName (),
250+ configurator .getUserPwd ());
256251 return conn ;
257252 }
258253
@@ -277,8 +272,7 @@ public List<Row> list(String sql, String[] params) {
277272 for (int i = 1 ; i <= count ; i ++) {
278273 values [i - 1 ] = rs .getObject (rsmd .getColumnName (i ));
279274 }
280- Row row = new DefaultRow (columnAttributeMapping .toArray (),
281- values );// 创建一行记录
275+ Row row = new DefaultRow (columnAttributeMapping .toArray (), values );// 创建一行记录
282276 list .add (row );
283277 }
284278 } catch (SQLException ex ) {
@@ -309,6 +303,7 @@ public List<Row> list(Condition condition) {
309303 /**
310304 * {@inheritDoc}
311305 */
306+ @ Deprecated
312307 @ Override
313308 public <T extends Entity > List <T > listEntity (Class <T > clz , String sql ) {
314309 return listEntity (clz , sql , null );
@@ -317,26 +312,23 @@ public <T extends Entity> List<T> listEntity(Class<T> clz, String sql) {
317312 /**
318313 * {@inheritDoc}
319314 */
315+ @ Deprecated
320316 @ Override
321- public <T extends Entity > List <T > listEntity (Class <T > clz , String sql ,
322- String [] params ) {
317+ public <T extends Entity > List <T > listEntity (Class <T > clz , String sql , String [] params ) {
323318 return list (clz , sql , params );
324319 }
325320
326321 /**
327322 * {@inheritDoc}
328323 */
324+ @ Deprecated
329325 @ Override
330- public <T extends Entity > List <T > listEntity (Class <T > clz ,
331- Condition condition ) {
332- return condition == null ? Collections .<T > emptyList () : listEntity (
333- clz , Condition .getFullSql (condition ));
326+ public <T extends Entity > List <T > listEntity (Class <T > clz , Condition condition ) {
327+ return condition == null ? Collections .<T > emptyList () : listEntity (clz , Condition .getFullSql (condition ));
334328 }
335329
336- /*
337- * (non-Javadoc)
338- *
339- * @see sql.dao.BaseDao#list(java.lang.Class)
330+ /**
331+ * {@inheritDoc}
340332 */
341333 @ Override
342334 public <T > List <T > list (Class <T > clz ) {
@@ -375,8 +367,7 @@ public <T> List<T> list(Class<T> clz, String sql, String[] params) {
375367 try {
376368 String columnName = rsmd .getColumnName (i );
377369 Object columnValue = rs .getObject (columnName );
378- ReflectEngine .propertyReflect (entity , columnName ,
379- columnValue );
370+ ReflectEngine .propertyReflect (entity , columnName , columnValue );
380371 } catch (Exception e ) {
381372 logger .warn (e );
382373 continue ;
@@ -400,8 +391,7 @@ public <T> List<T> list(Class<T> clz, String sql, String[] params) {
400391 */
401392 @ Override
402393 public <T > List <T > list (Class <T > clz , Condition condition ) {
403- return condition == null ? Collections .<T > emptyList () : list (clz ,
404- Condition .getFullSql (condition ));
394+ return condition == null ? Collections .<T > emptyList () : list (clz , Condition .getFullSql (condition ));
405395 }
406396
407397 /**
@@ -445,7 +435,7 @@ public void closeConnection(Connection conn) {
445435 logger .error (e );
446436 }
447437 }
448- if (conn != null && isUsePool () ) {
438+ if (conn != null && isUsePool ()) {
449439 //TODO put it back to pool
450440 }
451441 }
0 commit comments