Project

General

Profile

Wiki » History » Version 14

Soh Keong, 11/15/2021 04:23 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 12 Soh Keong
87 5 Soh Keong
boolean              added      = service.addKeyword(Connection conn, String keyword)
88 1 Soh Keong
boolean              updated    = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status)
89 14 Soh Keong
90
int totalRecord = service.getTotalKeywordInActive(Connection conn)
91
int totalRecord = service.getTotalKeywordAll(Connection conn)
92
int totalRecord = service.getTotalKeywordPrefix(Connection conn, String search)
93
int totalRecord = service.getTotalKeywordwildcard(Connection conn, String search)
94
95 12 Soh Keong
Map<Integer, String> KeywordMap = service.getKeywordAInActiveMap(Connection conn, *int startFrom, int totalRecord* )
96
Map<Integer, String> KeywordMap = service.getKeywordAllMap(Connection conn, *int startFrom, int totalRecord* )
97
Map<Integer, String> KeywordMap = service.getKeywordPrefixMap(Connection conn, String search, *int startFrom, int totalRecord* )
98
Map<Integer, String> KeywordMap = service.getKeywordwildcardMap(Connection conn, String search, *int startFrom, int totalRecord* )
99 3 Soh Keong
100 13 Soh Keong
*NOTE :* startFrom & totalRecord are optional field
101 12 Soh Keong
102 1 Soh Keong
h3. Product
103 3 Soh Keong
104 5 Soh Keong
<pre>
105 1 Soh Keong
com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService();
106
</pre>
107 5 Soh Keong
108 12 Soh Keong
109 5 Soh Keong
boolean                        added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
110
boolean                        updated    = service.updateProductStatus(Connection conn, int productRefNo, String status)
111 14 Soh Keong
112
int totalRecord = service.getTotalProductKeyword(Connection conn)
113
int totalRecord = service.getTotalProductKeywordSetByProductRefNo(Connection conn)
114
int totalRecord = service.getTotalProductSetByStatus(Connection conn, String status)
115
116 12 Soh Keong
Map<Integer, Set<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn, *int startFrom, int totalRecord* )
117 14 Soh Keong
118 12 Soh Keong
Set<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo, *int startFrom, int totalRecord* )
119
Set<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status, *int startFrom, int totalRecord* )
120 13 Soh Keong
121
*NOTE :* startFrom & totalRecord are optional field
122 5 Soh Keong
123 7 Soh Keong
> * *productRefNo* - 
124
> * *keywordRefNo* - 
125 4 Soh Keong
> * *priority*     - 
126
127
h3. Add product Keyword
128 5 Soh Keong
129 4 Soh Keong
<pre>
130
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
131 5 Soh Keong
</pre>
132
133
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
134 7 Soh Keong
135
> * *productRefNo* - 
136
> * *searchType*   - com.cosway.keyword.constant.SearchType
137 4 Soh Keong
> * *shopperRefNo* - 
138
139 5 Soh Keong
h3. Search
140
141
<pre>
142
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
143
</pre>
144 1 Soh Keong
145 11 Soh Keong
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
146 1 Soh Keong
Set<Integer>          productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean)
147 14 Soh Keong
148
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
149 1 Soh Keong
150 11 Soh Keong
> By Type
151
> * *shopperRefNo* - 
152
> * *noOfRecords*  - 
153
> * *searchType*   - com.cosway.keyword.constant.SearchType 
154
155
> By Level 
156
> * *shopperRefNo* - 
157
> * *noOfRecords*  - 
158
> * *level*        - 
159
160
> By Product
161 7 Soh Keong
> * *productRefNo* - 
162
> * *noOfRecords*  - 
163 11 Soh Keong
> * *level*        - (By Level & Product only)