This commit is contained in:
parent
873cf303c2
commit
6b1e9253af
@ -1,11 +1,11 @@
|
||||
package org.dromara.common.translation.core.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.dromara.common.core.service.DictService;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.translation.annotation.TranslationType;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.common.translation.core.TranslationInterface;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
/**
|
||||
* 字典翻译实现
|
||||
@ -20,7 +20,7 @@ public class DictTypeTranslationImpl implements TranslationInterface<String> {
|
||||
|
||||
@Override
|
||||
public String translation(Object key, String other) {
|
||||
if (key instanceof String && StringUtils.isNotBlank(other)) {
|
||||
if (key != null && StringUtils.isNotBlank(other)) {
|
||||
return dictService.getDictLabel(other, key.toString());
|
||||
}
|
||||
return null;
|
||||
|
@ -62,11 +62,11 @@ public class TbCommunityController extends BaseController {
|
||||
* @return 树结构数据
|
||||
*/
|
||||
@GetMapping("/tree/{level}")
|
||||
public List<TreeNode<Long>> tree(@PathVariable("level") Integer level) {
|
||||
public R<List<TreeNode<Long>>> tree(@PathVariable("level") Integer level) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
Assert.notNull(loginUser, "获取账户信息失败!");
|
||||
Assert.notEmpty(loginUser.getTenantId(), "获取租户信息失败");
|
||||
return tbCommunityService.tree(level, loginUser.getTenantId());
|
||||
return R.ok(tbCommunityService.tree(level, loginUser.getTenantId()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,9 +62,4 @@ public class SysCityArea implements Serializable {
|
||||
*/
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 数据状态:1有效,0无效
|
||||
*/
|
||||
private Long dataState;
|
||||
|
||||
}
|
||||
|
@ -32,28 +32,13 @@ public class TbBuilding extends TenantEntity {
|
||||
/**
|
||||
* 园区编码
|
||||
*/
|
||||
private String communityId;
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
private String buildingName;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 总层数
|
||||
*/
|
||||
|
@ -1,13 +1,13 @@
|
||||
package org.dromara.property.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 小区对象 tb_community
|
||||
@ -39,6 +39,10 @@ public class TbCommunity extends TenantEntity {
|
||||
*/
|
||||
private Integer communityType;
|
||||
|
||||
private String cityFullCode;
|
||||
|
||||
private String cityFullName;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
|
@ -27,6 +27,16 @@ public class TbFloor extends TenantEntity {
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 园区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑id
|
||||
*/
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
|
@ -1,9 +1,10 @@
|
||||
package org.dromara.property.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
@ -21,12 +22,25 @@ public class TbRoom extends TenantEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 园区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑id
|
||||
*/
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 所属楼层ID
|
||||
*/
|
||||
@ -50,7 +64,7 @@ public class TbRoom extends TenantEntity {
|
||||
/**
|
||||
* 户型(如2室1厅1卫)
|
||||
*/
|
||||
private Integer layout;
|
||||
private String layout;
|
||||
|
||||
/**
|
||||
* 朝向('东','南','西','北','东南','东北','西南','西北')
|
||||
|
@ -28,7 +28,12 @@ public class TbUnit extends TenantEntity {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
* 园区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑id
|
||||
*/
|
||||
private Long buildingId;
|
||||
|
||||
|
@ -70,11 +70,5 @@ public class SysCityAreaBo extends BaseEntity {
|
||||
@NotBlank(message = "维度不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 数据状态:1有效,0无效
|
||||
*/
|
||||
@NotNull(message = "数据状态:1有效,0无效不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long dataState;
|
||||
|
||||
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ public class TbBuildingBo extends BaseEntity {
|
||||
/**
|
||||
* 园区编码
|
||||
*/
|
||||
@NotBlank(message = "园区编码不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String communityId;
|
||||
@NotBlank(message = "园区id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
@ -41,24 +41,6 @@ public class TbBuildingBo extends BaseEntity {
|
||||
@NotBlank(message = "建筑名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String buildingName;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
@NotBlank(message = "省不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
@NotBlank(message = "市不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
@NotBlank(message = "区不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 总层数
|
||||
*/
|
||||
|
@ -1,15 +1,16 @@
|
||||
package org.dromara.property.domain.bo;
|
||||
|
||||
import org.dromara.property.domain.TbCommunity;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.property.domain.TbCommunity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 小区业务对象 tb_community
|
||||
@ -40,22 +41,24 @@ public class TbCommunityBo extends BaseEntity {
|
||||
@NotNull(message = "社区类型 1:园区,2:小区不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer communityType;
|
||||
|
||||
@NotBlank(message = "城市不能为null", groups = {AddGroup.class, EditGroup.class})
|
||||
private String cityFullCode;
|
||||
|
||||
private String cityFullName;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
@NotBlank(message = "省不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
@NotBlank(message = "市不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
@NotBlank(message = "区不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String district;
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ public class TbFloorBo extends BaseEntity {
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
@NotBlank(message = "单元编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "单元编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ public class TbRoomBo extends BaseEntity {
|
||||
/**
|
||||
* 所属楼层ID
|
||||
*/
|
||||
@NotBlank(message = "所属楼层ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "所属楼层ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long floorId;
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ public class TbUnitBo extends BaseEntity {
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
@NotBlank(message = "建筑名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "建筑名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ package org.dromara.property.domain.convert;
|
||||
|
||||
import org.dromara.property.domain.SysCityArea;
|
||||
import org.dromara.property.domain.vo.CityAreaTreeVo;
|
||||
import org.dromara.property.domain.vo.SysCityAreaVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingConstants;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
@ -21,4 +22,6 @@ public interface SysCityAreaCovert {
|
||||
|
||||
List<CityAreaTreeVo> entity2Vo(List<SysCityArea> cityAreas);
|
||||
|
||||
List<CityAreaTreeVo> vo2TreeVo(List<SysCityAreaVo> cityAreas);
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.core.domain.TreeEntity;
|
||||
import org.dromara.property.domain.SysCityArea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AutoMapper(target = SysCityArea.class)
|
||||
public class CityAreaTreeVo implements TreeEntity<CityAreaTreeVo, String> {
|
||||
|
||||
/**
|
||||
|
@ -77,11 +77,4 @@ public class SysCityAreaVo implements Serializable {
|
||||
@ExcelProperty(value = "维度")
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 数据状态:1有效,0无效
|
||||
*/
|
||||
@ExcelProperty(value = "数据状态:1有效,0无效")
|
||||
private Long dataState;
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,18 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.property.domain.TbBuilding;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.property.domain.TbBuilding;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 建筑视图对象 tb_building
|
||||
*
|
||||
@ -45,24 +42,6 @@ public class TbBuildingVo implements Serializable {
|
||||
@ExcelProperty(value = "建筑名称")
|
||||
private String buildingName;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
@ExcelProperty(value = "省")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
@ExcelProperty(value = "市")
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
@ExcelProperty(value = "区")
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 总层数
|
||||
*/
|
||||
@ -81,6 +60,9 @@ public class TbBuildingVo implements Serializable {
|
||||
@ExcelProperty(value = "建筑类型('1:住宅','2:商业','3:混合')")
|
||||
private Integer buildType;
|
||||
|
||||
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "buildType", other = "sis_build_use_type")
|
||||
private String buildTypeName;
|
||||
|
||||
/**
|
||||
* 电梯数量
|
||||
*/
|
||||
@ -111,12 +93,6 @@ public class TbBuildingVo implements Serializable {
|
||||
@ExcelProperty(value = "维度")
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 产权性质(1:自持,2:承租,3:自持+承租,4:政府免费使用)
|
||||
*/
|
||||
@ExcelProperty(value = "产权性质(1:自持,2:承租,3:自持+承租,4:政府免费使用)")
|
||||
private Integer cqxz;
|
||||
|
||||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
|
@ -1,21 +1,16 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.property.domain.TbCommunity;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.property.domain.TbCommunity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小区视图对象 tb_community
|
||||
*
|
||||
@ -48,6 +43,10 @@ public class TbCommunityVo implements Serializable {
|
||||
@ExcelProperty(value = "社区类型 1:园区,2:小区")
|
||||
private Long communityType;
|
||||
|
||||
private String cityFullCode;
|
||||
|
||||
private String cityFullName;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
|
@ -34,6 +34,17 @@ public class TbFloorVo implements Serializable {
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
@ExcelProperty(value = "建筑名称")
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
|
@ -1,17 +1,17 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
|
||||
import org.dromara.property.domain.TbRoom;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.property.domain.TbRoom;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -34,6 +34,23 @@ public class TbRoomVo implements Serializable {
|
||||
@ExcelProperty(value = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
@ExcelProperty(value = "建筑名称")
|
||||
private Long buildingId;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
@ExcelProperty(value = "单元编码")
|
||||
private Long unitId;
|
||||
|
||||
/**
|
||||
* 所属楼层ID
|
||||
*/
|
||||
@ -52,6 +69,9 @@ public class TbRoomVo implements Serializable {
|
||||
@ExcelProperty(value = "房间类型('住宅','商铺','办公室','设备间','公共区域')")
|
||||
private Integer roomType;
|
||||
|
||||
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "roomType", other = "room_type")
|
||||
private String roomTypeName;
|
||||
|
||||
/**
|
||||
* 面积(平方米)
|
||||
*/
|
||||
@ -67,9 +87,13 @@ public class TbRoomVo implements Serializable {
|
||||
/**
|
||||
* 朝向('东','南','西','北','东南','东北','西南','西北')
|
||||
*/
|
||||
|
||||
@ExcelProperty(value = "朝向('东','南','西','北','东南','东北','西南','西北')")
|
||||
private Integer orientation;
|
||||
|
||||
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "orientation", other = "direction_towards")
|
||||
private Integer orientationName;
|
||||
|
||||
/**
|
||||
* 是否可售
|
||||
*/
|
||||
@ -83,5 +107,7 @@ public class TbRoomVo implements Serializable {
|
||||
@ExcelDictFormat(readConverterExp = "'=空置','已售','已租','自用'")
|
||||
private Integer status;
|
||||
|
||||
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "status", other = "wy_fjzt")
|
||||
private String statusName;
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ public class TbUnitVo implements Serializable {
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
|
@ -1,16 +1,23 @@
|
||||
package org.dromara.property.mapper;
|
||||
|
||||
import org.dromara.property.domain.SysCityArea;
|
||||
import org.dromara.property.domain.vo.SysCityAreaVo;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.property.domain.SysCityArea;
|
||||
import org.dromara.property.domain.vo.CityAreaTreeVo;
|
||||
import org.dromara.property.domain.vo.SysCityAreaVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 行政区划
|
||||
Mapper接口
|
||||
* Mapper接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-06-18
|
||||
*/
|
||||
public interface SysCityAreaMapper extends BaseMapperPlus<SysCityArea, SysCityAreaVo> {
|
||||
|
||||
@Select("select * from sys_city_area")
|
||||
List<CityAreaTreeVo> seleAll();
|
||||
|
||||
}
|
||||
|
@ -80,6 +80,6 @@ public interface ITbCommunityService {
|
||||
* @param level 加载等级
|
||||
* @return 树结构
|
||||
*/
|
||||
List<TreeNode<String>> tree(Integer level,String tenantId);
|
||||
List<TreeNode<Long>> tree(Integer level,String tenantId);
|
||||
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ public class SysCityAreaServiceImpl implements ISysCityAreaService {
|
||||
lqw.like(StringUtils.isNotBlank(bo.getParentAreaName()), SysCityArea::getParentAreaName, bo.getParentAreaName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLon()), SysCityArea::getLon, bo.getLon());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLat()), SysCityArea::getLat, bo.getLat());
|
||||
lqw.eq(bo.getDataState() != null, SysCityArea::getDataState, bo.getDataState());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@ -150,12 +149,7 @@ public class SysCityAreaServiceImpl implements ISysCityAreaService {
|
||||
|
||||
@Override
|
||||
public List<CityAreaTreeVo> queryTreeList() {
|
||||
// 查询所有的行政区划数据
|
||||
List<SysCityArea> cityAreas = baseMapper.selectList(null);
|
||||
if (CollectionUtil.isEmpty(cityAreas)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<CityAreaTreeVo> vo = SysCityAreaCovert.INSTANCE.entity2Vo(cityAreas);
|
||||
List<CityAreaTreeVo> vo = baseMapper.seleAll();
|
||||
return TreeUtils.build(vo, "0");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -12,7 +13,9 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.domain.TbBuilding;
|
||||
import org.dromara.property.domain.bo.TbBuildingBo;
|
||||
import org.dromara.property.domain.vo.TbBuildingVo;
|
||||
import org.dromara.property.domain.vo.TbCommunityVo;
|
||||
import org.dromara.property.mapper.TbBuildingMapper;
|
||||
import org.dromara.property.mapper.TbCommunityMapper;
|
||||
import org.dromara.property.service.ITbBuildingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -32,6 +35,7 @@ import java.util.Map;
|
||||
public class TbBuildingServiceImpl implements ITbBuildingService {
|
||||
|
||||
private final TbBuildingMapper baseMapper;
|
||||
private final TbCommunityMapper communityMapper;
|
||||
|
||||
/**
|
||||
* 查询建筑
|
||||
@ -76,9 +80,6 @@ public class TbBuildingServiceImpl implements ITbBuildingService {
|
||||
lqw.orderByAsc(TbBuilding::getId);
|
||||
lqw.eq(bo.getCommunityId() != null, TbBuilding::getCommunityId, bo.getCommunityId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getBuildingName()), TbBuilding::getBuildingName, bo.getBuildingName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getProvince()), TbBuilding::getProvince, bo.getProvince());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCity()), TbBuilding::getCity, bo.getCity());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDistrict()), TbBuilding::getDistrict, bo.getDistrict());
|
||||
lqw.eq(bo.getFloorCount() != null, TbBuilding::getFloorCount, bo.getFloorCount());
|
||||
lqw.eq(bo.getUnitCount() != null, TbBuilding::getUnitCount, bo.getUnitCount());
|
||||
lqw.eq(bo.getBuildType() != null, TbBuilding::getBuildType, bo.getBuildType());
|
||||
@ -99,6 +100,9 @@ public class TbBuildingServiceImpl implements ITbBuildingService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TbBuildingBo bo) {
|
||||
// 检验社区是否存在
|
||||
TbCommunityVo tbCommunityVo = communityMapper.selectVoById(bo.getCommunityId());
|
||||
Assert.notNull(tbCommunityVo, "社区:{},不存在。", bo.getCommunityId());
|
||||
TbBuilding add = MapstructUtils.convert(bo, TbBuilding.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -196,6 +198,12 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TbCommunityBo bo) {
|
||||
// 处理cityFullCode
|
||||
String[] split = bo.getCityFullCode().split("/");
|
||||
Assert.isTrue(split.length == 3, "获取城市信息失败");
|
||||
bo.setProvince(split[0]);
|
||||
bo.setCity(split[1]);
|
||||
bo.setDistrict(split[2]);
|
||||
TbCommunity add = MapstructUtils.convert(bo, TbCommunity.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
@ -213,6 +221,11 @@ public class TbCommunityServiceImpl implements ITbCommunityService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(TbCommunityBo bo) {
|
||||
String[] split = bo.getCityFullCode().split("/");
|
||||
Assert.isTrue(split.length == 3, "获取城市信息失败");
|
||||
bo.setProvince(split[0]);
|
||||
bo.setCity(split[1]);
|
||||
bo.setDistrict(split[2]);
|
||||
TbCommunity update = MapstructUtils.convert(bo, TbCommunity.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -12,8 +13,10 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.domain.TbFloor;
|
||||
import org.dromara.property.domain.bo.TbFloorBo;
|
||||
import org.dromara.property.domain.vo.TbFloorVo;
|
||||
import org.dromara.property.domain.vo.TbUnitVo;
|
||||
import org.dromara.property.mapper.TbFloorMapper;
|
||||
import org.dromara.property.service.ITbFloorService;
|
||||
import org.dromara.property.service.ITbUnitService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -32,6 +35,7 @@ import java.util.Map;
|
||||
public class TbFloorServiceImpl implements ITbFloorService {
|
||||
|
||||
private final TbFloorMapper baseMapper;
|
||||
private final ITbUnitService tbUnitService;
|
||||
|
||||
/**
|
||||
* 查询楼层
|
||||
@ -91,7 +95,12 @@ public class TbFloorServiceImpl implements ITbFloorService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TbFloorBo bo) {
|
||||
// 验证单元是否存在
|
||||
TbUnitVo tbUnitVo = tbUnitService.queryById(bo.getUnitId());
|
||||
Assert.notNull(tbUnitVo, "单元:{},不存在。", bo.getUnitId());
|
||||
TbFloor add = MapstructUtils.convert(bo, TbFloor.class);
|
||||
add.setCommunityId(tbUnitVo.getCommunityId());
|
||||
add.setBuildingId(tbUnitVo.getBuildingId());
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -11,8 +12,10 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.domain.TbRoom;
|
||||
import org.dromara.property.domain.bo.TbRoomBo;
|
||||
import org.dromara.property.domain.vo.TbFloorVo;
|
||||
import org.dromara.property.domain.vo.TbRoomVo;
|
||||
import org.dromara.property.mapper.TbRoomMapper;
|
||||
import org.dromara.property.service.ITbFloorService;
|
||||
import org.dromara.property.service.ITbRoomService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -32,6 +35,7 @@ import java.util.Map;
|
||||
public class TbRoomServiceImpl implements ITbRoomService {
|
||||
|
||||
private final TbRoomMapper baseMapper;
|
||||
private final ITbFloorService tbFloorService;
|
||||
|
||||
/**
|
||||
* 查询房间信息
|
||||
@ -93,8 +97,12 @@ public class TbRoomServiceImpl implements ITbRoomService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TbRoomBo bo) {
|
||||
TbFloorVo tbFloorVo = tbFloorService.queryById(bo.getFloorId());
|
||||
Assert.notNull(tbFloorVo, "楼层:{},不存在。", bo.getFloorId());
|
||||
TbRoom add = MapstructUtils.convert(bo, TbRoom.class);
|
||||
validEntityBeforeSave(add);
|
||||
add.setCommunityId(tbFloorVo.getCommunityId());
|
||||
add.setBuildingId(tbFloorVo.getBuildingId());
|
||||
add.setUnitId(tbFloorVo.getUnitId());
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -11,8 +12,10 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.property.domain.TbUnit;
|
||||
import org.dromara.property.domain.bo.TbUnitBo;
|
||||
import org.dromara.property.domain.vo.TbBuildingVo;
|
||||
import org.dromara.property.domain.vo.TbUnitVo;
|
||||
import org.dromara.property.mapper.TbUnitMapper;
|
||||
import org.dromara.property.service.ITbBuildingService;
|
||||
import org.dromara.property.service.ITbUnitService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -32,6 +35,7 @@ import java.util.Map;
|
||||
public class TbUnitServiceImpl implements ITbUnitService {
|
||||
|
||||
private final TbUnitMapper baseMapper;
|
||||
private final ITbBuildingService buildingService;
|
||||
|
||||
/**
|
||||
* 查询单元
|
||||
@ -90,7 +94,11 @@ public class TbUnitServiceImpl implements ITbUnitService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(TbUnitBo bo) {
|
||||
// 检验建筑是否存在
|
||||
TbBuildingVo tbBuildingVo = buildingService.queryById(bo.getBuildingId());
|
||||
Assert.notNull(tbBuildingVo, "建筑:{},不存在。", bo.getBuildingId());
|
||||
TbUnit add = MapstructUtils.convert(bo, TbUnit.class);
|
||||
add.setCommunityId(tbBuildingVo.getCommunityId());
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
|
Loading…
Reference in New Issue
Block a user