Commit 3200b113 authored by lixuan's avatar lixuan

Merge branch 'dev-lx' into 'dev'

feat: 房源

See merge request !128
parents edaa037b d6d3cf01
Pipeline #143245 passed with stages
in 5 minutes and 3 seconds
...@@ -54,7 +54,7 @@ public class HouseResourceController { ...@@ -54,7 +54,7 @@ public class HouseResourceController {
} }
@GetMapping("/list") @GetMapping("/list")
public AjaxResult getListHouseResources(HouseResourcePageQuery query) { public AjaxResult getProfileGraphHouseResources(HouseResourcePageQuery query) {
return AjaxResult.success(houseResourceService.listHouseResources(query)); return AjaxResult.success(houseResourceService.profileGraphHouseResources(query));
} }
} }
package com.ruoyi.system.domain.house.vo;
import lombok.Data;
import java.util.List;
@Data
public class HouseResourceProfileGraph {
private String id;
private String wgName;
private List<HouseResourcePage> houseResources;
}
...@@ -22,5 +22,5 @@ public interface HouseResourceMapper { ...@@ -22,5 +22,5 @@ public interface HouseResourceMapper {
IPage<HouseResourcePage> selectPage(IPage<HouseResource> page, @Param("query") HouseResourcePageQuery houseResourcePageQuery); IPage<HouseResourcePage> selectPage(IPage<HouseResource> page, @Param("query") HouseResourcePageQuery houseResourcePageQuery);
List<HouseResourcePage> selectList(@Param("query") HouseResourcePageQuery houseResourcePageQuery); List<HouseResourcePage> selectProfileGraph(@Param("query") HouseResourcePageQuery houseResourcePageQuery);
} }
...@@ -2,10 +2,7 @@ package com.ruoyi.system.service.house; ...@@ -2,10 +2,7 @@ package com.ruoyi.system.service.house;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.system.domain.house.HouseResource; import com.ruoyi.system.domain.house.HouseResource;
import com.ruoyi.system.domain.house.vo.HouseResourceDetail; import com.ruoyi.system.domain.house.vo.*;
import com.ruoyi.system.domain.house.vo.HouseResourcePage;
import com.ruoyi.system.domain.house.vo.HouseResourcePageQuery;
import com.ruoyi.system.domain.house.vo.HouseResourceSaveUpdateDto;
import java.util.List; import java.util.List;
...@@ -23,5 +20,5 @@ public interface HouseResourceService { ...@@ -23,5 +20,5 @@ public interface HouseResourceService {
IPage<HouseResourcePage> pageHouseResources(HouseResourcePageQuery query); IPage<HouseResourcePage> pageHouseResources(HouseResourcePageQuery query);
List<HouseResourcePage> listHouseResources(HouseResourcePageQuery query); List<HouseResourceProfileGraph> profileGraphHouseResources(HouseResourcePageQuery query);
} }
...@@ -156,9 +156,19 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -156,9 +156,19 @@ public class HouseResourceServiceImpl implements HouseResourceService {
} }
@Override @Override
public List<HouseResourcePage> listHouseResources(HouseResourcePageQuery query) { public List<HouseResourceProfileGraph> profileGraphHouseResources(HouseResourcePageQuery query) {
List<HouseResourcePage> list = houseResourceMapper.selectList(query); List<HouseResourcePage> list = houseResourceMapper.selectProfileGraph(query);
return handleHouseList(list); List<HouseResourceProfileGraph> resourceProfileGraphList = new ArrayList<>();
Map<String, List<HouseResourcePage>> collect = list.stream().collect(Collectors.groupingBy(HouseResourcePage::getFour));
collect.forEach((k, v) -> {
HouseResourceProfileGraph houseResourceProfileGraph = new HouseResourceProfileGraph();
houseResourceProfileGraph.setId(k);
GridRegion gridRegion = gridRegionMapper.selectByPrimaryKey(k);
houseResourceProfileGraph.setWgName(gridRegion.getWgName());
houseResourceProfileGraph.setHouseResources(v);
resourceProfileGraphList.add(houseResourceProfileGraph);
});
return resourceProfileGraphList;
} }
private List<HouseResourcePage> handleHouseList(List<HouseResourcePage> list) { private List<HouseResourcePage> handleHouseList(List<HouseResourcePage> list) {
......
...@@ -140,41 +140,38 @@ ...@@ -140,41 +140,38 @@
and t2.house_number like concat('%', #{query.houseNumber}, '%') and t2.house_number like concat('%', #{query.houseNumber}, '%')
</if> </if>
<if test="query.sortWay != null and query.sortWay != ''"> <if test="query.sortWay != null and query.sortWay != ''">
order by t2.houseArea ${query.sortWay} order by t2.house_area ${query.sortWay}
</if> </if>
</where> </where>
</select> </select>
<select id="selectList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage"> <select id="selectProfileGraph" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT SELECT
t1.wg_name AS wgName4, t2.wg_name AS wgName4,
t2.* t1.*
FROM FROM
grid_region t1 house_resource t1
LEFT JOIN house_resource t2 ON t1.id = t2.four LEFT JOIN grid_region t2 ON t1.four = t2.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t2.type = #{query.wgType} and t1.type = #{query.wgType}
</if> </if>
<if test="query.two != null and query.two != ''"> <if test="query.two != null and query.two != ''">
and t2.two = #{query.two} and t1.two = #{query.two}
</if> </if>
<if test="query.three != null and query.three != ''"> <if test="query.three != null and query.three != ''">
and t2.three = #{query.three} and t1.three = #{query.three}
</if> </if>
<if test="query.four != null and query.four != ''"> <if test="query.four != null and query.four != ''">
and t2.four = #{query.four} and t1.four = #{query.four}
</if> </if>
<if test="query.houseResourceAttribute != null"> <if test="query.houseResourceAttribute != null">
and t2.house_resource_attribute = #{query.houseResourceAttribute} and t1.house_resource_attribute = #{query.houseResourceAttribute}
</if> </if>
<if test="query.hireStatus != null"> <if test="query.hireStatus != null">
and t2.hire_status = #{query.hireStatus} and t1.hire_status = #{query.hireStatus}
</if> </if>
<if test="query.houseNumber != null and query.houseNumber != ''"> <if test="query.houseNumber != null and query.houseNumber != ''">
and t2.house_number like concat('%', #{query.houseNumber}, '%') and t1.house_number like concat('%', #{query.houseNumber}, '%')
</if>
<if test="query.sortWay != null and query.sortWay != ''">
order by t2.houseArea ${query.sortWay}
</if> </if>
</where> </where>
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment