Wiki » History » Revision 14
Revision 13 (Soh Keong, 11/15/2021 02:47 PM) → Revision 14/28 (Soh Keong, 11/15/2021 04:23 PM)
{{toc}} h1. Specification h1. Chart !FlowChart.jpg! h1. Programming Guide h2. Jar version |_. version |_. Description | | 1.0 | Init | h2. Jar File Download "Jar":/redmine/attachments/download/618/keyword-1.0.jar "Lib":/redmine/attachments/download/602/lib.rar h3. Test Link https://202.129.164.38:9093/TestPage/page/keyword/addKeyword h2. Database Table <pre> CREATE TABLE KEYWORD_PRODUCT ( KEYWORD_REF_NO INTEGER NOT NULL, KEYWORD VARCHAR(50) NOT NULL, STATUS VARCHAR(2) DEFAULT 'A', CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MODIFY_DATETIME TIMESTAMP, PRIMARY KEY (KEYWORD_REF_NO)) CREATE UNIQUE INDEX UI_PROD_KEYWORD ON KEYWORD_PRODUCT(KEYWORD) </pre> <pre> CREATE TABLE KEYWORD_PRODUCT_PATTERN ( PRODUCT_REF_NO INTEGER NOT NULL, KEYWORD_REF_NO INTEGER NOT NULL, PRIORITY INTEGER, STATUS VARCHAR(2) DEFAULT 'A', CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MODIFY_DATETIME TIMESTAMP, PRIMARY KEY (PRODUCT_REF_NO,KEYWORD_REF_NO)) CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_PRIO ON KEYWORD_PRODUCT_PATTERN(PRIORITY) CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_STATUS ON KEYWORD_PRODUCT_PATTERN(STATUS) CREATE INDEX IX_KEYWORD_PRODUCT_PATTERN_DATE ON KEYWORD_PRODUCT_PATTERN(MODIFY_DATETIME) </pre> <pre> CREATE TABLE KEYWORD_SEARCH_PRODUCT ( PRODUCT_REF_NO INTEGER NOT NULL, SHOPPER_REF_NO INTEGER NOT NULL, SEARCH_TYPE VARCHAR(5) NOT NULL, CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MODIFY_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (PRODUCT_REF_NO,SHOPPER_REF_NO,SEARCH_TYPE)) CREATE INDEX IX_KEYWORD_SEARCH_PRODUCT_MODI ON KEYWORD_SEARCH_PRODUCT(MODIFY_DATETIME) </pre> <pre> CREATE TABLE KEYWORD_SEARCH_PATTERN ( SHOPPER_REF_NO INTEGER NOT NULL, KEYWORD_REF_NO INTEGER NOT NULL, PRIORITY INTEGER NOT NULL, CREATE_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, MODIFY_DATETIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (SHOPPER_REF_NO, KEYWORD_REF_NO, PRIORITY)) CREATE INDEX IX_KEYWORD_SEARCH_PATTERN_MODIFY ON KEYWORD_SEARCH_PATTERN(MODIFY_DATETIME) </pre> h2. Methods h3. Keyword <pre> com.cosway.keyword.service.KeywordService service = new com.cosway.keyword.service.KeywordService(); </pre> boolean added = service.addKeyword(Connection conn, String keyword) boolean updated = service.updateKeywordStatus(Connection conn, int keywordRefNo, String status) int totalRecord = service.getTotalKeywordInActive(Connection conn) int totalRecord = service.getTotalKeywordAll(Connection conn) int totalRecord = service.getTotalKeywordPrefix(Connection conn, String search) int totalRecord = service.getTotalKeywordwildcard(Connection conn, String search) Map<Integer, String> KeywordMap = service.getKeywordAInActiveMap(Connection conn, *int startFrom, int totalRecord* ) Map<Integer, String> KeywordMap = service.getKeywordAllMap(Connection conn, *int startFrom, int totalRecord* ) Map<Integer, String> KeywordMap = service.getKeywordPrefixMap(Connection conn, String search, *int startFrom, int totalRecord* ) Map<Integer, String> KeywordMap = service.getKeywordwildcardMap(Connection conn, String search, *int startFrom, int totalRecord* ) *NOTE :* startFrom & totalRecord are optional field h3. Product <pre> com.cosway.keyword.service.ProductService service = new com.cosway.keyword.service.ProductService(); </pre> boolean added = service.addProductKeyword(Connection conn, KeywordBean keyword) boolean updated = service.updateProductStatus(Connection conn, int productRefNo, String status) int totalRecord = service.getTotalProductKeyword(Connection conn) int totalRecord = service.getTotalProductKeywordSetByProductRefNo(Connection conn) int totalRecord = service.getTotalProductSetByStatus(Connection conn, String status) Map<Integer, Set<KeywordBean>> productMap = service.getProductKeywordMap(Connection conn, *int startFrom, int totalRecord* ) Set<KeywordBean> productSet = service.getProductKeywordSetByProductRefNo(Connection conn, int productRefNo, *int startFrom, int totalRecord* ) Set<Integer> productSet = service.getProductSetByStatus(Connection conn, String status, *int startFrom, int totalRecord* ) *NOTE :* startFrom & totalRecord are optional field > * *productRefNo* - > * *keywordRefNo* - > * *priority* - h3. Add product Keyword <pre> com.cosway.keyword.service.PurchaseService service = new com.cosway.keyword.service.PurchaseService(); </pre> boolean added = service.addProductPattern(Connection conn, PurchaseBean bean) > * *productRefNo* - > * *searchType* - com.cosway.keyword.constant.SearchType > * *shopperRefNo* - h3. Search <pre> com.cosway.keyword.service.SearchService service = new com.cosway.keyword.service.SearchService(); </pre> Set<Integer> productSet = service.getProductListByType(Connection conn, SearchBean searchBean) Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean) Set<Integer> productSet = service.getProductListByProduct(Connection conn, SearchBean searchBean) Map<Integer, Integer> productMap = service.getProductRefNoByLevel(Connection conn, SearchBean searchBean) > By Type > * *shopperRefNo* - > * *noOfRecords* - > * *searchType* - com.cosway.keyword.constant.SearchType > By Level > * *shopperRefNo* - > * *noOfRecords* - > * *level* - > By Product > * *productRefNo* - > * *noOfRecords* - > * *level* - (By Level & Product only)