| | |
| | | package com.smartor.service.impl; |
| | | |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.smartor.domain.HeCategory; |
| | | import com.smartor.domain.HeCategoryVO; |
| | | import com.smartor.domain.IvrLibaTargetAssort; |
| | | import com.smartor.domain.IvrLibaTargetAssortVO; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.IvrLibaTargetAssortMapper; |
| | | import com.smartor.service.IIvrLibaTargetAssortService; |
| | | import io.jsonwebtoken.lang.Collections; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | * @author ruoyi |
| | | * @date 2023-12-14 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class IvrLibaTargetAssortServiceImpl implements IIvrLibaTargetAssortService { |
| | | @Autowired |
| | |
| | | return ivrLibaTargetAssortMapper.insertIvrLibaTargetAssort(ivrLibaTargetAssort); |
| | | } |
| | | |
| | | @Override |
| | | public int insertIvrLibaTargetAssortTree(IvrLibaTargetAssortVO ivrLibaTargetAssortVO) { |
| | | Integer i = null; |
| | | if (ObjectUtils.isEmpty(ivrLibaTargetAssortVO)) { |
| | | throw new BaseException("入参为空,请检查后,再新增"); |
| | | } |
| | | Integer seqMax = ivrLibaTargetAssortMapper.selectSeqMax(); |
| | | IvrLibaTargetAssort ivrLibaTargetAssort = DtoConversionUtils.sourceToTarget(ivrLibaTargetAssortVO, IvrLibaTargetAssort.class); |
| | | ivrLibaTargetAssort.setSeqno(1); |
| | | if (seqMax != null) { |
| | | ivrLibaTargetAssort.setSeqno(seqMax + 1); |
| | | } |
| | | i = ivrLibaTargetAssortMapper.insertIvrLibaTargetAssort(ivrLibaTargetAssort); |
| | | log.info("指标分类一级树的主键:{}", ivrLibaTargetAssort.getId()); |
| | | |
| | | //新增二级树 |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTargetAssortVO.getIvrLibaTargetAssortList())) { |
| | | for (IvrLibaTargetAssort ivrLibaTargetAssort1 : ivrLibaTargetAssortVO.getIvrLibaTargetAssortList()) { |
| | | int seqMax1 = ivrLibaTargetAssortMapper.selectSeqMax(); |
| | | ivrLibaTargetAssort1.setPid(ivrLibaTargetAssort.getId()); |
| | | ivrLibaTargetAssort1.setSeqno(1); |
| | | if (seqMax != null) { |
| | | ivrLibaTargetAssort1.setSeqno(seqMax1 + 1); |
| | | } |
| | | |
| | | ivrLibaTargetAssortMapper.insertIvrLibaTargetAssort(ivrLibaTargetAssort1); |
| | | } |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 修改指标分类 |
| | | * |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteIvrLibaTargetAssortByIds(Long[] ids) { |
| | | return ivrLibaTargetAssortMapper.deleteIvrLibaTargetAssortByIds(ids); |
| | | public Integer deleteIvrLibaTargetAssortByIds(Long[] ids) { |
| | | Integer i = null; |
| | | for (Long id : ids) { |
| | | i = ivrLibaTargetAssortMapper.deleteIvrLibaTargetAssortById(id); |
| | | IvrLibaTargetAssort ivrLibaTargetAssort = new IvrLibaTargetAssort(); |
| | | ivrLibaTargetAssort.setPid(id); |
| | | |
| | | //将删除的id的二级菜单,放到未分类中 |
| | | List<IvrLibaTargetAssort> ivrLibaTargetAssorts = ivrLibaTargetAssortMapper.selectIvrLibaTargetAssortList(ivrLibaTargetAssort); |
| | | if (CollectionUtils.isNotEmpty(ivrLibaTargetAssorts)) { |
| | | for (IvrLibaTargetAssort ivrLibaTargetAssort1 : ivrLibaTargetAssorts) { |
| | | ivrLibaTargetAssort1.setPid(999999999L); |
| | | ivrLibaTargetAssortMapper.updateIvrLibaTargetAssort(ivrLibaTargetAssort1); |
| | | } |
| | | } |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |