fix: 逻辑删除唯一索引冲突的问题
parent
67435648b2
commit
9e3ed75772
|
@ -7,8 +7,11 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeExpo
|
|||
import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
|
@ -39,4 +42,10 @@ public interface DictTypeMapper extends BaseMapperX<DictTypeDO> {
|
|||
return selectOne(DictTypeDO::getName, name);
|
||||
}
|
||||
|
||||
@Delete("UPDATE system_dict_type SET DELETED = 1,DELETED_TIME=#{deletedTime} WHERE id = #{id}")
|
||||
int deleteById(@Param("id") Long id, @Param("deletedTime") LocalDateTime deletedTime);
|
||||
|
||||
default int deleteById(Long id) {
|
||||
return deleteById(id, LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,9 +81,7 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||
throw exception(DICT_TYPE_HAS_CHILDREN);
|
||||
}
|
||||
// 删除字典类型
|
||||
dictType.setDeletedTime(LocalDateTime.now());
|
||||
dictType.setDeleted(true);
|
||||
dictTypeMapper.updateById(dictType);
|
||||
dictTypeMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue