mybatis新查询方法

实体:

Params {

   private String planId

   private String headingName;   

   private String childName;  

   private Integer goodSource;   

   private Integer buyNumber;     

   private String goodsId;        

   private Integer isCheck

    

}

格式:

<select id="queryParams" resultType="com. web. domain.Params">

   SELECT

      head.program_item_id  as planId,

      head.purchase_list_name  as headingName,

      buy.goods_name  as childName,

      b.goods_idas goodsId,

      buy.goods_sourceas goodSource,

      buy.idas childId,

      b.buying_numberas buyNumber,

      buy.is_checkas isCheck

   FROM

      pb_purchaseheadinghead

   innerjoin bm_buying b on b.purchase_heading_id=  head.id

   LEFTJOIN bm_childbuy buy ON head.id = buy.purchase_heading_id

   WHERE

      (buy.is_check= 0 or buy.is_check=1)

      <if test="itemId != nulland itemId!=''" >

      andhead.program_item_id = #{programItemId} if>

   select>

 

mybatis新查询方法

你可能感兴趣的:(软件工程)