|
|
@@ -1,14 +1,10 @@
|
|
|
package com.goafanti.core.mybatis;
|
|
|
|
|
|
-import java.lang.reflect.ParameterizedType;
|
|
|
-import java.sql.Connection;
|
|
|
-import java.sql.PreparedStatement;
|
|
|
-import java.sql.ResultSet;
|
|
|
-import java.sql.SQLException;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
+import com.goafanti.common.utils.LoggerUtils;
|
|
|
+import com.goafanti.core.mybatis.page.MysqlDialect;
|
|
|
+import com.goafanti.core.mybatis.page.Pagination;
|
|
|
+import com.goafanti.core.mybatis.page.PagintionPlus;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
@@ -19,9 +15,16 @@ import org.mybatis.spring.SqlSessionTemplate;
|
|
|
import org.mybatis.spring.support.SqlSessionDaoSupport;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
-import com.goafanti.common.utils.LoggerUtils;
|
|
|
-import com.goafanti.core.mybatis.page.MysqlDialect;
|
|
|
-import com.goafanti.core.mybatis.page.Pagination;
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.lang.reflect.ParameterizedType;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.sql.Connection;
|
|
|
+import java.sql.PreparedStatement;
|
|
|
+import java.sql.ResultSet;
|
|
|
+import java.sql.SQLException;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@SuppressWarnings({ "unchecked" })
|
|
|
public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
|
|
|
@@ -200,6 +203,22 @@ public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public Pagination<?> findPagePlus(String sqlId, String countId,String coutnAoumt, Map<String, Object> params, Integer pageNo,
|
|
|
+ Integer pageSize) {
|
|
|
+ Pagination<?> page = findPage(sqlId, countId, params, pageNo, pageSize);
|
|
|
+ PagintionPlus res= new PagintionPlus();
|
|
|
+ try {
|
|
|
+ BeanUtils.copyProperties(res,page);
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (InvocationTargetException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ BigDecimal totalAmount = new BigDecimal(this.getSqlSession().selectOne(coutnAoumt, params).toString());
|
|
|
+ res.setTotalAmount(totalAmount);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 重载减少参数DEFAULT_SQL_ID, "findCount"
|
|
|
*
|