ibatis 一拖多

1. Model:

public class ServicePhotography
    {
        public string ServiceID { get; set; }
        public int ServiceTypeID { get; set; }
        public int PackageID { get; set; }
        public int Status { get; set; }
        public int IsFullPay { get; set; }
        public string Contacter { get; set; }
        public string ContactPhone { get; set; }
        public DateTime BookDateTime { get; set; }
        public string BookAddress { get; set; }
        public DateTime CreateTime { get; set; }
        public Guid UserID { get; set; }
        public string Remark { get; set; }
        public string GnetePayRecordNo { get; set; }
        public decimal Amount { get; set; }
        public List<ServiceType> serviceTypeList{get;set;}
    }


2. Map:

<resultMap id="ServicePhotographyMap" class="ServicePhotography">
      <result property="ServiceID" column="ServiceID"/>
   <result property="ServiceTypeID" column="ServiceTypeID"/>
   <result property="PackageID" column="PackageID" />
   <result property="Status" column="Status"  />
   <result property="IsFullPay" column="IsFullPay" />
      <result property="Contacter" column="Contacter" />
      <result property="ContactPhone" column="ContactPhone" />
      <result property="BookDateTime" column="BookDateTime" />
      <result property="BookAddress" column="BookAddress" />
      <result property="CreateTime" column="CreateTime" />
      <result property="UserID" column="UserID" />
      <result property="Remark" column="Remark" />
      <result property="GnetePayRecordNo" column="GnetePayRecordNo" />
      <result property="Amount" column="Amount" />
      <result property="serviceTypeList" column="ServiceID" select="getServiceTypeList"/>     注意此时的column可以作为getServiceTypeList方法的参数 ,当然不要参数亦可
  </resultMap>


  <select id="getServiceTypeList" resultMap="ServiceTypeMap">
      <![CDATA[SELECT * FROM Service_ServiceType]]>
    </select>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值