zhongrj
2024-04-09 daa9d8eba1f2b36d7b094d9079948b081008059d
公告删除同步
2 files modified
15 ■■■■ changed files
src/main/java/org/springblade/es/service/ElasticsearchDocumentService.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/article/controller/ArticleController.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/es/service/ElasticsearchDocumentService.java
@@ -546,7 +546,7 @@
    }
    /**
     * 新增数据
     * 新增数据--有问题,待调整
     */
    @Async
    public boolean add(EsParam esParam, T item) {
src/main/java/org/springblade/modules/article/controller/ArticleController.java
@@ -204,7 +204,18 @@
    @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);
        if (removeByIds){
            for (Long id : longs) {
                EsParam esParam = new EsParam();
                esParam.setIndexName("test");
                esParam.setTableName("jczz_article");
                esParam.setTableId(id.toString());
                elasticsearchDocumentService.removeByQuery(esParam);
            }
        }
        return R.status(removeByIds);
    }
    /**