| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwBuildingMapper; |
| | | import com.doumee.dao.business.model.YwBuilding; |
| | | import com.doumee.dao.business.model.YwProject; |
| | | import com.doumee.service.business.YwBuildingService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private YwBuildingMapper ywBuildingMapper; |
| | | |
| | | @Override |
| | | public Integer create(YwBuilding ywBuilding) { |
| | | ywBuildingMapper.insert(ywBuilding); |
| | | return ywBuilding.getId(); |
| | | public Integer create(YwBuilding model) { |
| | | model.setCreator(model.getLoginUserInfo().getId()); |
| | | model.setIsdeleted(Constants.ZERO); |
| | | model.setCreateDate(new Date()); |
| | | model.setStatus(Constants.ZERO); |
| | | model.setEditDate(model.getCreateDate()); |
| | | model.setEditor(model.getCreator()); |
| | | ywBuildingMapper.insert(model); |
| | | return model.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | ywBuildingMapper.deleteById(id); |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | YwBuilding model = new YwBuilding(); |
| | | model.setId(id); |
| | | model.setEditDate(new Date()); |
| | | model.setEditor(user.getId()); |
| | | model.setIsdeleted(Constants.ONE); |
| | | ywBuildingMapper.updateById(model); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByIdInBatch(List<Integer> ids) { |
| | | public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | ywBuildingMapper.deleteBatchIds(ids); |
| | | for(Integer id : ids){ |
| | | this.deleteById(id,user); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(YwBuilding ywBuilding) { |
| | | ywBuildingMapper.updateById(ywBuilding); |
| | | public void updateById(YwBuilding model) { |
| | | model.setEditDate(new Date()); |
| | | model.setEditor(model.getLoginUserInfo().getId()); |
| | | ywBuildingMapper.updateById(model); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public List<YwBuilding> findList(YwBuilding ywBuilding) { |
| | | ywBuilding.setIsdeleted(Constants.ZERO); |
| | | QueryWrapper<YwBuilding> wrapper = new QueryWrapper<>(ywBuilding); |
| | | return ywBuildingMapper.selectList(wrapper); |
| | | } |
| | |
| | | IPage<YwBuilding> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<YwBuilding> queryWrapper = new QueryWrapper<>(); |
| | | 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=yw_building.id) as roomNum"+ |
| | | ",(select count(1) from yw_room a where a.isdeleted=0 and a.BUILDING_ID=yw_building.id and a.IS_INVESTMENT=1) as roomRentNum"); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(YwBuilding::getId, pageWrap.getModel().getId()); |
| | | } |