|
|
@ -135,14 +135,19 @@ |
|
|
|
IF( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild |
|
|
|
FROM |
|
|
|
( SELECT t.*, p.parent_id FROM t_organization t, t_organization_parent p WHERE t.id = p.organization_id ORDER BY parent_id, id ) t1, |
|
|
|
( SELECT @pids := 2 ) t2 |
|
|
|
<choose> |
|
|
|
<when test="areaId == null">( SELECT @pids := 0 ) t2</when> |
|
|
|
<otherwise>( SELECT @pids := #{areaId} ) t2</otherwise> |
|
|
|
</choose> |
|
|
|
) t3 |
|
|
|
WHERE |
|
|
|
ischild != 0 |
|
|
|
organizationType = 3 |
|
|
|
<if test="areaId != null"> |
|
|
|
and ischild != 0 |
|
|
|
</if> |
|
|
|
<if test="level != null"> |
|
|
|
AND level = #{level} |
|
|
|
</if> |
|
|
|
AND organizationType = 3 |
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
) h |
|
|
@ -230,14 +235,22 @@ |
|
|
|
IF( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild |
|
|
|
FROM |
|
|
|
( SELECT t.*, p.parent_id FROM t_organization t, t_organization_parent p WHERE t.id = p.organization_id ORDER BY parent_id, id ) t1, |
|
|
|
( SELECT @pids := 2 ) t2 |
|
|
|
<choose> |
|
|
|
<when test="areaId == null">( SELECT @pids := 0 ) t2</when> |
|
|
|
<otherwise>( SELECT @pids := #{areaId} ) t2</otherwise> |
|
|
|
</choose> |
|
|
|
|
|
|
|
) t3 |
|
|
|
WHERE |
|
|
|
ischild != 0 |
|
|
|
organizationType = 3 |
|
|
|
<if test="areaId != null"> |
|
|
|
and ischild != 0 |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="level != null"> |
|
|
|
AND level = #{level} |
|
|
|
</if> |
|
|
|
AND organizationType = 3 |
|
|
|
|
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
) h |
|
|
|