<?xml version="1.0" encoding="UTF-8"?>
<queryMap desc="客户收货单位管理">
	<query id="CoreBuyerSend.doQuery" desc="查询客户收货单位">
		<![CDATA[
			 SELECT customer_no, sale_org, custm_use, region_no, address, consignee, phone,
					zip_code, fax, memo, validflag
					FROM slm_base_receiv_unit
			  WHERE customer_no = ? AND sale_org = ? AND custm_use = ?
		]]>
	</query>
	
	<query id="CoreBuyerSend.getRcvUnitCnt" desc="查询客户收货单位个数">
		<![CDATA[
SELECT COUNT(1) COUNT
  FROM SLM_BASE_RECEIV_UNIT
 WHERE CUSTOMER_NO = '#CUSTOMER_NO#'
   AND SALE_ORG = '#SALE_ORG#'
   AND CUSTM_USE = '#CUSTM_USE#'
		]]>
	</query>
	
	<query id="CoreBuyerSend.getCustmCnt" desc="查询客户系统用途是否存在">
		<![CDATA[
		SELECT COUNT(1) COUNT
		  FROM SLM_BASE_CUSTM_USE
		 WHERE CUSTOMER_NO = '#CUSTOMER_NO#'
		   AND SALE_ORG = '#SALE_ORG#'
		   AND CUSTM_USE = '#CUSTM_USE#'
		]]>
	</query>

	<query id="CoreBuyerSend.insertCustmuse" desc="新增客户用途类型单位">
		<![CDATA[
			INSERT INTO SLM_BASE_CUSTM_USE
			  (CUSTOMER_NO, SALE_ORG, CUSTM_USE, CREATE_NAME, CREATE_TIME)
			VALUES
			  (?, ?, ?, ?, SYSDATE)
		]]>
	</query>
	
	<query id="CoreBuyerSend.UpdateCustmuse" desc="更新客户用途类型单位">
		<![CDATA[
			update SLM_BASE_CUSTM_USE t
			   SET T.VALIDFLAG = '1', T.UPDATE_NAME = ?, T.UPDATE_TIME = SYSDATE
			 WHERE CUSTOMER_NO = ?
			   AND SALE_ORG = ?
			   AND CUSTM_USE = ?
		]]>
	</query>
	
	<query id="CoreBuyerSend.insertRcvUnit" desc="新增客户收货单位">
		<![CDATA[
INSERT INTO SLM_BASE_RECEIV_UNIT
  (CUSTM_USE,
   REGION_NO,
   ADDRESS,
   CONSIGNEE,
   PHONE,
   ZIP_CODE,
   FAX,
   MEMO,
   CREATE_NAME,
   CREATE_TIME,
   CUSTOMER_NO,
   SALE_ORG)
VALUES
  (?, ?, ?, ?, ?, ?, ?, ?, ?, SYSDATE, ?, ?)
		]]>
	</query>
	
	<query id="CoreBuyerSend.updateRcvUnit" desc="修改客户收货单位">
		<![CDATA[
UPDATE SLM_BASE_RECEIV_UNIT T
   SET CUSTM_USE   = ?,
       REGION_NO   = ?,
       ADDRESS     = ?,
       CONSIGNEE   = ?,
       PHONE       = ?,
       ZIP_CODE    = ?,
       FAX         = ?,
       MEMO        = ?,
       UPDATE_NAME = ?,
       UPDATE_TIME = SYSDATE
 WHERE T.CUSTOMER_NO = ?
   AND T.SALE_ORG = ?
		]]>
	</query>
</queryMap>
