spc-sms/xml/nhsmaster-sql.xml

1211 lines
31 KiB
XML
Raw Permalink Normal View History

<?xml version="1.0" encoding="utf-8"?>
<sql-resource key="nhsmaster-sql">
<!-- 01: 점포별 대기화면 -->
<query name="SEL_NHS_SCREEN">
<![CDATA[
SELECT 'FIRST' SCREEN_KIND,
A.CMP_CD,
A.SALES_ORG_CD,
? STOR_CD,
A.SCREEN_CD,
A.LAYOUT_CD,
A.SCREEN_NM,
A.SCREEN_DESC,
A.DISPLAY_YN,
A.DISPLAY_START_DT,
A.DISPLAY_END_DT,
A.REG_USER_ID,
A.REG_DATE,
A.UPD_USER_ID,
A.UPD_DATE
FROM
(
SELECT 'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
SCREEN_CD,
LAYOUT_CD,
SCREEN_NM,
SCREEN_DESC,
DISPLAY_YN,
DISPLAY_START_DT,
DISPLAY_END_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
AND DISPLAY_YN = '1'
AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DISPLAY_START_DT AND DISPLAY_END_DT
UNION ALL
SELECT 'SALES' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
SCREEN_CD,
LAYOUT_CD,
SCREEN_NM,
SCREEN_DESC,
DISPLAY_YN,
DISPLAY_START_DT,
DISPLAY_END_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = '000'
AND DISPLAY_YN = '1'
AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DISPLAY_START_DT AND DISPLAY_END_DT
) A, (SELECT COUNT(*) CNT FROM NHS_SCREEN WHERE CMP_CD = ?
AND SALES_ORG_CD = ? AND STOR_CD =? AND DISPLAY_YN='1') B
WHERE A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END
UNION ALL
SELECT 'MAIN' SCREEN_KIND,
A.CMP_CD,
A.SALES_ORG_CD,
? STOR_CD,
'M1',
'' LAYOUT_CD,
'메인 배너' SCREEN_NM,
'메인 배너' SCREEN_DESC,
'1' DISPLAY_YN,
'19991231' DISPLAY_START_DT,
'29991231' DISPLAY_END_DT,
'AUTO' REG_USER_ID,
SYSDATE REG_DATE,
'AUTO' UPD_USER_ID,
SYSDATE UPD_DATE
FROM NHS_BANNER A
WHERE CMP_CD =?
AND SALES_ORG_CD =?
AND STOR_CD ='000'
AND BANNER_KIND ='01'
GROUP BY A.CMP_CD,
A.SALES_ORG_CD
UNION ALL
SELECT 'PAYMENT' SCREEN_KIND,
A.CMP_CD,
A.SALES_ORG_CD,
? STOR_CD,
'P1',
'' LAYOUT_CD,
'결제 배너' SCREEN_NM,
'결제 배너' SCREEN_DESC,
'1' DISPLAY_YN,
'19991231' DISPLAY_START_DT,
'29991231' DISPLAY_END_DT,
'AUTO' REG_USER_ID,
SYSDATE REG_DATE,
'AUTO' UPD_USER_ID,
SYSDATE UPD_DATE
FROM NHS_BANNER A
WHERE CMP_CD =?
AND SALES_ORG_CD =?
AND STOR_CD ='000'
AND BANNER_KIND ='02'
GROUP BY A.CMP_CD,
A.SALES_ORG_CD
]]>
</query>
<!-- 02: 대기화면 레이어별 리소스 -->
<query name="SEL_NHS_SCREEN_CONTENTS">
<![CDATA[
SELECT 'FIRST' SCREEN_KIND,
CMP_CD,
SALES_ORG_CD,
? STOR_CD,
LAYER_CD,
CONTENTS_ID,
SCREEN_CD,
FRAME_CD,
DISPLAY_ORDER,
DISPLAY_START_TIME,
DISPLAY_END_TIME,
FILE_FULLPATH,
FILE_NAME,
DECODE(UPPER(FILE_MIME_TYPE),'MP4',UPPER(FILE_MIME_TYPE),'PNG') FILE_MIME_TYPE,
PLAY_TIME,
LINK_YN,
PRD_CATE_L,
PRD_CATE_M,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN_CONTENTS
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND SCREEN_CD = (SELECT
MAX(A.SCREEN_CD)
FROM
(
SELECT 'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
SCREEN_CD,
LAYOUT_CD,
SCREEN_NM,
SCREEN_DESC,
DISPLAY_YN,
DISPLAY_START_DT,
DISPLAY_END_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
AND DISPLAY_YN = '1'
AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DISPLAY_START_DT AND DISPLAY_END_DT
UNION ALL
SELECT 'SALES' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
SCREEN_CD,
LAYOUT_CD,
SCREEN_NM,
SCREEN_DESC,
DISPLAY_YN,
DISPLAY_START_DT,
DISPLAY_END_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = '000'
AND DISPLAY_YN = '1'
AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DISPLAY_START_DT AND DISPLAY_END_DT
) A, (SELECT COUNT(*) CNT FROM NHS_SCREEN WHERE CMP_CD = ?
AND SALES_ORG_CD = ? AND STOR_CD =? AND DISPLAY_YN = '1') B WHERE A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END )
UNION ALL
SELECT SCREEN_KIND,CMP_CD,SALES_ORG_CD,STOR_CD,LAYER_CD,BANNER_CD,SCREEN_ID,FRAME_CD,BANNER_SEQ,
START_TIME,END_TIME,FILE_PATH,FILE_NAME,FILE_MIME_TYPE,PLAY_TIME,LINK_YN,PRD_CATE_L,PRD_CATE_M,
REG_USER_ID,REG_DATE, UPD_USER_ID, UPD_DATE
FROM
(
SELECT DECODE(BANNER_KIND,'01','MAIN','02','PAYMENT') SCREEN_KIND,
'SALES' GBN,
CMP_CD,
SALES_ORG_CD,
? STOR_CD,
'001' LAYER_CD,
BANNER_CD,
DECODE(BANNER_KIND,'01','M1','02','P1') SCREEN_ID,
'11' FRAME_CD,
BANNER_SEQ,
START_TIME,
END_TIME,
'' FILE_PATH,
FILE_NAME,
FILE_MIME_TYPE,
PLAY_TIME,
LINK_YN,
PRD_CATE_L,
PRD_CATE_M,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_BANNER
WHERE CMP_CD = ?
AND SALES_ORG_CD =?
AND STOR_CD ='000'
AND USE_YN ='1'
UNION ALL
SELECT DECODE(BANNER_KIND,'01','MAIN','02','PAYMENT') SCREEN_KIND,
'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
'001' LAYER_CD,
BANNER_CD,
DECODE(BANNER_KIND,'01','M1','02','P1') SCREEN_ID,
'11' FRAME_CD,
BANNER_SEQ,
START_TIME,
END_TIME,
'' FILE_PATH,
FILE_NAME,
FILE_MIME_TYPE,
PLAY_TIME,
LINK_YN,
PRD_CATE_L,
PRD_CATE_M,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_BANNER
WHERE CMP_CD = ?
AND SALES_ORG_CD =?
AND STOR_CD =?
AND USE_YN ='1'
) A, (SELECT COUNT(*) CNT FROM NHS_BANNER WHERE CMP_CD =? AND SALES_ORG_CD =? AND STOR_CD =? AND USE_YN ='1') B
WHERE A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END
]]>
</query>
<!-- 03: 대기화면 레이어 -->
<query name="SEL_NHS_SCREEN_LAYER">
<![CDATA[
SELECT 'FIRST' SCREEN_KIND,
CMP_CD,
SALES_ORG_CD,
? STOR_CD,
FRAME_CD,
LAYER_CD,
SCREEN_CD,
FRAME_VERTICAL_SIZE,
LAYER_DISPLAY_ORDER,
FIX_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN_LAYER
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND SCREEN_CD = (SELECT
MAX(A.SCREEN_CD)
FROM
(
SELECT 'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
SCREEN_CD,
LAYOUT_CD,
SCREEN_NM,
SCREEN_DESC,
DISPLAY_YN,
DISPLAY_START_DT,
DISPLAY_END_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
AND DISPLAY_YN = '1'
AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DISPLAY_START_DT AND DISPLAY_END_DT
UNION ALL
SELECT 'SALES' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
SCREEN_CD,
LAYOUT_CD,
SCREEN_NM,
SCREEN_DESC,
DISPLAY_YN,
DISPLAY_START_DT,
DISPLAY_END_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_SCREEN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = '000'
AND DISPLAY_YN = '1'
AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DISPLAY_START_DT AND DISPLAY_END_DT
) A, (SELECT COUNT(*) CNT FROM NHS_SCREEN WHERE CMP_CD = ?
AND SALES_ORG_CD = ? AND STOR_CD =? AND DISPLAY_YN = '1') B WHERE A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END )
UNION ALL
SELECT 'MAIN' SCREEN_KIND,
CMP_CD,
SALES_ORG_CD,
? STOR_CD,
'11' FRAME_CD,
'001' LAYER_CD,
'M1' SCREEN_CD,
'' FRAME_VERTICAL_SIZE,
1 LAYER_DISPLAY_ORDER,
'0' FIX_YN,
'AUTO' REG_USER_ID,
SYSDATE REG_DATE,
'AUTO' UPD_USER_ID,
SYSDATE UPD_DATE
FROM NHS_BANNER
WHERE CMP_CD =?
AND SALES_ORG_CD =?
AND STOR_CD ='000'
AND BANNER_KIND ='01'
GROUP BY CMP_CD,
SALES_ORG_CD
UNION ALL
SELECT 'PAYMENT' SCREEN_KIND,
CMP_CD,
SALES_ORG_CD,
? STOR_CD,
'11' FRAME_CD,
'001' LAYER_CD,
'P1' SCREEN_CD,
'' FRAME_VERTICAL_SIZE,
1 LAYER_DISPLAY_ORDER,
'0' FIX_YN,
'AUTO' REG_USER_ID,
SYSDATE REG_DATE,
'AUTO' UPD_USER_ID,
SYSDATE UPD_DATE
FROM NHS_BANNER
WHERE CMP_CD =?
AND SALES_ORG_CD =?
AND STOR_CD ='000'
AND BANNER_KIND ='02'
GROUP BY CMP_CD,
SALES_ORG_CD
]]>
</query>
<!-- 04: 점포별 제품카테고리 (삭제 2019.03.11)-->
<query name="SEL_NHS_STOR_PRD_CATE">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
STOR_CD,
PRD_CATE_UP_CD,
PRD_CATE_CD,
FILE_FULLPATH,
FILE_NAME,
DISPLAY_ORDER,
USE_YN,
HIDE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_STOR_PRD_CATE
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
]]>
</query>
<!-- 05: 점포별 제품 터치키 -->
<query name="SEL_NHS_STOR_PRD_KEY">
<![CDATA[
SELECT A.CMP_CD,
A.SALES_ORG_CD,
A.STOR_CD,
A.PRD_CATE_CD,
A.TOUCH_KEY_CD,
A.ITEM_CD,
A.DISPLAY_ORDER,
A.USE_YN,
A.SOLDOUT_YN,
A.RECOMMAND_YN,
A.NEW_YN,
A.PRESENT_YN,
A.SALES_PRC,
(SELECT CASE WHEN COUNT(ITEM_OPTN_GRP_CD) > 0 THEN 1 ELSE 0 END
FROM NHS_PRD_OPTN DD
WHERE DD.CMP_CD = A.CMP_CD
AND DD.SALES_ORG_CD = A.SALES_ORG_CD
AND DD.STOR_CD = A.STOR_CD
AND DD.ITEM_CD=A.ITEM_CD) OPTN_YN,
A.TOUCH_KEY_NM,
A.LAST_UPD_TIME,
B.FILE_NAME ,
C.BAR_CD,
B.ORDER_TYPE,
A.REG_USER_ID,
A.REG_DATE,
A.UPD_USER_ID,
A.UPD_DATE,
/* BR 추가 */
A.TOUCH_KEY_KIND,
A.MAPPING_CD,
A.PRD_LINK_PAGE1,
A.PRD_LINK_PAGE2,
A.SET_YN,
A.SET_ITEM_CD,
A.SET_ITEM_CNT,
A.FLAVOR_YN,
A.FLAVOR_CNT,
A.OPTN_CNT_CHG_YN,
A.SET_CHANGE_YN,
A.SET_CHANGE_ITEM_CD,
A.EVENT_CHANGE_YN,
A.EVENT_ITEM_CD,
A.D2_USE_YN
FROM NHS_STOR_PRD_KEY A
LEFT OUTER JOIN NHS_PRD_MST B ON A.CMP_CD = B.CMP_CD
AND A.SALES_ORG_CD = B.SALES_ORG_CD
AND A.ITEM_CD = B.ITEM_CD
LEFT OUTER JOIN MST_ITEM_BAR_CD C ON A.CMP_CD = C.CMP_CD
AND A.ITEM_CD = C.ITEM_CD
WHERE A.CMP_CD = ?
AND A.SALES_ORG_CD = ?
AND A.STOR_CD = ?
]]>
</query>
<!-- 06: 점포별 UI템플릿 -->
<query name="SEL_NHS_UI_TEMPLATE">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
STOR_CD,
TEMPL_CD,
TEMPL_NM,
LOGO_FILE_NAME,
LOGO_FILE_FULLPATH,
GNB_BACK_COLOR,
MAIN_BACK_COLOR,
MAIN_FONT_COLOR,
HPC_GNB_BACK_COLOR,
HPC_MAIN_BACK_COLOR,
HPC_MAIN_FONT_COLOR,
USE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_UI_TEMPLATE
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
]]>
</query>
<!-- 07: 캠페인 리소스 -->
<query name="SEL_NHS_CPI_CONTENTS">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
CPI_CD,
FILE_FULLPATH,
FILE_NAME,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_CPI_CONTENTS
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
]]>
</query>
<!-- 08: 고객구매이력(삭제 2019.03.10) -->
<query name="SEL_NHS_CUST_BUY_HIST">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
HPC_CUST_CD,
ITEM_CD,
ITEM_NM,
BUY_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_CUST_BUY_HIST
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND HPC_CUST_CD = ?
]]>
</query>
<!-- 09: 제품 다국어 -->
<query name="SEL_NHS_LANG_MSG">
<![CDATA[
SELECT A.CMP_CD,
A.SALES_ORG_CD,
DECODE(A.LANG_GBN_CD,'LBL','COMMON','BTN','COMMON',A.LANG_GBN_CD) LANG_GBN_CD,
A.LANG_CD,
A.LANG_MESSAGE_CD,
A.LANG_MESSAGE,
A.REG_USER_ID,
A.REG_DATE,
A.UPD_USER_ID,
A.UPD_DATE
FROM
(
SELECT 'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
LANG_GBN_CD,
LANG_CD,
LANG_MESSAGE_CD,
LANG_MESSAGE,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_LANG_MSG
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
UNION ALL
SELECT 'SALES' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
LANG_GBN_CD,
LANG_CD,
LANG_MESSAGE_CD,
LANG_MESSAGE,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_LANG_MSG
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = '000'
) A,
(SELECT COUNT(*) CNT,LANG_GBN_CD,LANG_MESSAGE_CD FROM NHS_LANG_MSG WHERE CMP_CD = ?
AND SALES_ORG_CD = ? AND STOR_CD =? GROUP BY LANG_GBN_CD,LANG_MESSAGE_CD) B
WHERE A.LANG_GBN_CD = B.LANG_GBN_CD(+)
AND A.LANG_MESSAGE_CD = B.LANG_MESSAGE_CD(+)
AND A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END
]]>
</query>
<!-- 10: 화면구성 -->
<query name="SEL_NHS_LAYOUT">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
LAYOUT_CD,
LAYOUT_NM,
LAYOUT_RESOLUTION,
FRAME_COUNT,
RESOLUTION_HORIZEN,
RESOLUTION_VERTICAL,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_LAYOUT
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
]]>
</query>
<!-- 11: 제품카테고리(대분류)(삭제 2019.03.10) -->
<query name="SEL_NHS_PRD_CATE1">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
PRD_CATE_CD,
PRD_CATE_UP_CD,
FILE_FULLPATH,
FILE_NAME,
DISPLAY_ORDER,
USE_YN,
HIDE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_PRD_CATE
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND PRD_CATE_UP_CD = '0000'
]]>
</query>
<!-- 12: 제품카테고리(중분류)(삭제 2019.03.10) -->
<query name="SEL_NHS_PRD_CATE2">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
PRD_CATE_CD,
PRD_CATE_UP_CD,
FILE_FULLPATH,
FILE_NAME,
DISPLAY_ORDER,
USE_YN,
HIDE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_PRD_CATE
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
]]>
</query>
<!-- 13: 제품마스터 -->
<query name="SEL_NHS_PRD_MST">
<![CDATA[
SELECT A.CMP_CD,
A.SALES_ORG_CD,
A.PRD_CATE_CD,
A.ITEM_CD,
B.BAR_CD,
A.ITEM_NM,
A.FILE_FULLPATH,
A.FILE_NAME,
A.ORDER_TYPE,
A.RECOMMAND_YN,
A.NEW_YN,
A.DISPLAY_ORDER,
A.USE_YN,
A.PRESENT_YN,
A.REG_USER_ID,
A.REG_DATE,
A.UPD_USER_ID,
A.UPD_DATE
FROM NHS_PRD_MST A
LEFT OUTER JOIN MST_ITEM_BAR_CD B ON A.CMP_CD = B.CMP_CD AND A.ITEM_CD = B.ITEM_CD
WHERE A.CMP_CD = ?
AND A.SALES_ORG_CD = ?
]]>
</query>
<!-- 14: 부가옵션 -->
<query name="SEL_NHS_OPTN_MST">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
ITEM_OPTN_GRP_CD,
ITEM_OPTN_CD,
ITEM_OPTN_NM,
KIND,
OPTN_MTD,
KIND_CODE,
AMT,
MIN_AMT,
MAX_AMT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_OPTN_MST
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
]]>
</query>
<!-- 15: 부가옵션그룹 -->
<query name="SEL_NHS_PRD_OPTN_GRP">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
ITEM_OPTN_GRP_CD,
OPTN_GRP_NM,
FILE_FULLPATH,
FILE_NAME,
SEL_MTD,
RQRD_YN,
USE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_PRD_OPTN_GRP
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
]]>
</query>
<!-- 16: 제품별 부가옵션 -->
<query name="SEL_NHS_PRD_OPTN">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
STOR_CD,
ITEM_CD,
ITEM_OPTN_GRP_CD,
DISPLAY_ORDER,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_PRD_OPTN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
]]>
</query>
<!-- 17: 제품카테고리(전체) -->
<!-- 점포와 조인걸어야함 -->
<query name="SEL_NHS_PRD_CATE">
<![CDATA[
SELECT A.CMP_CD,
A.SALES_ORG_CD,
A.PRD_CATE_CD,
A.PRD_CATE_UP_CD,
A.FILE_FULLPATH,
A.FILE_NAME,
A.DISPLAY_ORDER,
A.USE_YN,
A.HIDE_YN,
A.REG_USER_ID,
A.REG_DATE,
A.UPD_USER_ID,
A.UPD_DATE
FROM(
SELECT 'SALES' GBN,
CMP_CD,
SALES_ORG_CD,
'000' STOR_CD,
PRD_CATE_CD,
PRD_CATE_UP_CD,
FILE_FULLPATH,
FILE_NAME,
DISPLAY_ORDER,
USE_YN,
HIDE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_PRD_CATE
WHERE CMP_CD =?
AND SALES_ORG_CD = ?
AND USE_YN ='1'
UNION ALL
SELECT 'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
PRD_CATE_CD,
PRD_CATE_UP_CD,
FILE_FULLPATH,
FILE_NAME,
DISPLAY_ORDER,
USE_YN,
HIDE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_STOR_PRD_CATE
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
AND USE_YN ='1'
) A ,(SELECT COUNT(*) CNT FROM NHS_STOR_PRD_CATE WHERE CMP_CD = ?
AND SALES_ORG_CD = ? AND STOR_CD =?) B
WHERE A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END
]]>
</query>
<!-- 18: 점포별 제품별 태그 정보 -->
<query name="SEL_NHS_STOR_PRD_TAG">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
STOR_CD,
ITEM_CD,
TAG_KIND,
FILE_NAME,
NEW_START_DT,
NEW_END_DT,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_STOR_PRD_TAG
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
UNION ALL
SELECT CITEM.CMP_CD,
CITEM.SALES_ORG_CD,
? STOR_CD,
CITEM.ITEM_CD,
'3' TAG_KIND,
'img_event.png' FILE_NAME,
NULL NEW_START_DT,
NULL NEW_END_DT,
'AUTO' REG_USER_ID,
SYSDATE,
'AUTO' UPD_USER_ID,
SYSDATE
FROM CPI_ITEM_MNG CITEM,
MST_ITEM ITEM
WHERE CITEM.CPI_CD IN (
SELECT D.CPI_CD
FROM CPI_MST A,
CPI_APPLY_STOR B,
CPI_DOW_TIMEZON_MNG D
WHERE A.CMP_CD =?
AND A.SALES_ORG_CD =?
AND A.CPI_CD = B.CPI_CD
AND A.CPI_CD = D.CPI_CD
AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN A.START_DT AND A.FNSH_DT
AND A.PRGRS_STATUS ='C'
AND B.STOR_CD =?
AND TO_CHAR (SYSDATE, 'D') = D.DOW
AND TO_CHAR(SYSDATE,'HH24SS') BETWEEN D.START_HOUR AND D.FNSH_HOUR
)
AND ((CITEM.ITEM_LVL ='1' AND CITEM.ITEM_CD = ITEM.ITEM_CD) OR
(CITEM.ITEM_LVL ='2' AND CITEM.ITEM_CD = ITEM.ITEM_CLASS_CD) OR
(CITEM.ITEM_LVL ='3' AND SUBSTR(CITEM.ITEM_CD,4,2) = SUBSTR(ITEM.ITEM_CLASS_CD,4,2)) OR
(CITEM.ITEM_LVL ='4' AND SUBSTR(CITEM.ITEM_CD,0,3) = SUBSTR(ITEM.ITEM_CLASS_CD,0,3)))
AND ITEM.USE_YN ='1'
AND CITEM.USE_YN ='1'
GROUP BY CITEM.CMP_CD,
CITEM.SALES_ORG_CD,
CITEM.ITEM_CD
]]>
</query>
<!-- 19: 비알 영업조직 별 링크상품 정보 -->
<query name="SEL_NHS_LINK_ITEM">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
LINK_CD,
LINK_NM,
LINK_ITEM_CD,
UPCHARGE_YN,
UPCHARGE_ITEM_CD,
DISPLAY_ORDER,
USE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_LINK_ITEM
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
]]>
</query>
<!-- 20: 점포별 플레이버 정보 -->
<query name="SEL_NHS_STOR_FLAVOR">
<![CDATA[
SELECT CMP_CD,
SALES_ORG_CD,
STOR_CD,
ITEM_CD,
ITEM_NM,
DISPLAY_ORDER,
USE_YN,
DESC1,
DESC2,
INFO,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM
(
SELECT 'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
ITEM_CD,
ITEM_NM,
DISPLAY_ORDER,
USE_YN,
DESC1,
DESC2,
INFO,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_STOR_FLAVOR
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
UNION ALL
SELECT 'SALES' GBN,
CITEM.CMP_CD,
CITEM.SALES_ORG_CD,
'000' STOR_CD,
CITEM.ITEM_CD,
CITEM.ITEM_NM,
CITEM.DISPLAY_ORDER,
CITEM.USE_YN,
CITEM.DESC1,
CITEM.DESC2,
CITEM.INFO,
CITEM.REG_USER_ID,
CITEM.REG_DATE,
CITEM.UPD_USER_ID,
CITEM.UPD_DATE,
FROM NHS_STOR_FLAVOR CITEM
WHERE CMP_CD =?
AND SALES_ORG_CD = ?
AND STOR_CD = '000'
) A, (SELECT COUNT(*) CNT FROM NHS_STOR_FLAVOR WHERE CMP_CD = ? AND SALES_ORG_CD = ? AND STOR_CD = ? ) B
WHERE A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END
]]>
</query>
<!-- 포스 옵션 21 -->
<query name="SEL_MST_POS_OPTN">
<![CDATA[
SELECT
NVL(B.CMP_CD ,?) AS CMP_CD
,NVL(B.STOR_CD,?) AS STOR_CD
,NVL(D.POS_NO,?) AS POS_NO
,CASE WHEN B.OPTN_CD IS NULL THEN CASE WHEN C.OPTN_CD IS NULL THEN A.CLASS_DTL_CD ELSE C.OPTN_CD END ELSE B.OPTN_CD END AS OPTN_CD
,CASE WHEN B.OPTN_VAL IS NULL THEN CASE WHEN C.OPTN_VAL IS NULL THEN A.CLASS_DTL_CD_NM_REFER_01 ELSE C.OPTN_VAL END ELSE B.OPTN_VAL END AS OPTN_VAL
,A.CLASS_DTL_CD_NM AS OPTN_NM
,A.CHAR_VAL_01 AS OPTN_EXPLN
,B.FILLER_1 AS FILLER1
,B.FILLER_2 AS FILLER2
,B.FILLER_3 AS FILLER3
,B.FILLER_4 AS FILLER4
,B.FILLER_5 AS FILLER5
,GREATEST( NVL(A.UPD_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS')),
NVL(B.UPD_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS')),
NVL(C.UPD_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS'))) AS UPD_DT
,GREATEST( NVL(A.REG_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS')),
NVL(B.REG_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS')),
NVL(C.REG_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS'))) AS REG_DT
, CASE WHEN B.USE_YN IS NULL THEN CASE WHEN C.USE_YN IS NULL THEN A.USE_YN ELSE C.USE_YN END ELSE B.USE_YN END AS USE_YN
FROM SYS_CMM_CD_DTL A LEFT JOIN POS_MST_TRMNL D
ON D.CMP_CD = ?
AND D.STOR_CD = ?
AND D.POS_NO = ?
LEFT OUTER JOIN POS_MST_TRMNL_OPTN B
ON A.CLASS_DTL_CD = B.OPTN_CD
AND D.CMP_CD = B.CMP_CD
AND D.STOR_CD= B.STOR_CD
AND D.POS_NO = B.POS_NO
AND B.CMP_CD = ?
LEFT OUTER JOIN POS_MST_SALESORG_TRMNL_OPTN C
ON A.CLASS_DTL_CD = C.OPTN_CD
AND C.SALES_ORG_CD = ?
AND C.DRT_FRCS_TYPE = ?
WHERE A.CLASS_CD ='POS0003'
AND GREATEST( NVL(A.UPD_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS')),
NVL(B.UPD_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS')),
NVL(C.UPD_DATE, TO_DATE('20000101000001', 'YYYYMMDDHH24MISS'))) >= TO_DATE(?,'YYYYMMDDHH24MISS')
]]>
</query>
<!-- 22: 결제수단 사용여부 정보 -->
<query name="SEL_NHS_FUNC_INFO">
<![CDATA[
SELECT A.CMP_CD,
A.SALES_ORG_CD,
A.STOR_CD,
A.STEP_GRP_CD,
A.FUNC_GRP_CD,
A.FUNC_CD,
A.STEP_GRP_NM,
A.FUNC_GRP_NM,
A.FUNC_NM,
A.DISPLAY_ORDER,
A.USE_YN,
A.REG_USER_ID,
A.REG_DATE,
A.UPD_USER_ID,
A.UPD_DATE
FROM
(
SELECT 'STOR' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
STEP_GRP_CD,
FUNC_GRP_CD,
FUNC_CD,
STEP_GRP_NM,
FUNC_GRP_NM,
FUNC_NM,
DISPLAY_ORDER,
USE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_FUNC_INFO
WHERE CMP_CD =?
AND SALES_ORG_CD =?
AND STOR_CD =?
UNION ALL
SELECT 'SALES' GBN,
CMP_CD,
SALES_ORG_CD,
STOR_CD,
STEP_GRP_CD,
FUNC_GRP_CD,
FUNC_CD,
STEP_GRP_NM,
FUNC_GRP_NM,
FUNC_NM,
DISPLAY_ORDER,
USE_YN,
REG_USER_ID,
REG_DATE,
UPD_USER_ID,
UPD_DATE
FROM NHS_FUNC_INFO
WHERE CMP_CD =?
AND SALES_ORG_CD =?
AND STOR_CD ='000'
) A, (SELECT COUNT(*) CNT FROM NHS_FUNC_INFO WHERE CMP_CD = ?
AND SALES_ORG_CD = ? AND STOR_CD = ? ) B
WHERE A.GBN = CASE WHEN NVL(B.CNT,0) = 0 THEN 'SALES' ELSE 'STOR' END
]]>
</query>
<!-- 결제 할인 59 -->
<query name="SEL_MST_PAY_DC">
<![CDATA[
SELECT
CMP_CD
, STOR_CD
, PAY_DC_GRP_TYPE
, PAY_DC_CD
, PAY_DC_NM
, PAY_DC_TYPE
, APPR_VEND_CD
, NVL(CASH_BILL_ISSUE_YN,0) AS CASH_BILL_ISSUE_YN
, NVL(BLNC_AMT_EXCHNG_CPN_PRT_YN,'0') AS BLNC_AMT_EXCHNG_CPN_PRT_YN
, NVL(CNNT_ITEM_CHECK_YN,'0') AS CNNT_ITEM_CHECK_YN
, NVL(COOP_CMP_CNNT_YN,'0') AS COOP_CMP_CNNT_YN
, NVL(PRFX_TRGT_YN,'0') AS PRFX_TRGT_YN
, PAY_DC_METHD
, NVL(PAY_DC_VAL,0) AS PAY_DC_VAL
, DC_APPLY_TRGT
, NVL(HP_BASIC_ACCUM_TYPE,'0') AS HP_BASIC_ACCUM_YN
, DC_TRGT_AMT_TYPE
, NVL(CPI_DUP_YN,'0') AS CPI_DUP_YN
, NVL(DC_TELECOM_DUP_YN,'0') AS DC_TELECOM_DUP_YN
, NVL(DC_POINT_DUP_YN,'0') AS DC_POINT_DUP_YN
, NVL(DC_CPN_DUP_YN,'0') AS DC_CPN_DUP_YN
, NVL(DC_EMP_DC_DUP_YN,'0') AS DC_EMP_DC_DUP_YN
, NVL(DC_GNRL_DUP_YN,'0') AS DC_GNRL_DUP_YN
, NVL(PAY_GNRL_DUP_YN,'0') AS PAY_GNRL_DUP_YN
, NVL(PAY_MOBILE_DUP_YN,'0') AS PAY_MOBILE_DUP_YN
, NVL(PAY_POINT_DUP_YN,'0') AS PAY_POINT_DUP_YN
, NVL(SALE_POS_PRT_QUE,0) AS SALE_POS_PRT_QUE
, NVL(USE_YN,0) AS USE_YN
, REG_DATE
, UPD_DATE
, HP_ADD_ACCUM_TYPE AS HP_ADD_ACCUM_DIV
, TELECOM_DC_TYPE AS MOBILE_DC_DIV
FROM V_POS_MST_PAY_DC
WHERE 1= 1
AND CMP_CD = ?
AND STOR_CD = ?
AND UPD_DATE >=? --TO_DATE(,'YYYYMMDDHH24MISS')
]]>
</query>
<!-- 15: 부가옵션그룹 -->
<query name="SEL_NHS_STOR_PRD_LINK_OPTN">
<![CDATA[
SELECT
CMP_CD
, SALES_ORG_CD
, STOR_CD
, LINK_OPTN_CD
, TOUCH_KEY_CD
, USE_YN
, REG_USER_ID
, REG_DATE
, UPD_USER_ID
, UPD_DATE
, ITEM_OPTN_CD1
, ITEM_OPTN_CD2
, ITEM_OPTN_CD3
, ITEM_OPTN_CD4
, ITEM_OPTN_CD5
, LINK_KEY_CD
FROM NHS_STOR_PRD_LINK_OPTN
WHERE CMP_CD = ?
AND SALES_ORG_CD = ?
AND STOR_CD = ?
]]>
</query>
<query name="SEL_STOR_TYPE">
<![CDATA[
SELECT DRT_FRCS_TYPE AS STOR_TYPE
FROM MST_STOR
WHERE CMP_CD = ?
AND STOR_CD = ?
]]>
</query>
<!-- 마스터 수신 정보 데이터 저장 -->
<query name="INS_MASTER_RCV">
<![CDATA[
MERGE INTO POS_MASTER_RCV_LOG T
USING ( SELECT ? AS SALE_DT,
? AS CMP_CD,
? AS STOR_CD,
? AS POS_NO,
? AS MASTER_DIV,
TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS') AS RCV_DATETIME,
? AS DOWN_DATETIME
FROM DUAL
) R
ON ( T.SALE_DT = R.SALE_DT
AND T.CMP_CD = R.CMP_CD
AND T.STOR_CD = R.STOR_CD
AND T.POS_NO = R.POS_NO
AND T.MASTER_DIV = R.MASTER_DIV
)
WHEN MATCHED THEN
UPDATE SET T.RCV_DATETIME = R.RCV_DATETIME --TO_CHAR(SYSDATE, 'YYYYMMDDHH24MISS')
,T.DOWN_DATETIME = R.DOWN_DATETIME
WHEN NOT MATCHED THEN
INSERT (
SALE_DT, CMP_CD, STOR_CD, POS_NO, MASTER_DIV, RCV_DATETIME, DOWN_DATETIME
)
VALUES (
R.SALE_DT, R.CMP_CD, R.STOR_CD, R.POS_NO, R.MASTER_DIV, R.RCV_DATETIME,R.DOWN_DATETIME
)
]]>
</query>
</sql-resource>