Project

General

Profile

Wiki » History » Version 20

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