<where><iftest="provider != null and provider.providerCode">provider_code like "%"{provider.providerCode}"%" </if><iftest="provider != null and provider.providerName">and provider_name like "%"#{provider.providerName}"%"</if><iftest="provider != null and provider.contacts">and contacts like "%"#{provider.contacts}"%"</if><iftest="provider != null and provider.mobile">and mobile like "%"#{provider.mobile}"%"</if><iftest="provider != null and provider.fax">and fax like "%"#{provider.fax}"%" </if><iftest="provider != null and provider.createDate">and create_date=#{provider.createDate}</if></where>
<resultMapid="billMap"type="bill"><idproperty="bid"column="bid"></id><resultproperty="productName"column="product_name"></result><resultproperty="price"column="price"></result><resultproperty="payment"column="payment"></result><resultproperty="createTime"column="create_time"></result><resultproperty="proId"column="pro_id"></result><resultproperty="total"column="total"></result><resultproperty="unit"column="unit"></result><associationproperty="provider"javaType="provider"><idproperty="id"column="id"></id><resultproperty="providerCode"column="provider_code"></result><resultproperty="providerName"column="provider_name"></result><resultproperty="contacts"column="contacts"></result><resultproperty="mobile"column="mobile"></result><resultproperty="fax"column="fax"></result><resultproperty="createDate"column="create_date"></result></association></resultMap><sqlid="select_bill">
b.bid,b.product_name,b.price,b.payment,b.create_time,b.pro_id,b.total,b.unit,
p.id,p.provider_code,p.provider_name,p.contacts,p.mobile,p.fax,p.create_date
</sql><selectid="selectAllBill"resultMap="billMap"resultSets="java.util.List">
select <includerefid="select_bill"></include> from bill b
inner join provider p on b.pro_id=p.id
<where><iftest="bill != null and bill.productName !=null">b.product_name like "%"#{bill.productName}"%"</if><iftest="bill != null and bill.payment !=null">and b.payment=#{bill.payment }</if><iftest="bill != null and bill.proId !=null">and b.pro_id=#{bill.proId}</if></where><iftest="pageSize != null">limit #{pageNum},#{pageSize}</if></select>