🎨 专题接口变更

🎨 专题接口变更
This commit is contained in:
ronger 2021-08-25 17:22:29 +08:00 committed by GitHub
commit fc8349d90e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 15 deletions

View File

@ -22,13 +22,11 @@ import org.springframework.web.servlet.HandlerMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
* 浏览
*
* @author ronger
*/
@Aspect
@ -43,7 +41,8 @@ public class VisitAspect {
private VisitService visitService;
@Pointcut("@annotation(com.rymcu.forest.core.service.log.annotation.VisitLogger)")
public void pointCut() {}
public void pointCut() {
}
/**
* 保存系统操作日志
@ -71,8 +70,10 @@ public class VisitAspect {
String authHeader = request.getHeader(JwtConstants.AUTHORIZATION);
if (StringUtils.isNotBlank(authHeader)) {
TokenUser tokenUser = UserUtils.getTokenUser(authHeader);
if (Objects.nonNull(tokenUser)) {
visit.setVisitUserId(tokenUser.getIdUser());
}
}
visitService.save(visit);
String methodName = joinPoint.getSignature().getName();

View File

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

View File

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

View File

@ -45,6 +45,8 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
Author author = userService.selectAuthor(userDTO.getIdUser());
list.forEach(portfolioDTO -> {
genPortfolioAuthor(portfolioDTO,author);
Integer articleNumber = portfolioMapper.selectCountArticleNumber(portfolioDTO.getIdPortfolio());
portfolioDTO.setArticleNumber(articleNumber);
});
return list;
}
@ -199,7 +201,7 @@ public class PortfolioServiceImpl extends AbstractService<Portfolio> implements
}
@Override
public List<Portfolio> findPortfolios() {
public List<PortfolioDTO> findPortfolios() {
return portfolioMapper.selectPortfolios();
}

View File

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

View File

@ -17,6 +17,7 @@
<result column="portfolio_author_id" property="portfolioAuthorId"></result>
<result column="portfolio_description" property="portfolioDescription"></result>
<result column="updated_time" property="updatedTime"></result>
<result column="numbers" property="articleNumber"></result>
</resultMap>
<insert id="insertPortfolioArticle">
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 ifnull(max(sort_no),0) + 1 from forest_portfolio_article where id_portfolio = #{idPortfolio}
</select>
<select id="selectPortfolios" resultMap="BaseResultMap">
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 id="selectPortfolios" resultMap="DTOResultMap">
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
</select>
</mapper>