| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 运维项目信息表Service实现 |
| | |
| | | |
| | | @Override |
| | | public Integer create(YwProject model) { |
| | | if(Objects.isNull(model) |
| | | || StringUtils.isBlank(model.getName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(ywProjectMapper.selectCount(new QueryWrapper<YwProject>().lambda() |
| | | .eq(YwProject::getName,model.getName()) |
| | | .eq(YwProject::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+model.getName()+"】已存在!"); |
| | | } |
| | | model.setCreator(model.getLoginUserInfo().getId()); |
| | | model.setIsdeleted(Constants.ZERO); |
| | | model.setCreateDate(new Date()); |
| | |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | //查询项目下的数据 |
| | | if(ywBuildingMapper.selectCount(new QueryWrapper<YwBuilding>().lambda().eq(YwBuilding::getIsdeleted,Constants.ZERO) |
| | | .eq(YwBuilding::getProjectId,id))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"项目下存在楼宇数据!"); |
| | | }; |
| | | YwProject model = new YwProject(); |
| | | model.setId(id); |
| | | model.setEditDate(new Date()); |
| | |
| | | |
| | | @Override |
| | | public void updateById(YwProject model) { |
| | | if(Objects.isNull(model) |
| | | || Objects.isNull(model.getId()) |
| | | || StringUtils.isBlank(model.getName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(ywProjectMapper.selectCount(new QueryWrapper<YwProject>().lambda() |
| | | .eq(YwProject::getName,model.getName()) |
| | | .ne(YwProject::getId,model.getId()) |
| | | .eq(YwProject::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+model.getName()+"】已存在!"); |
| | | } |
| | | model.setEditDate(new Date()); |
| | | model.setEditor(model.getLoginUserInfo().getId()); |
| | | ywProjectMapper.updateById(model); |
| | |
| | | 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.PROJECT_ID=yw_project.id) as roomNum"+ |
| | | ",(select count(1) from yw_room a where a.isdeleted=0 and a.PROJECT_ID=yw_project.id and a.IS_INVESTMENT=1) as roomRentNum"); |
| | | ",(select count(1) from yw_room a where a.isdeleted=0 and a.PROJECT_ID=yw_project.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.PROJECT_ID=yw_project.id ) as area"); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(YwProject::getId, pageWrap.getModel().getId()); |
| | | } |