| | |
| | | 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.ximon.admin.param.PoleGroupParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.domain.PoleGroup; |
| | | import com.sandu.ximon.dao.mapper.GroupMapper; |
| | | import com.sandu.ximon.dao.mapper.PoleGroupMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | public boolean addGroup(PoleGroupParam param) { |
| | | PoleGroup group = new PoleGroup(); |
| | | group.setClientId(SecurityUtils.getClientId()); |
| | | if(SecurityUtils.getClientId()!=null){ |
| | | group.setClientId(SecurityUtils.getUserId()); |
| | | } |
| | | |
| | | group.setGroupName(param.getGroupName()); |
| | | return save(group); |
| | | } |
| | |
| | | return removeById(groupId); |
| | | } |
| | | |
| | | public List<PoleGroup> groupList() { |
| | | public List<PoleGroup> groupList(BaseConditionVO baseConditionVO,String keyword) { |
| | | Long clientId = SecurityUtils.getClientId(); |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize()); |
| | | if (clientId == null) { |
| | | return list(); |
| | | return list(Wrappers.lambdaQuery(PoleGroup.class).like(PoleGroup::getGroupName,keyword)); |
| | | } else { |
| | | return list(Wrappers.lambdaQuery(PoleGroup.class).eq(PoleGroup::getClientId, clientId)); |
| | | return list(Wrappers.lambdaQuery(PoleGroup.class).eq(PoleGroup::getClientId, clientId).like(PoleGroup::getGroupName,keyword)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 绑定灯杆 |
| | | */ |
| | | public boolean bindPole(Long groupId,List<Long> poleList) { |
| | | public boolean bindPole(Long groupId,List<Long> poleIdList) { |
| | | PoleGroup poleGroup = getById(groupId); |
| | | if (poleGroup == null) { |
| | | throw new BusinessException("未找到该分组"); |
| | | } |
| | | return poleGroupRelationService.saveBinding(groupId,poleList); |
| | | return poleGroupRelationService.saveBinding(groupId,poleIdList); |
| | | } |
| | | } |