|  |  | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.core.utils.Utils; | 
 |  |  | import com.doumee.dao.business.YwBuildingMapper; | 
 |  |  | import com.doumee.dao.business.YwFloorMapper; | 
 |  |  | import com.doumee.dao.business.YwProjectMapper; | 
 |  |  | import com.doumee.dao.business.model.YwBuilding; | 
 |  |  | import com.doumee.dao.business.model.YwFloor; | 
 |  |  | import com.doumee.dao.business.model.YwProject; | 
 |  |  | import com.doumee.service.business.YwBuildingService; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | 
 |  |  |     private YwBuildingMapper ywBuildingMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private YwProjectMapper ywProjectMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private YwFloorMapper ywFloorMapper; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Integer create(YwBuilding model) { | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void deleteById(Integer id, LoginUserInfo user) { | 
 |  |  |         //查询楼宇下的数据 | 
 |  |  |         if(ywFloorMapper.selectCount(new QueryWrapper<YwFloor>().lambda().eq(YwFloor::getIsdeleted,Constants.ZERO) | 
 |  |  |                 .eq(YwFloor::getBuildingId,id))>Constants.ZERO){ | 
 |  |  |             throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"楼宇中存在楼层数据!"); | 
 |  |  |         }; | 
 |  |  |  | 
 |  |  |         YwBuilding model = new YwBuilding(); | 
 |  |  |         model.setId(id); | 
 |  |  |         model.setEditDate(new Date()); | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public YwBuilding findById(Integer id) { | 
 |  |  |         return ywBuildingMapper.selectById(id); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         MPJLambdaWrapper<YwBuilding> queryWrapper = new MPJLambdaWrapper<>(); | 
 |  |  |         queryWrapper.selectAll(YwBuilding.class ) | 
 |  |  |                 .selectAs(YwProject::getName,YwBuilding::getProjectName) | 
 |  |  |                 .leftJoin(YwProject.class,YwProject::getId,YwBuilding::getProjectId) | 
 |  |  |                 .eq(YwBuilding::getId,id) | 
 |  |  |                 .last(" limit 1 ") | 
 |  |  |         ; | 
 |  |  |  | 
 |  |  |         return ywBuildingMapper.selectJoinOne(YwBuilding.class, queryWrapper); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override |