|  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public YwBuilding findById(Integer id) { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         MPJLambdaWrapper<YwBuilding> queryWrapper = new MPJLambdaWrapper<>(); | 
 |  |  |         queryWrapper.selectAll(YwBuilding.class ) | 
 |  |  |                 .selectAs(YwProject::getName,YwBuilding::getProjectName) | 
 |  |  |                 .select(" (select ifnull(sum(y.FEE_AREA),0) from yw_room y where y.ISDELETED = 0 and y.status = 0 and y.IS_INVESTMENT = 1 and y.BUILDING_ID = t.id ) ",YwBuilding::getRoomFeeArea) | 
 |  |  |                 .select(" (select ifnull(sum(y.RENT_AREA),0) from yw_room y where y.ISDELETED = 0 and y.status = 0 and y.IS_INVESTMENT = 1 and y.BUILDING_ID = t.id ) ",YwBuilding::getRoomRentArea) | 
 |  |  |                 .select("",YwBuilding::getRoomFeeArea) | 
 |  |  |                 .leftJoin(YwProject.class,YwProject::getId,YwBuilding::getProjectId) | 
 |  |  |                 .eq(YwBuilding::getId,id) | 
 |  |  |                 .last(" limit 1 ") | 
 |  |  | 
 |  |  |         Utils.MP.blankToNull(pageWrap.getModel()); | 
 |  |  |         pageWrap.getModel().setIsdeleted(Constants.ZERO); | 
 |  |  |         queryWrapper.select(" (select count(1) from yw_room a where a.isdeleted=0 and a.BUILDING_ID=t.id) as roomNum "+ | 
 |  |  |                 ",(select count(1) from yw_room a where a.isdeleted=0 and a.BUILDING_ID=t.id and a.IS_INVESTMENT=1) as roomRentNum"); | 
 |  |  |                 ",(select count(1) from yw_room a where a.isdeleted=0 and a.BUILDING_ID=t.id and a.IS_INVESTMENT=1) as roomRentNum " + | 
 |  |  |                 ", ( select ifnull(sum(a.RENT_AREA),0) from  yw_room a where a.isdeleted=0 and a.BUILDING_ID=t.id ) as manageArea"); | 
 |  |  |         if (pageWrap.getModel().getId() != null) { | 
 |  |  |             queryWrapper.eq(YwBuilding::getId, pageWrap.getModel().getId()); | 
 |  |  |         } |