| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.util.SpringContextHolder; |
| | | import com.sandu.ximon.admin.param.InterphoneHostParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.bo.InterphoneHostBo; |
| | | import com.sandu.ximon.dao.domain.InterphoneHost; |
| | | import com.sandu.ximon.dao.domain.InterphoneHostSubPole; |
| | | import com.sandu.ximon.dao.enums.PoleBindingEnums; |
| | | import com.sandu.ximon.dao.mapper.InterphoneHostMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | public class InterphoneHostService extends BaseServiceImpl<InterphoneHostMapper, InterphoneHost> { |
| | | |
| | | private final InterphoneHostMapper interphoneHostMapper; |
| | | |
| | | private final InterphoneHostSubService interphoneHostSubService; |
| | | |
| | | |
| | | /** |
| | |
| | | if (byId == null) { |
| | | return false; |
| | | } |
| | | |
| | | boolean belong = SpringContextHolder.getBean(PoleBindingService.class).isBelong(byId.getHostMac(), PoleBindingEnums.FOR_HELP); |
| | | if (!belong) { |
| | | throw new BusinessException("该设备不属于您,不能修改设备信息"); |
| | | } |
| | | InterphoneHost interphoneHost = new InterphoneHost(); |
| | | interphoneHost.setHostId(id); |
| | | BeanUtils.copyProperties(interphoneHostParam, interphoneHost); |
| | |
| | | */ |
| | | public boolean deleteHost(Integer id) { |
| | | InterphoneHost byId = getById(id); |
| | | |
| | | InterphoneHostSubPole one = interphoneHostSubService.getOne(Wrappers.lambdaQuery(InterphoneHostSubPole.class).eq(InterphoneHostSubPole::getHostId, id)); |
| | | if (one != null) { |
| | | throw new BusinessException("该主机存在绑定关系,不能删除"); |
| | | } |
| | | if (byId == null) { |
| | | return false; |
| | | } |
| | |
| | | /** |
| | | * 查询主机列表 |
| | | */ |
| | | public List<InterphoneHost> getHostList() { |
| | | List<InterphoneHost> list = list();//TODO |
| | | return list(); |
| | | public List<InterphoneHostBo> getInterphoneHostList(BaseConditionVO baseConditionVO, String keyword) { |
| | | if (baseConditionVO != null) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | } |
| | | List<InterphoneHostBo> list; |
| | | if (SecurityUtils.getClientId() == null) { |
| | | list = interphoneHostMapper.getInterphoneHostList(keyword, null); |
| | | } else { |
| | | list = interphoneHostMapper.getInterphoneHostList(keyword, SecurityUtils.getUserId()); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |