浏览 475 次
|
该帖已经被评为新手帖
|
|
|---|---|
| 作者 | 正文 |
|
时间:2008-04-02
如上。这么写可以么
声明:JavaEye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
|
|
| 返回顶楼 | |
|
时间:2008-04-02
为什么不直接用sql的join呢,
resultMap有个属性叫groupBy,专门做这个事情的 |
|
| 返回顶楼 | |
|
时间:2008-04-03
<resultMap id="billCardResult" class="BillCard" groupBy="cardId">
<result property="cardId" column="card_id" /> <result property="cardCode" column="card_code" /> <result property="cardName" column="CARD_NAME" /> <result property="cardCodeLength" column="CODE_LENGTH" /> <result property="cardType" column="CARD_TYPE" /> <result property="cardTypeName" column="CARD_NAME" /> <result property="cardDescription" column="CARD_DESC" /> <result property="personalDrawLimit" column="LIMIT_DRAW" /> <result property="isVoucher" column="IS_VOUCHER" /> <result property="isImport" column="IS_IMPORT" /> <result property="returnLimit" column="LIMIT_RETURN" /> <result property="hasCheckCode" column="HAS_CHECK_CODE" /> <result property="codeRelation" column="CODE_RELA" /> <result property="otherCode" column="OTHRE_CODE" nullValue=""/> <result property="status" column="STATUS" /> <result property="createDate" column="CREATE_DATE" /> <result property="createUserId" column="CREATED_BY" /> <result property="updateDate" column="UPDATE_DATE" /> <result property="updateUserId" column="UPDATED_BY" /> <result property="premiumSum" column="PREMIUM_SUM" /> <result property="billCardProductList" resultMap="BillCardDefinition.billCardProductResult" nullValue="null"/> </resultMap> <resultMap id="billCardProductResult" class="BillCardProduct"> <result property="cardId" column="billCardProduct_card_id" /> <result property="productId" column="PRODUCT_ID" /> <result property="policyAmount" column="POLICY_AMOUNT" /> <result property="premium" column="PREMIUM" /> <result property="unit" column="UNIT" /> <result property="productLevel" column="PRODUCT_LEVEL" /> <result property="coverageTermId" column="COVERAGETERMID" /> <result property="coveragePeriod" column="COVERAGEPERIOD" /> <result property="paymentTermId" column="PAYMENTTERMID" /> <result property="paymentPeriod" column="PAYMENTPERIOD" /> <result property="paymentType" column="PAYMENTTYPE" /> <!-- <result property="productId" column="PRODUCT_ID" /> --> </resultMap> <select id="getBillCardById" parameterClass="Long" resultMap="billCardResult"> select billCard.*,billCardProduct.*,billCardProduct.card_id as billCardProduct_card_id from t_billcard billCard join T_BILLCARD_TYPE billCardType on billCard.Card_Type=billCardType.Card_Type left join t_billcard_product billCardProduct on billCard.Card_Id=billCardProduct.Card_Id where billCard.status='Y' and billCard.Card_Id=#value# order by billCard.card_code asc </select> 自己看吧,看不懂再看看iBATIS的文档。 |
|
| 返回顶楼 | |
|
时间:2008-04-03
搞定,谢谢大家
|
|
| 返回顶楼 | |



