Project

General

Profile

Wiki » History » Version 21

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