🎨 作品集排序修改

This commit is contained in:
ronger 2021-06-03 09:27:20 +08:00
parent 60d3380758
commit 0a9882d466
2 changed files with 15 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import com.rymcu.forest.core.result.GlobalResultGenerator;
import com.rymcu.forest.core.result.GlobalResultMessage; import com.rymcu.forest.core.result.GlobalResultMessage;
import com.rymcu.forest.core.service.log.annotation.VisitLogger; import com.rymcu.forest.core.service.log.annotation.VisitLogger;
import com.rymcu.forest.dto.*; import com.rymcu.forest.dto.*;
import com.rymcu.forest.entity.Portfolio;
import com.rymcu.forest.entity.User; import com.rymcu.forest.entity.User;
import com.rymcu.forest.service.*; import com.rymcu.forest.service.*;
import com.rymcu.forest.util.UserUtils; import com.rymcu.forest.util.UserUtils;
@ -142,4 +143,16 @@ public class CommonApiController {
Map map = Utils.getArticlesGlobalResult(pageInfo); Map map = Utils.getArticlesGlobalResult(pageInfo);
return GlobalResultGenerator.genSuccessResult(map); return GlobalResultGenerator.genSuccessResult(map);
} }
@GetMapping("/portfolios")
public GlobalResult portfolios(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "12") Integer rows) {
PageHelper.startPage(page, rows);
List<Portfolio> list = portfolioService.findPortfolios();
PageInfo<Portfolio> pageInfo = new PageInfo(list);
Map map = new HashMap(2);
map.put("portfolios", pageInfo.getList());
Map pagination = Utils.getPagination(pageInfo);
map.put("pagination", pagination);
return GlobalResultGenerator.genSuccessResult(map);
}
} }

View File

@ -52,6 +52,7 @@
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 id="selectPortfolios" resultMap="BaseResultMap">
select * from forest_portfolio order by updated_time desc select fp.* from forest_portfolio fp left join (select id_portfolio, count(id_portfolio) numbers from forest_portfolio_article group by id_portfolio) fpa
on fp.id = fpa.id_portfolio order by fpa.numbers desc, updated_time desc
</select> </select>
</mapper> </mapper>