Commit e752ea69 authored by lixuan's avatar lixuan

feat: 房源

parent f3ba8231
Pipeline #145501 failed with stages
package com.ruoyi.web.controller.house;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.house.BusinessEntityInfo;
import com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping;
import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper;
import com.ruoyi.system.mapper.house.HouseResourceBusinessEntityInfoMappingMapper;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/houseResourceBusinessEntityInfoMapping")
public class HouseResourceBusinessEntityInfoMappingController {
private final HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper;
private final BusinessEntityInfoMapper businessEntityInfoMapper;
public HouseResourceBusinessEntityInfoMappingController(HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper, BusinessEntityInfoMapper businessEntityInfoMapper) {
this.houseResourceBusinessEntityInfoMappingMapper = houseResourceBusinessEntityInfoMappingMapper;
this.businessEntityInfoMapper = businessEntityInfoMapper;
}
@PostMapping("/start")
@Transactional(rollbackFor = Exception.class)
public AjaxResult start() {
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectAllBusinessEntityInfos();
Map<String, List<BusinessEntityInfo>> group = businessEntityInfos.stream().collect(Collectors.groupingBy(BusinessEntityInfo::getHouseResourceId));
group.forEach((houseResourceId, businessEntityInfoList) -> {
System.out.println("当前处理houseId = " + houseResourceId);
if (!CollectionUtils.isEmpty(businessEntityInfoList)) {
for (BusinessEntityInfo businessEntityInfo : businessEntityInfoList) {
HouseResourceBusinessEntityInfoMapping houseResourceBusinessEntityInfoMapping = new HouseResourceBusinessEntityInfoMapping();
houseResourceBusinessEntityInfoMapping.setId(UUID.randomUUID().toString().replaceAll("-", ""));
houseResourceBusinessEntityInfoMapping.setHouseResourceId(houseResourceId);
houseResourceBusinessEntityInfoMapping.setBusinessEntityInfoId(businessEntityInfo.getId());
houseResourceBusinessEntityInfoMappingMapper.insert(houseResourceBusinessEntityInfoMapping);
}
}
});
System.out.println("数据处理完成");
return AjaxResult.success();
}
}
...@@ -31,8 +31,8 @@ public class HouseResourceController { ...@@ -31,8 +31,8 @@ public class HouseResourceController {
} }
@GetMapping @GetMapping
public AjaxResult queryHouseResourceById(@RequestParam String id) { public AjaxResult getHouseResourceById(@RequestParam String id) {
return AjaxResult.success(houseResourceService.queryHouseResourceById(id)); return AjaxResult.success(houseResourceService.detail(id));
} }
// @PreAuthorize("@ss.hasPermi('system:house:edit')") // @PreAuthorize("@ss.hasPermi('system:house:edit')")
......
package com.ruoyi.system.domain.house;
import lombok.Data;
@Data
public class HouseResourceBusinessEntityInfoMapping {
private String id;
private String houseResourceId;
private String businessEntityInfoId;
}
...@@ -36,7 +36,7 @@ public class AssociationBusinessEntityHouseResourceDto { ...@@ -36,7 +36,7 @@ public class AssociationBusinessEntityHouseResourceDto {
private boolean associationBusinessEntityFlag; private boolean associationBusinessEntityFlag;
private HouseResourcePage houseResource; private List<HouseResourcePage> houseResources;
private List<BusinessEntitySell> businessEntitySells; private List<BusinessEntitySell> businessEntitySells;
} }
package com.ruoyi.system.mapper.house;
import com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping;
import java.util.List;
public interface HouseResourceBusinessEntityInfoMappingMapper {
void insert(HouseResourceBusinessEntityInfoMapping houseResourceBusinessEntityInfoMapping);
void deleteByHouseResourceIdBusinessEntityInfoId(String houseResourceId, String businessEntityInfoId);
void deleteByHouseResourceId(String houseResourceId);
List<HouseResourceBusinessEntityInfoMapping> selectByBusinessEntityInfoId(String businessEntityInfoId);
}
...@@ -33,4 +33,6 @@ public interface HouseResourceMapper { ...@@ -33,4 +33,6 @@ public interface HouseResourceMapper {
List<HouseResource> selectPageBusinessEntityStatistics(); List<HouseResource> selectPageBusinessEntityStatistics();
List<HouseResourcePage> selectForContrast(@Param("two") String two, @Param("name") String name); List<HouseResourcePage> selectForContrast(@Param("two") String two, @Param("name") String name);
List<HouseResourcePage> selectByIdList(List<String> idList);
} }
package com.ruoyi.system.service.house; 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.BusinessEntityInfo;
import com.ruoyi.system.domain.house.HouseResource; import com.ruoyi.system.domain.house.HouseResource;
import com.ruoyi.system.domain.house.vo.*; import com.ruoyi.system.domain.house.vo.*;
...@@ -11,7 +10,7 @@ public interface HouseResourceService { ...@@ -11,7 +10,7 @@ public interface HouseResourceService {
void saveHouseResource(HouseResourceSaveUpdateDto dto); void saveHouseResource(HouseResourceSaveUpdateDto dto);
HouseResourceDetail queryHouseResourceById(String id); HouseResourceDetail detail(String id);
void updateHouseResource(HouseResourceSaveUpdateDto dto); void updateHouseResource(HouseResourceSaveUpdateDto dto);
......
...@@ -10,12 +10,14 @@ import com.ruoyi.system.domain.grid.GridRegionUserExample; ...@@ -10,12 +10,14 @@ import com.ruoyi.system.domain.grid.GridRegionUserExample;
import com.ruoyi.system.domain.house.BusinessEntityInfo; import com.ruoyi.system.domain.house.BusinessEntityInfo;
import com.ruoyi.system.domain.house.BusinessEntitySell; import com.ruoyi.system.domain.house.BusinessEntitySell;
import com.ruoyi.system.domain.house.HouseResource; import com.ruoyi.system.domain.house.HouseResource;
import com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping;
import com.ruoyi.system.domain.house.enums.HouseEnums; import com.ruoyi.system.domain.house.enums.HouseEnums;
import com.ruoyi.system.domain.house.vo.*; import com.ruoyi.system.domain.house.vo.*;
import com.ruoyi.system.mapper.grid.GridRegionMapper; import com.ruoyi.system.mapper.grid.GridRegionMapper;
import com.ruoyi.system.mapper.grid.GridRegionUserMapper; import com.ruoyi.system.mapper.grid.GridRegionUserMapper;
import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper; import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper;
import com.ruoyi.system.mapper.house.BusinessEntitySellMapper; import com.ruoyi.system.mapper.house.BusinessEntitySellMapper;
import com.ruoyi.system.mapper.house.HouseResourceBusinessEntityInfoMappingMapper;
import com.ruoyi.system.mapper.house.HouseResourceMapper; import com.ruoyi.system.mapper.house.HouseResourceMapper;
import com.ruoyi.system.service.house.HouseResourceService; import com.ruoyi.system.service.house.HouseResourceService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -37,14 +39,17 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -37,14 +39,17 @@ public class HouseResourceServiceImpl implements HouseResourceService {
private final BusinessEntitySellMapper businessEntitySellMapper; private final BusinessEntitySellMapper businessEntitySellMapper;
private final HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper;
private final GridRegionMapper gridRegionMapper; private final GridRegionMapper gridRegionMapper;
private final GridRegionUserMapper gridRegionUserMapper; private final GridRegionUserMapper gridRegionUserMapper;
public HouseResourceServiceImpl(HouseResourceMapper houseResourceMapper, BusinessEntityInfoMapper businessEntityInfoMapper, BusinessEntitySellMapper businessEntitySellMapper, GridRegionMapper gridRegionMapper, GridRegionUserMapper gridRegionUserMapper) { public HouseResourceServiceImpl(HouseResourceMapper houseResourceMapper, BusinessEntityInfoMapper businessEntityInfoMapper, BusinessEntitySellMapper businessEntitySellMapper, HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper, GridRegionMapper gridRegionMapper, GridRegionUserMapper gridRegionUserMapper) {
this.houseResourceMapper = houseResourceMapper; this.houseResourceMapper = houseResourceMapper;
this.businessEntityInfoMapper = businessEntityInfoMapper; this.businessEntityInfoMapper = businessEntityInfoMapper;
this.businessEntitySellMapper = businessEntitySellMapper; this.businessEntitySellMapper = businessEntitySellMapper;
this.houseResourceBusinessEntityInfoMappingMapper = houseResourceBusinessEntityInfoMappingMapper;
this.gridRegionMapper = gridRegionMapper; this.gridRegionMapper = gridRegionMapper;
this.gridRegionUserMapper = gridRegionUserMapper; this.gridRegionUserMapper = gridRegionUserMapper;
} }
...@@ -68,19 +73,40 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -68,19 +73,40 @@ public class HouseResourceServiceImpl implements HouseResourceService {
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo); BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", ""); businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId); businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfo.setHouseResourceId(houseResourceId);
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo); businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
} }
HouseResourceBusinessEntityInfoMapping houseResourceBusinessEntityInfoMapping = new HouseResourceBusinessEntityInfoMapping();
houseResourceBusinessEntityInfoMapping.setId(UUID.randomUUID().toString().replaceAll("-", ""));
houseResourceBusinessEntityInfoMapping.setHouseResourceId(houseResourceId);
houseResourceBusinessEntityInfoMapping.setBusinessEntityInfoId(businessEntityInfoId);
houseResourceBusinessEntityInfoMappingMapper.insert(houseResourceBusinessEntityInfoMapping);
Map<Integer, List<BusinessEntitySell>> sellGroup = businessEntityDto.getBusinessEntitySells().stream().collect(Collectors.groupingBy(BusinessEntitySell::getYear));
for (Map.Entry<Integer, List<BusinessEntitySell>> entry : sellGroup.entrySet()) {
if (entry.getValue().size() > 1) {
throw new RuntimeException("年份 " + entry.getKey() + " 只能有一条销售数据");
}
}
for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) { for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", "")); if (StringUtils.hasText(businessEntitySell.getId())) {
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId); BusinessEntitySell existSell = businessEntitySellMapper.selectBusinessEntitySellById(businessEntitySell.getId());
businessEntitySellMapper.insertBusinessEntitySell(businessEntitySell); if (Objects.isNull(existSell)) {
throw new RuntimeException("未找到对应的销售记录: " + businessEntitySell.getId());
}
BeanUtils.copyProperties(businessEntitySell, existSell);
businessEntitySellMapper.updateBusinessEntitySell(existSell);
} else {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
businessEntitySellMapper.insertBusinessEntitySell(businessEntitySell);
}
} }
} }
} }
@Override @Override
public HouseResourceDetail queryHouseResourceById(String id) { public HouseResourceDetail detail(String id) {
HouseResource houseResource = houseResourceMapper.selectHouseResourceById(id); HouseResource houseResource = houseResourceMapper.selectHouseResourceById(id);
if (houseResource == null) { if (houseResource == null) {
return null; return null;
...@@ -132,26 +158,56 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -132,26 +158,56 @@ public class HouseResourceServiceImpl implements HouseResourceService {
throw new RuntimeException("房源id不能为空"); throw new RuntimeException("房源id不能为空");
} }
houseResourceMapper.updateHouseResource(dto.getHouseResource()); houseResourceMapper.updateHouseResource(dto.getHouseResource());
String houseResourceId = dto.getHouseResource().getId();
houseResourceBusinessEntityInfoMappingMapper.deleteByHouseResourceId(houseResourceId);
for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) { for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) {
String businessEntityInfoId; String businessEntityInfoId;
BusinessEntityInfo businessEntityInfo;
if (StringUtils.hasText(businessEntityDto.getId())) { if (StringUtils.hasText(businessEntityDto.getId())) {
businessEntityInfoId = businessEntityDto.getId(); businessEntityInfoId = businessEntityDto.getId();
BusinessEntityInfo existingInfo = businessEntityInfoMapper.selectBusinessEntityInfoById(businessEntityDto.getId()); businessEntityInfo = businessEntityInfoMapper.selectBusinessEntityInfoById(businessEntityInfoId);
BeanUtils.copyProperties(businessEntityDto, existingInfo); if (businessEntityInfo == null) {
businessEntityInfoMapper.updateBusinessEntityInfo(existingInfo); throw new RuntimeException("未找到对应的企业信息: " + businessEntityInfoId);
}
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
businessEntityInfoMapper.updateBusinessEntityInfo(businessEntityInfo);
} else { } else {
BusinessEntityInfo businessEntityInfo = new BusinessEntityInfo(); businessEntityInfo = new BusinessEntityInfo();
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo); BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", ""); businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId); businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfo.setHouseResourceId(dto.getHouseResource().getId());
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo); businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
} }
HouseResourceBusinessEntityInfoMapping mapping = new HouseResourceBusinessEntityInfoMapping();
mapping.setId(UUID.randomUUID().toString().replaceAll("-", ""));
mapping.setHouseResourceId(houseResourceId);
mapping.setBusinessEntityInfoId(businessEntityInfoId);
houseResourceBusinessEntityInfoMappingMapper.insert(mapping);
Map<Integer, List<BusinessEntitySell>> sellGroup = businessEntityDto.getBusinessEntitySells()
.stream().collect(Collectors.groupingBy(BusinessEntitySell::getYear));
for (Map.Entry<Integer, List<BusinessEntitySell>> entry : sellGroup.entrySet()) {
if (entry.getValue().size() > 1) {
throw new RuntimeException("年份 " + entry.getKey() + " 只能有一条销售数据");
}
}
for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) { for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", "")); if (StringUtils.hasText(businessEntitySell.getId())) {
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId); BusinessEntitySell existSell = businessEntitySellMapper.selectBusinessEntitySellById(businessEntitySell.getId());
businessEntitySellMapper.insertBusinessEntitySell(businessEntitySell); if (existSell == null) {
throw new RuntimeException("未找到对应的销售记录: " + businessEntitySell.getId());
}
BeanUtils.copyProperties(businessEntitySell, existSell);
businessEntitySellMapper.updateBusinessEntitySell(existSell);
} else {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
businessEntitySellMapper.insertBusinessEntitySell(businessEntitySell);
}
} }
} }
} }
...@@ -464,11 +520,12 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -464,11 +520,12 @@ public class HouseResourceServiceImpl implements HouseResourceService {
AssociationBusinessEntityHouseResourceDto associationBusinessEntityHouseResourceDto = new AssociationBusinessEntityHouseResourceDto(); AssociationBusinessEntityHouseResourceDto associationBusinessEntityHouseResourceDto = new AssociationBusinessEntityHouseResourceDto();
BeanUtils.copyProperties(x, associationBusinessEntityHouseResourceDto); BeanUtils.copyProperties(x, associationBusinessEntityHouseResourceDto);
if (StringUtils.hasText(x.getHouseResourceId())) { if (StringUtils.hasText(x.getHouseResourceId())) {
HouseResource houseResource = houseResourceMapper.selectHouseResourceById(x.getHouseResourceId()); List<HouseResourceBusinessEntityInfoMapping> houseResourceBusinessEntityInfoMappings = houseResourceBusinessEntityInfoMappingMapper.selectByBusinessEntityInfoId(x.getId());
HouseResourcePage houseResourcePage = new HouseResourcePage(); if (!CollectionUtils.isEmpty(houseResourceBusinessEntityInfoMappings)) {
BeanUtils.copyProperties(houseResource, houseResourcePage); List<HouseResourcePage> list = houseResourceMapper.selectByIdList(houseResourceBusinessEntityInfoMappings.stream().map(HouseResourceBusinessEntityInfoMapping::getHouseResourceId).collect(Collectors.toList()));
List<HouseResourcePage> list = handleHouseList(Collections.singletonList(houseResourcePage), false); List<HouseResourcePage> handleList = handleHouseList(list, false);
associationBusinessEntityHouseResourceDto.setHouseResource(list.get(0)); associationBusinessEntityHouseResourceDto.setHouseResources(handleList);
}
} }
List<BusinessEntitySell> businessEntitySells = businessEntitySellMapper.selectBusinessEntitySellByEntityId(x.getId()); List<BusinessEntitySell> businessEntitySells = businessEntitySellMapper.selectBusinessEntitySellByEntityId(x.getId());
if (!CollectionUtils.isEmpty(businessEntitySells)) { if (!CollectionUtils.isEmpty(businessEntitySells)) {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.house.HouseResourceBusinessEntityInfoMappingMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping">
<id property="houseResourceId" column="house_resource_id" jdbcType="VARCHAR"/>
<id property="businessEntityInfoId" column="business_entity_info_id" jdbcType="VARCHAR"/>
</resultMap>
<insert id="insert">
INSERT INTO house_resource_business_entity_info_mapping
(id, house_resource_id, business_entity_info_id)
VALUES
(#{id,jdbcType=VARCHAR}, #{houseResourceId,jdbcType=VARCHAR}, #{businessEntityInfoId,jdbcType=VARCHAR})
</insert>
<delete id="deleteByHouseResourceIdBusinessEntityInfoId">
DELETE FROM house_resource_business_entity_info_mapping
WHERE house_resource_id = #{houseResourceId,jdbcType=VARCHAR}
AND business_entity_info_id = #{businessEntityInfoId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByHouseResourceId">
DELETE FROM house_resource_business_entity_info_mapping
WHERE house_resource_id = #{houseResourceId,jdbcType=VARCHAR}
</delete>
<select id="selectByBusinessEntityInfoId"
resultType="com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping">
SELECT * FROM house_resource_business_entity_info_mapping WHERE business_entity_info_id = #{businessEntityInfoId,jdbcType=VARCHAR}
</select>
</mapper>
...@@ -125,17 +125,18 @@ ...@@ -125,17 +125,18 @@
SELECT SELECT
t2.wg_name AS wgName4, t2.wg_name AS wgName4,
t1.*, t1.*,
SUM(t4.year_sell) AS income, SUM(t5.year_sell) AS income,
t3.nature, t4.nature,
t3.industry_classification, t4.industry_classification,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice, ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t3.name, t4.name,
t4.year t5.year
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
...@@ -292,17 +293,18 @@ ...@@ -292,17 +293,18 @@
SELECT SELECT
t2.wg_name AS wgName4, t2.wg_name AS wgName4,
t1.*, t1.*,
SUM(t4.year_sell) AS income, SUM(t5.year_sell) AS income,
t3.nature, t4.nature,
t3.industry_classification, t4.industry_classification,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice, ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t3.name, t4.name,
t4.year t5.year
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
...@@ -456,14 +458,18 @@ ...@@ -456,14 +458,18 @@
SELECT SELECT
t2.wg_name AS wgName4, t2.wg_name AS wgName4,
t1.*, t1.*,
t4.year_sell, SUM(t5.year_sell) AS income,
t3.nature, t4.nature,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice t4.industry_classification,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t4.name,
t5.year
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
...@@ -629,26 +635,27 @@ ...@@ -629,26 +635,27 @@
t1.ownership, t1.ownership,
t1.house_resource_equity_tel, t1.house_resource_equity_tel,
t1.unit_price, t1.unit_price,
t3.nature, t4.nature,
t3.NAME, t4.NAME,
t3.principal_tel, t4.principal_tel,
t3.business, t4.business,
t3.worker_number, t4.worker_number,
t3.registration_place_flag, t4.registration_place_flag,
t3.registered_address, t4.registered_address,
t3.industry_classification, t4.industry_classification,
t3.gs, t4.gs,
t1.remark, t1.remark,
t3.name AS businessEntityInfoName, t4.name AS businessEntityInfoName,
t3.principal, t4.principal,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice, ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t1.house_resource_url, t1.house_resource_url,
t1.business_license_url t1.business_license_url
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
...@@ -778,8 +785,9 @@ ...@@ -778,8 +785,9 @@
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
GROUP BY t1.id, t3.id GROUP BY t1.id, t3.id
</select> </select>
<select id="selectForContrast" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage"> <select id="selectForContrast" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
...@@ -797,22 +805,30 @@ ...@@ -797,22 +805,30 @@
t1.ownership, t1.ownership,
t1.house_resource_equity_tel, t1.house_resource_equity_tel,
t1.unit_price, t1.unit_price,
t3.nature, t4.nature,
t3.NAME, t4.NAME,
t3.principal_tel, t4.principal_tel,
t3.business, t4.business,
t3.worker_number, t4.worker_number,
t3.registration_place_flag, t4.registration_place_flag,
t3.registered_address, t4.registered_address,
t3.industry_classification, t4.industry_classification,
t3.gs, t4.gs,
t1.remark, t1.remark,
t3.name AS businessEntityInfoName, t4.name AS businessEntityInfoName,
t3.principal t4.principal
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
WHERE t1.two = #{two} AND t3.NAME = #{name} WHERE t1.two = #{two} AND t3.NAME = #{name}
</select> </select>
<select id="selectByIdList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT * FROM house_resource WHERE id IN
<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>
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