🎨 专题接口变更
🎨 专题接口变更
This commit is contained in:
commit
fc8349d90e
@ -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() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存系统操作日志
|
||||
@ -52,7 +51,7 @@ public class VisitAspect {
|
||||
* @return 方法执行结果
|
||||
* @throws Throwable 调用出错
|
||||
*/
|
||||
@AfterReturning(value = "pointCut()", returning="obj")
|
||||
@AfterReturning(value = "pointCut()", returning = "obj")
|
||||
public void save(JoinPoint joinPoint, Object obj) {
|
||||
logger.info("保存访问记录 start ...");
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
@ -69,10 +68,12 @@ public class VisitAspect {
|
||||
visit.setVisitRefererUrl(referer);
|
||||
visit.setCreatedTime(new Date());
|
||||
String authHeader = request.getHeader(JwtConstants.AUTHORIZATION);
|
||||
if(StringUtils.isNotBlank(authHeader)){
|
||||
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();
|
||||
|
@ -78,5 +78,5 @@ public interface PortfolioMapper extends Mapper<Portfolio> {
|
||||
* 获取作品集列表数据
|
||||
* @return
|
||||
*/
|
||||
List<Portfolio> selectPortfolios();
|
||||
List<PortfolioDTO> selectPortfolios();
|
||||
}
|
||||
|
@ -82,5 +82,5 @@ public interface PortfolioService extends Service<Portfolio> {
|
||||
* 获取作品集列表数据
|
||||
* @return
|
||||
*/
|
||||
List<Portfolio> findPortfolios();
|
||||
List<PortfolioDTO> findPortfolios();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user