返回复杂对象

来源:互联网 发布:java简单工厂模式缺点 编辑:程序博客网 时间:2024/05/17 07:46
  1. <typeAlias alias="Customer" type="com.example.domain.Customer"/>   
  2.  <resultMap id="getCustomerResult" class="Customer">   
  3.    <result property="id" column="C_ID"/>   
  4.    <result property="name" column="C_NAME"/>   
  5.    <result property="birthday" column="C_BIRTHDAY"/>   
  6.    <result property="gender" column="C_GENDER"/>   
  7.    <result property="identityType" column="C_IDENTITYTYPE"/>   
  8.      <result property="identityId" column="C_IDENTITYID"/>   
  9.    <result property="consumePoint" column="C_CONSUMEPOINT"/>   
  10.    <result property="lastGetDate" column="C_LASTGETDATE"/>   
  11.      <result property="lastUseDate" column="C_LASTUSEDATE"/>   
  12.  </resultMap>   
  13. <select id="getCustomerById" resultMap="getCustomerResult" parameterClass="string"/>    
  14. SELECT   
  15. `CUMAS`.`ID` AS `C_ID`, `CUMAS`.`NAME` AS `C_NAME`, `CUMAS`.`BIRTHDAY` AS   
  16. `C_BIRTHDAY`, `CUMAS`.`GENDER` AS `C_GENDER`, `CUMAS`.`IDTYPE` AS `C_IDENTITYTYPE`,   
  17. `CUMAS`.`IDNO` AS `C_IDENTITYID`, `CUSPT`.`POINT` AS `C_CONSUMEPOINT`, `CUSPT`.`LASTGET`   
  18. AS `C_LASTGETDATE`, `CUSPT`.`LASTUSE` AS `C_LASTUSEDATE`   
  19. FROM `CUMAS`, `CUSPT` WHERE `ID` = #id# AND `CUMAS`.`ID` = `CUSPT`.`CUSID`  
  20. <select/>   
0 0