提交 420e8944 作者: ZhangJingKun

修改单号 2759 人物所在类别删除后,展示异常

上级 6b90f090
...@@ -3,16 +3,20 @@ package com.zzsn.leaderbase.service.impl; ...@@ -3,16 +3,20 @@ package com.zzsn.leaderbase.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsn.leaderbase.entity.CharacterCategoryStructure; import com.zzsn.leaderbase.entity.CharacterCategoryStructure;
import com.zzsn.leaderbase.entity.CharacterChangeInfo;
import com.zzsn.leaderbase.mapper.LeaderCategoryMapper; import com.zzsn.leaderbase.mapper.LeaderCategoryMapper;
import com.zzsn.leaderbase.service.CharacterChangeInfoService;
import com.zzsn.leaderbase.service.LeaderCategoryService; import com.zzsn.leaderbase.service.LeaderCategoryService;
import com.zzsn.leaderbase.vo.CharacterCategoryStructureTreeVo; import com.zzsn.leaderbase.vo.CharacterCategoryStructureTreeVo;
import com.zzsn.leaderbase.vo.Result; import com.zzsn.leaderbase.vo.Result;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -30,6 +34,9 @@ import java.util.stream.Collectors; ...@@ -30,6 +34,9 @@ import java.util.stream.Collectors;
@Service @Service
public class LeaderCategoryServiceImpl extends ServiceImpl<LeaderCategoryMapper, CharacterCategoryStructure> implements LeaderCategoryService { public class LeaderCategoryServiceImpl extends ServiceImpl<LeaderCategoryMapper, CharacterCategoryStructure> implements LeaderCategoryService {
@Autowired
CharacterChangeInfoService characterChangeInfoService;
@Override @Override
@Transactional @Transactional
public Result<?> add(CharacterCategoryStructure characterCategoryStructure) { public Result<?> add(CharacterCategoryStructure characterCategoryStructure) {
...@@ -133,6 +140,13 @@ public class LeaderCategoryServiceImpl extends ServiceImpl<LeaderCategoryMapper, ...@@ -133,6 +140,13 @@ public class LeaderCategoryServiceImpl extends ServiceImpl<LeaderCategoryMapper,
if (StringUtils.isNotBlank(byId.getPid())&&!LeaderCategoryService.ROOT_PID_VALUE.equals(byId.getPid())){ if (StringUtils.isNotBlank(byId.getPid())&&!LeaderCategoryService.ROOT_PID_VALUE.equals(byId.getPid())){
updateOldParentNodeDel(byId.getPid()); updateOldParentNodeDel(byId.getPid());
} }
//删除分类时,需要情况该分类下关联的人物 单号 2759 人物所在类别删除后,展示异常
UpdateWrapper<CharacterChangeInfo> wrapper = new UpdateWrapper<>();
wrapper.set("type_id",null); //设置字段值为null
wrapper.in("type_id",id);
characterChangeInfoService.update(null,wrapper); //更新 默认忽略null,所以实体类传的null,然后执行后面的条件和内容
return Result.OK(); return Result.OK();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论