|
@@ -7,5 +7,29 @@
|
|
|
SELECT nextval(#{sequenceName});
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getSysAreaTree" resultMap="AreaTreeMap">
|
|
|
+ select t1.code,t1.name,t1.level,t2.code town_code,t2.name town_name,t2.level town_level,
|
|
|
+ t3.code village_code,t3.name village_name,t3.level village_level
|
|
|
+ from sys_area t1
|
|
|
+ left join sys_area t2 on t1.code = t2.parent_id
|
|
|
+ left join sys_area t3 on t2.code = t3.parent_id
|
|
|
+ where t1.code = '511503'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap id="AreaTreeMap" type="org.thingsboard.server.domain.SysAreaTreeInfo">
|
|
|
+ <result column="code" property="code"/>
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="level" property="level"/>
|
|
|
+ <collection property="areas" ofType="org.thingsboard.server.domain.SysAreaTreeInfo">
|
|
|
+ <result column="town_code" property="code"/>
|
|
|
+ <result column="town_name" property="name"/>
|
|
|
+ <result column="town_level" property="level"/>
|
|
|
+ <collection property="areas" ofType="org.thingsboard.server.domain.SysAreaTreeInfo">
|
|
|
+ <result column="village_code" property="code"/>
|
|
|
+ <result column="village_name" property="name"/>
|
|
|
+ <result column="village_level" property="level"/>
|
|
|
+ </collection>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
</mapper>
|
|
|
|