<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="权限功能表查询">
	<query id="CoreSpecificationsGradeChem.QUERY" desc="权限功能">
		<![CDATA[
 SELECT 'FALSE' SPCHK,
        GRADECODE,
        GRADENAME,
        ASSORTMENT_CODE,
        ASSORTMENT_NAME,
        COEFFICIENT,
        CHEM_CODE,
        CHEM_CODE CHEM_CODE_OLD,
        CHEM_NAME,
        STDMIN_SIGN,
        STDMIN,
        STDMAX_SIGN,
        STDMAX,
        CREATE_NAME,
        TO_CHAR(CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
        UPDATE_NAME,
        TO_CHAR(UPDATE_TIME, 'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
        DELETE_NAME,
        TO_CHAR(DELETE_TIME, 'YYYY-MM-DD HH24:MI:SS') DELETE_TIME,
        VALIDFLAG,
        MEMO
   FROM COM_BASE_GRADE_CHEM
  WHERE VALIDFLAG IN ('1', ?)
    AND GRADECODE || '&' LIKE '%' || ? || '%'
    AND DECODE(?, NULL, '1', UPPER(GRADENAME)) LIKE '%' || UPPER(NVL(?, '1')) || '%'
		]]>
	</query>
	<query id="CoreSpecificationsGradeChem.ADD" desc="新增">
		<![CDATA[
INSERT INTO COM_BASE_GRADE_CHEM
  (
   ASSORTMENT_CODE,
   ASSORTMENT_NAME,
   COEFFICIENT,
   STDMIN_SIGN,
   STDMIN,
   STDMAX_SIGN,
   STDMAX,
   CREATE_NAME,
   CREATE_TIME,
   VALIDFLAG,
   MEMO,
   GRADENAME,
   CHEM_NAME,
   GRADECODE,
   CHEM_CODE
   )
VALUES
  (
   '#ASSORTMENT_CODE#',
   '#ASSORTMENT_NAME#',
   '#COEFFICIENT#',
   '#STDMIN_SIGN#',
   '#STDMIN#',
   '#STDMAX_SIGN#',
   '#STDMAX#',
   '#CREATE_NAME#',
   SYSDATE,
   '1',
   '#MEMO#',
   '#GRADENAME#',
   '#CHEM_NAME#',
   '#GRADECODE#',
   '#CHEM_CODE#')
		]]>
	</query>
	<query id="CoreSpecificationsGradeChem.UPDATE" desc="修改">
		<![CDATA[
UPDATE COM_BASE_GRADE_CHEM
   SET ASSORTMENT_CODE = '#ASSORTMENT_CODE#',
       ASSORTMENT_NAME = '#ASSORTMENT_NAME#',
       COEFFICIENT     = TO_NUMBER('#COEFFICIENT#'),
       CHEM_NAME       = '#CHEM_NAME#',
       STDMIN_SIGN     = '#STDMIN_SIGN#',
       STDMIN          = '#STDMIN#',
       STDMAX_SIGN     = '#STDMAX_SIGN#',
       STDMAX          = '#STDMAX#',
       UPDATE_NAME     = '#UPDATE_NAME#',
       UPDATE_TIME     = SYSDATE,
       MEMO            = '#MEMO#'
 WHERE GRADECODE = '#GRADECODE#'
   AND CHEM_CODE = '#CHEM_CODE#'
		]]>
	</query>
	<query id="CoreSpecificationsGradeChem.DELETE" desc="作废">
		<![CDATA[
			 UPDATE com_base_grade_chem T
			   SET T.DELETE_NAME = ?, T.DELETE_TIME = ?, T.VALIDFLAG = '0'
			 WHERE T.GRADECODE = ? AND CHEM_CODE = ?
		]]>
	</query>
	
	<query id="CoreSpecificationsGradeChem.RESUME" desc="恢复">
		<![CDATA[
			UPDATE com_base_grade_chem T
               SET T.DELETE_NAME = '', T.DELETE_TIME = '', T.VALIDFLAG = '1'
             WHERE T.GRADECODE = ?  AND CHEM_CODE = ?
		]]>
	</query>
	
	<query id="CoreSpecificationsGradeChem.SELECT" desc="查询是否存在">
		<![CDATA[
			select count(*) from  com_base_grade_chem T
             WHERE T.GRADECODE = ?  AND CHEM_CODE = ?
		]]>
	</query>
</queryMap>