From 9e3ed7577224560314b09117cd38318a13ec1df7 Mon Sep 17 00:00:00 2001 From: gaibu <1016771049@qq.com> Date: Sat, 10 Dec 2022 11:59:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=BB=E8=BE=91=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E7=B4=A2=E5=BC=95=E5=86=B2=E7=AA=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/system/dal/mysql/dict/DictTypeMapper.java | 9 +++++++++ .../module/system/service/dict/DictTypeServiceImpl.java | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java index 83cb9a503..197c03976 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java @@ -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 { 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()); + } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java index aa65d0f74..af698a2b0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java @@ -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