select * from (select t2.id,t2.category_name,t2.category_level,t2.parent_id,t2.checkBox,t2.sort from(select @r as _id,(select @r := parent_id from category where id=_id)as parent_id,@l :=@l+1 as lvl from (select @r := #{id,jdbcType=INTERGER},@l :=0) vars,category h where @r ]]>0)t1 join category t2 on t1._id=t2.id and t2.id !=#{id,jdbcType=INTERGER} and t2.community_code = #{communityCode,jdbcType=varchar} order by t1.lvl desc)t4 left join property vy on t4.id=vy.category_id left join proprety_value vl on vy.id=vl.property_id order by t4.sort asc,vl.sort asc
sql中添加行号
select (@r :=@r+1)rowNo from (select @r:=0)t