|
@@ -1104,15 +1104,18 @@ public class BuildingServiceImpl implements BuildingService {
|
|
|
throw new ServiceException(-900, "建筑名称已经存在");
|
|
|
}
|
|
|
Community community = communityMapper.findById(building.getCommunity());
|
|
|
- if(building.getProvince() == null || building.getProvince() == 0){
|
|
|
- building.setProvince(community.getProvince());
|
|
|
- }
|
|
|
- if(building.getCity() == null || building.getCity() == 0){
|
|
|
- building.setCity(community.getCity());
|
|
|
- }
|
|
|
- if(building.getRegion() == null || building.getRegion() == 0){
|
|
|
- building.setRegion(community.getRegion());
|
|
|
+ if (community != null) {
|
|
|
+ if(building.getProvince() == null || building.getProvince() == 0){
|
|
|
+ building.setProvince(community.getProvince());
|
|
|
+ }
|
|
|
+ if(building.getCity() == null || building.getCity() == 0){
|
|
|
+ building.setCity(community.getCity());
|
|
|
+ }
|
|
|
+ if(building.getRegion() == null || building.getRegion() == 0){
|
|
|
+ building.setRegion(community.getRegion());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
int result = this.updateByPrimaryKeySelective(building);
|
|
|
//添加建筑
|
|
|
|