🎨 作品集展示效果优化

This commit is contained in:
ronger 2021-03-15 21:21:27 +08:00
parent 9aa0aad655
commit 198cff64a5
5 changed files with 22 additions and 2 deletions

View File

@ -73,4 +73,10 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* @return * @return
*/ */
Integer unbindArticle(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle); Integer unbindArticle(@Param("idPortfolio") Integer idPortfolio, @Param("idArticle") Integer idArticle);
/**
* 获取作品集列表数据
* @return
*/
List<Portfolio> selectPortfolios();
} }

View File

@ -77,4 +77,10 @@ public interface PortfolioService extends Service<Portfolio> {
* @return * @return
*/ */
Map deletePortfolio(Integer idPortfolio); Map deletePortfolio(Integer idPortfolio);
/**
* 获取作品集列表数据
* @return
*/
List<Portfolio> findPortfolios();
} }

View File

@ -174,6 +174,11 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
return map; return map;
} }
@Override
public List<Portfolio> findPortfolios() {
return portfolioMapper.selectPortfolios();
}
private PortfolioDTO genPortfolioAuthor(PortfolioDTO portfolioDTO, Author author) { private PortfolioDTO genPortfolioAuthor(PortfolioDTO portfolioDTO, Author author) {
portfolioDTO.setPortfolioAuthorAvatarUrl(author.getUserAvatarURL()); portfolioDTO.setPortfolioAuthorAvatarUrl(author.getUserAvatarURL());
portfolioDTO.setPortfolioAuthorName(author.getUserNickname()); portfolioDTO.setPortfolioAuthorName(author.getUserNickname());

View File

@ -143,9 +143,9 @@ public class CommonApiController {
} }
@GetMapping("/portfolios") @GetMapping("/portfolios")
public GlobalResult portfolios(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) { public GlobalResult portfolios(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "12") Integer rows) {
PageHelper.startPage(page, rows); PageHelper.startPage(page, rows);
List<Portfolio> list = portfolioService.findAll(); List<Portfolio> list = portfolioService.findPortfolios();
PageInfo<Portfolio> pageInfo = new PageInfo(list); PageInfo<Portfolio> pageInfo = new PageInfo(list);
Map map = new HashMap(2); Map map = new HashMap(2);
map.put("portfolios", pageInfo.getList()); map.put("portfolios", pageInfo.getList());

View File

@ -51,4 +51,7 @@
<select id="selectMaxSortNo" resultType="java.lang.Integer"> <select id="selectMaxSortNo" resultType="java.lang.Integer">
select ifnull(max(sort_no),0) + 1 from forest_portfolio_article where id_portfolio = #{idPortfolio} select ifnull(max(sort_no),0) + 1 from forest_portfolio_article where id_portfolio = #{idPortfolio}
</select> </select>
<select id="selectPortfolios" resultMap="BaseResultMap">
select * from forest_portfolio order by updated_time desc
</select>
</mapper> </mapper>