xml
<insert id="addMain" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.hopedove.coreserver.vo.vpm.ForeignTradeOutboundOrderVO"> insert into aps_foreign_trade_ex_warehouse (invoiceNumber,factoryId,mainStyleNumber,customerId,customerIdentifyName,quantity,passQty,status,shipmentNumber, disabled,createUserId,createUserName,createDatetime,createDeptId,createIp,updateUserId, updateUserName,updateDatetime,updateDeptId,updateIp) values(#{invoiceNumber},#{factoryId},#{mainStyleNumber},#{customerId},#{customerIdentifyName},#{quantity},#{passQty},#{status},#{shipmentNumber}, #{disabled},#{createUserId},#{createUserName},#{createDatetime},#{createDeptId},#{createIp}, #{updateUserId},#{updateUserName},#{updateDatetime},#{updateDeptId},#{updateIp}) </insert>
dao
int addMain(ForeignTradeOutboundOrderVO vo);
实现类
vo.setInvoiceNumber(code); vo.setFactoryId(factoryId); vo.setDisabled(0); vo.setStatus(0); VOUtil.fillCreate(vo); iForeignTradeOutboundOrderDao.addMain(vo); List<ForeignTradeOutboundOrderDetailVO> details = vo.getDetails(); details.forEach(item->{ item.setFactoryId(factoryId); item.setParentId(vo.getId()); VOUtil.fillCreate(item); });
vo.getId()就可以直接获取到了
标签:updateIp,insert,自增,VOUtil,factoryId,vo,item,MySQL From: https://www.cnblogs.com/lilulin/p/18397080