Project

General

Profile

Wiki » History » Version 22

Soh Keong, 06/08/2023 04:54 PM

1 1 Soh Keong
{{toc}}
2
3
h1. Specification
4
5 2 Soh Keong
6
h1. Programming Guide
7
8
h2. Jar version 
9
10
|_. version |_. Description  |
11
| 1.0       | Init           |
12
13
h2. Jar File Download
14
15 11 Soh Keong
"Jar":/redmine/attachments/download/618/keyword-1.0.jar
16 1 Soh Keong
"Lib":/redmine/attachments/download/602/lib.rar
17 6 Soh Keong
18
h3. Test Link
19
20
https://202.129.164.38:9093/TestPage/page/keyword/addKeyword
21
22 22 Soh Keong
h3. Diagram 
23
24
!FlowChart.jpg!
25
26 2 Soh Keong
27
h2. Database Table
28
29
<pre>
30
CREATE TABLE KEYWORD_PRODUCT (
31
	KEYWORD_REF_NO INTEGER NOT NULL,
32
	KEYWORD VARCHAR(50) NOT NULL,
33
	STATUS VARCHAR(2) DEFAULT 'A', 
34 16 Soh Keong
	CREATE_BY VARCHAR(15) NOT NULL,
35 2 Soh Keong
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
36 16 Soh Keong
	MODIFY_BY VARCHAR(15),
37 2 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
38
	PRIMARY KEY (KEYWORD_REF_NO))
39 1 Soh Keong
40 2 Soh Keong
CREATE UNIQUE INDEX UI_PROD_KEYWORD ON KEYWORD_PRODUCT(KEYWORD)
41 21 Soh Keong
CREATE UNIQUE INDEX UI_PROD_STATUS ON KEYWORD_PRODUCT(STATUS)
42 2 Soh Keong
</pre>
43
44
<pre>
45
CREATE TABLE KEYWORD_PRODUCT_PATTERN (
46 1 Soh Keong
	PRODUCT_REF_NO INTEGER NOT NULL,
47
	KEYWORD_REF_NO INTEGER NOT NULL,
48 21 Soh Keong
	PRIORITY INTEGER NOT NULL,
49 1 Soh Keong
	STATUS VARCHAR(2) DEFAULT 'A', 
50 21 Soh Keong
	CREATE_BY VARCHAR(15) NOT NULL,
51 19 Soh Keong
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
52 21 Soh Keong
	MODIFY_BY VARCHAR(15),
53 1 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
54 21 Soh Keong
	PRIMARY KEY (PRODUCT_REF_NO,KEYWORD_REF_NO,PRIORITY))
55 1 Soh Keong
	
56
CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_STATUS ON KEYWORD_PRODUCT_PATTERN(STATUS)
57
</pre>
58
59
<pre>
60 21 Soh Keong
CREATE TABLE KEYWORD_PRODUCT_PATTERN_AUDIT (
61
	PRODUCT_REF_NO INTEGER NOT NULL,
62
	KEYWORD_REF_NO INTEGER NOT NULL,
63
	PRIORITY INTEGER NOT NULL,
64
	STATUS VARCHAR(2) DEFAULT 'A', 
65
	CREATE_BY VARCHAR(15) NOT NULL,
66
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
67
	MODIFY_BY VARCHAR(15),
68
	MODIFY_DATETIME TIMESTAMP,
69
	PRIMARY KEY (PRODUCT_REF_NO,KEYWORD_REF_NO,PRIORITY))
70
</pre>
71
72
<pre>
73 2 Soh Keong
CREATE TABLE KEYWORD_SEARCH_PRODUCT (
74
	PRODUCT_REF_NO INTEGER NOT NULL,
75 9 Soh Keong
	SHOPPER_REF_NO INTEGER NOT NULL,
76 2 Soh Keong
	SEARCH_TYPE VARCHAR(5) NOT NULL, 
77
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
78 21 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
79 2 Soh Keong
	PRIMARY KEY (PRODUCT_REF_NO,SHOPPER_REF_NO,SEARCH_TYPE))
80 1 Soh Keong
	
81 2 Soh Keong
CREATE INDEX IX_KEYWORD_SEARCH_PRODUCT_MODI ON KEYWORD_SEARCH_PRODUCT(MODIFY_DATETIME)
82
</pre>
83
84
<pre>
85
CREATE TABLE KEYWORD_SEARCH_PATTERN (
86
	SHOPPER_REF_NO INTEGER NOT NULL,
87
	KEYWORD_REF_NO INTEGER NOT NULL,
88 9 Soh Keong
	PRIORITY INTEGER NOT NULL,
89 2 Soh Keong
	CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
90 21 Soh Keong
	MODIFY_DATETIME TIMESTAMP,
91 2 Soh Keong
	PRIMARY KEY (SHOPPER_REF_NO, KEYWORD_REF_NO, PRIORITY))
92 1 Soh Keong
</pre>
93
94 18 Soh Keong
h1. Methods
95 3 Soh Keong
96 18 Soh Keong
h2. Keyword
97 3 Soh Keong
98 1 Soh Keong
<pre>
99 3 Soh Keong
com.cosway.keyword.service.KeywordService service = new com.cosway.keyword.service.KeywordService();
100
</pre>
101 12 Soh Keong
102 16 Soh Keong
boolean added      = service.addProductKeyword(Connection conn, KeywordBean keywordBean)
103
boolean updated    = service.updateKeywordByRefNo(Connection conn, KeywordBean keywordBean)
104 1 Soh Keong
105 17 Soh Keong
*KeywordBean*
106 16 Soh Keong
> * *Keyword* - 
107
> * *Status*  - 
108
> * *User*    - Who perform the action
109
110 1 Soh Keong
111 17 Soh Keong
boolean updated    = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status)
112 1 Soh Keong
113 17 Soh Keong
KeywordBean = service.getKeywordBeanByRefNo();
114
115
int totalRecord = service.getKeywordActiveTotal(Connection conn)
116 1 Soh Keong
int totalRecord = service.getTotalKeywordInActive(Connection conn)
117
int totalRecord = service.getTotalKeywordAll(Connection conn)
118
int totalRecord = service.getTotalKeywordPrefix(Connection conn, String search)
119
int totalRecord = service.getTotalKeywordwildcard(Connection conn, String search)
120
121 17 Soh Keong
List<KeywordBean> keywordList = getKeywordActiveList(Connection conn, *int startFrom, int totalRecord* )
122
List<KeywordBean> keywordList = service.getKeywordAInActiveList(Connection conn, *int startFrom, int totalRecord* )
123
List<KeywordBean> keywordList = service.getKeywordAllList(Connection conn, *int startFrom, int totalRecord* )
124 3 Soh Keong
List<KeywordBean> keywordList = service.getKeywordPrefixList(Connection conn, String search, *int startFrom, int totalRecord* )
125 1 Soh Keong
List<KeywordBean> keywordList = service.getKeywordwildcardList(Connection conn, String search, *int startFrom, int totalRecord* )
126 16 Soh Keong
127 1 Soh Keong
*NOTE :* startFrom & totalRecord are optional field
128
129
130 3 Soh Keong
131 5 Soh Keong
132 1 Soh Keong
133
h2. Product
134 5 Soh Keong
135 1 Soh Keong
<pre>
136
com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService();
137
</pre>
138
139 12 Soh Keong
140 20 Soh Keong
boolean added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
141 21 Soh Keong
boolean updated    = service.updateProductStatus(Connection conn, int productRefNo, String status, String user)
142
boolean updated    = service.updateProductStatus(Connection conn, int[] productRefNo, String status, String user)
143
boolean updated    = service.updateAddProductKeywordByProductAndPriority(Connection conn, List<KeywordBean> beanList)
144 20 Soh Keong
145
*KeywordBean*
146
> * *productRefNo*  - 
147
> * *keywordRefNo*  - 
148
> * *priority*      - 
149
> * *User*          - Who perform the action
150 14 Soh Keong
151 21 Soh Keong
int                              totalRecord = service.getTotalProductKeyword(Connection conn)
152
int                              totalRecord = service.getTotalProductSetByStatus(Connection conn, String status)
153 15 Soh Keong
154 21 Soh Keong
Vector<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo)
155 15 Soh Keong
156 21 Soh Keong
Map<Integer, Vector<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn, *int startFrom, int totalRecord* )
157
Vector<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status, *int startFrom, int totalRecord* )
158 13 Soh Keong
159 5 Soh Keong
*NOTE :* startFrom & totalRecord are optional field
160 7 Soh Keong
161
> * *productRefNo* - 
162 1 Soh Keong
> * *keywordRefNo* - 
163
> * *priority*     - 
164 20 Soh Keong
165
166
167
168
169 18 Soh Keong
170 5 Soh Keong
h2. Add product Keyword
171 4 Soh Keong
172
<pre>
173 5 Soh Keong
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
174
</pre>
175
176 7 Soh Keong
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
177
178 1 Soh Keong
> * *productRefNo* - 
179
> * *searchType*   - com.cosway.keyword.constant.SearchType
180 20 Soh Keong
> * *shopperRefNo* - 
181
182
183
184
185 4 Soh Keong
186 18 Soh Keong
187 5 Soh Keong
h2. Search
188
189
<pre>
190
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
191 1 Soh Keong
</pre>
192 11 Soh Keong
193 1 Soh Keong
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
194 14 Soh Keong
Set<Integer>          productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean)
195
196 1 Soh Keong
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
197 11 Soh Keong
198
> By Type
199
> * *shopperRefNo* - 
200
> * *noOfRecords*  - 
201
> * *searchType*   - com.cosway.keyword.constant.SearchType 
202
203
> By Level 
204
> * *shopperRefNo* - 
205
> * *noOfRecords*  - 
206
> * *level*        - 
207
208 7 Soh Keong
> By Product
209
> * *productRefNo* - 
210 11 Soh Keong
> * *noOfRecords*  - 
211 1 Soh Keong
> * *level*        - (By Level & Product only)