SELECT
a.*,
count(p.id) AS pnum
FROM
activity a
left join activity_type aty on aty.id=a.type
left JOIN player p ON p.reg_place = #{orgId} and ((p.current=1 and p.is_pay=0) or(p.current>1))
AND activity_id IN (a.id)
WHERE
LOCATE(#{orgId}, a.org_list) > 0 and a.state <>2
<if test="type!=-1">
and (a.type like concat('%',#{type},'%'))
</if>
GROUP BY a.id ORDER BY a.create_time DESC
limit #{page},#{rows}
mysql中的LOCATE,返回param在目标字符串中第一次出现的位置,如果没有则返回0;