Browse Source

连接es报错问题修复

macro 6 years ago
parent
commit
1bf9a4b7b7

+ 5 - 3
mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminServiceImpl.java

@@ -91,8 +91,8 @@ public class UmsAdminServiceImpl implements UmsAdminService {
             return null;
         }
         //将密码进行加密操作
-        String md5Password = passwordEncoder.encode(umsAdmin.getPassword());
-        umsAdmin.setPassword(md5Password);
+        String encodePassword = passwordEncoder.encode(umsAdmin.getPassword());
+        umsAdmin.setPassword(encodePassword);
         adminMapper.insert(umsAdmin);
         return umsAdmin;
     }
@@ -172,7 +172,9 @@ public class UmsAdminServiceImpl implements UmsAdminService {
     @Override
     public int update(Long id, UmsAdmin admin) {
         admin.setId(id);
-        return adminMapper.updateByPrimaryKey(admin);
+        //密码已经加密处理,需要单独修改
+        admin.setPassword(null);
+        return adminMapper.updateByPrimaryKeySelective(admin);
     }
 
     @Override

+ 6 - 6
mall-search/src/main/java/com/macro/mall/search/domain/EsProduct.java

@@ -18,20 +18,20 @@ public class EsProduct implements Serializable {
     private static final long serialVersionUID = -1L;
     @Id
     private Long id;
-    @Field(index = false)
+    @Field(type = FieldType.Keyword)
     private String productSn;
     private Long brandId;
-    @Field(index = false)
+    @Field(type = FieldType.Keyword)
     private String brandName;
     private Long productCategoryId;
-    @Field(index = false)
+    @Field(type = FieldType.Keyword)
     private String productCategoryName;
     private String pic;
-    @Field(analyzer = "ik_max_word")
+    @Field(analyzer = "ik_max_word",type = FieldType.Text)
     private String name;
-    @Field(analyzer = "ik_max_word")
+    @Field(analyzer = "ik_max_word",type = FieldType.Text)
     private String subTitle;
-    @Field(analyzer = "ik_max_word")
+    @Field(analyzer = "ik_max_word",type = FieldType.Text)
     private String keywords;
     private BigDecimal price;
     private Integer sale;

+ 3 - 2
mall-search/src/main/java/com/macro/mall/search/domain/EsProductAttributeValue.java

@@ -1,6 +1,7 @@
 package com.macro.mall.search.domain;
 
 import org.springframework.data.elasticsearch.annotations.Field;
+import org.springframework.data.elasticsearch.annotations.FieldType;
 
 import java.io.Serializable;
 
@@ -13,12 +14,12 @@ public class EsProductAttributeValue implements Serializable {
     private Long id;
     private Long productAttributeId;
     //属性值
-    @Field(index = false)
+    @Field(type = FieldType.Keyword)
     private String value;
     //属性参数:0->规格;1->参数
     private Integer type;
     //属性名称
-    @Field(index = false)
+    @Field(type=FieldType.Keyword)
     private String name;
     public Long getId() {
         return id;