当前位置:编程学习 > C#/ASP.NET >>

ibatis.net框架下多表查询

MODEL 的代码 
public sealed class S_baseinfo
{     
    private string _fname;
         private string _fcode;

        private BondInfoModel _zhcode;

        public BondInfoModel Zhcode
        {
            get { return _zhcode; }
            set { _zhcode = value; }
        }

        public string Fname
        {
            get { return _fname; }
            set { _fname = value; }
        }

        public string Fcode
        {
            get { return _fcode; }
            set { _fcode = value; }
        }
}
public sealead class S_bondinfo
{
   private DateTime _fjxjzr;
        private string _fzqlb;
        private string _zhcode;
        private DateTime _fcxjzr;
        //private string _fname;
        //private string _fcode;
 
        #endregion

        #region Constuctor
        /// <summary>
        /// default constructor
        /// </summary>
        public BondInfoModel()
        {

        }
        #endregion // End of  Constuctor

        #region Public Properties

        /// <summary>
        /// 
        /// </summary>
        public string Fzqdm
        {
            get { return _fzqdm; }
            set { _fzqdm = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public DateTime Fjxqsr
        {
            get { return _fjxqsr; }
            set { _fjxqsr = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public DateTime Fjxjzr
        {
            get { return _fjxjzr; }
            set { _fjxjzr = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public string Fzqlb
        {
            get { return _fzqlb; }
            set { _fzqlb = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public string Zhcode
        {
            get { return _zhcode; }
            set { _zhcode = value; }
        }

}

xml的代码
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="BondInfoModel"   xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SqlMap.xsd">
  <alias>
    <typeAlias alias="BondInfoModel" type="CS.DomainModel.BondInfoModel,DomainModel" />
    <typeAlias alias="BaseInfoModel" type="CS.DomainModel.BaseInfoModel,DomainModel"/>
  </alias>
  <resultMaps>
    <resultMap id="SBondinfoResult" class="BondInfoModel">
      <result property="Fzqdm" column="FZQDM" type="string" dbType="varchar2"/>
      <result property="Fjxqsr" column="FJXQSR" type="DateTime" dbType="date"/>
      <result property="Fjxjzr" column="FJXJZR" type="DateTime" dbType="date"/>
      <result property="Fzqlb" column="FZQLB" type="string" dbType="varchar2"/>
      <result property="Zhcode" column="ZHCODE" type="string" dbType="varchar2"/>
      <result property="Fcxjzr" column="FCXJZR" type="DateTime" dbType="date" />
    </resultMap>
    <resultMap id="SBaseinfoResult" class="BaseInfoModel">
      <result property="Zhcode" column="ZHCODE" type="string" dbType="varchar2"  select="BondInfoByPage"/>
      <result property="Fname" column="Fname" type="string" />
      <result property="Fcode" column="Fcode" type="string"/>
    </resultMap>
  </resultMaps>
  <statements>
    <select id="BondInfoByPage" parameterClass="BondInfoModel" resultMap="SBondinfoResult">
    
    </select>
  </statements>
</sqlMap>

--------------------编程问答-------------------- 没弄过,UP一下
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,