model
父model
package com.book.municipaldoctor.bim.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class FacilityTypeRoadVo {
@ApiModelProperty(value = "设施uuid")
private String facilityUuid;
@ApiModelProperty(value = "设施名称")
private String facilityName;
@ApiModelProperty(value = "设施路段信息")
private List<RoadModelVo> roadModelVoList;
}
子model
package com.book.municipaldoctor.bim.model.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class RoadModelVo {
@ApiModelProperty(value = "设施路段矢量主键id")
private Integer id;
@ApiModelProperty(value = "路段矢量uuid")
private String roadUuid;
@ApiModelProperty(value = "路段矢量名称")
private String roadName;
}
XML
返回对象
<resultMap id="getFacilityTypeRoadVo" type="com.book.municipaldoctor.bim.model.vo.FacilityTypeRoadVo">
<result column="facilityUuid" jdbcType="VARCHAR" property="facilityUuid" />
<result column="facilityName" jdbcType="VARCHAR" property="facilityName" />
<collection property="roadModelVoList" ofType="com.book.municipaldoctor.bim.model.vo.RoadModelVo">
<id column="id" property="id"/>
<result column="roadUuid" property="roadUuid"/>
<result column="roadName" property="roadName"/>
</collection>
</resultMap>
查询语句
<select id="getFacilityRoadByFacilityType" resultMap="getFacilityTypeRoadVo">
select sf.facility_uuid as facilityUuid, sf.facility_name as facilityName,
sfr.id as id, sfr.road_uuid as roadUuid, sfr.road_name as roadName
from szys_facility sf
left join szys_facility_road sfr on sfr.facility_uuid = sf.facility_uuid
where sf.facility_type = #{facilityType}
and sf.flag = 1
and sf.parent_facility_uuid is null
and sfr.flag = 0
</select>