| | |
| | | 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.param.GroupParam; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.dao.domain.PoleGroup; |
| | | import com.sandu.ximon.dao.domain.PoleGroupRelation; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private final PoleGroupRelationService poleGroupRelationService; |
| | | |
| | | public boolean addGroup(PoleGroupParam param) { |
| | | public boolean addGroup(GroupParam param) { |
| | | PoleGroup group = new PoleGroup(); |
| | | if (SecurityUtils.getClientId() != null) { |
| | | group.setClientId(SecurityUtils.getUserId()); |
| | |
| | | return save(group); |
| | | } |
| | | |
| | | public boolean updateGroup(Long groupId, PoleGroupParam param) { |
| | | public boolean updateGroup(Long groupId, GroupParam param) { |
| | | PoleGroup poleGroup = getById(groupId); |
| | | if (poleGroup == null) { |
| | | throw new BusinessException("未找到该分组"); |
| | |
| | | return updateById(update); |
| | | } |
| | | |
| | | public boolean deleteGroup(Long groupId) { |
| | | PoleGroup poleGroup = getById(groupId); |
| | | if (poleGroup == null) { |
| | | public boolean deleteGroup(List<Long> groupIds) { |
| | | List<PoleGroup> poleGroups = listByIds(groupIds); |
| | | if (poleGroups.isEmpty()) { |
| | | throw new BusinessException("未找到该分组"); |
| | | } |
| | | /** |
| | | * 刪除 |
| | | */ |
| | | poleGroupRelationService.remove(Wrappers.lambdaQuery(PoleGroupRelation.class).eq(PoleGroupRelation::getPoleGroupId, groupId)); |
| | | return removeById(groupId); |
| | | poleGroupRelationService.remove(Wrappers.lambdaQuery(PoleGroupRelation.class).in(PoleGroupRelation::getPoleGroupId, groupIds)); |
| | | return removeByIds(groupIds); |
| | | } |
| | | |
| | | public List<PoleGroup> groupList(BaseConditionVO baseConditionVO, String keyword, Integer order, Integer seq) { |
| | |
| | | //排序方式 |
| | | String orderBy = orderByResult + " " + orderBySeq; |
| | | |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy); |
| | | if (baseConditionVO != null) { |
| | | PageHelper.startPage(baseConditionVO.getPageNo(), baseConditionVO.getPageSize(), orderBy); |
| | | } |
| | | |
| | | List<PoleGroup> list; |
| | | if (clientId == null) { |