Browse Source

1.0.0 修改楼盘接口

feature/v1.0.0
peihao 4 years ago
parent
commit
57f5ce64e2
  1. 5
      air/src/main/java/com/air/housing/controller/HousingEstatesController.java
  2. 43
      air/src/main/java/com/air/housing/dto/HousingEstatesListDto.java
  3. 29
      air/src/main/java/com/air/housing/dto/HousingEstatesQuery.java
  4. 54
      air/src/main/java/com/air/housing/entity/AnnoBlocksRel.java
  5. 4
      air/src/main/java/com/air/housing/entity/Blocks.java
  6. 9
      air/src/main/java/com/air/housing/entity/HousingEstates.java
  7. 13
      air/src/main/java/com/air/housing/mapper/AnnoBlocksRelMapper.java
  8. 6
      air/src/main/java/com/air/housing/mapper/HousingEstatesMapper.java
  9. 14
      air/src/main/java/com/air/housing/service/AnnoBlocksRelService.java
  10. 7
      air/src/main/java/com/air/housing/service/HousingEstatesService.java
  11. 18
      air/src/main/java/com/air/housing/service/impl/AnnoBlocksRelServiceImpl.java
  12. 35
      air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java
  13. 31
      air/src/main/java/com/air/housing/vo/HousingEstatesListVO.java
  14. 15
      air/src/main/resources/mapper/BlocksMapper.xml
  15. 36
      air/src/main/resources/mapper/HousingEstatesMapper.xml

5
air/src/main/java/com/air/housing/controller/HousingEstatesController.java

@ -30,7 +30,6 @@ public class HousingEstatesController {
private final HousingEstatesService housingEstatesService; private final HousingEstatesService housingEstatesService;
/** /**
* 分页查询 * 分页查询
* *
@ -65,8 +64,8 @@ public class HousingEstatesController {
*/ */
@ApiOperation(value = "通过id查询详情", notes = "通过id查询详情") @ApiOperation(value = "通过id查询详情", notes = "通过id查询详情")
@GetMapping("/{housingEstateId}") @GetMapping("/{housingEstateId}")
public R getById(@PathVariable("housingEstateId") Long housingEstateId,Long blockId) { public R getById(@PathVariable("housingEstateId") Long housingEstateId) {
HousingEstatesDetail housingEstates = housingEstatesService.getHousingEstatesDetail(housingEstateId,blockId); HousingEstatesDetail housingEstates = housingEstatesService.getHousingEstatesDetail(housingEstateId);
return R.ok(housingEstates); return R.ok(housingEstates);
} }

43
air/src/main/java/com/air/housing/dto/HousingEstatesListDto.java

@ -0,0 +1,43 @@
package com.air.housing.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 楼盘列表返回参数
*
* @author peihao
* @date 2021/7/13
**/
@Data
@ApiModel
public class HousingEstatesListDto {
@ApiModelProperty(value = "楼盘id")
private Long housingEstateId;
@ApiModelProperty(value = "楼盘名称")
private String name;
@ApiModelProperty(value = "公告编号")
private String landCode;
@ApiModelProperty(value = "行政区")
private String canton;
@ApiModelProperty(value = "大组团")
private String bigGroup;
@ApiModelProperty(value = "小组团")
private String smallGroup;
@ApiModelProperty(value = "操盘企业")
private String tradingEnterprises;
@ApiModelProperty(value = "合作方")
private String partner;
@ApiModelProperty(value = "经营企业")
private String conductEnterprise;
}

29
air/src/main/java/com/air/housing/dto/HousingEstatesQuery.java

@ -1,37 +1,36 @@
package com.air.housing.dto; package com.air.housing.dto;
import com.air.housing.entity.HousingEstates;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/** /**
* @author zeb. * 楼盘查询条件
* Created by zeb on 2021/6/9. * @author peihao
*/ * @date 2021/7/13
**/
@Data @Data
@EqualsAndHashCode @EqualsAndHashCode
@ApiModel @ApiModel(value = "楼盘查询条件")
public class HousingEstatesQuery { public class HousingEstatesQuery {
@ApiModelProperty(value = "公告编号") @ApiModelProperty(value = "公告编号")
private String annoId; private String landCode;
@ApiModelProperty(value = "楼盘名称") @ApiModelProperty(value = "楼盘名称")
private String name; private String name;
@ApiModelProperty(value = "业态")
private String format;
@ApiModelProperty(value = "区域") @ApiModelProperty(value = "区域")
private String area; private String canton;
@ApiModelProperty(value = "大组团") @ApiModelProperty(value = "大组团")
private String bigGroup; private String bigGroup;
@ApiModelProperty(value = "小组团") @ApiModelProperty(value = "小组团")
private String smallGroup; private String smallGroup;
@ApiModelProperty(value = "日期,格式yyyy-MM-dd")
private String createDate;
@ApiModelProperty(value = "开发企业") @ApiModelProperty(value = "开发企业")
private String program; private String conductEnterprise;
} }

54
air/src/main/java/com/air/housing/entity/AnnoBlocksRel.java

@ -0,0 +1,54 @@
package com.air.housing.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 地块楼盘关联表
*
* @author peihao
* @date 2021/5/18
**/
@Data
@TableName("anno_blocks_rel")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "地块楼盘关联表")
public class AnnoBlocksRel extends Model<AnnoBlocksRel> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "楼盘id")
private Long housingEstatesId;
@ApiModelProperty(value = "地块id")
private String landListedId;
@ApiModelProperty(value = "是否主要地块(0:否,1:是)")
private Integer mainLand;
@ApiModelProperty(value = "状态")
private String statusCd;
@ApiModelProperty(value = "状态时间")
private LocalDateTime statusDate;
@ApiModelProperty(value = "创建人")
private String createUserId;
@ApiModelProperty(value = "创建时间")
private LocalDateTime createDate;
@ApiModelProperty(value = "修改人")
private String updateUserId;
@ApiModelProperty(value = "修改时间")
private LocalDateTime updateDate;
@ApiModelProperty(value = "备注")
private String remark;
}

4
air/src/main/java/com/air/housing/entity/Blocks.java

@ -43,10 +43,10 @@ public class Blocks extends Model<Blocks> {
@ApiModelProperty(value = "物业类型") @ApiModelProperty(value = "物业类型")
private String propertyType; private String propertyType;
@ApiModelProperty(value = "物业类型") @ApiModelProperty(value = "大业态")
private String largeFormat; private String largeFormat;
@ApiModelProperty(value = "物业类型") @ApiModelProperty(value = "小业态")
@TableField(value = "`format`") @TableField(value = "`format`")
private String format; private String format;

9
air/src/main/java/com/air/housing/entity/HousingEstates.java

@ -28,12 +28,6 @@ public class HousingEstates extends Model<HousingEstates> {
@ApiModelProperty(value = "楼盘id") @ApiModelProperty(value = "楼盘id")
private Long housingEstateId; private Long housingEstateId;
@ApiModelProperty(value = "公告id")
private String annoId;
@ApiModelProperty(value = "公告id")
private String otherAnnoIds;
@ApiModelProperty(value = "楼盘名称") @ApiModelProperty(value = "楼盘名称")
private String name; private String name;
@ -55,9 +49,6 @@ public class HousingEstates extends Model<HousingEstates> {
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private LocalDateTime updateDate; private LocalDateTime updateDate;
// @ApiModelProperty(value = "已挂牌地块id")
// private Long landListedId;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;

13
air/src/main/java/com/air/housing/mapper/AnnoBlocksRelMapper.java

@ -0,0 +1,13 @@
package com.air.housing.mapper;
import com.air.housing.entity.AnnoBlocksRel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 地块楼盘关联表
*
* @author peihao
* @date 2021-05-18 09:39:45
*/
public interface AnnoBlocksRelMapper extends BaseMapper<AnnoBlocksRel> {
}

6
air/src/main/java/com/air/housing/mapper/HousingEstatesMapper.java

@ -2,13 +2,11 @@ package com.air.housing.mapper;
import com.air.housing.dto.HousingEstatesQuery; import com.air.housing.dto.HousingEstatesQuery;
import com.air.housing.entity.HousingEstates; import com.air.housing.entity.HousingEstates;
import com.air.housing.vo.HousingEstatesListVO; import com.air.housing.dto.HousingEstatesListDto;
import com.air.housing.vo.HousingEstatesName; import com.air.housing.vo.HousingEstatesName;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cinderella.framework.common.data.mybatis.QueryPage;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -33,5 +31,5 @@ public interface HousingEstatesMapper extends BaseMapper<HousingEstates> {
* @return * @return
*/ */
@InterceptorIgnore @InterceptorIgnore
IPage<HousingEstatesListVO> selectIPage(IPage<HousingEstatesListVO> page, @Param("query") HousingEstatesQuery query); IPage<HousingEstatesListDto> selectIPage(IPage<HousingEstatesListDto> page, @Param("query") HousingEstatesQuery query);
} }

14
air/src/main/java/com/air/housing/service/AnnoBlocksRelService.java

@ -0,0 +1,14 @@
package com.air.housing.service;
import com.air.housing.entity.AnnoBlocksRel;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 地块楼盘关联表
*
* @author peihao
* @date 2021-05-18 09:39:45
*/
public interface AnnoBlocksRelService extends IService<AnnoBlocksRel> {
}

7
air/src/main/java/com/air/housing/service/HousingEstatesService.java

@ -4,7 +4,7 @@ import com.air.housing.dto.HousingDefine;
import com.air.housing.dto.HousingEstatesQuery; import com.air.housing.dto.HousingEstatesQuery;
import com.air.housing.entity.HousingEstates; import com.air.housing.entity.HousingEstates;
import com.air.housing.vo.HousingEstatesDetail; import com.air.housing.vo.HousingEstatesDetail;
import com.air.housing.vo.HousingEstatesListVO; import com.air.housing.dto.HousingEstatesListDto;
import com.air.housing.vo.HousingEstatesName; import com.air.housing.vo.HousingEstatesName;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -39,10 +39,9 @@ public interface HousingEstatesService extends IService<HousingEstates> {
/** /**
* 根据楼盘id查询楼盘信息和相关的地块信息如果楼栋个id不为空再查询业态信息 * 根据楼盘id查询楼盘信息和相关的地块信息如果楼栋个id不为空再查询业态信息
* @param housingEstateId * @param housingEstateId
* @param blockId
* @return * @return
*/ */
HousingEstatesDetail getHousingEstatesDetail(Long housingEstateId,Long blockId); HousingEstatesDetail getHousingEstatesDetail(Long housingEstateId);
/** /**
* 分页 * 分页
@ -50,5 +49,5 @@ public interface HousingEstatesService extends IService<HousingEstates> {
* @param query * @param query
* @return * @return
*/ */
IPage<HousingEstatesListVO> page(QueryPage page, HousingEstatesQuery query); IPage<HousingEstatesListDto> page(QueryPage page, HousingEstatesQuery query);
} }

18
air/src/main/java/com/air/housing/service/impl/AnnoBlocksRelServiceImpl.java

@ -0,0 +1,18 @@
package com.air.housing.service.impl;
import com.air.housing.entity.AnnoBlocksRel;
import com.air.housing.mapper.AnnoBlocksRelMapper;
import com.air.housing.service.AnnoBlocksRelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* 地块楼盘关联表
*
* @author peihao
* @date 2021-05-18 09:39:45
*/
@Service
public class AnnoBlocksRelServiceImpl extends ServiceImpl<AnnoBlocksRelMapper, AnnoBlocksRel> implements AnnoBlocksRelService {
}

35
air/src/main/java/com/air/housing/service/impl/HousingEstatesServiceImpl.java

@ -4,18 +4,16 @@ import cn.hutool.core.util.ObjectUtil;
import com.air.common.Constant; import com.air.common.Constant;
import com.air.enums.BlocksOriginStatusEnum; import com.air.enums.BlocksOriginStatusEnum;
import com.air.housing.dto.HousingDefine; import com.air.housing.dto.HousingDefine;
import com.air.housing.dto.HousingEstatesListDto;
import com.air.housing.dto.HousingEstatesQuery; import com.air.housing.dto.HousingEstatesQuery;
import com.air.housing.entity.Blocks; import com.air.housing.entity.*;
import com.air.housing.entity.Format; import com.air.housing.mapper.AnnoBlocksRelMapper;
import com.air.housing.entity.Houses;
import com.air.housing.entity.HousingEstates;
import com.air.housing.mapper.HousingEstatesMapper; import com.air.housing.mapper.HousingEstatesMapper;
import com.air.housing.service.BlocksService; import com.air.housing.service.BlocksService;
import com.air.housing.service.FormatService; import com.air.housing.service.FormatService;
import com.air.housing.service.HousesService; import com.air.housing.service.HousesService;
import com.air.housing.service.HousingEstatesService; import com.air.housing.service.HousingEstatesService;
import com.air.housing.vo.HousingEstatesDetail; import com.air.housing.vo.HousingEstatesDetail;
import com.air.housing.vo.HousingEstatesListVO;
import com.air.housing.vo.HousingEstatesName; import com.air.housing.vo.HousingEstatesName;
import com.air.land.entity.LandListed; import com.air.land.entity.LandListed;
import com.air.land.mapper.LandListedMapper; import com.air.land.mapper.LandListedMapper;
@ -57,13 +55,14 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
@Autowired @Autowired
private HousingEstatesMapper housingEstatesMapper; private HousingEstatesMapper housingEstatesMapper;
@Autowired @Autowired
private AnnoBlocksRelMapper annoBlocksRelMapper;
@Autowired
private LandListedMapper landListedMapper; private LandListedMapper landListedMapper;
@Autowired @Autowired
private FormatService formatService; private FormatService formatService;
@Override @Override
public IPage<HousingEstatesName> getHousingEstatesNamePage(IPage<HousingEstatesName> page, String name) { public IPage<HousingEstatesName> getHousingEstatesNamePage(IPage<HousingEstatesName> page, String name) {
return housingEstatesMapper.getHousingEstatesNamePage(page, name); return housingEstatesMapper.getHousingEstatesNamePage(page, name);
} }
@ -73,7 +72,7 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
if (housingDefine.getHousingEstateId() == null) { if (housingDefine.getHousingEstateId() == null) {
HousingEstates housingEstates = new HousingEstates(); HousingEstates housingEstates = new HousingEstates();
housingEstates.setName(housingDefine.getName()); housingEstates.setName(housingDefine.getName());
housingEstates.setAnnoId(housingDefine.getAnnoId()); // housingEstates.setAnnoId(housingDefine.getAnnoId());
housingEstates.setStatusCd(Constant.COMMON_STATUS_1000); housingEstates.setStatusCd(Constant.COMMON_STATUS_1000);
save(housingEstates); save(housingEstates);
housingDefine.setHousingEstateId(housingEstates.getHousingEstateId()); housingDefine.setHousingEstateId(housingEstates.getHousingEstateId());
@ -106,21 +105,27 @@ public class HousingEstatesServiceImpl extends ServiceImpl<HousingEstatesMapper,
} }
@Override @Override
public HousingEstatesDetail getHousingEstatesDetail(Long housingEstateId, Long blockId) { public HousingEstatesDetail getHousingEstatesDetail(Long housingEstateId) {
HousingEstates housingEstates = baseMapper.selectById(housingEstateId);
LandListed landListed = landListedMapper.selectOne(Wrappers.<LandListed>lambdaQuery().eq(LandListed::getAnnoId,housingEstates.getAnnoId()));
HousingEstatesDetail detail = new HousingEstatesDetail(); HousingEstatesDetail detail = new HousingEstatesDetail();
HousingEstates housingEstates = baseMapper.selectById(housingEstateId);
if (null == housingEstates) {
return detail;
}
detail.setHousingEstates(housingEstates); detail.setHousingEstates(housingEstates);
detail.setLandListed(landListed); AnnoBlocksRel annoBlocksRel = annoBlocksRelMapper.selectOne(Wrappers.<AnnoBlocksRel>query().lambda()
if(ObjectUtil.isNotNull(blockId)){ .eq(AnnoBlocksRel::getHousingEstatesId, housingEstateId).eq(AnnoBlocksRel::getMainLand, 1));
Format format = formatService.getOne(Wrappers.<Format>lambdaQuery().eq(Format::getHousingEstateId,housingEstateId)); if (null != annoBlocksRel) {
detail.setFormat(format); LandListed landListed = landListedMapper.selectOne(Wrappers.<LandListed>lambdaQuery()
.eq(LandListed::getLandListedId, annoBlocksRel.getLandListedId()));
detail.setLandListed(landListed);
} }
Format format = formatService.getOne(Wrappers.<Format>lambdaQuery().eq(Format::getHousingEstateId, housingEstateId));
detail.setFormat(format);
return detail; return detail;
} }
@Override @Override
public IPage<HousingEstatesListVO> page(QueryPage page, HousingEstatesQuery query) { public IPage<HousingEstatesListDto> page(QueryPage page, HousingEstatesQuery query) {
return baseMapper.selectIPage(page.toPage(), query); return baseMapper.selectIPage(page.toPage(), query);
} }

31
air/src/main/java/com/air/housing/vo/HousingEstatesListVO.java

@ -1,31 +0,0 @@
package com.air.housing.vo;
import com.air.housing.entity.HousingEstates;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* @author zeb.
* Created by zeb on 2021/6/9.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel
public class HousingEstatesListVO extends HousingEstates {
@ApiModelProperty(value = "其他编号")
private String otherNo;
@ApiModelProperty(value = "大组团")
private String bigGroup;
@ApiModelProperty(value = "小组团")
private String smallGroup;
@ApiModelProperty(value = "日期,格式yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDateTime createDate;
}

15
air/src/main/resources/mapper/BlocksMapper.xml

@ -3,12 +3,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.air.housing.mapper.BlocksMapper"> <mapper namespace="com.air.housing.mapper.BlocksMapper">
<sql id="base_block_column">
b.block_id,b.housing_estate_id,b.pre_sale_permit_no,b.block_name,b.status_cd,b.status_date,b.create_user_id,b.create_date,b.update_user_id,b.update_date,b.remark
</sql>
<select id="getBlocksPageByhousingEstateId" parameterType="com.air.housing.dto.BlockListDto" resultType="com.air.housing.entity.Blocks"> <select id="getBlocksPageByhousingEstateId" parameterType="com.air.housing.dto.BlockListDto" resultType="com.air.housing.entity.Blocks">
select <include refid="base_block_column"/> select
b.block_id,
b.housing_estate_id,
b.pre_sale_permit_no,
b.block_name,
b.property_type,
b.large_format,
b.`format`,
b.status_cd,
b.remark
from blocks b from blocks b
<choose> <choose>
<when test="Blocks.largeFormat !=null and Blocks.format == null"> <when test="Blocks.largeFormat !=null and Blocks.format == null">

36
air/src/main/resources/mapper/HousingEstatesMapper.xml

@ -14,28 +14,32 @@
</where> </where>
</select> </select>
<select id="selectIPage" resultType="com.air.housing.vo.HousingEstatesListVO"> <select id="selectIPage" resultType="com.air.housing.dto.HousingEstatesListDto">
select h.housing_estate_id, select h.housing_estate_id,
h.anno_id, l.land_code,
h.other_anno_ids,
h.`name`, h.`name`,
h.status_cd, l.canton,
h.status_date, l.trading_enterprises,
h.create_user_id, l.partner,
h.create_date, l.conduct_enterprise,
h.update_user_id,
h.update_date,
h.remark,
l.big_group, l.big_group,
l.small_group l.small_group
from housing_estates h FROM
join land_listed l on h.anno_id = l.anno_id housing_estates h
JOIN anno_blocks_rel an ON h.housing_estate_id = an.housing_estates_id and an.main_land = 1
JOIN land_listed l on l.land_listed_id = an.land_listed_id
<where> <where>
<if test="query.name != null and query.name != ''"> <if test="query.name != null and query.name != ''">
and h.name like concat('%', #{query.name}, '%') and h.name like concat('%', #{query.name}, '%')
</if> </if>
<if test="query.annoId != null and query.annoId != ''"> <if test="query.landCode != null and query.landCode != ''">
and h.anno_id like concat('%', #{query.annoId}, '%') and l.land_code like concat('%', #{query.landCode}, '%')
</if>
<if test="query.canton != null and query.canton != ''">
and l.canton = #{query.canton}
</if>
<if test="query.conductEnterprise != null and query.conductEnterprise != ''">
and l.conductEnterprise like concat('%', #{query.conductEnterprise}, '%')
</if> </if>
<if test="query.bigGroup != null and query.bigGroup != ''"> <if test="query.bigGroup != null and query.bigGroup != ''">
and l.big_group = #{query.bigGroup} and l.big_group = #{query.bigGroup}
@ -43,9 +47,7 @@
<if test="query.smallGroup != null and query.smallGroup != ''"> <if test="query.smallGroup != null and query.smallGroup != ''">
and l.small_group = #{query.smallGroup} and l.small_group = #{query.smallGroup}
</if> </if>
<if test="query.createDate != null and query.createDate != ''">
and h.create_date like concat(#{query.createDate}, '%')
</if>
</where> </where>
order by h.housing_estate_id desc order by h.housing_estate_id desc
</select> </select>

Loading…
Cancel
Save