| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.es.service.ElasticsearchDocumentService; |
| | | import org.springblade.es.vo.EsParam; |
| | | import org.springblade.modules.article.entity.Article; |
| | | import org.springblade.modules.article.service.ArticleService; |
| | | import org.springblade.modules.article.vo.ArticleVO; |
| | |
| | | public class ArticleController { |
| | | |
| | | private final ArticleService articleService; |
| | | private final ElasticsearchDocumentService elasticsearchDocumentService; |
| | | |
| | | /** |
| | | * 查询资讯分页信息 |
| | |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改资讯信息", notes = "传入article") |
| | | public R submit(@RequestBody ArticleVO article) { |
| | | public R submit(@RequestBody Article article) { |
| | | boolean flag = false; |
| | | if (null == article.getId()) { |
| | | flag = true; |
| | | if (null == article.getCreateTime()) { |
| | | article.setCreateTime(new Date()); |
| | | } |
| | | } |
| | | article.setUpdateTime(new Date()); |
| | | return R.status(articleService.saveOrUpdate(article)); |
| | | boolean saveOrUpdate = articleService.saveOrUpdate(article); |
| | | return R.status(saveOrUpdate); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(articleService.removeByIds(Func.toLongList(ids))); |
| | | List<Long> longs = Func.toLongList(ids); |
| | | boolean removeByIds = articleService.removeByIds(longs); |
| | | return R.status(removeByIds); |
| | | } |
| | | |
| | | /** |