国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術(shù)文章
文章詳情頁

詳解mybatis collection標(biāo)簽一對多的使用

瀏覽:102日期:2023-10-23 17:59:08

查詢, 結(jié)果集為AssociatedInfo:

<select resultMap='AssociatedInfo'> SELECT r.requisition_number AS business_code, r.id AS header_id, r.document_type_id AS reportTypeId, r.applicant_id as employeeId FROM fec_expense.exp_report_payment_schedule b,fec_expense.exp_report_header r WHERE b.exp_report_header_id=r.id and r.`status`=1004 and b.frozen_flag ='Y' and r.applicant_id=#{applicationId} <if test='reportNumber!=null and reportNumber != ’’'> AND r.requisition_number LIKE concat( ’%’, concat(#{reportNumber,jdbcType=VARCHAR}, ’%’)) </if> <if test='documentTypeId !=null and reportNumber != ’’'> AND r.document_type_id = #{documentTypeId} </if> <if test='formTypes != null and formTypes.size > 0'> AND r.document_type_id IN <foreach collection='formTypes' item='formId' open='(' separator=',' close=')'>#{formId} </foreach> </if> AND ( b.amount - ( SELECT COALESCE(sum( c.write_off_amount ), 0) AS write_off_amount FROM csh_write_off c WHERE c.document_header_id = b.exp_report_header_id AND c.document_line_id = b.id AND ( c.STATUS = ’Y’ OR ( c.STATUS = ’P’ AND c.operation_type = ’WRITE_OFF’ ) ) ) - ( SELECT COALESCE(sum( a.amount ), 0) AS commit_amount FROM csh_data_relation_acp a WHERE a.report_head_id = b.exp_report_header_id AND a.report_line_id = b.id AND a.document_type = ’ACP_REQUISITION’ ) > 0 ) GROUP BY r.requisition_number, b.exp_report_header_id, r.document_type_id, b.applicant_id ORDER BY r.requisition_number </select>

結(jié)果集 AssociatedInfo: 使用collection 實(shí)現(xiàn)1對多的場景, CashDataPublicReportHeaderDTO實(shí)體里包含一個(gè)行的集合List<CashDataPublicReportLineDTO> lines:

<resultMap type='com.hand.hcf.app.payment.web.dto.CashDataPublicReportHeaderDTO'> <result column='header_id' property='reportHeadId'/> <result column='business_code' property='reportNumber'/> <result column='form_name' property='reportTypeName'/> <collection property='lineList' column='{headerId=header_id}' ofType='ArrayList' select='getPaymentInfo'/> </resultMap> <select resultType='com.hand.hcf.app.payment.web.dto.CashDataPublicReportLineDTO'> SELECTtemp.id scheduleLineId,'' AS cshTransactionId,temp.amount,temp.associated_amount associatedAmount,(temp.amount - temp.associated_amount - (SELECT COALESCE( sum( c.write_off_amount ), 0 ) AS write_off_amountFROMcsh_write_off cWHEREc.document_header_id = temp.exp_report_header_idAND c.document_line_id = temp.idAND c.document_type = 'PUBLIC_REPORT'AND ( c.STATUS = ’Y’ OR ( c.STATUS = ’P’ AND c.operation_type = ’WRITE_OFF’ ) ))) AS availableAmount,temp.exp_report_header_id expReportHeaderId,0 AS scheduleLineNumber,temp.company_id companyId,temp.currency_code currency,temp.description description,temp.exchange_rate exchangeRate,temp.payment_schedule_date schedulePaymentDate,temp.payment_method paymentMethod,temp.payment_type,temp.prop_flag prop_flag,temp.csh_transaction_class_id cshTransactionClassId,( SELECT ctc.description FROM csh_transaction_class ctc WHERE ctc.id = temp.csh_transaction_class_id ) AS cshTransactionClassName,temp.cash_flow_item_id cashFlowItemId,temp.payee_category payeeCategory,temp.payee_id payeeId,temp.account_number accountNumber,temp.account_name accountName,temp.bank_code bankCode,temp.bank_name bankName,temp.bank_code bankLocationCode,temp.bank_name bankLocationName,'' provinceCode,'' provinceName,''cityCode,'' cityName, (select c.type_code from csh_transaction_class c where c.id=temp.csh_transaction_class_id ) cshTransactionTypeCode,''contractHeaderIdFROM(SELECT b.*,(SELECT COALESCE( sum( a.amount ), 0 ) AS associated_amountFROMcsh_data_relation_acp aWHEREa.report_head_id = b.exp_report_header_idAND a.report_line_id = b.idAND a.document_type = ’ACP_REQUISITION’) AS associated_amountFROMfec_expense.exp_report_payment_schedule b ,fec_expense.exp_report_header rWHEREb.frozen_flag = 'Y'and b.exp_report_header_id=r.idAND b.exp_report_header_id = #{headerId}) temp </select>

包含列表的實(shí)體類 CashDataPublicReportHeaderDTO :

package com.hand.hcf.app.payment.web.dto; import com.fasterxml.jackson.databind.annotation.JsonSerialize;import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;import lombok.Data; import java.time.ZonedDateTime;import java.util.List; @Datapublic class CashDataPublicReportHeaderDTO { @JsonSerialize(using = ToStringSerializer.class) private Long reportHeadId;//報(bào)賬單頭ID private String reportNumber;//報(bào)賬單編號(hào) private String reportTypeName;//報(bào)賬單類型 @JsonSerialize(using = ToStringSerializer.class) private Long reportTypeId;// 報(bào)賬單類型ID private List<CashDataPublicReportLineDTO> lineList;//報(bào)賬單計(jì)劃付款行 @JsonSerialize(using = ToStringSerializer.class) private Long employeeId;//員工ID private String employeeName;//員工名稱 private ZonedDateTime requisitionDate; // 申請日期}

總結(jié)

到此這篇關(guān)于mybatis collection標(biāo)簽一對多的使用的文章就介紹到這了,更多相關(guān)mybatis collection標(biāo)簽內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Mybatis 數(shù)據(jù)庫
相關(guān)文章:
主站蜘蛛池模板: 色综合久久综合 | 成人久久精品一区二区三区 | 亚洲一区二区中文字幕 | 欧美日韩一区二区中文字幕视频 | 在线播放成人高清免费视频 | 另类专区欧美 | 国产成人女人视频在线观看 | 久草网站在线观看 | 91久久在线| 免费观看国产网址你懂的 | 日本不卡一二三 | 手机看片在线精品观看 | 日本a级精品一区二区三区 日本a级毛片免费视频播放 | 97超级碰碰碰碰在线视频 | 无套内谢孕妇毛片免费看 | 91精品综合久久久久m3u8 | 黄色毛片在线 | 成人午夜性a一级毛片美女 成人午夜亚洲影视在线观看 | 久久久久久久久久久久久久久久久久 | 久草在线视频免费 | 中国一级毛片视频 | 日韩中文字幕免费 | 亚洲在线欧美 | 国产香蕉国产精品偷在线观看 | 亚洲精品中文一区不卡 | 久久成人视 | 台湾三级在线播放 | 亚洲三级在线视频 | 国产精品国产亚洲精品看不卡 | 一级毛片免费观看久 | 成人在线手机视频 | 正能量www正能量免费网站 | 在线观看成年人免费视频 | 在线观看aaa | 国产免费久久精品99久久 | 国产一级毛片午夜 | 国产高清视频免费最新在线 | 成年男女男精品免费视频网站 | 国产精品观看在线亚洲人成网 | 欧美在线乱妇一级毛片 | 国产农村一二三区 |