<iftest="cashCollection.markets != null and cashCollection.markets.size() > 0">
AND (
<foreachcollection="cashCollection.markets"item="market"open=""close=""separator=" OR ">
cr.market = #{market}
</foreach>
)
</if>
<iftest="cashCollection.market != null and cashCollection.market != ''">
AND cr.market = #{cashCollection.market}
</if>
<iftest="cashCollection.jwcode != null and cashCollection.jwcode!=''">
AND cr.jwcode = #{cashCollection.jwcode}
</if>
<iftest="cashCollection.name!=null and cashCollection.name !=''">
AND cr.name like concat('%',#{cashCollection.name},'%')
</if>
<iftest="cashCollection.activity!=null and cashCollection.activity!=''">
AND cr.activity like concat('%',#{cashCollection.activity},'%')
</if>
<iftest="cashCollection.goodsName!=null and cashCollection.goodsName!=''">
AND cr.goods_name like concat('%',#{cashCollection.goodsName},'%')
</if>
<iftest="cashCollection.payType!=null and cashCollection.payType!=''">
AND cr.pay_type = #{cashCollection.payType}
</if>
<iftest="cashCollection.status!=null and cashCollection.status!=''">
AND cr.status = #{cashCollection.status}
</if>
<iftest="cashCollection.startTime!=null and cashCollection.endTime!=null">
AND cr.pay_time between #{cashCollection.startTime} and #{cashCollection.endTime}
</if>
and cr.order_type=1
</where>
<choose>
<whentest="cashCollection.sortField != null and cashCollection.sortField.length > 0 or cashCollection.sortOrder != null and cashCollection.sortOrder.length > 0">
ORDER BY ${cashCollection.sortField} ${cashCollection.sortOrder}