重新生成
不写javaType,能匹配上吗
不歇javaType,能匹配上吗
xml复制代码
<result property="totalCubage" column="total_cubage" />
<result property="totalWeight" column="total_weight" />
<result property="totalQty" column="total_qty" />
<result property="totalBcsQty" column="total_bcs_qty" />
<result property="totalRedBillQty" column="total_red_bill_qty" />
<result property="taxRate" column="tax_rate" />
<result property="lbcsFlag" column="lbcs_flag" />
<result property="isDirect" column="is_direct" />
<result property="anInvbillno" column="an_invbillno" />
<result property="isCollectMoney" column="is_collect_money" />
<result property="paymentType" column="payment_type" />
<result property="isPrint" column="is_print" />
<result property="anAmount" column="an_amount" />
<result property="agentAmount" column="agent_amount" />
<result property="isPrintNotax" column="is_print_notax" />
<result property="interceptStatus" column="intercept_status" />
<result property="interceptFailRes" column="intercept_fail_res" />
<result property="interceptDate" column="intercept_date" />
<result property="stat" column="stat" />
<result property="note" column="note" />
<result property="printtimes" column="printtimes" />
<result property="createdBy" column="created_by" />
<result property="creationDate" column="creation_date" />
<result property="lastUpdatedBy" column="last_updated_by" />
<result property="lastUpdateDate" column="last_update_date" />
<result property="attribute1" column="attribute1" />
<result property="attribute2" column="attribute2" />
<result property="attribute3" column="attribute3" />
<result property="attribute4" column="attribute4" />
<result property="attribute5" column="attribute5" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="custCode" column="cust_code" />
请注意,这是一个基本的示例,您可能需要根据实际的数据库表结构和Java类属性进行适当的调整。还需要确保数据库列名与Java类属性名之间的映射是正确的。
继续
在MyBatis中,ResultMap是用于将数据库查询结果映射到Java对象的重要元素。根据您提供的Java类属性名,以下是一个可能的ResultMap的示例:
xml复制代码
<resultMap id="CCSInvOutBillHeadResultMap" type="com.example.CCSInvOutBillHead">
<result property="ccsInvOutBillHeadId" column="ccs_inv_out_bill_head_id" />
<result property="billno" column="billno" />
<result property="batchBillno" column="batch_billno" />
<result property="warehouseId" column="warehouse_id" />
<result property="billdate" column="billdate" />
<result property="yearMonth" column="year_month" />
<result property="billtype" column="billtype" />
<result property="sourceBillId" column="source_bill_id" />
<result property="sourceBillNo" column="source_bill_no" />
<result property="sourceBillType" column="source_bill_type" />
<result property="isOutoRed" column="is_outo_red" />
<result property="bluered" column="bluered" />
<result property="ccsPoHeadId" column="ccs_po_head_id" />
<result property="ccsPoNo" column="ccs_po_no" />
<result property="customerId" column="customer_id" />
<result property="orgId" column="org_id" />
<result property="orgIdStr" column="org_id_str" />
<result property="isConfirm" column="is_confirm" />
<result property="confirmBy" column="confirm_by" />
<result property="confirmDate" column="confirm_date" />
<result property="shipmodeId" column="shipmode_id" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="districtId" column="district_id" />
<result property="townId" column="town_id" />
<result property="villageId" column="village_id" />
<result property="defineAddr" column="define_addr" />
<result property="consigneeName" column="consignee_name" />
<result property="consigneeMobile" column="consignee_mobile" />
<result property="amountTotalFNotax" column="amount_total_fnotax" />
<result property="amountTotalF" column="amount_total_f" />
<result property="amountTotalNotax" column="amount_total_notax" />
<result property="amountTotal
private Long ccsInvOutBillHeadId; private String billno;段名 : BATCH_BILLNO */ private String batchBillno; private Long warehouseId; private Date billdate; private String yearMonth; private String billtype;拔单(调拔出库) 字段名 : SOURCE_BILL_ID */ private Long sourceBillId; private String sourceBillNo private Integer sourceBillType; // private Long setsOfBooksId; private String isOutoRed; private String bluered; private Long ccsPoHeadId; private String ccsPoNo; private Long customerId; private BigDecimal orgId; private String orgIdStr; private Integer isConfirm; private String confirmBy; private Date confirmDate; private Long shipmodeId; private Long provinceId; private Long cityId; private Long districtId; private Long townId; private Long villageId; private String defineAddr; private String consigneeName; private String consigneeMobile; private BigDecimal amountTotalFNotax; private BigDecimal amountTotalF; private BigDecimal amountTotalNotax; private BigDecimal amountTotal; private BigDecimal totalCubage; private BigDecimal totalWeight; private BigDecimal totalQty; private BigDecimal totalBcsQty; private BigDecimal totalRedBillQty; private BigDecimal taxRate; private Integer lbcsFlag; private Integer isDirect; private String anInvbillno; private Integer isCollectMoney; private Integer paymentType; private Integer isPrint; private BigDecimal anAmount; private BigDecimal agentAmount; private Integer isPrintNotax; private Integer interceptStatus; private String interceptFailRes; private Date interceptDate; private Integer stat; private String note; private Integer printtimes; private String createdBy; private Date creationDate; private String lastUpdatedBy; private Date lastUpdateDate; private String attribute1; private Date attribute2; private String attribute3; private Integer attribute4; private Integer attribute5; */ private String startDate; */ private String endDate; private String custCode; 这是Java类的属性名,你给我对应一下写出resultMap里的result项(mybatis的)
好的,我记录下来了。您需要我帮您完成什么呢?
数据库查询的字段如下,你先不要回答你先记下来ph.SALE_ORG_CODE,ph.SALE_ORG_NAME,ph.SUP_DEPT_ID,ph.SUP_DEPT_CODE,ph.SUP_DEPT_NAME,ph.CHANNEL_CODE,ph.CHANNEL_NAME, nvl(ph.source_system,1) source_system,nvl(ph.order_type,0) order_type,pl.policy_no,pl.MATCH_NUMBER,pl.BEGIN_NUMBER,ph.is_group_finish, ph.PO_HEAD_ID, ph.PO_NO, ph.BILLTYPE, ph.STAT, ph.INVOICE_CUST_ID, ph.INVOICE_CUST_CODE, ph.INVOICE_CUST_NAME, ph.NOTE,ph.SHIPMODE, pl.PO_LINE_ID as CCS_PO_LINE_ID, pl.APPLY_PRICE, pl.APPLY_QTY, pl.AMOUNT, pl.APPLY_PRICE as PRICE_BILL_F, NVL(pl.AUDIT_QTY_BILL,0) as AUDIT_QTY_BILL, (pl.APPLY_QTY-NVL(pl.AUDIT_QTY_BILL,0)-NVL(pl.CANCEL_QTY, 0)) as BILL_QTY, NVL(pl.CARRYOVER_QTY,0) as CARRYOVER_QTY, NVL(pl.SALE_OUT_QTY,0) as SALE_OUT_QTY, NVL(pl.AUDIT_AMOUNT,0) as AUDIT_AMOUNT, bi.pack_Cubage CUBAGE, pl.TOTAL_CUBAGE,pl.sp_type IS_PRESENT, bi.gross_Weigth as WEIGHT, pl.TOTAL_WEIGTH as TOTAL_WEIGHT, pl.DISCOUNT_RATE, pl.DISCOUNT_MONTH, pl.IS_CARRYOVER, w.warehouse_id,w.warehouse_name, ph.CREATED_BY, ph.CREATION_DATE, ph.LAST_UPDATED_BY, pl.LAST_UPDATE_DATE, pl.ITEM_ID, bi.ITEM_CODE,bi.ITEM_NAME, bi.design_code, bi.design_name, bi.product_group_name, bi.product_group_code, bi.CRM_ENTID, bi.IS_SYS, pl.UOM_ID, bi.CAT_ID, bi.PRO_LINE_ID as PROLINE_ID, pl.RETRUN_PO_NO, /* 转采购订单号, 品类64来源IMS, 其他来源CIMS */ NVL(PL.CANCEL_QTY, 0) AS CANCEL_QTY, (select bu.UOM_NAME from CCS_BASE_UOM bu where bu.UOM_ID = pl.UOM_ID) as UOM_NAME, /*计量单位*/ pl.SETTLEMENT_TYPE, pl.APPLY_BEFORE_PRICE, NVL(inv.QTY_AVI, 0) available_qty, CBC.DESCRIPTION, ph.MANAGER_CODE, ph.MANAGER_NAME, ph.REVIEW_DATE
好的,让我结合当前上下文进行回答。
根据您提供的代码片段,我可以看到您正在尝试将rows
列表中的数据赋值给invOutBillHeadDTOS
列表。根据上下文,我理解您希望将每个row
对象转换为InvOutBillHeadDTO
对象,并将这些对象添加到invOutBillHeadDTOS
已停止生成
现在给你个任务,你上下文结合一下一会
要将rows
赋值给invOutBillHeadDTOS
,你需要遍历rows
列表,并使用每个列表项中的数据创建一个InvOutBillHeadDTO
对象。然后,将该对象添加到invOutBillHeadDTOS
列表中。
以下是一个示例代码,展示了如何将rows
赋值给invOutBillHeadDTOS
:
java复制代码
List<Map<String, Object>> rows = showSaleOrderList(poHeadTmp).getRows();
List<InvOutBillHeadDTO> invOutBillHeadDTOS = new ArrayList<>();
for (Map<String, Object> row : rows) {
InvOutBillHeadDTO invOutBillHeadDTO = new InvOutBillHeadDTO();
// 使用row中的数据设置invOutBillHeadDTO的属性
// 例如:
invOutBillHeadDTO.setSupDeptId((Long) row.get("supDeptId"));
// 还可以根据row中的其他字段设置其他属性
invOutBillHeadDTOS.add(invOutBillHeadDTO);
}
在上述代码中,我们使用了一个增强的for循环(也称为foreach循环)来遍历rows
列表。对于每个row
,我们创建一个新的InvOutBillHeadDTO
对象,并使用row
中的数据设置该对象的属性。在这个例子中,我们假设row
中的键为"supDeptId",并将其值设置为InvOutBillHeadDTO
对象的supDeptId
属性。你可以根据实际情况根据其他字段设置其他属性。最后,我们将创建的InvOutBillHeadDTO
对象添加到invOutBillHeadDTOS
列表中。