提交 971f60b7 编写于 作者: zhouweidong's avatar zhouweidong

es支持

上级 d2b0d8c5
...@@ -12,7 +12,7 @@ import org.springframework.stereotype.Repository; ...@@ -12,7 +12,7 @@ import org.springframework.stereotype.Repository;
* 实体[${item.getLogicName()}] * 实体[${item.getLogicName()}]
*/ */
@Repository @Repository
public interface ${item.getCodeName()}Repository extends ElasticsearchRepository<${item.getCodeName()}, String>{ public interface ${item.getCodeName()}ESRepository extends ElasticsearchRepository<${item.getCodeName()}, String>{
} }
</#if> </#if>
......
...@@ -7,10 +7,13 @@ package ${pub.getPKGCodeName()}.core.es.domain; ...@@ -7,10 +7,13 @@ package ${pub.getPKGCodeName()}.core.es.domain;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.annotation.Id;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import lombok.Data;
@Data
@Document(indexName = "${sys.codeName}", type = "${item.codeName}", shards = 5, replicas = 1) @Document(indexName = "${sys.codeName}", type = "${item.codeName}", shards = 5, replicas = 1)
public class ${item.codeName} implements Serializable { public class ${item.codeName} implements Serializable {
...@@ -31,7 +34,11 @@ public class ${item.codeName} implements Serializable { ...@@ -31,7 +34,11 @@ public class ${item.codeName} implements Serializable {
<#elseif javaType=='Timestamp'> <#elseif javaType=='Timestamp'>
<#assign esType="FieldType.Date"> <#assign esType="FieldType.Date">
</#if> </#if>
<#if defield.isKeyDEField()==true>
@Id
<#else>
@Field(type = ${esType}) @Field(type = ${esType})
</#if>
private ${javaType} ${privateCodeName}; private ${javaType} ${privateCodeName};
</#list> </#list>
</#if> </#if>
......
...@@ -18,17 +18,18 @@ import org.springframework.stereotype.Service; ...@@ -18,17 +18,18 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.Collection;
/** /**
* 实体[${item.getLogicName()}] 服务对象接口实现 * 实体[${item.getLogicName()}] 服务对象接口实现
*/ */
@Slf4j @Slf4j
@Service("${item.getCodeName()}ServiceImpl") @Service("${item.getCodeName()}ServiceImpl")
public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Service { public class ${item.getCodeName()}ESServiceImpl implements I${de.getCodeName()}Service {
@Autowired @Autowired
@Lazy @Lazy
${item.getCodeName()}Repository repository; ${item.getCodeName()}ESRepository repository;
<#assign keyfield=de.getKeyPSDEField()> <#assign keyfield=de.getKeyPSDEField()>
<#comment>输出实体行为</#comment> <#comment>输出实体行为</#comment>
<#if item.getAllPSDEActions()??> <#if item.getAllPSDEActions()??>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册