Project

General

Profile

Wiki » History » Version 7

Soh Keong, 11/11/2021 03:07 PM

1 1 Soh Keong
{{toc}}
2
3
h1. Specification
4
5 6 Soh Keong
h1. Chart
6 1 Soh Keong
!FlowChart.jpg!
7 2 Soh Keong
8
h1. Programming Guide
9
10
h2. Jar version 
11
12
|_. version |_. Description  |
13
| 1.0       | Init           |
14
15
h2. Jar File Download
16
17 6 Soh Keong
"Jar":/redmine/attachments/download/601/keyword-1.0.jar
18 1 Soh Keong
"Lib":/redmine/attachments/download/602/lib.rar
19 6 Soh Keong
20
h3. Test Link
21
22
https://202.129.164.38:9093/TestPage/page/keyword/addKeyword
23
24 2 Soh Keong
25
h2. Database Table
26
27
<pre>
28
CREATE TABLE KEYWORD_PRODUCT (
29
	KEYWORD_REF_NO INTEGER NOT NULL,
30
	KEYWORD VARCHAR(50) NOT NULL,
31
	STATUS VARCHAR(2) DEFAULT 'A', 
32
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
33
	MODIFY_DATETIME TIMESTAMP,
34
	PRIMARY KEY (KEYWORD_REF_NO))
35
36
CREATE UNIQUE INDEX UI_PROD_KEYWORD ON KEYWORD_PRODUCT(KEYWORD)
37
</pre>
38
39
<pre>
40
CREATE TABLE KEYWORD_PRODUCT_PATTERN (
41
	PRODUCT_REF_NO INTEGER NOT NULL,
42
	KEYWORD_REF_NO INTEGER NOT NULL,
43
	PRIORITY INTEGER,
44
	STATUS VARCHAR(2) DEFAULT 'A', 
45
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
46
	MODIFY_DATETIME TIMESTAMP,
47
	PRIMARY KEY (PRODUCT_REF_NO,KEYWORD_REF_NO))
48
	
49
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_PRIO ON KEYWORD_PRODUCT_PATTERN(PRIORITY)
50
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_STATUS ON KEYWORD_PRODUCT_PATTERN(STATUS)
51
</pre>
52
53
<pre>
54
CREATE TABLE KEYWORD_SEARCH_PRODUCT (
55
	PRODUCT_REF_NO INTEGER NOT NULL,
56
	SHOPPER_REF_NO INTEGER NOT NULL,
57
	SEARCH_TYPE VARCHAR(5) NOT NULL, 
58
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
59
	MODIFY_DATETIME TIMESTAMP,
60
	PRIMARY KEY (PRODUCT_REF_NO,SHOPPER_REF_NO,SEARCH_TYPE))
61
	
62
CREATE INDEX IX_KEYWORD_SEARCH_PRODUCT_MODI ON KEYWORD_SEARCH_PRODUCT(MODIFY_DATETIME)
63
</pre>
64
65
<pre>
66
CREATE TABLE KEYWORD_SEARCH_PATTERN (
67
	SHOPPER_REF_NO INTEGER NOT NULL,
68
	KEYWORD_REF_NO INTEGER NOT NULL,
69
	PRIORITY INTEGER NOT NULL,
70
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
71
	MODIFY_DATETIME TIMESTAMP,
72
	PRIMARY KEY (SHOPPER_REF_NO, KEYWORD_REF_NO, PRIORITY))
73
74
CREATE INDEX IX_KEYWORD_SEARCH_PATTERN_MODIFY ON KEYWORD_SEARCH_PATTERN(MODIFY_DATETIME)
75 1 Soh Keong
</pre>
76
77 5 Soh Keong
h2. Methods
78 3 Soh Keong
79 5 Soh Keong
h3. Keyword
80 3 Soh Keong
81 1 Soh Keong
<pre>
82 3 Soh Keong
com.cosway.keyword.service.KeywordService service = new com.cosway.keyword.service.KeywordService();
83
</pre>
84
85
<pre>
86 5 Soh Keong
boolean              added      = service.addKeyword(Connection conn, String keyword)
87
boolean              updated    = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status)
88
Map<Integer, String> KeywordMap = service.getKeywordAInActiveMap(Connection conn) 
89
Map<Integer, String> KeywordMap = service.getKeywordAllMap(Connection conn)
90
Map<Integer, String> KeywordMap = service.getKeywordPrefixMap(Connection conn, String search)
91
Map<Integer, String> KeywordMap = service.getKeywordwildcardMap(Connection conn, String search)
92 3 Soh Keong
</pre>
93
94 1 Soh Keong
h3. Product
95 3 Soh Keong
96
<pre>
97 5 Soh Keong
com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService();
98 1 Soh Keong
</pre>
99
100 5 Soh Keong
<pre>
101
boolean                        added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
102
boolean                        updated    = service.updateProductStatus(Connection conn, int productRefNo, String status)
103
Map<Integer, Set<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn)
104
Set<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo)
105
Set<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status)
106
</pre>
107
108 7 Soh Keong
> * *productRefNo* - 
109
> * *keywordRefNo* - 
110
> * *priority*     - 
111
112 4 Soh Keong
h3. Add product Keyword
113
114
<pre>
115 5 Soh Keong
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
116 4 Soh Keong
</pre>
117
118 5 Soh Keong
<pre>
119
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
120
</pre>
121
122 7 Soh Keong
> * *productRefNo* - 
123
> * *searchType*   - com.cosway.keyword.constant.SearchType
124
> * *shopperRefNo* - 
125
126 4 Soh Keong
h3. Search
127
128
<pre>
129 5 Soh Keong
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
130
</pre>
131
132
<pre>
133
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
134
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
135 4 Soh Keong
</pre>
136 7 Soh Keong
137
> * *productRefNo* - 
138
> * *noOfRecords*  - 
139
> * *searchType*   - com.cosway.keyword.constant.SearchType (By Type)
140
> * *level*        - (By Level)