Project

General

Profile

Wiki » History » Version 11

Soh Keong, 11/12/2021 12:03 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 11 Soh Keong
"Jar":/redmine/attachments/download/618/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 10 Soh Keong
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_DATE ON KEYWORD_PRODUCT_PATTERN(MODIFY_DATETIME)
52 2 Soh Keong
</pre>
53
54
<pre>
55
CREATE TABLE KEYWORD_SEARCH_PRODUCT (
56
	PRODUCT_REF_NO INTEGER NOT NULL,
57
	SHOPPER_REF_NO INTEGER NOT NULL,
58
	SEARCH_TYPE VARCHAR(5) NOT NULL, 
59
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
60 9 Soh Keong
	MODIFY_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
61 2 Soh Keong
	PRIMARY KEY (PRODUCT_REF_NO,SHOPPER_REF_NO,SEARCH_TYPE))
62
	
63
CREATE INDEX IX_KEYWORD_SEARCH_PRODUCT_MODI ON KEYWORD_SEARCH_PRODUCT(MODIFY_DATETIME)
64
</pre>
65
66
<pre>
67
CREATE TABLE KEYWORD_SEARCH_PATTERN (
68
	SHOPPER_REF_NO INTEGER NOT NULL,
69
	KEYWORD_REF_NO INTEGER NOT NULL,
70
	PRIORITY INTEGER NOT NULL,
71
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
72 9 Soh Keong
	MODIFY_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
73 2 Soh Keong
	PRIMARY KEY (SHOPPER_REF_NO, KEYWORD_REF_NO, PRIORITY))
74
75
CREATE INDEX IX_KEYWORD_SEARCH_PATTERN_MODIFY ON KEYWORD_SEARCH_PATTERN(MODIFY_DATETIME)
76 1 Soh Keong
</pre>
77
78 5 Soh Keong
h2. Methods
79 3 Soh Keong
80 5 Soh Keong
h3. Keyword
81 3 Soh Keong
82 1 Soh Keong
<pre>
83 3 Soh Keong
com.cosway.keyword.service.KeywordService service = new com.cosway.keyword.service.KeywordService();
84
</pre>
85
86
<pre>
87 5 Soh Keong
boolean              added      = service.addKeyword(Connection conn, String keyword)
88
boolean              updated    = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status)
89
Map<Integer, String> KeywordMap = service.getKeywordAInActiveMap(Connection conn) 
90
Map<Integer, String> KeywordMap = service.getKeywordAllMap(Connection conn)
91
Map<Integer, String> KeywordMap = service.getKeywordPrefixMap(Connection conn, String search)
92
Map<Integer, String> KeywordMap = service.getKeywordwildcardMap(Connection conn, String search)
93 3 Soh Keong
</pre>
94
95 1 Soh Keong
h3. Product
96 3 Soh Keong
97
<pre>
98 5 Soh Keong
com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService();
99 1 Soh Keong
</pre>
100
101 5 Soh Keong
<pre>
102
boolean                        added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
103
boolean                        updated    = service.updateProductStatus(Connection conn, int productRefNo, String status)
104
Map<Integer, Set<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn)
105
Set<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo)
106
Set<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status)
107
</pre>
108
109 7 Soh Keong
> * *productRefNo* - 
110
> * *keywordRefNo* - 
111
> * *priority*     - 
112
113 4 Soh Keong
h3. Add product Keyword
114
115
<pre>
116 5 Soh Keong
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
117 4 Soh Keong
</pre>
118
119 5 Soh Keong
<pre>
120
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
121
</pre>
122
123 7 Soh Keong
> * *productRefNo* - 
124
> * *searchType*   - com.cosway.keyword.constant.SearchType
125
> * *shopperRefNo* - 
126
127 4 Soh Keong
h3. Search
128
129
<pre>
130 5 Soh Keong
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
131
</pre>
132
133
<pre>
134
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
135 1 Soh Keong
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
136 11 Soh Keong
Set<Integer>          productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean)
137 4 Soh Keong
</pre>
138 1 Soh Keong
139 11 Soh Keong
> By Type
140
> * *shopperRefNo* - 
141
> * *noOfRecords*  - 
142
> * *searchType*   - com.cosway.keyword.constant.SearchType 
143
144
> By Level 
145
> * *shopperRefNo* - 
146
> * *noOfRecords*  - 
147
> * *level*        - 
148
149
> By Product
150 7 Soh Keong
> * *productRefNo* - 
151
> * *noOfRecords*  - 
152 11 Soh Keong
> * *level*        - (By Level & Product only)