|
|
@@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.dao.EmptyResultDataAccessException;
|
|
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
+import com.roma.romaapi.utils.CommonUtil;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -13,6 +14,8 @@ import java.util.Map;
|
|
|
public class PageDao {
|
|
|
@Autowired
|
|
|
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
|
|
|
+ @Autowired
|
|
|
+ private CommonUtil commonUtil;
|
|
|
|
|
|
// 获取页面json
|
|
|
public Map dbQueryForMap(String pageCode) {
|
|
|
@@ -79,6 +82,27 @@ public class PageDao {
|
|
|
return resMap2;
|
|
|
}
|
|
|
|
|
|
+ // Page页面管理-获取带分页的列表数据
|
|
|
+ public List<Map<String, Object>> getAllPageListHasPaging(Map bindValue, String page, String perPage, Integer count) {
|
|
|
+ // 计算分页
|
|
|
+ String limitAfter = commonUtil.calcPagingString(count, page, perPage);
|
|
|
+ String listSql = "SELECT * FROM `page_details` WHERE 1=1 ORDER BY `id` DESC " + " LIMIT " + limitAfter;
|
|
|
+
|
|
|
+ List<Map<String, Object>> resMap2 = namedParameterJdbcTemplate.queryForList(listSql, bindValue);
|
|
|
+
|
|
|
+ return resMap2;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Page页面管理-获取总数
|
|
|
+ public Integer getAllPageListHasPagingCount(Map bindValue) {
|
|
|
+ // 获取总数
|
|
|
+ String countInnerSql = " SELECT * FROM `page_details` WHERE 1=1 ";
|
|
|
+ String countSql = "SELECT COUNT(*) AS `totalData` FROM ( " + countInnerSql + " ) AS ROMA";
|
|
|
+ Integer count = namedParameterJdbcTemplate.queryForObject(countSql, bindValue, Integer.class);
|
|
|
+
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
// 获取全部的sql
|
|
|
public List<Map<String, Object>> getAllSqlList() {
|
|
|
Map<String, Object> paramMap = new HashMap<>();
|