<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="QCM_LG_PHYJUDGE （生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）">
    <query id="QcmLgPhyjudgeDAL.Query" desc="查询">
        <![CDATA[
SELECT T.PHY_JUDGE_ID,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.OBJECTNO,
       T.PLINE_CODE,
       B.PLINE_NAME,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.JUDGERESULT_PHY,
       A.BASENAME JUDGERESULT_PHY_DESC,
       T.JUDGESTEELCODE,
       D.STEELNAME JUDGESTEELNAME,
       T.JUDGEGRADECODE,
       C.GRADENAME JUDGEGRADEDESC,
       T.MEMO,
       T.PHY_RESULT_ID,
       T.VALIDFLAG,
       DECODE(T.VALIDFLAG, '1', '有效', '0', '无效') VALIDFLAG_DESC,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
  FROM QCM_LG_PHYJUDGE T
  LEFT JOIN COM_BASE_INFO A
    ON A.BASECODE = T.JUDGERESULT_PHY
  LEFT JOIN COM_BASE_PLINE B
    ON B.PLINE_CODE = T.PLINE_CODE
  LEFT JOIN COM_BASE_GRADE C
    ON C.GRADECODE = T.JUDGEGRADECODE
  LEFT JOIN COM_BASE_STEEL D
    ON D.STEELCODE = T.JUDGESTEELCODE
 WHERE T.PROCESS_CDOE = {0}
   AND ({1} IS NULL OR T.STOVE_NO LIKE '%' || {1} || '%')
   AND ({2} IS NULL OR T.JUDGE_STOVE_NO LIKE '%' || {2} || '%')
   AND T.JUDGERESULT_PHY = {3}
   AND ({4} IS NULL OR
       T.CREATE_TIME >= TO_DATE({4}, 'YYYY-MM-DD HH24:MI:SS'))
   AND ({5} IS NULL OR
       T.CREATE_TIME <= TO_DATE({5}, 'YYYY-MM-DD HH24:MI:SS'))
 ORDER BY T.PHY_JUDGE_ID DESC
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.QueryByPk" desc="通过主键查询">
        <![CDATA[
 SELECT 
       T.PHY_JUDGE_ID,
       T.STOVE_NO,
       T.JUDGE_STOVE_NO,
       T.OBJECTNO,
       T.PLINE_CODE,
       T.PROCESS_CDOE,
       T.PROCESS_DESC,
       T.JUDGERESULT_PHY,
       T.JUDGESTEELCODE,
       T.JUDGEGRADECODE,
       T.MEMO,
       T.PHY_RESULT_ID,
       T.VALIDFLAG,
       T.CREATE_NAME,
       TO_CHAR(T.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME
 FROM QCM_LG_PHYJUDGE T
 WHERE
       T.PHY_JUDGE_ID = '#PHY_JUDGE_ID#'
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.Insert" desc="新增">
        <![CDATA[
 INSERT INTO QCM_LG_PHYJUDGE(
        PHY_JUDGE_ID,
        STOVE_NO,
        JUDGE_STOVE_NO,
        OBJECTNO,
        PLINE_CODE,
        PROCESS_CDOE,
        PROCESS_DESC,
        JUDGERESULT_PHY,
        JUDGESTEELCODE,
        JUDGEGRADECODE,
        MEMO,
        PHY_RESULT_ID,
        CREATE_NAME,
        CREATE_TIME,
        JUGDE_APPLY_CODE,
        BATCH_NO,
        HEAT_PLAN_NO)
 VALUES( 
        '#PHY_JUDGE_ID#',
        '#STOVE_NO#',
        '#JUDGE_STOVE_NO#',
        '#OBJECTNO#',
        '#PLINE_CODE#',
        '#PROCESS_CDOE#',
        '#PROCESS_DESC#',
        '#JUDGERESULT_PHY#',
        '#JUDGESTEELCODE#',
        '#JUDGEGRADECODE#',
        '#MEMO#',
        '#PHY_RESULT_ID#',
        '#CREATE_NAME#',
        SYSDATE,
        '#JUGDE_APPLY_CODE#',
        '#BATCH_NO#',
        '#HEAT_PLAN_NO#')
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.Update" desc="修改">
        <![CDATA[
 UPDATE QCM_LG_PHYJUDGE T
   SET 
        T.PHY_JUDGE_ID = '#PHY_JUDGE_ID#',
        T.STOVE_NO = '#STOVE_NO#',
        T.JUDGE_STOVE_NO = '#JUDGE_STOVE_NO#',
        T.OBJECTNO = '#OBJECTNO#',
        T.PLINE_CODE = '#PLINE_CODE#',
        T.PROCESS_CDOE = '#PROCESS_CDOE#',
        T.PROCESS_DESC = '#PROCESS_DESC#',
        T.JUDGERESULT_PHY = '#JUDGERESULT_PHY#',
        T.JUDGESTEELCODE = '#JUDGESTEELCODE#',
        T.JUDGEGRADECODE = '#JUDGEGRADECODE#',
        T.MEMO = '#MEMO#',
        T.PHY_RESULT_ID = '#PHY_RESULT_ID#',
        T.VALIDFLAG = '#VALIDFLAG#',
        T.CREATE_NAME = '#CREATE_NAME#',
        T.CREATE_TIME = SYSDATE
 WHERE
       T.PHY_JUDGE_ID = '#PHY_JUDGE_ID#'
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.GetMaxPk" desc="获取最大主键">
        <![CDATA[
SELECT NVL(MAX(PHY_JUDGE_ID), 0) + 1 MAX_VALUE FROM QCM_LG_PHYJUDGE T
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.getMaxPhyJudgeId" desc="查询最大的理化判定记录号">
		<![CDATA[
SELECT NVL(MAX(T.PHY_JUDGE_ID), TO_CHAR(SYSDATE, 'YYYYMMDD') || '00000') + 1 MAX_VALUE
  FROM QCM_LG_PHYJUDGE T
 WHERE T.PHY_JUDGE_ID LIKE TO_CHAR(SYSDATE, 'YYYYMMDD') || '%'
		]]>
	</query>
	<query id="QcmLgPhyjudgeDAL.getMaxPhyResultId" desc="查询最大的理化判定结果集号">
		<![CDATA[
SELECT NVL(MAX(T.PHY_RESULT_ID), TO_CHAR(SYSDATE, 'YYYYMMDD') || '00000') + 1 MAX_VALUE
  FROM QCM_LG_PHYRESULT T
 WHERE T.PHY_RESULT_ID LIKE TO_CHAR(SYSDATE, 'YYYYMMDD') || '%'
		]]>
	</query>
    <query id="QcmLgPhyjudgeDAL.Delete" desc="作废">
        <![CDATA[
UPDATE QCM_LG_PHYJUDGE T
   SET
       T.VALIDFLAG = '0',
       T.DELETE_NAME = '#DELETE_NAME#',
       T.DELETE_TIME = SYSDATE
WHERE
       T.PHY_JUDGE_ID = '#PHY_JUDGE_ID#'
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.Resume" desc="恢复">
        <![CDATA[
UPDATE QCM_LG_PHYJUDGE T
   SET
       T.VALIDFLAG = '1',
       T.DELETE_NAME = NULL,
       T.DELETE_TIME = NULL,
       T.UPDATE_NAME = '#UPDATE_NAME#',
       T.UPDATE_TIME = SYSDATE
WHERE
       T.PHY_JUDGE_ID = '#PHY_JUDGE_ID#'
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.updateLgPhyJudgeValid" desc="">
        <![CDATA[
UPDATE QCM_LG_PHYJUDGE T
            SET T.VALIDFLAG = {2}
          WHERE T.JUDGE_STOVE_NO = {0}
            AND T.PROCESS_CDOE = {1}
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.updateLgPhyResultValid" desc="">
        <![CDATA[
UPDATE QCM_LG_PHYRESULT T
               SET T.VALIDFLAG = {2}
             WHERE EXISTS (SELECT 1
                      FROM QCM_LG_PHYJUDGE A
                     WHERE A.JUDGE_STOVE_NO = {0}
                       AND A.PROCESS_CDOE = {1}
                       AND A.PHY_RESULT_ID = T.PHY_RESULT_ID)
        ]]>
    </query>
    <query id="QcmLgPhyjudgeDAL.queryByJudgeStoveNo" desc="">
        <![CDATA[
SELECT *
  FROM QCM_LG_PHYJUDGE T
 WHERE T.JUDGE_STOVE_NO = {0}
   AND T.PROCESS_CDOE = {1}
   AND T.VALIDFLAG = '1'
        ]]>
    </query>
</queryMap>