mybatis配置对象包含对象以及List的方式

mybatis配置对象包含对象及List

这里隐藏get set方法

public class BatchManagerViewVo  implements Serializable{
 
	/**
	* @Description: serialVersionUID : TODO
	*/ 
	private static final long serialVersionUID = 1L; 
	private List resourceItem;	
	private List priceInfo;
	
	/**
     * 主键(PM200600001)
     */
    @Id
    @Column(name = "ID")
    private String id; 
    public List getResourceItem() {
		return resourceItem;
	}
	public void setResourceItem(List resourceItem) {
		this.resourceItem = resourceItem;
	}
	public List getPriceInfo() {
		return priceInfo;
	}
	public void setPriceInfo(List priceInfo) {
		this.priceInfo = priceInfo;
	}
 
	/**
     * 场次名称
     */
    @Column(name = "BATCH_NAME")
    private String batchName;
 
    /**
     * 会员名称
     */
    @Column(name = "MEMBER_NAME")
    private String memberName;
 
    /**
     * 发起竞价的会员代码
     */
    @Column(name = "MEMBER_CODE")
    private String memberCode;
 
    /**
     * 委托状态:0-已生成,1-已发布,2.竞价中 3-已撤消,4--已作废,5-已完成
     */
    @Column(name = "BATCH_STATE")
    private String batchState;
 
    /**
     * 委托申请时间
     */
    @Column(name = "BATCH_DATE")
    private Date batchDate;
 
    /**
     * 结束时间
     */
    @Column(name = "END_TIME")
    private Date endTime;
 
    /**
     * 开始时间
     */
    @Column(name = "START_TIME")
    private Date startTime;
 
    /**
     * 履约保证金是否已经支付 1 - 已经支付 0 - 未支付(只有此状态为1才允许开始拍卖)
     */
    @Column(name = "BOND_PAYMENT_STATUS")
    private String bondPaymentStatus;
 
    /**
     * 结算方式:1-场外结算(默认) 2- 场内结算
     */
    @Column(name = "SETTLEMENT_MODE")
    private String settlementMode;
 
    /**
     * 作废时间
     */
    @Column(name = "INVALID_DATE")
    private Date invalidDate;
 
    /**
     * 审核操作员
     */
    @Column(name = "AUDIT_OPERATOR")
    private String auditOperator;
 
    /**
     * 终止操作员
     */
    @Column(name = "STOP_OPERATOR")
    private String stopOperator;
 
    /**
     * 作废操作员
     */
    @Column(name = "INVALID_OPERATOR")
    private String invalidOperator;
 
    /**
     * 申请操作员
     */
    @Column(name = "APPLY_OPERATOR")
    private String applyOperator;
 
    /**
     * 公告日
     */
    @Column(name = "ANNOUNCEMENT_DAY")
    private Date announcementDay;
 
    /**
     * 竞价日
     */
    @Column(name = "BID_DAY")
    private Date bidDay;
 
    /**
     * 买方保证金
     */
    @Column(name = "BUYER_DEPOSIT")
    private BigDecimal buyerDeposit;
 
    /**
     * 卖家保证金
     */
    @Column(name = "SELLER_BOND")
    private BigDecimal sellerBond;
 
    /**
     * 强制终止理由
     */
    @Column(name = "FORCED_TERMINATION_REASON")
    private String forcedTerminationReason;
 
    /**
     * 终止委托审核理由(待定)
     */
    @Column(name = "AUDIT_STOP_REASON")
    private String auditStopReason;
 
    /**
     * 终止委托审核时间(待定)
     */
    @Column(name = "AUDIT_STOP_DATE")
    private Date auditStopDate;
 
    /**
     * 终止委托申请理由(待定)
     */
    @Column(name = "APPLY_STOP_REASON")
    private String applyStopReason;
 
    /**
     * 终止委托申请时间(待定)
     */
    @Column(name = "APPLY_STOP_DATE")
    private Date applyStopDate;
 
    /**
     * 拒绝审核委托理由(待定)
     */
    @Column(name = "REFUSE_AUDIT_REASON")
    private String refuseAuditReason;
 
    /**
     * 委托审核时间(待定)
     */
    @Column(name = "AUDIT_TIME")
    private Date auditTime;
 
    /**
     * 定向竞价0否1是1
     */
    @Column(name = "IS_DIRECTIONAL_BID")
    private String isDirectionalBid;
 
    /**
     * 定向的原因,当场次定向时必须输入
     */
    @Column(name = "DIRECTIONAL_REASON")
    private String directionalReason;
 
    /**
     * 是否需要发送短信0不发送1发送
     */
    @Column(name = "IS_SEND_MESSAGE")
    private String isSendMessage;
 
    /**
     * 是否显示中标价格
     */
    @Column(name = "IS_SHOW_DEAL_PRICE")
    private String isShowDealPrice;
 
    /**
     * 是否显示定价
     */
    @Column(name = "IS_SHOW_ORDER_PRICE")
    private String isShowOrderPrice;
 
    /**
     * 是否显示中标会员
     */
    @Column(name = "IS_SHOW_DEAL_MEMBER")
    private String isShowDealMember;
 
    /**
     * 最少响应人数
     */
    @Column(name = "MINIMUM_RESPONSE")
    private String minimumResponse;
 
    /**
     * 是否显示成交结果
     */
    @Column(name = "ISSHOWDEALRESULT")
    private String isshowdealresult;
 
    /**
     * 竞价模式:1-公开增价,2自由报价,3-荷式竞价
     */
    @Column(name = "BIDDING_TYPE")
    private String biddingType;
 
    /**
     * 报盘方式:1-单价,2-总价
     */
    @Column(name = "OFFER_TYPE")
    private String offerType;
 
    /**
     * 是否显示起拍价 1显示(默认) 2不显示 
     */
    @Column(name = "IS_SHOW_STARTING_PIRCE")
    private String isShowStartingPirce;
 
    /**
     * 域名
     */
    @Column(name = "DOAMIN")
    private String doamin;
 
    /**
     * 协议
     */
    @Column(name = "EDITMENT")
    private String editment;
} 
 

        
        
        
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
	    
        
        
            
       		
       		
       		
       		
       		
        
       
        
       		
       		
       		
       		
       		
       		
       		
        
  

mybatis参数为对象中包含list情况处理

mybatis是一个非常好用且灵活的持久层框架,但也正是因为太过灵活,导致有时候参数很难整理。我把我在项目中遇到的一个特殊情况列出来,希望下次再碰到时,也有个印象。

实体类如下:

package com.kxlive.erp.sc.stock.vo; 
import java.util.Date;
import java.util.List; 
import org.springframework.format.annotation.DateTimeFormat; 
import com.kxlive.erp.sc.stock.po.PurchaseDeliver; 

public class QueryPurchaseDeliverVo extends PurchaseDeliver{ 
	private Long merchantId;	
	private Long stockId;
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date startTime;//发货开始时间
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date endTime;//发货结束时间 
	private Integer page;//当前页	
	private Integer rows;//每页记录数	
	private String stockName;//仓库名	
	private String supplierName;//供应商名称	
	private List condSupplierIds;//供应商IDs	
	private List condStatuss;//状态s
	public Date getStartTime() {
		return startTime;
	}
	
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
 
	public Date getEndTime() {
		return endTime;
	}
 
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
 
	public Integer getPage() {
		return page;
	}
 
	public void setPage(Integer page) {
		this.page = page;
	}
 
	public Integer getRows() {
		return rows;
	}
 
	public void setRows(Integer rows) {
		this.rows = rows;
	}
 
	public String getStockName() {
		return stockName;
	}
 
	public void setStockName(String stockName) {
		this.stockName = stockName;
	}
 
	public String getSupplierName() {
		return supplierName;
	}
 
	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}
 
	public List getCondSupplierIds() {
		return condSupplierIds;
	}
 
	public void setCondSupplierIds(List condSupplierIds) {
		this.condSupplierIds = condSupplierIds;
	}
 
	public List getCondStatuss() {
		return condStatuss;
	}
 
	public void setCondStatuss(List condStatuss) {
		this.condStatuss = condStatuss;
	}
 
	public Long getMerchantId() {
		return merchantId;
	}
 
	public void setMerchantId(Long merchantId) {
		this.merchantId = merchantId;
	}
 
	public Long getStockId() {
		return stockId;
	}
 
	public void setStockId(Long stockId) {
		this.stockId = stockId;
	}
 
}

这里的实体类中,包含了一个List对象,所以在写xml文件的时候多少对我这种菜鸟有点难度。

  

标红的地方,即为应用。在foreach循环中,引用index作为list的下标,这样即可将对象中的所有数据取出。

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

你可能感兴趣的:(mybatis配置对象包含对象以及List的方式)