Skip to content

Commit ea079de

Browse files
完善项目
1 parent 0d0306e commit ea079de

6 files changed

Lines changed: 189 additions & 173 deletions

File tree

search-service/search-api/src/main/java/com/gpmall/search/ProductSearchService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ public interface ProductSearchService {
1414
/**
1515
* 搜索商品 精准搜索
1616
*
17-
* @param request
18-
* @return
17+
* @param request request
18+
* @return SearchResponse
1919
*/
2020
SearchResponse search(SearchRequest request);
2121

2222
/**
2323
* 搜索商品 模糊搜索
2424
*
25-
* @param request
26-
* @return
25+
* @param request request
26+
* @return SearchResponse
2727
*/
2828
SearchResponse fuzzySearch(SearchRequest request);
2929

3030
/**
3131
* 商品热门搜索关键字 **热搜推荐**
3232
*
33-
* @return
33+
* @return SearchResponse
3434
*/
3535
SearchResponse hotProductKeyword();
3636
}

search-service/search-api/src/main/java/com/gpmall/search/consts/SearchEnum.java

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,48 @@
99
* @Date 2019年8月10日
1010
*/
1111
public enum SearchEnum {
12-
SUCCESS("Z0000", "成功"),
13-
FAILED("Z0001", "失败,详情见附属信息"),
14-
15-
STRING_EMPTY("Z0002", "入参字符串为空,%s");
16-
private String code;
17-
18-
private String msg;
19-
20-
private SearchEnum(String code, String msg) {
21-
this.code = code;
22-
this.msg = msg;
23-
}
24-
25-
public String getCode() {
26-
return code;
27-
}
28-
29-
public String getMsg() {
30-
return msg;
31-
}
32-
33-
public String param(Object o) {
34-
return String.format(msg, o);
35-
}
36-
37-
public String getMsg(String code) {
38-
return msg + ":" + code;
39-
}
40-
41-
@Override
42-
public String toString() {
43-
return "SearchEnum{" +
44-
"code=" + code +
45-
", msg='" + msg + '\'' +
46-
'}';
47-
}
12+
/**
13+
* 成功响应码
14+
*/
15+
SUCCESS("Z0000", "成功"),
16+
/**
17+
* 失败响应码
18+
*/
19+
FAILED("Z0001", "失败,详情见附属信息"),
20+
/**
21+
* 参数为空
22+
*/
23+
STRING_EMPTY("Z0002", "入参字符串为空,%s");
24+
private String code;
25+
26+
private String msg;
27+
28+
private SearchEnum(String code, String msg) {
29+
this.code = code;
30+
this.msg = msg;
31+
}
32+
33+
public String getCode() {
34+
return code;
35+
}
36+
37+
public String getMsg() {
38+
return msg;
39+
}
40+
41+
public String param(Object o) {
42+
return String.format(msg, o);
43+
}
44+
45+
public String getMsg(String code) {
46+
return msg + ":" + code;
47+
}
48+
49+
@Override
50+
public String toString() {
51+
return "SearchEnum{" +
52+
"code=" + code +
53+
", msg='" + msg + '\'' +
54+
'}';
55+
}
4856
}

search-service/search-provider/src/main/java/com/gpmall/search/bootstrap/SearchProviderApplication.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
import org.springframework.boot.autoconfigure.SpringBootApplication;
77
import org.springframework.context.annotation.ComponentScan;
88

9-
109
/**
11-
* 启动类
10+
* 搜索服务启动类
11+
*
12+
* @author jin
1213
*/
1314

1415
@SpringBootApplication
1516
@ComponentScan(basePackages = "com.gpmall.search.repository")
1617
@MapperScan(basePackages = "com.gpmall.search.mapper")
1718
public class SearchProviderApplication {
1819

19-
public static void main(String[] args) {
20-
SpringApplication.run(SearchProviderApplication.class, args);
21-
}
20+
public static void main(String[] args) {
21+
SpringApplication.run(SearchProviderApplication.class, args);
22+
}
2223

2324
}
2425

search-service/search-provider/src/main/java/com/gpmall/search/entity/ProductSearchModel.java

Lines changed: 127 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -7,129 +7,133 @@
77

88
import java.util.Date;
99

10+
/**
11+
* @author jin
12+
*/
13+
1014
@Document(indexName = "product", type = "item", shards = 1, replicas = 0)
1115
public class ProductSearchModel {
12-
@Id
13-
private Integer id;
14-
@Field(type = FieldType.Text)
15-
private String image;
16-
@Field(type = FieldType.Long)
17-
private Integer status;
18-
@Field(type = FieldType.Text)
19-
private String sell_point;
20-
@Field(type = FieldType.Text)
21-
private String title;
22-
@Field(type = FieldType.Long)
23-
private Integer num;
24-
@Field(type = FieldType.Long)
25-
private Long cid;
26-
@Field(type = FieldType.Long)
27-
private Date created;
28-
@Field(type = FieldType.Float)
29-
private Double price;
30-
@Field(type = FieldType.Long)
31-
private Integer limit_num;
32-
@Field(type = FieldType.Date)
33-
private Date updated;
34-
35-
public void setCid(Long cid) {
36-
this.cid = cid;
37-
}
38-
39-
@Override
40-
public String toString() {
41-
return "ProductSearchModel{" +
42-
"id=" + id +
43-
", image='" + image + '\'' +
44-
", status=" + status +
45-
", sell_point='" + sell_point + '\'' +
46-
", title='" + title + '\'' +
47-
", num=" + num +
48-
", cid=" + cid +
49-
", created=" + created +
50-
", price=" + price +
51-
", limit_num=" + limit_num +
52-
", updated=" + updated +
53-
'}';
54-
}
55-
56-
public Integer getId() {
57-
return id;
58-
}
59-
60-
public void setId(Integer id) {
61-
this.id = id;
62-
}
63-
64-
public String getImage() {
65-
return image;
66-
}
67-
68-
public void setImage(String image) {
69-
this.image = image;
70-
}
71-
72-
public Integer getStatus() {
73-
return status;
74-
}
75-
76-
public void setStatus(Integer status) {
77-
this.status = status;
78-
}
79-
80-
public String getSell_point() {
81-
return sell_point;
82-
}
83-
84-
public void setSell_point(String sell_point) {
85-
this.sell_point = sell_point;
86-
}
87-
88-
public String getTitle() {
89-
return title;
90-
}
91-
92-
public void setTitle(String title) {
93-
this.title = title;
94-
}
95-
96-
public Integer getNum() {
97-
return num;
98-
}
99-
100-
public void setNum(Integer num) {
101-
this.num = num;
102-
}
103-
104-
public Date getCreated() {
105-
return created;
106-
}
107-
108-
public void setCreated(Date created) {
109-
this.created = created;
110-
}
111-
112-
public Double getPrice() {
113-
return price;
114-
}
115-
116-
public void setPrice(Double price) {
117-
this.price = price;
118-
}
119-
120-
public Integer getLimit_num() {
121-
return limit_num;
122-
}
123-
124-
public void setLimit_num(Integer limit_num) {
125-
this.limit_num = limit_num;
126-
}
127-
128-
public Date getUpdated() {
129-
return updated;
130-
}
131-
132-
public void setUpdated(Date updated) {
133-
this.updated = updated;
134-
}
16+
@Id
17+
private Integer id;
18+
@Field(type = FieldType.Text)
19+
private String image;
20+
@Field(type = FieldType.Long)
21+
private Integer status;
22+
@Field(type = FieldType.Text)
23+
private String sell_point;
24+
@Field(type = FieldType.Text)
25+
private String title;
26+
@Field(type = FieldType.Long)
27+
private Integer num;
28+
@Field(type = FieldType.Long)
29+
private Long cid;
30+
@Field(type = FieldType.Long)
31+
private Date created;
32+
@Field(type = FieldType.Float)
33+
private Double price;
34+
@Field(type = FieldType.Long)
35+
private Integer limit_num;
36+
@Field(type = FieldType.Date)
37+
private Date updated;
38+
39+
public void setCid(Long cid) {
40+
this.cid = cid;
41+
}
42+
43+
@Override
44+
public String toString() {
45+
return "ProductSearchModel{" +
46+
"id=" + id +
47+
", image='" + image + '\'' +
48+
", status=" + status +
49+
", sell_point='" + sell_point + '\'' +
50+
", title='" + title + '\'' +
51+
", num=" + num +
52+
", cid=" + cid +
53+
", created=" + created +
54+
", price=" + price +
55+
", limit_num=" + limit_num +
56+
", updated=" + updated +
57+
'}';
58+
}
59+
60+
public Integer getId() {
61+
return id;
62+
}
63+
64+
public void setId(Integer id) {
65+
this.id = id;
66+
}
67+
68+
public String getImage() {
69+
return image;
70+
}
71+
72+
public void setImage(String image) {
73+
this.image = image;
74+
}
75+
76+
public Integer getStatus() {
77+
return status;
78+
}
79+
80+
public void setStatus(Integer status) {
81+
this.status = status;
82+
}
83+
84+
public String getSell_point() {
85+
return sell_point;
86+
}
87+
88+
public void setSell_point(String sell_point) {
89+
this.sell_point = sell_point;
90+
}
91+
92+
public String getTitle() {
93+
return title;
94+
}
95+
96+
public void setTitle(String title) {
97+
this.title = title;
98+
}
99+
100+
public Integer getNum() {
101+
return num;
102+
}
103+
104+
public void setNum(Integer num) {
105+
this.num = num;
106+
}
107+
108+
public Date getCreated() {
109+
return created;
110+
}
111+
112+
public void setCreated(Date created) {
113+
this.created = created;
114+
}
115+
116+
public Double getPrice() {
117+
return price;
118+
}
119+
120+
public void setPrice(Double price) {
121+
this.price = price;
122+
}
123+
124+
public Integer getLimit_num() {
125+
return limit_num;
126+
}
127+
128+
public void setLimit_num(Integer limit_num) {
129+
this.limit_num = limit_num;
130+
}
131+
132+
public Date getUpdated() {
133+
return updated;
134+
}
135+
136+
public void setUpdated(Date updated) {
137+
this.updated = updated;
138+
}
135139
}

0 commit comments

Comments
 (0)