Project

General

Profile

Wiki » History » Version 16

Soh Keong, 03/04/2022 10:33 AM

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 16 Soh Keong
	CREATE_BY VARCHAR(15) NOT NULL,
33 2 Soh Keong
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
34 16 Soh Keong
	MODIFY_BY VARCHAR(15),
35 2 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
36
	PRIMARY KEY (KEYWORD_REF_NO))
37
38
CREATE UNIQUE INDEX UI_PROD_KEYWORD ON KEYWORD_PRODUCT(KEYWORD)
39
</pre>
40
41
<pre>
42
CREATE TABLE KEYWORD_PRODUCT_PATTERN (
43
	PRODUCT_REF_NO INTEGER NOT NULL,
44
	KEYWORD_REF_NO INTEGER NOT NULL,
45
	PRIORITY INTEGER,
46
	STATUS VARCHAR(2) DEFAULT 'A', 
47
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
48
	MODIFY_DATETIME TIMESTAMP,
49
	PRIMARY KEY (PRODUCT_REF_NO,KEYWORD_REF_NO))
50
	
51
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_PRIO ON KEYWORD_PRODUCT_PATTERN(PRIORITY)
52
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_STATUS ON KEYWORD_PRODUCT_PATTERN(STATUS)
53 10 Soh Keong
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_DATE ON KEYWORD_PRODUCT_PATTERN(MODIFY_DATETIME)
54 2 Soh Keong
</pre>
55
56
<pre>
57
CREATE TABLE KEYWORD_SEARCH_PRODUCT (
58
	PRODUCT_REF_NO INTEGER NOT NULL,
59
	SHOPPER_REF_NO INTEGER NOT NULL,
60
	SEARCH_TYPE VARCHAR(5) NOT NULL, 
61
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
62 9 Soh Keong
	MODIFY_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
63 2 Soh Keong
	PRIMARY KEY (PRODUCT_REF_NO,SHOPPER_REF_NO,SEARCH_TYPE))
64
	
65
CREATE INDEX IX_KEYWORD_SEARCH_PRODUCT_MODI ON KEYWORD_SEARCH_PRODUCT(MODIFY_DATETIME)
66
</pre>
67
68
<pre>
69
CREATE TABLE KEYWORD_SEARCH_PATTERN (
70
	SHOPPER_REF_NO INTEGER NOT NULL,
71
	KEYWORD_REF_NO INTEGER NOT NULL,
72
	PRIORITY INTEGER NOT NULL,
73
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
74 9 Soh Keong
	MODIFY_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
75 2 Soh Keong
	PRIMARY KEY (SHOPPER_REF_NO, KEYWORD_REF_NO, PRIORITY))
76
77
CREATE INDEX IX_KEYWORD_SEARCH_PATTERN_MODIFY ON KEYWORD_SEARCH_PATTERN(MODIFY_DATETIME)
78 1 Soh Keong
</pre>
79
80 5 Soh Keong
h2. Methods
81 3 Soh Keong
82 5 Soh Keong
h3. Keyword
83 3 Soh Keong
84 1 Soh Keong
<pre>
85 3 Soh Keong
com.cosway.keyword.service.KeywordService service = new com.cosway.keyword.service.KeywordService();
86
</pre>
87 12 Soh Keong
88 16 Soh Keong
boolean added      = service.addProductKeyword(Connection conn, KeywordBean keywordBean)
89
boolean updated    = service.updateKeywordByRefNo(Connection conn, KeywordBean keywordBean)
90 1 Soh Keong
91 16 Soh Keong
> * *Keyword* - 
92
> * *Status*  - 
93
> * *User*    - Who perform the action
94
95
96 1 Soh Keong
boolean              updated    = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status)
97 14 Soh Keong
98
int totalRecord = service.getTotalKeywordInActive(Connection conn)
99
int totalRecord = service.getTotalKeywordAll(Connection conn)
100
int totalRecord = service.getTotalKeywordPrefix(Connection conn, String search)
101
int totalRecord = service.getTotalKeywordwildcard(Connection conn, String search)
102
103 12 Soh Keong
Map<Integer, String> KeywordMap = service.getKeywordAInActiveMap(Connection conn, *int startFrom, int totalRecord* )
104
Map<Integer, String> KeywordMap = service.getKeywordAllMap(Connection conn, *int startFrom, int totalRecord* )
105
Map<Integer, String> KeywordMap = service.getKeywordPrefixMap(Connection conn, String search, *int startFrom, int totalRecord* )
106
Map<Integer, String> KeywordMap = service.getKeywordwildcardMap(Connection conn, String search, *int startFrom, int totalRecord* )
107 3 Soh Keong
108 1 Soh Keong
*NOTE :* startFrom & totalRecord are optional field
109 16 Soh Keong
110
111
112
113 12 Soh Keong
114 1 Soh Keong
h3. Product
115 3 Soh Keong
116 5 Soh Keong
<pre>
117 1 Soh Keong
com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService();
118
</pre>
119 5 Soh Keong
120 12 Soh Keong
121 5 Soh Keong
boolean                        added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
122
boolean                        updated    = service.updateProductStatus(Connection conn, int productRefNo, String status)
123 14 Soh Keong
124
int totalRecord = service.getTotalProductKeyword(Connection conn)
125
int totalRecord = service.getTotalProductSetByStatus(Connection conn, String status)
126 1 Soh Keong
127 15 Soh Keong
Set<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo)
128 14 Soh Keong
129 15 Soh Keong
Map<Integer, Set<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn, *int startFrom, int totalRecord* )
130 12 Soh Keong
Set<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status, *int startFrom, int totalRecord* )
131 13 Soh Keong
132
*NOTE :* startFrom & totalRecord are optional field
133 5 Soh Keong
134 7 Soh Keong
> * *productRefNo* - 
135
> * *keywordRefNo* - 
136 4 Soh Keong
> * *priority*     - 
137
138
h3. Add product Keyword
139 5 Soh Keong
140 4 Soh Keong
<pre>
141
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
142 5 Soh Keong
</pre>
143
144
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
145 7 Soh Keong
146
> * *productRefNo* - 
147
> * *searchType*   - com.cosway.keyword.constant.SearchType
148 4 Soh Keong
> * *shopperRefNo* - 
149
150 5 Soh Keong
h3. Search
151
152
<pre>
153
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
154
</pre>
155 1 Soh Keong
156 11 Soh Keong
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
157 1 Soh Keong
Set<Integer>          productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean)
158 14 Soh Keong
159
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
160 1 Soh Keong
161 11 Soh Keong
> By Type
162
> * *shopperRefNo* - 
163
> * *noOfRecords*  - 
164
> * *searchType*   - com.cosway.keyword.constant.SearchType 
165
166
> By Level 
167
> * *shopperRefNo* - 
168
> * *noOfRecords*  - 
169
> * *level*        - 
170
171
> By Product
172 7 Soh Keong
> * *productRefNo* - 
173
> * *noOfRecords*  - 
174 11 Soh Keong
> * *level*        - (By Level & Product only)