Project

General

Profile

Wiki » History » Version 13

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