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 {
}
@GetMapping("/list")
public AjaxResult getListHouseResources(HouseResourcePageQuery query) {
return AjaxResult.success(houseResourceService.listHouseResources(query));
public AjaxResult getProfileGraphHouseResources(HouseResourcePageQuery 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 {
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;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.system.domain.house.HouseResource;
import com.ruoyi.system.domain.house.vo.HouseResourceDetail;
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 com.ruoyi.system.domain.house.vo.*;
import java.util.List;
......@@ -23,5 +20,5 @@ public interface HouseResourceService {
IPage<HouseResourcePage> pageHouseResources(HouseResourcePageQuery query);
List<HouseResourcePage> listHouseResources(HouseResourcePageQuery query);
List<HouseResourceProfileGraph> profileGraphHouseResources(HouseResourcePageQuery query);
}
......@@ -156,9 +156,19 @@ public class HouseResourceServiceImpl implements HouseResourceService {
}
@Override
public List<HouseResourcePage> listHouseResources(HouseResourcePageQuery query) {
List<HouseResourcePage> list = houseResourceMapper.selectList(query);
return handleHouseList(list);
public List<HouseResourceProfileGraph> profileGraphHouseResources(HouseResourcePageQuery query) {
List<HouseResourcePage> list = houseResourceMapper.selectProfileGraph(query);
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) {
......
......@@ -140,41 +140,38 @@
and t2.house_number like concat('%', #{query.houseNumber}, '%')
</if>
<if test="query.sortWay != null and query.sortWay != ''">
order by t2.houseArea ${query.sortWay}
order by t2.house_area ${query.sortWay}
</if>
</where>
</select>
<select id="selectList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
<select id="selectProfileGraph" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT
t1.wg_name AS wgName4,
t2.*
t2.wg_name AS wgName4,
t1.*
FROM
grid_region t1
LEFT JOIN house_resource t2 ON t1.id = t2.four
house_resource t1
LEFT JOIN grid_region t2 ON t1.four = t2.id
<where>
<if test="query.wgType != null">
and t2.type = #{query.wgType}
and t1.type = #{query.wgType}
</if>
<if test="query.two != null and query.two != ''">
and t2.two = #{query.two}
and t1.two = #{query.two}
</if>
<if test="query.three != null and query.three != ''">
and t2.three = #{query.three}
and t1.three = #{query.three}
</if>
<if test="query.four != null and query.four != ''">
and t2.four = #{query.four}
and t1.four = #{query.four}
</if>
<if test="query.houseResourceAttribute != null">
and t2.house_resource_attribute = #{query.houseResourceAttribute}
and t1.house_resource_attribute = #{query.houseResourceAttribute}
</if>
<if test="query.hireStatus != null">
and t2.hire_status = #{query.hireStatus}
and t1.hire_status = #{query.hireStatus}
</if>
<if test="query.houseNumber != null and query.houseNumber != ''">
and t2.house_number like concat('%', #{query.houseNumber}, '%')
</if>
<if test="query.sortWay != null and query.sortWay != ''">
order by t2.houseArea ${query.sortWay}
and t1.house_number like concat('%', #{query.houseNumber}, '%')
</if>
</where>
</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