Commit 304ce506 by 赵剑炜

增加ES数据

parent 9c83538f
...@@ -3,6 +3,7 @@ package com.junmp.jyzb.controller.ES; ...@@ -3,6 +3,7 @@ package com.junmp.jyzb.controller.ES;
import com.junmp.jyzb.Repository.BlogRepository; import com.junmp.jyzb.Repository.BlogRepository;
import com.junmp.jyzb.entity.ES.Blog; import com.junmp.jyzb.entity.ES.Blog;
import com.junmp.jyzb.service.EquipmentTypeService; import com.junmp.jyzb.service.EquipmentTypeService;
import com.junmp.jyzb.service.PubOrgService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -26,13 +27,18 @@ public class CrudController { ...@@ -26,13 +27,18 @@ public class CrudController {
private BlogRepository blogRepository; private BlogRepository blogRepository;
@Resource @Resource
public EquipmentTypeService equipmentTypeService; public EquipmentTypeService equipmentTypeService;
@Resource
public PubOrgService pubOrgService;
@ApiOperation("测试") @ApiOperation("测试")
@PostMapping("testDocument") @PostMapping("testDocument")
public Object testDocument() { public Object testDocument() {
return equipmentTypeService.addEs(); return equipmentTypeService.addEs();
} }
@ApiOperation("测试组织机构")
@PostMapping("testOrgDocument")
public Object testOrgDocument() {
return pubOrgService.AddToEs();
}
@ApiOperation("添加单个文档") @ApiOperation("添加单个文档")
@PostMapping("addDocument") @PostMapping("addDocument")
public Blog addDocument() { public Blog addDocument() {
......
...@@ -16,7 +16,7 @@ import org.springframework.data.elasticsearch.annotations.Document; ...@@ -16,7 +16,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName("base_equipment_type") @TableName("base_equipment_type")
@Document(indexName = "type") @Document(indexName = "type_pinyin")
public class EquipmentType implements Serializable { public class EquipmentType implements Serializable {
/** /**
* 装备类型ID * 装备类型ID
......
...@@ -21,17 +21,17 @@ import org.springframework.data.elasticsearch.annotations.Document; ...@@ -21,17 +21,17 @@ import org.springframework.data.elasticsearch.annotations.Document;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName("pub_org") @TableName("pub_org")
@Document(indexName = "org") @Document(indexName = "org_pinyin")
public class PubOrg implements Serializable { public class PubOrg implements Serializable {
//此项作为id,不会写到_source里边。 //此项作为id,不会写到_source里边。
@Id // @Id
private String id; // private String id;
/** /**
* 主键 * 主键
*/ */
@TableId(type = IdType.AUTO, value = "org_id") @TableId(type = IdType.AUTO, value = "org_id")
@Id
private Long orgId; private Long orgId;
/** /**
* 主键 * 主键
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论