<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="工艺评审-工序点 ">
	<query id="OrderAddAskDao.QueryOrderAddAskAll" desc="查询合同附加要求（全项）">
         <![CDATA[
SELECT *
  FROM (SELECT ORD_ADD.ASK_ITME,
               ORD_ADD.ASK_ITME_DESC,
               ORD_ADD.ASK_SUB_ITME,
               ORD_ADD.ASK_SUB_ITME_DESC,
               ORD_ADD.ASK_SUB_ITME_VAL,
               ORD_ADD.ASK_SUB_ITME_VAL_DESC,
               ORD_ADD.PIC
          FROM SLM_ORDER_ADD_ASK ORD_ADD, SLM_ORDER_LINE T
         WHERE T.ADD_ASK_NO = ORD_ADD.ADD_ASK_NO
           AND T.ORD_LN_PK = '#ORD_LN_PK#'
           AND ORD_ADD.VALIDFLAG = '1'
           AND T.VALIDFLAG = '1'
        UNION ALL
        SELECT BAS_ADD.ASK_ITME,
               BAS_ADD.ASK_ITME_DESC,
               BAS_ADD.ASK_SUB_ITME,
               BAS_ADD.ASK_SUB_ITME_DESC,
               BAS_ADD.ASK_SUB_ITME_VAL,
               BAS_ADD.ASK_SUB_ITME_VAL_DESC,
               BAS_ADD.PIC
          FROM COM_BASE_ADDITIONAL BAS_ADD, SLM_ORDER_LINE T
         WHERE T.STD_CODE = BAS_ADD.STD_CODE
           AND T.ORD_LN_PK = '#ORD_LN_PK#'
           AND T.VALIDFLAG = '1'
           AND BAS_ADD.VALIDFLAG = '1'
           AND NOT EXISTS
         (SELECT 1
                  FROM SLM_ORDER_ADD_ASK ORD_ADD, SLM_ORDER_LINE T
                 WHERE T.ADD_ASK_NO = ORD_ADD.ADD_ASK_NO
                   AND T.ORD_LN_PK = '#ORD_LN_PK#'
                   AND ORD_ADD.ASK_SUB_ITME = BAS_ADD.ASK_SUB_ITME
                   AND ORD_ADD.VALIDFLAG = '1'
                   AND T.VALIDFLAG = '1')) A
 ORDER BY A.ASK_ITME_DESC, A.ASK_SUB_ITME_DESC, A.ASK_SUB_ITME_VAL_DESC
             ]]>
	</query>
	
	<query id="OrderAddAskDao.QueryOrderAddAskDiff" desc="查询合同附加要求（差异项）">
         <![CDATA[
SELECT *
  FROM (SELECT ORD_ADD.ASK_ITME,
               ORD_ADD.ASK_ITME_DESC,
               ORD_ADD.ASK_SUB_ITME,
               ORD_ADD.ASK_SUB_ITME_DESC,
               ORD_ADD.ASK_SUB_ITME_VAL,
               ORD_ADD.ASK_SUB_ITME_VAL_DESC
          FROM SLM_ORDER_ADD_ASK ORD_ADD, SLM_ORDER_LINE T
         WHERE T.ADD_ASK_NO = ORD_ADD.ADD_ASK_NO
           AND T.ORD_LN_PK = '#ORD_LN_PK#'
           AND ORD_ADD.ADD_ASK_TYPE IN ('1', '2')) A
 ORDER BY A.ASK_ITME_DESC, A.ASK_SUB_ITME_DESC, A.ASK_SUB_ITME_VAL_DESC
             ]]>
	</query>
	
	<query id="OrderAddAskDao.Insert" desc="新增附加要求全项">
         <![CDATA[
INSERT INTO CRAFT_ORD_DESIGN_ADD_ASK
  (DESGIN_KEY,
   ASK_ITME,
   ASK_ITME_DESC,
   ASK_SUB_ITME,
   ASK_SUB_ITME_DESC,
   ASK_SUB_ITME_VAL,
   ASK_SUB_ITME_VAL_DESC,
   DESCRIPTION_ALL,
   DESCRIPTION_DIFF,
   PIC)
VALUES
  ('#DESGIN_KEY#',
   '#ASK_ITME#',
   '#ASK_ITME_DESC#',
   '#ASK_SUB_ITME#',
   '#ASK_SUB_ITME_DESC#',
   '#ASK_SUB_ITME_VAL#',
   '#ASK_SUB_ITME_VAL_DESC#',
   '#DESCRIPTION_ALL#',
   '#DESCRIPTION_DIFF#',
   '#PIC#')
             ]]>
	</query>
</queryMap>