🎨 专题接口变更

This commit is contained in:
ronger 2021-08-05 10:51:16 +08:00
parent 837cdec2e6
commit 745389caae
5 changed files with 8 additions and 7 deletions

View File

@ -78,5 +78,5 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
* 获取作品集列表数据 * 获取作品集列表数据
* @return * @return
*/ */
List<Portfolio> selectPortfolios(); List<PortfolioDTO> selectPortfolios();
} }

View File

@ -82,5 +82,5 @@ public interface PortfolioService extends Service<Portfolio> {
* 获取作品集列表数据 * 获取作品集列表数据
* @return * @return
*/ */
List<Portfolio> findPortfolios(); List<PortfolioDTO> findPortfolios();
} }

View File

@ -199,7 +199,7 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
} }
@Override @Override
public List<Portfolio> findPortfolios() { public List<PortfolioDTO> findPortfolios() {
return portfolioMapper.selectPortfolios(); return portfolioMapper.selectPortfolios();
} }

View File

@ -147,8 +147,8 @@ public class CommonApiController {
@GetMapping("/portfolios") @GetMapping("/portfolios")
public GlobalResult portfolios(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "12") 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.findPortfolios(); List<PortfolioDTO> list = portfolioService.findPortfolios();
PageInfo<Portfolio> pageInfo = new PageInfo(list); PageInfo<PortfolioDTO> pageInfo = new PageInfo(list);
Map map = new HashMap(2); Map map = new HashMap(2);
map.put("portfolios", pageInfo.getList()); map.put("portfolios", pageInfo.getList());
Map pagination = Utils.getPagination(pageInfo); Map pagination = Utils.getPagination(pageInfo);

View File

@ -17,6 +17,7 @@
<result column="portfolio_author_id" property="portfolioAuthorId"></result> <result column="portfolio_author_id" property="portfolioAuthorId"></result>
<result column="portfolio_description" property="portfolioDescription"></result> <result column="portfolio_description" property="portfolioDescription"></result>
<result column="updated_time" property="updatedTime"></result> <result column="updated_time" property="updatedTime"></result>
<result column="numbers" property="articleNumber"></result>
</resultMap> </resultMap>
<insert id="insertPortfolioArticle"> <insert id="insertPortfolioArticle">
insert into forest_portfolio_article (id_portfolio, id_article, sort_no) values (#{idPortfolio}, #{idArticle}, #{maxSortNo}) insert into forest_portfolio_article (id_portfolio, id_article, sort_no) values (#{idPortfolio}, #{idArticle}, #{maxSortNo})
@ -51,8 +52,8 @@
<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 id="selectPortfolios" resultMap="DTOResultMap">
select fp.* from forest_portfolio fp left join (select id_portfolio, count(id_portfolio) numbers from forest_portfolio_article group by id_portfolio) fpa select fp.*,fpa.numbers 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 on fp.id = fpa.id_portfolio order by fpa.numbers desc, updated_time desc
</select> </select>
</mapper> </mapper>