|
|
@@ -5,6 +5,7 @@ import com.happy.Until.SqlUtil;
|
|
|
import com.happy.Until.UUIDUtil;
|
|
|
import com.happy.dao.ArticleTweetDao;
|
|
|
import com.happy.vo.*;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
|
|
@@ -739,5 +740,45 @@ public class ArticleTweetImplDao implements ArticleTweetDao {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<WalkthroughVo> walkthroughPage(String strSql, Integer page, Integer rows) {
|
|
|
+ int start = (page - 1) * rows;// 每页的起始下标
|
|
|
+
|
|
|
+ String sql=" SELECT AT.id AS id, AT.location_id AS locationId, AT\n" +
|
|
|
+ "\t.user_name AS userName,\n" +
|
|
|
+ "\tAT.title AS title,\n" +
|
|
|
+ "\tAT.content AS content,\n" +
|
|
|
+ "\tAT.create_date AS createDate,\n" +
|
|
|
+ "\tafi2.urls AS urls \n" +
|
|
|
+ "FROM\n" +
|
|
|
+ "\t`article_tweet`\n" +
|
|
|
+ "\tAT LEFT JOIN ( SELECT afi.link_id, GROUP_CONCAT( afi.url ) AS urls FROM article_file_info afi GROUP BY afi.link_id ) afi2 ON afi2.link_id = AT.id \n" +
|
|
|
+ "WHERE\n" +
|
|
|
+ "\tAT.approve = 2 " +strSql+"ORDER BY AT.create_date limit :page,:rows ";
|
|
|
+
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
+ sps.addValue("page", start);
|
|
|
+ sps.addValue("rows", rows);
|
|
|
+ List<WalkthroughVo> list = namedParameterJdbcTemplate.query(sql, sps,
|
|
|
+ new BeanPropertyRowMapper<>(WalkthroughVo.class));
|
|
|
+ if (list != null && list.size() > 0) return list;
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int walkthroughTotal(String strSql) {
|
|
|
+ String sql="SELECT \n" +
|
|
|
+ "\tCOUNT(*)\n" +
|
|
|
+ "FROM\n" +
|
|
|
+ "\t`article_tweet`\n" +
|
|
|
+ "\tAT LEFT JOIN ( SELECT afi.link_id, GROUP_CONCAT( afi.url ) AS urls FROM article_file_info afi GROUP BY afi.link_id ) afi2 ON afi2.link_id = AT.id \n" +
|
|
|
+ "WHERE\n" +
|
|
|
+ "\tAT.approve = 2 " +strSql;
|
|
|
+
|
|
|
+ MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
+
|
|
|
+ return namedParameterJdbcTemplate.queryForInt(sql, sps);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|