机构树形排序

This commit is contained in:
zhaokaiyao@91isoft.com
2021-09-28 08:58:23 +08:00
parent f3b8466c5f
commit 4e2278a987
2 changed files with 2 additions and 2 deletions
@@ -54,7 +54,7 @@ public interface TsInstitutionDao extends BaseMapper<TsInstitution> {
* 查询根机构 * 查询根机构
* @return List<TsInstitution> * @return List<TsInstitution>
*/ */
@Select("select * from ts_institution where parent_id not in (select id from ts_institution)") @Select("select * from ts_institution where parent_id not in (select id from ts_institution) order by name")
List<TsInstitution> selectRoot(); List<TsInstitution> selectRoot();
@Select("select * from ts_institution order by rand() limit 1") @Select("select * from ts_institution order by rand() limit 1")
@@ -45,7 +45,7 @@
left join ts_user u left join ts_user u
on i.id=u.institution_id on i.id=u.institution_id
<if test="userName == null"> <if test="userName == null">
where i.parent_id not in (select id from ts_institution) where i.parent_id not in (select id from ts_institution) order by i.name
</if> </if>
<if test="userName != null"> <if test="userName != null">