mybatis新查询方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sinat_28729797/article/details/79585161

实体:

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新查询方法

猜你喜欢

转载自blog.csdn.net/sinat_28729797/article/details/79585161