| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.exception.ServiceException; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.SystemmanagementConfigVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructBuildTypeVO; |
| | |
| | | @Override |
| | | public R listBuildType() { |
| | | List<ComMngStructBuildTypeVO>comMngStructBuildTypeVOS=new ArrayList<>(); |
| | | List<ComMngStructBuildTypeDO> comMngStructBuildTypeDOS = comMngStructBuildTypeDAO.selectList(null); |
| | | List<ComMngStructBuildTypeDO> comMngStructBuildTypeDOS = comMngStructBuildTypeDAO.selectList(new LambdaQueryWrapper<>()); |
| | | if (!ObjectUtils.isEmpty(comMngStructBuildTypeDOS)) { |
| | | ComMngStructBuildTypeVO comMngStructBuildTypeVO=new ComMngStructBuildTypeVO(); |
| | | comMngStructBuildTypeDOS.forEach(comMngStructBuildTypeDO -> { |
| | | ComMngStructBuildTypeVO comMngStructBuildTypeVO=new ComMngStructBuildTypeVO(); |
| | | BeanUtils.copyProperties(comMngStructBuildTypeDO,comMngStructBuildTypeVO); |
| | | comMngStructBuildTypeVOS.add(comMngStructBuildTypeVO); |
| | | }); |
| | |
| | | buildTypdIds.forEach(aLong -> { |
| | | if (!collect.contains(aLong)) { |
| | | ComMngStructBuildTypeDO comMngStructBuildTypeDO = comMngStructBuildTypeDAO.selectById(aLong); |
| | | throw new ServiceException(comMngStructBuildTypeDO.getName()+"已经在使用无法删除"); |
| | | if (!ObjectUtils.isEmpty(comMngStructBuildTypeDO)) { |
| | | throw new ServiceException(comMngStructBuildTypeDO.getName()+"已经在使用无法删除"); |
| | | } |
| | | } |
| | | }); |
| | | comMngStructBuildTypeDAO.delete(new QueryWrapper<ComMngStructBuildTypeDO>().lambda().eq(ComMngStructBuildTypeDO::getCommunityId, communityId)); |
| | |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 其他建筑详情 |
| | | * |
| | | * @param id 主键id |
| | | * @return 建筑内容 |
| | | */ |
| | | @Override |
| | | public R detailOtherbuild(Long id) { |
| | | ComMngStructOtherBuildDO comMngStructOtherBuildDO = comMngStructOtherBuildDAO.selectById(id); |
| | | if (ObjectUtils.isEmpty(comMngStructOtherBuildDO)) { |
| | | return R.fail("建筑不存在"); |
| | | } |
| | | Long typeId = comMngStructOtherBuildDO.getTypeId(); |
| | | ComMngStructBuildTypeDO comMngStructBuildTypeDO = comMngStructBuildTypeDAO.selectById(typeId); |
| | | if (ObjectUtils.isEmpty(comMngStructBuildTypeDO)) { |
| | | return R.fail("建筑类型不存在"); |
| | | } |
| | | ComMngStructOtherBuildVO comMngStructOtherBuildVO=new ComMngStructOtherBuildVO(); |
| | | BeanUtils.copyProperties(comMngStructOtherBuildDO,comMngStructOtherBuildVO); |
| | | comMngStructOtherBuildVO.setBuileTypeName(comMngStructBuildTypeDO.getName()); |
| | | return R.ok(comMngStructOtherBuildVO); |
| | | } |
| | | |
| | | /** |
| | | * 编辑其他建筑 |
| | | * |
| | | * @param comMngStructOtherBuildVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @Override |
| | | public R putOtherbuild(ComMngStructOtherBuildVO comMngStructOtherBuildVO) { |
| | | Long typeId = comMngStructOtherBuildVO.getTypeId(); |
| | | ComMngStructBuildTypeDO comMngStructBuildTypeDO = comMngStructBuildTypeDAO.selectById(typeId); |
| | | if (ObjectUtils.isEmpty(comMngStructBuildTypeDO)) { |
| | | return R.fail("建筑类型不存在"); |
| | | } |
| | | ComMngStructOtherBuildDO comMngStructOtherBuildDO=new ComMngStructOtherBuildDO(); |
| | | BeanUtils.copyProperties(comMngStructOtherBuildVO,comMngStructOtherBuildDO); |
| | | int update = comMngStructOtherBuildDAO.updateById(comMngStructOtherBuildDO); |
| | | if (update>0) { |
| | | return R.ok("编辑成功过"); |
| | | } |
| | | return R.fail("编辑失败"); |
| | | } |
| | | |
| | | /** |
| | | * 删除其他建筑 |
| | | * |
| | | * @param id 主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @Override |
| | | public R deleteOtherbuild(Long id) { |
| | | int delete = comMngStructOtherBuildDAO.deleteById(id); |
| | | if (delete>0) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail("删除失败"); |
| | | } |
| | | } |