0% found this document useful (0 votes)
63 views

Data Service Pagination

This document contains XML code that defines SQL queries and result mappings for retrieving and filtering item records. The queries include pagination logic and support filtering by various item fields like ID, code, description. The results are mapped to a Java object with properties corresponding to the item data in the database.

Uploaded by

Rajiv Gandhi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Data Service Pagination

This document contains XML code that defines SQL queries and result mappings for retrieving and filtering item records. The queries include pagination logic and support filtering by various item fields like ID, code, description. The results are mapped to a Java object with properties corresponding to the item data in the database.

Uploaded by

Rajiv Gandhi
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibat is.apache.org/dtd/sql-map-2.

dtd" > <sqlMap namespace="DATASERVICE_RULES"> <sql id="dataservicePaginationPrefixQuery"> SELECT * FROM( SELECT RS.*, ROWNUM rnum FROM ( </sql> <sql id="dataservicePaginationSuffixQuery"> ) RS <dynamic prepend="where"> <isPropertyAvailable property="pagination_minRowNumber"> ROWNUM <![CDATA[<=]]> #pagination_maxRowNumber# </isPropertyAvailable> </dynamic> ) <dynamic prepend="where"> <isPropertyAvailable property="pagination_maxRowNumber"> rnum <![CDATA[>=]]> #pagination_minRowNumber# </isPropertyAvailable> </dynamic> </sql> <resultMap class="com.nielsen.ogrds.dto.ibatis.resultmap.RetrieveTotalAn dChangedItemStatForRuleRespDto" id="RetrieveTotalAndChangedItemStatForRuleResultMap"> <result property="itemRecordId" column="item_rec_id" jdbcType="N UMBER" typeHandler="com.nielsen.ogrds.util.BigIntegerTypeHandler"/> <result property="itemCode" column="item_code" jdbcType="NUMBER" typeHandler="com.nielsen.ogrds.util.BigIntegerTypeHandler"/> <result property="externalCode" column="extrn_code" jdbcType="VA RCHAR"/> <result property="outcomeMessage" column="outcome_mesg" jdbcType ="VARCHAR"/> <result property="localProductClass" column="localPC" jdbcType= "VARCHAR"/> <result property="globalModule" column="globalModule" jdbcType=" VARCHAR" /> <result property="itemDescription" column="item_dscr" jdbcType= "VARCHAR" /> </resultMap> <select id="RetrieveTotalAndChangedItemStatForRule" resultMap="RetrieveT otalAndChangedItemStatForRuleResultMap" parameterClass="Map"> <include refid="dataservicePaginationPrefixQuery"/> SELECT coll.* FROM (SELECT DISTINCT ro.item_rec_id item_rec_id, (SELECT it.item_code FROM item_t it

WHERE it.item_rec_id = ro.item_rec_id) item_code, (SELECT itec.extrn_code FROM item_extrn_code_t itec WHERE itec.rgn_id = #criteria_rgnId:NUMBER# AND itec.del_ind = 'N' AND itec.item_rec_id = ro.item_rec_id) extrn_code, ro.outcome_mesg outcome_mesg, (SELECT FROM INNER ON WHERE AND AND AND (SELECT FROM WHERE AND AND itd.item_dscr item_dscr_t itd JOIN dscr_config_t dc dc.dscr_id = itd.dscr_id itd.lang_id = f_get_central_language() dc.enty_dscr = 'ITEM' dc.main_dscr_ind = 'Y' itd.item_rec_id = ro.item_rec_id) item_dscr, cvd1.chr_val_dscr chr_val_dscr_t cvd1, item_chr_val_t itcv1, chr_t c1 itcv1.item_rec_id = ro.item_rec_id itcv1.chr_id = c1.chr_id c1.ctrl_chr_flg = 'Y' AND c1.del_ind = 'N' AND cvd1.chr_val_id = itcv1.chr_val_id AND cvd1.lang_id = #criteria_langId:NUMBER# AND cvd1.dscr_id = (SELECT dc.dscr_id FROM dscr_config_t dc where dc.rgn_id = #criteria_rgnId:NUMBER# AND dc.main_dscr_ind = 'Y' AND dc.enty_dscr = 'LOCAL PRODUCT CLASS')) local

PC, cvd2.chr_val_dscr chr_t c2, chr_val_dscr_t cvd2, item_chr_val_t itcv2 itcv2.item_rec_id = ro.item_rec_id itcv2.chr_id = c2.chr_id c2.ctrl_chr_flg = 'Y' cvd2.chr_val_id = itcv2.chr_val_id cvd2.lang_id = #criteria_langId:NUMBER# cvd2.dscr_id = (SELECT dc.dscr_id FROM dscr_config_t dc where dc.rgn_id = f_get_rgn_id_by_iso('XGL') and dc.main_dscr_ind = 'Y' AND dc.enty_dscr = 'GLOBAL MODULE')) globalModule FROM rule_outcome_t ro WHERE ro.rule_id = #criteria_ruleId:NUMBER# AND ro.job_id = (SELECT max(ro1.job_id) FROM rul e_outcome_t ro1 WHERE ro1.rule_id = #criteria_ruleId:NUMBER#) <isEqual property="criteria_gridCellType" compareValue="CHANGED" > AND ro.chng_ind='Y' </isEqual> ) coll <dynamic prepend="WHERE" open="(" close=")"> <isEqual property="searchMode" compareValue="SIMPLE"> <isPropertyAvailable property="filter_ITEM_REC_I D" prepend="OR"> <isNotNull property="filter_ITEM_REC_ID" > coll.item_rec_id = #filter_ITEM_ (SELECT FROM WHERE AND AND AND AND AND

REC_ID:NUMBER# </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_ITEM_CODE" prepend="OR"> <isNotNull property="filter_ITEM_CODE"> coll.item_code = #filter_ITEM_CO DE:NUMBER# </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_EXTRN_CODE " prepend="OR"> <isNotNull property="filter_EXTRN_CODE"> UPPER(coll.extrn_code) LIKE UPPE R(#filter_EXTRN_CODE#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_ITEM_DSCR" prepend="OR"> <isNotNull property="filter_ITEM_DSCR"> UPPER(coll.item_dscr) LIKE UPPER (#filter_ITEM_DSCR#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_LOCALPC" p repend="OR"> <isNotNull property="filter_LOCALPC"> UPPER(coll.localPC) LIKE UPPER(# filter_LOCALPC#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_GLOBALMODU LE" prepend="OR"> <isNotNull property="filter_GLOBALMODULE "> UPPER(coll.globalModule) LIKE UP PER(#filter_GLOBALMODULE#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_OUTCOME_ME SG" prepend="OR"> <isNotNull property="filter_OUTCOME_MESG "> UPPER(coll.outcome_mesg) LIKE UP PER(#filter_OUTCOME_MESG#) </isNotNull> </isPropertyAvailable> </isEqual> <isEqual property="searchMode" compareValue="ADVANCED"> <isPropertyAvailable property="filter_ITEM_REC_I DFrom" prepend="AND"> <isNotNull property="filter_ITEM_REC_IDF rom"> coll.item_rec_id <![CDATA[>=]]> #filter_ITEM_REC_IDFrom:NUMBER# </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_ITEM_REC_I DTo" prepend="AND">

<isNotNull property="filter_ITEM_REC_IDT o"> coll.item_rec_id <![CDATA[<=]]> #filter_ITEM_REC_IDTo:NUMBER# </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_ITEM_CODEF rom" prepend="AND"> <isNotNull property="filter_ITEM_CODEFro m"> coll.item_code <![CDATA[>=]]> #f ilter_ITEM_CODEFrom:NUMBER# </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_ITEM_CODET o" prepend="AND"> <isNotNull property="filter_ITEM_CODETo" > coll.item_code <![CDATA[<=]]> #f ilter_ITEM_CODETo:NUMBER# </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_EXTRN_CODE " prepend="AND"> <isNotNull property="filter_EXTRN_CODE"> UPPER(coll.extrn_code) LIKE UPPE R(#filter_EXTRN_CODE#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_ITEM_DSCR" prepend="AND"> <isNotNull property="filter_ITEM_DSCR"> UPPER(coll.item_dscr) LIKE UPPER (#filter_ITEM_DSCR#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_LOCALPC" p repend="AND"> <isNotNull property="filter_LOCALPC"> UPPER(coll.localPC) LIKE UPPER(# filter_LOCALPC#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_GLOBALMODU LE" prepend="AND"> <isNotNull property="filter_GLOBALMODULE "> UPPER(coll.globalModule) LIKE UP PER(#filter_GLOBALMODULE#) </isNotNull> </isPropertyAvailable> <isPropertyAvailable property="filter_OUTCOME_ME SG" prepend="AND"> <isNotNull property="filter_OUTCOME_MESG "> UPPER(coll.outcome_mesg) LIKE UP PER(#filter_OUTCOME_MESG#) </isNotNull> </isPropertyAvailable> </isEqual>

</dynamic> <dynamic prepend="ORDER BY"> <isPropertyAvailable prepend="," property="sortColumn1"> <isPropertyAvailable property="sortOrder1"> $sortColumn1$ $sortOrder1$ </isPropertyAvailable> </isPropertyAvailable> <isPropertyAvailable prepend="," property="sortColumn2"> <isPropertyAvailable property="sortOrder2"> $sortColumn2$ $sortOrder2$ </isPropertyAvailable> </isPropertyAvailable> <isPropertyAvailable prepend="," property="sortColumn3"> <isPropertyAvailable property="sortOrder3"> $sortColumn3$ $sortOrder3$ </isPropertyAvailable> </isPropertyAvailable> </dynamic> <include refid="dataservicePaginationSuffixQuery"/> </select> </sqlMap>

You might also like