Commit ead5c9ca authored by hanfeng's avatar hanfeng

Merge branch 'dev-hf' into base-modify

parents 9eb9be84 ad97f753
...@@ -44,7 +44,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -44,7 +44,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
*/ */
public PageInfo getArticleList(Integer page, Integer limit, Integer type) { public PageInfo getArticleList(Integer page, Integer limit, Integer type) {
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
List articleList = mapper.getArticleList(type,null); List articleList = mapper.getArticleList(type,null,null);
return PageInfo.of(articleList); return PageInfo.of(articleList);
} }
...@@ -71,12 +71,15 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -71,12 +71,15 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
/** /**
* 随机获取三条连续的文章 * 随机获取三条连续的文章
* *
*
*
* @param type * @param type
* @param id
* @return * @return
*/ */
public List getThree(Integer type) { public List getThree( Integer type,Integer id) {
List<Article> articleList = mapper.getArticleList(type,null); List<Article> articleList = mapper.getArticleList(type,null,id);
if (!Objects.isNull(articleList)) { if (!Objects.isNull(articleList)) {
int size = articleList.size(); int size = articleList.size();
if (RANDOM_NUMBER >= size) { if (RANDOM_NUMBER >= size) {
...@@ -103,7 +106,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -103,7 +106,7 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
* @return * @return
*/ */
public List getHomePageArticle(Integer type) { public List getHomePageArticle(Integer type) {
List<Article> articleList = mapper.getArticleList(type,HOME_PAGE_NUMBER); List<Article> articleList = mapper.getArticleList(type,HOME_PAGE_NUMBER,null);
// if (Objects.isNull(articleList)) { // if (Objects.isNull(articleList)) {
// return new ArrayList(); // return new ArrayList();
// } else { // } else {
......
...@@ -11,9 +11,11 @@ import java.util.List; ...@@ -11,9 +11,11 @@ import java.util.List;
*/ */
public interface ArticleMapper extends Mapper<Article> { public interface ArticleMapper extends Mapper<Article> {
/** /**
* 根据网站类型查询文章 * 获取获取文章信息
* @param type * @param type
* @param limit 已使用分业插件传null值即可,不要重复传
* @param id 当前文章id ,无就传null
* @return * @return
*/ */
List<Article> getArticleList(@Param("type") Integer type,@Param( "limit") Integer limit); List<Article> getArticleList(@Param("type") Integer type,@Param( "limit") Integer limit,@Param("id") Integer id);
} }
...@@ -36,11 +36,16 @@ public class ArticleController extends BaseController<ArticleBiz, Article> { ...@@ -36,11 +36,16 @@ public class ArticleController extends BaseController<ArticleBiz, Article> {
return ObjectRestResponse.succ(baseBiz.getOne(id,urlType)); return ObjectRestResponse.succ(baseBiz.getOne(id,urlType));
} }
/**
@GetMapping("/app/unauth/three/{type}") *
* @param type
* @param id 当前文章id
* @return
*/
@GetMapping("/app/unauth/three/{type}/{id}")
@ApiOperation(value = "随机获取三条数据") @ApiOperation(value = "随机获取三条数据")
public ObjectRestResponse randomAccessToThreeData(@PathVariable Integer type){ public ObjectRestResponse randomAccessToThreeData(@PathVariable Integer type,@PathVariable Integer id){
return ObjectRestResponse.succ(baseBiz.getThree(type)); return ObjectRestResponse.succ(baseBiz.getThree(type,id));
} }
@GetMapping("/app/unauth/homePage/{type}") @GetMapping("/app/unauth/homePage/{type}")
......
...@@ -8,12 +8,18 @@ ...@@ -8,12 +8,18 @@
where where
is_del=0 is_del=0
and status=1 and status=1
<if test="id != null">
and id != #{id}
</if>
and (type=#{type} or type=0) and (type=#{type} or type=0)
order by order by
weight ASC ,add_time DESC weight ASC ,add_time DESC
<if test="limit != null"> <if test="limit != null">
limit #{limit} limit #{limit}
</if> </if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment