Project

General

Profile

Wiki » History » Version 19

Soh Keong, 03/04/2022 11:20 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 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 5 Soh Keong
boolean                        added      = service.addProductKeyword(Connection conn, KeywordBean keyword)
129
boolean                        updated    = service.updateProductStatus(Connection conn, int productRefNo, String status)
130 14 Soh Keong
131
int totalRecord = service.getTotalProductKeyword(Connection conn)
132
int totalRecord = service.getTotalProductSetByStatus(Connection conn, String status)
133 1 Soh Keong
134 15 Soh Keong
Set<KeywordBean>               productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo)
135 14 Soh Keong
136 15 Soh Keong
Map<Integer, Set<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn, *int startFrom, int totalRecord* )
137 12 Soh Keong
Set<Integer>                   productSet = service.getProductSetByStatus(Connection conn, String status, *int startFrom, int totalRecord* )
138 13 Soh Keong
139
*NOTE :* startFrom & totalRecord are optional field
140 5 Soh Keong
141 7 Soh Keong
> * *productRefNo* - 
142
> * *keywordRefNo* - 
143 4 Soh Keong
> * *priority*     - 
144
145 18 Soh Keong
h2. Add product Keyword
146 5 Soh Keong
147 4 Soh Keong
<pre>
148
com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService();
149 5 Soh Keong
</pre>
150
151
boolean added = service.addProductPattern(Connection conn, PurchaseBean bean)
152 7 Soh Keong
153
> * *productRefNo* - 
154
> * *searchType*   - com.cosway.keyword.constant.SearchType
155 4 Soh Keong
> * *shopperRefNo* - 
156
157 18 Soh Keong
h2. Search
158 5 Soh Keong
159
<pre>
160
com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService();
161
</pre>
162 1 Soh Keong
163 11 Soh Keong
Set<Integer>          productSet = service.getProductListByType(Connection conn, SearchBean searchBean)
164 1 Soh Keong
Set<Integer>          productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean)
165 14 Soh Keong
166
Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean)
167 1 Soh Keong
168 11 Soh Keong
> By Type
169
> * *shopperRefNo* - 
170
> * *noOfRecords*  - 
171
> * *searchType*   - com.cosway.keyword.constant.SearchType 
172
173
> By Level 
174
> * *shopperRefNo* - 
175
> * *noOfRecords*  - 
176
> * *level*        - 
177
178
> By Product
179 7 Soh Keong
> * *productRefNo* - 
180
> * *noOfRecords*  - 
181 11 Soh Keong
> * *level*        - (By Level & Product only)