IBATIS 存储过程写法

上代码!!!!
/**
     * 订单录入页面数据,存储过程方式
     * @param customerOrderInputDTO
     * @return
     * @throws BizServiceException
     */
    public CustomerOrderInputRspDTO orderInput(CustomerOrderInputDTO customerOrderInputDTO) throws BizServiceException{
        CustomerOrderInputRspDTO customerOrderInputRspDTO = new CustomerOrderInputRspDTO();
        Map<String,Object> map = new HashMap<String, Object>();
        setParameterMapInput(map,customerOrderInputDTO);	
        Integer orderType = customerOrderInputDTO.getCustomerOrderDTO().getOrderType();
        if(orderType==null){
        	throw new BizServiceException("orderType is null");
        }
        Long startTime = System.currentTimeMillis();
        /**
         * 充值卡订单录入
         	BO需要返回的值有:
			productDTOs
			productDTO:cardLayouts/packages(包含packageFee)/replaceFee/validityPeriod
			custContractDTO:annualFee/deliveryFee/cardFee
			customerDTO:invoiceAddressList/invoiceCompanyList/deliveryPointList/deliveryPoint.recipientList/name/id
			deliveryRecipientDTOs
			orderDate/sales	
			cardValidityPeriod
			初始页面需要返回currDate/sales
			选择客户或者产品->访问后台,返回数据重新加载整个页面,参数有客户号或产品号
			三种状态:无客户号、有客户号无产品号、有客户号有产品号
         */
        if(orderType.equals(1)){
        	customerOrderDAO.queryForObject("RLOrderInput",map);
        }
        /**
    	 * 充值订单录入页面
    	 * BO需要返回的值有:
    		productDTOs
    		productDTO.accTypes/cardValidityPeriod
    		custAcctypeContractDTO.serviceFee
    		customerDTO:invoiceAddressList/invoiceCompanyList/name/id
    		orderDate/sales
    	  	初始页面需要返回currDate/sales
    	  	选择客户或者产品或服务->访问后台,返回数据重新加载整个页面,参数有客户号或产品号
    		四种状态:无客户号、有客户号无产品号、有客户号有产品号、有服务号
    	 */
        if(orderType.equals(2)){
        	customerOrderDAO.queryForObject("CROrderInput",map);
        }
        /**
    	 * 礼品卡库存订单录入页面数据,存储过程方式
    	 * BO需要返回的值:
    		productDTOs
    		productDTO:accTypes/cardLayouts/prodFaceValues
    		cardValidityPeriod
    		orderDate
    		选择产品->访问后台,重载整个页面
    		两种状态:初始页面无产品号、选择产品后有产品号
    	 */
        if(orderType.equals(3)){
        	customerOrderDAO.queryForObject("GSTOrderInput",map);
        }
        /**
    	 * 礼品卡销售订单录入页面数据,存储过程方式
    	 * BO需要返回的值:
    		productDTOs
    		productDTO.accTypes
    		custContractDTO:deliveryFee
    		customerDTO:invoiceAddressList/invoiceCompanyList/deliveryPointList/deliveryPoint.recipientList/name/id
    		orderDate/sales
    	   	初始页面需要返回currDate/sales
    	   	选择客户或者产品->访问后台,返回数据重新加载整个页面,参数有客户号或产品号
    		三种状态:无客户号、有客户号无产品号、有客户号有产品号
    	 */
        if(orderType.equals(4)){
        	customerOrderDAO.queryForObject("GSLOrderInput",map);
        }
        
     	System.out.println("================= cost time  "+(System.currentTimeMillis() - startTime)+"/1000  seconds");
     	parseParameterMapResult(map, customerOrderInputRspDTO,customerOrderInputDTO);
    	return customerOrderInputRspDTO;
    }



/**
     * 订单录入,调用存储过程以前,设置其参数parameterMap
     * @param map
     * @param customerOrderInputDTO
     * @throws BizServiceException
     */
    private void setParameterMapInput(Map<String,Object> map,CustomerOrderInputDTO customerOrderInputDTO) throws BizServiceException{
    	CustomerOrderDTO customerOrderDTO = customerOrderInputDTO.getCustomerOrderDTO();
    	Long productId = customerOrderDTO.getProductId();
        Short acctypeId = customerOrderDTO.getAccTypeId();
        Long customerId = customerOrderDTO.getCustomerId();
        Integer orderType = customerOrderDTO.getOrderType();
        Long orderId = customerOrderDTO.getOrderId();
        productId = (productId==null)?-1l:productId;
        customerId = (customerId==null)?-1l:customerId;
        acctypeId = (acctypeId==null)?(short)-1:acctypeId;
        orderId = (orderId==null)?-1l:orderId;
    	map.put("i_issuerId", customerOrderInputDTO.getDefaultIssuerId());
     	map.put("i_issuerGroupId", customerOrderInputDTO.getDefaultIssuerGroupId());
     	map.put("i_orderType", orderType);
     	map.put("i_customerId",customerId);
     	map.put("i_productId", productId);
     	map.put("i_accTypeId", acctypeId);
     	map.put("i_orderId", orderId);
    }
    /**
     * 订单录入,调用存储过程以后,处理其返回参数,由MAP转为DTO
     * @param map
     * @param customerOrderInputRspDTO
     * @throws BizServiceException
     */
    @SuppressWarnings("unchecked")
	private void parseParameterMapResult(Map<String,Object> map,CustomerOrderInputRspDTO customerOrderInputRspDTO,CustomerOrderInputDTO customerOrderInputDTO) throws BizServiceException{
		try{
			CustomerDTO customerDTO = new CustomerDTO();
			customerDTO.setCustomerId(customerOrderInputDTO.getCustomerOrderDTO().getCustomerId());
			//设置销售人员列表
			List<User> users = (List<User>) map.get("o_sales");
			List<UserDTO> saleUserList = new ArrayList<UserDTO>();
			if(users!=null){
				for (User user : users) {
					UserDTO dto = new UserDTO();
					ReflectionUtil.copyProperties(user, dto);
					saleUserList.add(dto);
				}
			}
			//设置订单日期
			List<Map> currDates = (List<Map>) map.get("o_orderDate");
			Date currDate = null;
			if(currDates!=null&&currDates.size()>0&&currDates.get(0).get("currDate")!=null){
				currDate = new SimpleDateFormat("yyyyMMdd").parse(currDates.get(0).get("currDate").toString());
			}
			//设置产品列表
			List<ProductDTO> products = (List<ProductDTO>) map.get("o_products");
			//设置产品
			List<ProductDTO> products2 = (List<ProductDTO>) map.get("o_product");
			ProductDTO productDTO = new ProductDTO();
			if(products2!=null&&products2.size()>0){
				productDTO = products2.get(0);
			}
			//设置收货地址列表,包含地址下收货人列表
			List<DeliveryPointDTO> deliveryPointDTOs = (List<DeliveryPointDTO>) map.get("o_deliveryPointList");
			if(deliveryPointDTOs!=null&&deliveryPointDTOs.size()>0){
				for(DeliveryPointDTO deliveryPointDTO:deliveryPointDTOs){
					String str = deliveryPointDTO.getRecipientsStr();//格式为"..id,name;.."
					if(str==null){
						break;
					}
					List<DeliveryRecipientDTO> deliveryRecipientDTOs = new ArrayList<DeliveryRecipientDTO>();
					for(String s:str.split(";")){
						if(s==null){
							break;
						}
						DeliveryRecipientDTO deliveryRecipientDTO = new DeliveryRecipientDTO();
						deliveryRecipientDTO.setRecipientId(Long.parseLong(s.split(",")[0]));
						deliveryRecipientDTO.setRecipient(s.split(",")[1]);
						deliveryRecipientDTOs.add(deliveryRecipientDTO);
					}
					deliveryPointDTO.setRecipientList(deliveryRecipientDTOs);
				}
			}
			customerDTO.setDeliveryPointList(deliveryPointDTOs);
			//设置收货人列表为第一个地址下收货人列表
			List<DeliveryRecipientDTO> deliveryRecipientDTOs = new ArrayList<DeliveryRecipientDTO>();
			if(deliveryPointDTOs!=null&&deliveryPointDTOs.size()>0){
				DeliveryPointDTO deliveryPointDTO = deliveryPointDTOs.get(0);
				if(deliveryPointDTO!=null){
					deliveryRecipientDTOs = deliveryPointDTO.getRecipientList();
				}
			}
			//设置发票地址列表
			List<InvoiceAddressDTO> invoiceAddressDTOs = (List<InvoiceAddressDTO>) map.get("o_invoiceAddressList");
			customerDTO.setInvoiceAddressList(invoiceAddressDTOs);
			//设置发票公司列表
			List<InvoiceCompanyDTO> invoiceCompanyDTOs = (List<InvoiceCompanyDTO>) map.get("o_invoiceCompanyList");
			customerDTO.setInvoiceCompanyList(invoiceCompanyDTOs);
			//设置产品下服务列表
			List<AccTypeDTO> accTypeDTOs = (List<AccTypeDTO>) map.get("o_accTypes");
			productDTO.setAccTypes(accTypeDTOs);
			//设置产品下包装列表
			List<PackageDTO> packageDTOs = (List<PackageDTO>) map.get("o_packages");
			productDTO.setPackages(packageDTOs);
			//设置产品合同,结果集只有一条
			List<CustContractDTO> contractDTOs = (List<CustContractDTO>) map.get("o_custContracts");
            CustContractDTO contractDTO = new CustContractDTO();
            if(contractDTOs!=null&&contractDTOs.size()>0){
            	contractDTO = contractDTOs.get(0);
            }
			//设置产品下卡面列表
			List<CardLayoutDTO> cardLayoutDTOs = (List<CardLayoutDTO>) map.get("o_cardLayouts");
			productDTO.setCardLayouts(cardLayoutDTOs);
			//设置产品下面额列表
			List<ProdFaceValueDTO> prodFaceValueDTOs = (List<ProdFaceValueDTO>) map.get("o_prodFaceValues");
			productDTO.setProdFaceValues(prodFaceValueDTOs);
			//设置客户姓名
			String customerName = (String)map.get("o_customerName");
			customerDTO.setCustomerName(customerName);
			//设置服务费(服务合同)
			BigDecimal serviceFee = (BigDecimal) map.get("o_serviceFee");
			CustAcctypeContractDTO custAcctypeContractDTO = new CustAcctypeContractDTO();
			if(serviceFee!=null){
				custAcctypeContractDTO.setServiceFee(serviceFee);
			}
			
			CustomerOrderDTO customerOrderDTO = customerOrderInputDTO.getCustomerOrderDTO();
			if(map.get("o_customerOrder")!=null&&((List)map.get("o_customerOrder")).size()>0){
				ReflectionUtil.copyProperties((CustomerOrder)((List)map.get("o_customerOrder")).get(0), customerOrderDTO);
				customerOrderDTO.setCustomerName(customerName);
				if(map.get("o_productName")!=null){
					customerOrderDTO.setProductName(map.get("o_productName").toString());
				}
				if(map.get("o_issuerName")!=null){
					customerOrderDTO.setIssuerName(map.get("o_issuerName").toString());
				}
			}else{
				customerOrderDTO.setOrderDate(currDate);
				customerOrderDTO.setCustomerId(customerDTO.getCustomerId());
				customerOrderDTO.setCustomerName(customerName);
				customerOrderDTO.setProductId(productDTO.getProductId());
				Date cardValidityPeriod = null;
				if(productDTO.getValidityePeriod()!=null){
					cardValidityPeriod = DateUtil.countCardValidate(new Date(), productDTO.getValidityePeriod());
				}
	            customerOrderDTO.setCardValidityPeriod(cardValidityPeriod);
	            customerOrderDTO.setAccTypeId(custAcctypeContractDTO.getAccTypeId());
	            if(deliveryRecipientDTOs!=null&&deliveryRecipientDTOs.size()>0){
	            	customerOrderDTO.setOrderContact(deliveryRecipientDTOs.get(0).getRecipientId());
	            }
			}
			customerOrderInputRspDTO.setSaleUserList(saleUserList);
			customerOrderInputRspDTO.setCustomerOrderDTO(customerOrderDTO);
			customerOrderInputRspDTO.setCustContractDTO(contractDTO);
			customerOrderInputRspDTO.setProductDTO(productDTO);
			customerOrderInputRspDTO.setProductDTOs(products);
			customerOrderInputRspDTO.setCustomerDTO(customerDTO);
			customerOrderInputRspDTO.setDeliveryRecipientDTOs(deliveryRecipientDTOs);
			customerOrderInputRspDTO.setCustAcctypeContractDTO(custAcctypeContractDTO);
		}catch(Exception e){
			e.printStackTrace();
			throw new BizServiceException("系统异常");
		}
    }

IBATIS XML文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="TB_ENT_CUSTOMER_ORDER"> 
	
	<resultMap id="r_batCtrl" class="java.util.HashMap">
		<result property="currDate" column="curr_date" />
	</resultMap>
	<resultMap class="com.***.product.dto.ProductDTO" id="r_productDTO">
		<result property="productId" column="product_id"/>
		<result property="productName" column="product_name"/>
		<result property="replaceFee" column="replace_fee"/>
		<result property="validityePeriod" column="validitye_period"/>
	</resultMap>
	<resultMap class="com.***.acctype.dto.AccTypeDTO" id="r_accTypeDTO">
		<result property="accTypeId" column="acc_type_id"/>
		<result property="accTypeName" column="acc_type_name"/>
	</resultMap>
	<resultMap class="com.***.packag.dto.PackageDTO" id="r_packageDTO">
		<result property="packageId" column="package_id"/>
		<result property="packageName" column="package_name"/>
		<result property="packageFee" column="package_fee"/>
	</resultMap>
	<resultMap class="com.***.cardlayout.dto.CardLayoutDTO" id="r_cardLayoutDTO">
		<result property="cardLayoutId" column="card_layout_id"/>
		<result property="cardName" column="card_name"/>
	</resultMap>
	<resultMap class="com.***.product.dto.ProdFaceValueDTO" id="r_prodFaceValueDTO">
		<result property="faceValueId" column="face_value_id"/>
		<result property="faceValue" column="face_value"/>
		<result property="faceValueType" column="face_value_type"/>
	</resultMap>
	<resultMap class="com.***.customer.dto.DeliveryPointDTO" id="r_deliveryPointDTO">
		<result property="deliveryPointId" column="delivery_point_id"/>
		<result property="deliveryPointName" column="delivery_point_name"/>
		<result property="recipientsStr" column="recipients_str"/>
	</resultMap>
	<resultMap class="com.***.customercontract.dto.CustContractDTO" id="r_custContractDTO">
		<result property="contractId" column="contract_id"/>
		<result property="cardFee" column="card_fee"/>
		<result property="annualFee" column="annual_fee"/>
		<result property="deliveryFee" column="delivery_fee"/>
	</resultMap>
	<resultMap class="com.***.customer.dto.InvoiceAddressDTO" id="r_invoiceAddressDTO">
		<result property="invoiceAddressId" column="invoice_address_id"/>
		<result property="invoiceAddress" column="invoice_address"/>
	</resultMap>
	<resultMap class="com.***.customer.dto.InvoiceCompanyDTO" id="r_invoiceCompanyDTO">
		<result property="invoiceCompanyId" column="invoice_company_id"/>
		<result property="invoiceCompanyName" column="invoice_company_name"/>
	</resultMap>
	
	
	<parameterMap class="java.util.HashMap" id="p_orderInput">
		<parameter property="o_products" resultMap="r_productDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_product" resultMap="r_productDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_accTypes" resultMap="r_accTypeDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_cardLayouts" resultMap="r_cardLayoutDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_packages" resultMap="r_packageDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_prodFaceValues" resultMap="r_prodFaceValueDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_custContracts" resultMap="r_custContractDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_invoiceAddressList" resultMap="r_invoiceAddressDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_invoiceCompanyList" resultMap="r_invoiceCompanyDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_deliveryPointList" resultMap="r_deliveryPointDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_orderDate" resultMap="r_batCtrl" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_sales" resultMap="TB_ENT_USER.abatorgenerated_UserResult" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_customerName" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT"/>
		<parameter property="o_serviceFee" javaType="java.math.BigDecimal" jdbcType="DECIMAL" mode="OUT"/>
		<parameter property="i_orderType" javaType="Integer" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_customerId" javaType="Long" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_productId" javaType="Long" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_accTypeId" javaType="Short" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_issuerId" javaType="Integer" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_issuerGroupId" javaType="Integer" jdbcType="DECIMAL" mode="IN"/>
	</parameterMap>
	<parameterMap class="java.util.HashMap" id="p_orderEdit">
		<parameter property="o_customerOrder" resultMap="TB_ENT_CUSTOMER_ORDER.abatorgenerated_CustomerOrderResult" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_products" resultMap="r_productDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_cardLayouts" resultMap="r_cardLayoutDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_packages" resultMap="r_packageDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_prodFaceValues" resultMap="r_prodFaceValueDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_sales" resultMap="TB_ENT_USER.abatorgenerated_UserResult" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_accTypes" resultMap="r_accTypeDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_invoiceAddressList" resultMap="r_invoiceAddressDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_invoiceCompanyList" resultMap="r_invoiceCompanyDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_deliveryPointList" resultMap="r_deliveryPointDTO" javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"/>
		<parameter property="o_customerName" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT"/>
		<parameter property="o_issuerName" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT"/>
		<parameter property="o_productName" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT"/>
		<parameter property="o_serviceFee" javaType="java.math.BigDecimal" jdbcType="DECIMAL" mode="OUT"/>
		<parameter property="i_orderType" javaType="Integer" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_orderId" javaType="Long" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_productId" javaType="Long" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_accTypeId" javaType="Short" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_issuerId" javaType="Integer" jdbcType="DECIMAL" mode="IN"/>
		<parameter property="i_issuerGroupId" javaType="Integer" jdbcType="DECIMAL" mode="IN"/>
	</parameterMap>
	
	<procedure id="RLOrderInput" parameterMap="p_orderInput">
		{call RLOrderInput(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>
	<procedure id="CROrderInput" parameterMap="p_orderInput">
		{call CROrderInput(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>
	<procedure id="GSTOrderInput" parameterMap="p_orderInput">
		{call GSTOrderInput(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>
	<procedure id="GSLOrderInput" parameterMap="p_orderInput">
		{call GSLOrderInput(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>
	
	<procedure id="RLOrderEdit" parameterMap="p_orderEdit">
		{call RLOrderEdit(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>
	<procedure id="CROrderEdit" parameterMap="p_orderEdit">
		{call CROrderEdit(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>
	<procedure id="GSTOrderEdit" parameterMap="p_orderEdit">
		{call GSTOrderEdit(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>
	<procedure id="GSLOrderEdit" parameterMap="p_orderEdit">
		{call GSLOrderEdit(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
	</procedure>

</sqlMap>

ORACLE 存储过程

create or replace procedure RLOrderInput(
       o_products out sys_refcursor,
       o_product out sys_refcursor,
       o_accTypes out sys_refcursor,
       o_cardLayouts out sys_refcursor,
       o_packages out sys_refcursor,
       o_prodFaceValues out sys_refcursor,
       o_custContracts out sys_refcursor,
       o_invoiceAddressList out sys_refcursor,
       o_invoiceCompanyList out sys_refcursor,
       o_deliveryPointList out sys_refcursor,
       o_orderDate out sys_refcursor,
       o_sales out sys_refcursor,
       o_customerName out varchar,
       o_serviceFee out number,
       i_orderType in number,
       i_customerId in number,
       i_productId in number,
       i_accTypeId in number,
       i_issuerId in number,
       i_issuerGroupId in number) 
as 
       productId number;
begin
  productId := -1;
    --充值卡订单:初始页面查sales/orderDate,选择客户查客户相关及产品列表第一个产品,改变产品查对应产品
    --三种状态:无客户号、有客户号无产品号、有客户号有产品号

      if i_customerId!=-1 then--选择客户或者改变产品查客户
        begin
          getprodsbycustidandptype(o_products,i_customerId,1,1);
          getinvoicebycustid(o_invoiceAddressList,o_invoiceCompanyList,i_customerId,1);
          getdeliverybycustid(o_deliveryPointList,i_customerId,1);
          select t.customer_name into o_customerName from tb_ent_customer t where t.customer_id=i_customerId;
          
        end;
      end if;
      if i_customerId=-1 then--初始页面不查客户
        begin
          getprodsbycustidandptype(o_products,i_customerId,1,0);
          getinvoicebycustid(o_invoiceAddressList,o_invoiceCompanyList,i_customerId,0);
          getdeliverybycustid(o_deliveryPointList,i_customerId,0);
        end;
      end if;
     if i_customerId!=-1 and i_productId=-1 then--选择客户没选择产品后设置为第一条产品
        begin
          select t2.product_id into productId 
                from tb_ent_cust_contract t1,tb_ent_product t2 
                where t1.product_id=t2.product_id and t1.customer_id=i_customerId and t2.product_type=1  
                and t2.data_state=1 and t1.data_state=1 and t2.prod_stat=1
                and nvl(t1.start_date,sysdate)<=sysdate and nvl(t1.end_date,sysdate)>=sysdate AND ROWNUM=1;
                
          EXCEPTION WHEN NO_DATA_FOUND THEN 
            NULL;
        end;
      end if; 
      if i_productId!=-1 then--产品列表下拉框改变产品设置为该产品
        begin
          productId := i_productId;
        end;
      end if;
      if productId!=-1 then--产品列表下拉框改变产品查产品
        begin
          getprodfororderinput(o_product,productId,1);
          getcardlayoutsbyprodid(o_cardLayouts,productId,1);
          getpackagesbyprodid(o_packages,productId,1);
          getvalidcustcontract(o_custcontracts,i_customerId,productId,1);
        end;
      end if;
      if productId=-1 then--产品列表下拉框改变产品查产品
        begin
          getprodfororderinput(o_product,productId,0);
          getcardlayoutsbyprodid(o_cardLayouts,productId,0);
          getpackagesbyprodid(o_packages,productId,0);
          getvalidcustcontract(o_custcontracts,i_customerId,productId,0);
        end;
      end if;
      getcurrdateandsales(o_orderDate,o_sales,i_issuerId,i_issuerGroupId,1);
    getacctypesbyprodid(o_accTypes,productId,0);
    getprodfacevaluesbyprodid(o_prodFaceValues,productId,0);
 
end RLOrderInput;

其中调用了其他存储过程

---------------------------------------------------------

注意事项::::::::::::::::::

IBATIS版本2.3.4

每个DTO都写一个RESULTMAP,无奈吧,不用试了,没别的好办法

MYIBATIS配置XML文件似乎更方便一些,这里只能如此

存储过程中OUT游标CURSOR要全部OPEN,不然JAVA异常‘CURSOR IS CLOSED....’

存储过程难以看懂,维护麻烦,好处是快,这里如果用DAO可能会访问数据库78次,所以存储过程适用于访问次数多的情况下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值