Project

General

Profile

Wiki » History » Version 18

Soh Keong, 03/04/2022 10:49 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 18 Soh Keong
h1. Methods
81 3 Soh Keong
82 18 Soh Keong
h2. 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 17 Soh Keong
*KeywordBean*
92 16 Soh Keong
> * *Keyword* - 
93
> * *Status*  - 
94
> * *User*    - Who perform the action
95
96 1 Soh Keong
97 17 Soh Keong
boolean updated    = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status)
98 1 Soh Keong
99 17 Soh Keong
KeywordBean = service.getKeywordBeanByRefNo();
100
101
int totalRecord = service.getKeywordActiveTotal(Connection conn)
102 1 Soh Keong
int totalRecord = service.getTotalKeywordInActive(Connection conn)
103
int totalRecord = service.getTotalKeywordAll(Connection conn)
104
int totalRecord = service.getTotalKeywordPrefix(Connection conn, String search)
105
int totalRecord = service.getTotalKeywordwildcard(Connection conn, String search)
106
107 17 Soh Keong
List<KeywordBean> keywordList = getKeywordActiveList(Connection conn, *int startFrom, int totalRecord* )
108
List<KeywordBean> keywordList = service.getKeywordAInActiveList(Connection conn, *int startFrom, int totalRecord* )
109
List<KeywordBean> keywordList = service.getKeywordAllList(Connection conn, *int startFrom, int totalRecord* )
110
List<KeywordBean> keywordList = service.getKeywordPrefixList(Connection conn, String search, *int startFrom, int totalRecord* )
111
List<KeywordBean> keywordList = service.getKeywordwildcardList(Connection conn, String search, *int startFrom, int totalRecord* )
112 3 Soh Keong
113 1 Soh Keong
*NOTE :* startFrom & totalRecord are optional field
114 16 Soh Keong
115
116
117
118 12 Soh Keong
119 18 Soh Keong
h2. Product
120 3 Soh Keong
121 5 Soh Keong
<pre>
122 1 Soh Keong
com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService();
123
</pre>
124 5 Soh Keong
125 12 Soh Keong
126 5 Soh Keong
boolean                        added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
127
boolean                        updated    = service.updateProductStatus(Connection conn, int productRefNo, String status)
128 14 Soh Keong
129
int totalRecord = service.getTotalProductKeyword(Connection conn)
130
int totalRecord = service.getTotalProductSetByStatus(Connection conn, String status)
131 1 Soh Keong
132 15 Soh Keong
Set<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo)
133 14 Soh Keong
134 15 Soh Keong
Map<Integer, Set<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn, *int startFrom, int totalRecord* )
135 12 Soh Keong
Set<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status, *int startFrom, int totalRecord* )
136 13 Soh Keong
137
*NOTE :* startFrom & totalRecord are optional field
138 5 Soh Keong
139 7 Soh Keong
> * *productRefNo* - 
140
> * *keywordRefNo* - 
141 4 Soh Keong
> * *priority*     - 
142
143 18 Soh Keong
h2. Add product Keyword
144 5 Soh Keong
145 4 Soh Keong
<pre>
146
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
147 5 Soh Keong
</pre>
148
149
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
150 7 Soh Keong
151
> * *productRefNo* - 
152
> * *searchType*   - com.cosway.keyword.constant.SearchType
153 4 Soh Keong
> * *shopperRefNo* - 
154
155 18 Soh Keong
h2. Search
156 5 Soh Keong
157
<pre>
158
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
159
</pre>
160 1 Soh Keong
161 11 Soh Keong
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
162 1 Soh Keong
Set<Integer>          productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean)
163 14 Soh Keong
164
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
165 1 Soh Keong
166 11 Soh Keong
> By Type
167
> * *shopperRefNo* - 
168
> * *noOfRecords*  - 
169
> * *searchType*   - com.cosway.keyword.constant.SearchType 
170
171
> By Level 
172
> * *shopperRefNo* - 
173
> * *noOfRecords*  - 
174
> * *level*        - 
175
176
> By Product
177 7 Soh Keong
> * *productRefNo* - 
178
> * *noOfRecords*  - 
179 11 Soh Keong
> * *level*        - (By Level & Product only)