Commit 5cfb478d authored by hanfeng's avatar hanfeng

添加排序

parent 72f75b73
...@@ -3,10 +3,10 @@ package com.xxfc.platform.uccn.biz; ...@@ -3,10 +3,10 @@ package com.xxfc.platform.uccn.biz;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import com.xxfc.platform.uccn.mapper.ArticleMapper; import com.xxfc.platform.uccn.mapper.ArticleMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls; import tk.mybatis.mapper.weekend.WeekendSqls;
...@@ -104,4 +104,21 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { ...@@ -104,4 +104,21 @@ public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
} }
} }
@Transactional(rollbackFor = Exception.class)
public void add(Article article) {
if (article==null) {
return;
}
article.setIsDel(0);
if (article.getStatus()==null){
article.setStatus(0);
}
if (article.getType()==null){
article.setType(0);
}
article.setCreTime(new Date());
mapper.insertSelective(article);
}
} }
...@@ -48,4 +48,14 @@ public class ArticleController extends BaseController<ArticleBiz, Article> { ...@@ -48,4 +48,14 @@ public class ArticleController extends BaseController<ArticleBiz, Article> {
public ObjectRestResponse getHomePageArticle(@PathVariable Integer type){ public ObjectRestResponse getHomePageArticle(@PathVariable Integer type){
return ObjectRestResponse.succ(baseBiz.getHomePageArticle(type)); return ObjectRestResponse.succ(baseBiz.getHomePageArticle(type));
} }
@Override
@PostMapping("/add")
@ApiOperation(value = "获取首页文章列表")
public ObjectRestResponse add(@RequestBody Article article){
baseBiz.add(article);
return ObjectRestResponse.succ();
}
} }
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