| | |
| | | |
| | | List<YwRoom> ywRoomList = ywRoomMapper.selectJoinList(YwRoom.class,new MPJLambdaWrapper<YwRoom>() |
| | | .selectAll(YwRoom.class) |
| | | // .select(" ( SELECT count(1) FROM yw_contract y1 " + |
| | | // " left join yw_contract_room y2 on y1.id = y2.contract_id " + |
| | | // " where 1 = 1 and y2.type = 0 and y1.`STATUS` in( 0,1,2) " + |
| | | // " and y1.START_DATE < now() and y1.END_DATE > now() and y2.ROOM_ID = yw_room.id ) as investmentStatus ") |
| | | .select(" ifnull( ( select case when y1.status = 3 then now() BETWEEN y1.START_DATE and y1.BT_DATE else now() BETWEEN y1.START_DATE and y1.END_DATE END " + |
| | | "from yw_contract y1 left join yw_contract_room y2 on y1.id = y2.CONTRACT_ID and y2.TYPE = 0 " + |
| | | "where y1.`STATUS` <> 4 and y2.room_id = t.id order by y1.create_date desc limit 1 ) ,0) ",YwRoom::getLeaseStatus) |
| | | .select(" ifnull( ( case when t.IS_INVESTMENT = 0 then 2 else t.LEASE_NOW_STATUS end ) ,0) ",YwRoom::getLeaseStatus) |
| | | .eq(YwRoom::getIsdeleted,Constants.ZERO) |
| | | .eq(YwRoom::getStatus,Constants.ZERO) |
| | | .eq(YwRoom::getIsInvestment,Constants.ONE) |
| | |
| | | " ) ") |
| | | .apply(Objects.nonNull(dataDTO)&&Objects.nonNull(dataDTO.getStartDate())&&Objects.nonNull(dataDTO.getEndDate())," id not in (" + |
| | | " SELECT y2.room_id FROM yw_contract y1 left join yw_contract_room y2 on y1.id = y2.contract_id where 1 = 1 and y1.`STATUS` = 3 " + |
| | | " and y1.START_DATE < '"+dataDTO.getEndDate()+" 00:00:00' and y1.BT_DATE > '"+ dataDTO.getStartDate() +" 00:00:00' " + |
| | | " and y1.START_DATE < '"+dataDTO.getEndDate()+" 00:00:00' and y1.BT_DATE >= '"+ dataDTO.getStartDate() +" 00:00:00' " + |
| | | " ) ") |
| | | .orderByAsc(YwRoom::getRoomNum) |
| | | ); |