<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="COM_BASE_DETECTION_RLT （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="ComBaseDetectionRltDAL.QueryStd" desc="查询标准">
        <![CDATA[
 SELECT T.PHY_CODE,
       T.PHY_NAME,
       T.STD_CODE,
       T.STD_DESC,
       T.LV_CODE,
       T.LV_DESC,
       T.ID
  FROM COM_BASE_DETECTION_RLT T
 WHERE ({0} IS NULL OR T.PHY_CODE = {0})
 AND T.PHY_CODE IS NOT NULL
 ORDER BY T.ID
        ]]>
    </query>
    <query id="ComBaseDetectionRltDAL.QueryLv" desc="查询等级">
        <![CDATA[
SELECT T.PHY_CODE,
       T.PHY_NAME,
       T.STD_CODE,
       T.STD_DESC,
       T.LV_CODE,
       T.LV_DESC,
       T.ID
  FROM COM_BASE_DETECTION_RLT T
 WHERE ({0} IS NULL OR T.STD_CODE = {0})
 AND T.LV_CODE IS NOT NULL
 ORDER BY T.ID
        ]]>
    </query>
    <query id="ComBaseDetectionRltDAL.QueryStdBaseInfo" desc="查询标准基础信息">
        <![CDATA[
SELECT T.STD_CODE, T.STD_DESC
  FROM COM_BASE_DETECTION_RLT T
 WHERE T.PHY_CODE = {0}
   AND T.PHY_CODE IS NOT NULL
UNION ALL
SELECT T3.BASECODE, T3.BASENAME
  FROM COM_BASE_INFO T3
 WHERE T3.SORTCODE = '4021'
   AND T3.VALIDFLAG = '1'
   AND NOT EXISTS (SELECT 1
          FROM COM_BASE_DETECTION_RLT T2
         WHERE T2.PHY_CODE = {0}
           AND T2.PHY_CODE IS NOT NULL)
 ORDER BY STD_DESC
        ]]>
    </query>
     <query id="ComBaseDetectionRltDAL.QueryLvBaseInfo" desc="查询等级基础信息">
        <![CDATA[
SELECT T.LV_CODE, T.LV_DESC
  FROM COM_BASE_DETECTION_RLT T
 WHERE T.STD_CODE = {0}
   AND T.LV_CODE IS NOT NULL
UNION ALL
SELECT T3.BASECODE, T3.BASENAME
  FROM COM_BASE_INFO T3
 WHERE T3.SORTCODE = '4022'
   AND T3.VALIDFLAG = '1'
   AND NOT EXISTS (SELECT 1
          FROM COM_BASE_DETECTION_RLT T2
         WHERE T2.STD_CODE = {0}
           AND T2.LV_CODE IS NOT NULL)
ORDER BY LV_DESC
        ]]>
    </query>
    <query id="ComBaseDetectionRltDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.PHY_CODE,
       T.PHY_NAME,
       T.STD_CODE,
       T.STD_DESC,
       T.LV_CODE,
       T.LV_DESC,
       T.ID
 FROM COM_BASE_DETECTION_RLT T
 WHERE
       T.ID = '#ID#'
        ]]>
    </query>
    <query id="ComBaseDetectionRltDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO COM_BASE_DETECTION_RLT(
        PHY_CODE,
        PHY_NAME,
        STD_CODE,
        STD_DESC,
        LV_CODE,
        LV_DESC,
        ID)
 VALUES( 
        '#PHY_CODE#',
        '#PHY_NAME#',
        '#STD_CODE#',
        '#STD_DESC#',
        '#LV_CODE#',
        '#LV_DESC#',
        '#ID#')
        ]]>
    </query>
    <query id="ComBaseDetectionRltDAL.Update" desc="修改">
        <![CDATA[
 UPDATE COM_BASE_DETECTION_RLT T
   SET 
        T.PHY_CODE = '#PHY_CODE#',
        T.PHY_NAME = '#PHY_NAME#',
        T.STD_CODE = '#STD_CODE#',
        T.STD_DESC = '#STD_DESC#',
        T.LV_CODE = '#LV_CODE#',
        T.LV_DESC = '#LV_DESC#'
 WHERE
       T.ID = '#ID#'
        ]]>
    </query>
    <query id="ComBaseDetectionRltDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT NVL(MAX(ID), 0) + 1 MAX_VALUE FROM COM_BASE_DETECTION_RLT T
        ]]>
    </query>
    <query id="ComBaseDetectionRltDAL.Delete" desc="作废">
        <![CDATA[
DELETE COM_BASE_DETECTION_RLT T WHERE T.ID = '#ID#'
        ]]>
    </query>
</queryMap>