💩 公告组件 API
This commit is contained in:
parent
fe61bf1945
commit
baa49a22e4
@ -2,6 +2,9 @@ package com.rymcu.forest.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author ronger
|
||||
*/
|
||||
@Data
|
||||
public class ForgetPasswordDTO {
|
||||
private String code;
|
||||
|
@ -190,4 +190,10 @@ public interface ArticleMapper extends Mapper<Article> {
|
||||
* @param idArticle
|
||||
*/
|
||||
void deleteArticleContent(@Param("idArticle") Integer idArticle);
|
||||
|
||||
/**
|
||||
* 获取公告
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectAnnouncements();
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ public interface ArticleService extends Service<Article> {
|
||||
* 删除文章
|
||||
* @param id
|
||||
* @return
|
||||
* @throws BaseApiException
|
||||
* */
|
||||
Map delete(Integer id) throws BaseApiException;
|
||||
|
||||
@ -123,4 +124,10 @@ public interface ArticleService extends Service<Article> {
|
||||
* @return
|
||||
*/
|
||||
Map updatePerfect(Integer idArticle, String articlePerfect);
|
||||
|
||||
/**
|
||||
* 获取公告列表
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> findAnnouncements();
|
||||
}
|
||||
|
@ -364,6 +364,15 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> findAnnouncements() {
|
||||
List<ArticleDTO> list = articleMapper.selectAnnouncements();
|
||||
list.forEach(article -> {
|
||||
genArticle(article, 0);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
private ArticleDTO genArticle(ArticleDTO article, Integer type) {
|
||||
Integer articleList = 0;
|
||||
Integer articleView = 1;
|
||||
|
@ -97,6 +97,16 @@ public class CommonApiController {
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/announcements")
|
||||
@VisitLogger
|
||||
public GlobalResult<Map> announcements(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "5") Integer rows){
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.findAnnouncements();
|
||||
PageInfo<ArticleDTO> pageInfo = new PageInfo(list);
|
||||
Map map = Utils.getArticlesGlobalResult(pageInfo);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/article/{id}")
|
||||
@VisitLogger
|
||||
public GlobalResult<Map<String, Object>> article(@PathVariable Integer id){
|
||||
|
@ -105,6 +105,7 @@
|
||||
where article_status = 0
|
||||
<if test="topicUri != 'news'">
|
||||
and FIND_IN_SET('划水',art.article_tags) = 0
|
||||
and FIND_IN_SET('公告',art.article_tags) = 0
|
||||
</if>
|
||||
order by updated_time desc
|
||||
</select>
|
||||
@ -155,4 +156,10 @@
|
||||
select va.article_title, va.id, va.article_permalink from forest_portfolio_article vpa
|
||||
join forest_article va on va.id = vpa.id_article where va.article_status = '0' and id_portfolio = #{idPortfolio} order by sort_no
|
||||
</select>
|
||||
<select id="selectAnnouncements" resultMap="DTOResultMap">
|
||||
select art.*,su.nickname,su.avatar_url from forest_article art join forest_user su on art.article_author_id = su.id
|
||||
where article_status = 0
|
||||
and FIND_IN_SET('公告',art.article_tags) > 0
|
||||
order by updated_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user