| | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwBuildingMapper; |
| | | import com.doumee.dao.business.YwContractRoomMapper; |
| | | import com.doumee.dao.business.YwRoomMapper; |
| | | import com.doumee.dao.business.model.YwBuilding; |
| | | import com.doumee.dao.business.model.YwFloor; |
| | | import com.doumee.dao.business.model.YwProject; |
| | | import com.doumee.dao.business.model.YwRoom; |
| | | import com.doumee.dao.business.YwWorkorderMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.YwRoomService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | private YwRoomMapper ywRoomMapper; |
| | | @Autowired |
| | | private YwBuildingMapper ywBuildingMapper; |
| | | @Autowired |
| | | private YwContractRoomMapper ywContractRoomMapper; |
| | | @Autowired |
| | | private YwWorkorderMapper ywWorkorderMapper; |
| | | |
| | | @Override |
| | | public Integer create(YwRoom model) { |
| | |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | if(ywContractRoomMapper.selectCount(new QueryWrapper<YwContractRoom>() |
| | | .lambda().eq(YwContractRoom::getIsdeleted,Constants.ZERO) |
| | | .eq(YwContractRoom::getRoomId,id))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"房间信息已使用,无法进行删除!"); |
| | | }; |
| | | if(ywWorkorderMapper.selectCount(new QueryWrapper<YwWorkorder>() |
| | | .lambda().eq(YwWorkorder::getIsdeleted,Constants.ZERO) |
| | | .eq(YwWorkorder::getRoomId,id))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"房间信息已使用,无法进行删除!"); |
| | | }; |
| | | YwRoom model = new YwRoom(); |
| | | model.setId(id); |
| | | model.setEditDate(new Date()); |
| | |
| | | .selectAs(YwProject::getName,YwRoom::getProjectName) |
| | | .selectAs(YwFloor::getName,YwRoom::getFloorName) |
| | | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) |
| | | .select(" 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 ",YwRoom::getLeaseStatus) |
| | | .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId) |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId) |
| | | .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor); |
| | |
| | | queryWrapper.eq(YwRoom::getBuildingId, pageWrap.getModel().getBuildingId()); |
| | | } |
| | | queryWrapper.orderByAsc(YwRoom::getRoomNum); |
| | | return PageData.from(ywRoomMapper.selectJoinPage(page,YwRoom.class, queryWrapper)); |
| | | IPage<YwRoom> iPage = ywRoomMapper.selectJoinPage(page,YwRoom.class, queryWrapper); |
| | | for (YwRoom ywRoom:iPage.getRecords()) { |
| | | if(Constants.equalsInteger(ywRoom.getIsInvestment(),Constants.ZERO)){ |
| | | ywRoom.setLeaseStatus(Constants.TWO); |
| | | } |
| | | } |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |