From 20d40ea691ee75c70cbe1b11ec52cfbd4173c960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Tue, 13 Apr 2021 15:29:05 +0800 Subject: [PATCH] =?UTF-8?q?update=20mp=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/domain/entity/SysDept.java | 1 + .../ruoyi/system/mapper/SysDeptMapper.java | 94 ------------ .../system/mapper/SysDictDataMapper.java | 83 ---------- .../system/mapper/SysDictTypeMapper.java | 39 ----- .../service/impl/SysConfigServiceImpl.java | 8 +- .../service/impl/SysDeptServiceImpl.java | 63 ++++++-- .../service/impl/SysDictDataServiceImpl.java | 25 +-- .../service/impl/SysDictTypeServiceImpl.java | 54 +++++-- .../resources/mapper/system/SysDeptMapper.xml | 145 ------------------ .../mapper/system/SysDictDataMapper.xml | 120 --------------- .../mapper/system/SysDictTypeMapper.xml | 65 -------- 11 files changed, 110 insertions(+), 587 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index 20370580..8db94dab 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -64,6 +64,7 @@ public class SysDept private String delFlag; /** 父部门名称 */ + @TableField(exist = false) private String parentName; /** 创建者 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 1ab45bab..c2619d31 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -12,13 +12,6 @@ import java.util.List; * @author ruoyi */ public interface SysDeptMapper extends BaseMapper { - /** - * 查询部门管理数据 - * - * @param dept 部门信息 - * @return 部门信息集合 - */ - public List selectDeptList(SysDept dept); /** * 根据角色ID查询部门树信息 @@ -29,91 +22,4 @@ public interface SysDeptMapper extends BaseMapper { */ public List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); - /** - * 根据部门ID查询信息 - * - * @param deptId 部门ID - * @return 部门信息 - */ - public SysDept selectDeptById(Long deptId); - - /** - * 根据ID查询所有子部门 - * - * @param deptId 部门ID - * @return 部门列表 - */ - public List selectChildrenDeptById(Long deptId); - - /** - * 根据ID查询所有子部门(正常状态) - * - * @param deptId 部门ID - * @return 子部门数 - */ - public int selectNormalChildrenDeptById(Long deptId); - - /** - * 是否存在子节点 - * - * @param deptId 部门ID - * @return 结果 - */ - public int hasChildByDeptId(Long deptId); - - /** - * 查询部门是否存在用户 - * - * @param deptId 部门ID - * @return 结果 - */ - public int checkDeptExistUser(Long deptId); - - /** - * 校验部门名称是否唯一 - * - * @param deptName 部门名称 - * @param parentId 父部门ID - * @return 结果 - */ - public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); - - /** - * 新增部门信息 - * - * @param dept 部门信息 - * @return 结果 - */ - public int insertDept(SysDept dept); - - /** - * 修改部门信息 - * - * @param dept 部门信息 - * @return 结果 - */ - public int updateDept(SysDept dept); - - /** - * 修改所在部门的父级部门状态 - * - * @param dept 部门 - */ - public void updateDeptStatus(SysDept dept); - - /** - * 修改子元素关系 - * - * @param depts 子元素 - * @return 结果 - */ - public int updateDeptChildren(@Param("depts") List depts); - - /** - * 删除部门管理信息 - * - * @param deptId 部门ID - * @return 结果 - */ - public int deleteDeptById(Long deptId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java index 1f72b49c..8da79ca0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -2,9 +2,6 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.common.core.domain.entity.SysDictData; -import org.apache.ibatis.annotations.Param; - -import java.util.List; /** * 字典表 数据层 @@ -12,85 +9,5 @@ import java.util.List; * @author ruoyi */ public interface SysDictDataMapper extends BaseMapper { - /** - * 根据条件分页查询字典数据 - * - * @param dictData 字典数据信息 - * @return 字典数据集合信息 - */ - public List selectDictDataList(SysDictData dictData); - /** - * 根据字典类型查询字典数据 - * - * @param dictType 字典类型 - * @return 字典数据集合信息 - */ - public List selectDictDataByType(String dictType); - - /** - * 根据字典类型和字典键值查询字典数据信息 - * - * @param dictType 字典类型 - * @param dictValue 字典键值 - * @return 字典标签 - */ - public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue); - - /** - * 根据字典数据ID查询信息 - * - * @param dictCode 字典数据ID - * @return 字典数据 - */ - public SysDictData selectDictDataById(Long dictCode); - - /** - * 查询字典数据 - * - * @param dictType 字典类型 - * @return 字典数据 - */ - public int countDictDataByType(String dictType); - - /** - * 通过字典ID删除字典数据信息 - * - * @param dictCode 字典数据ID - * @return 结果 - */ - public int deleteDictDataById(Long dictCode); - - /** - * 批量删除字典数据信息 - * - * @param dictCodes 需要删除的字典数据ID - * @return 结果 - */ - public int deleteDictDataByIds(Long[] dictCodes); - - /** - * 新增字典数据信息 - * - * @param dictData 字典数据信息 - * @return 结果 - */ - public int insertDictData(SysDictData dictData); - - /** - * 修改字典数据信息 - * - * @param dictData 字典数据信息 - * @return 结果 - */ - public int updateDictData(SysDictData dictData); - - /** - * 同步修改字典类型 - * - * @param oldDictType 旧字典类型 - * @param newDictType 新旧字典类型 - * @return 结果 - */ - public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java index 5854d2d7..ead5d2d0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java @@ -13,13 +13,6 @@ import java.util.List; */ @Mapper public interface SysDictTypeMapper extends BaseMapper { - /** - * 根据条件分页查询字典类型 - * - * @param dictType 字典类型信息 - * @return 字典类型集合信息 - */ - public List selectDictTypeList(SysDictType dictType); /** * 根据所有字典类型 @@ -44,38 +37,6 @@ public interface SysDictTypeMapper extends BaseMapper { */ public SysDictType selectDictTypeByType(String dictType); - /** - * 通过字典ID删除字典信息 - * - * @param dictId 字典ID - * @return 结果 - */ - public int deleteDictTypeById(Long dictId); - - /** - * 批量删除字典类型信息 - * - * @param dictIds 需要删除的字典ID - * @return 结果 - */ - public int deleteDictTypeByIds(Long[] dictIds); - - /** - * 新增字典类型信息 - * - * @param dictType 字典类型信息 - * @return 结果 - */ - public int insertDictType(SysDictType dictType); - - /** - * 修改字典类型信息 - * - * @param dictType 字典类型信息 - * @return 结果 - */ - public int updateDictType(SysDictType dictType); - /** * 校验字典类型称是否唯一 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 7f694ae9..4acfeb3e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -91,8 +91,12 @@ public class SysConfigServiceImpl extends ServiceImpl params = config.getParams(); - lqw.between(params.get("beginTime") != null && params.get("endTime") != null, - SysConfig::getCreateTime, params.get("beginTime"), params.get("endTime")); + lqw.apply(params.get("beginTime") != null, + "date_format(create_time,'%y%m%d') >= date_format(#{0},'%y%m%d')", + params.get("beginTime")); + lqw.apply(params.get("endTime") != null, + "date_format(create_time,'%y%m%d') >= date_format(#{0},'%y%m%d')", + params.get("endTime")); return baseMapper.selectList(lqw); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 467e501d..79a09e97 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -1,20 +1,26 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.lang.Validator; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.CustomException; import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.mapper.SysRoleMapper; +import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.ISysDeptService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; @@ -32,6 +38,9 @@ public class SysDeptServiceImpl extends ServiceImpl impl @Autowired private SysRoleMapper roleMapper; + @Autowired + private SysUserMapper userMapper; + /** * 查询部门管理数据 * @@ -41,7 +50,15 @@ public class SysDeptServiceImpl extends ServiceImpl impl @Override @DataScope(deptAlias = "d") public List selectDeptList(SysDept dept) { - return deptMapper.selectDeptList(dept); + Object dataScope = dept.getParams().get("dataScope"); + return list(new LambdaQueryWrapper() + .eq(dept.getParentId() != null && dept.getParentId() != 0, + SysDept::getParentId, dept.getParentId()) + .like(StrUtil.isNotBlank(dept.getDeptName()), SysDept::getDeptName, dept.getDeptName()) + .eq(StrUtil.isNotBlank(dept.getStatus()), SysDept::getStatus, dept.getStatus()) + .apply(dataScope != null, dataScope != null ? dataScope.toString() : null) + .orderByAsc(SysDept::getParentId) + .orderByAsc(SysDept::getOrderNum)); } /** @@ -103,7 +120,7 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ @Override public SysDept selectDeptById(Long deptId) { - return deptMapper.selectDeptById(deptId); + return getById(deptId); } /** @@ -114,7 +131,9 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ @Override public int selectNormalChildrenDeptById(Long deptId) { - return deptMapper.selectNormalChildrenDeptById(deptId); + return count(new LambdaQueryWrapper() + .eq(SysDept::getStatus, 0) + .apply("find_in_set({0}, ancestors)", deptId)); } /** @@ -125,7 +144,9 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ @Override public boolean hasChildByDeptId(Long deptId) { - int result = deptMapper.hasChildByDeptId(deptId); + int result = count(new LambdaQueryWrapper() + .eq(SysDept::getParentId, deptId) + .last("limit 1")); return result > 0 ? true : false; } @@ -137,7 +158,8 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ @Override public boolean checkDeptExistUser(Long deptId) { - int result = deptMapper.checkDeptExistUser(deptId); + int result = userMapper.selectCount(new LambdaQueryWrapper() + .eq(SysUser::getDeptId, deptId)); return result > 0 ? true : false; } @@ -150,7 +172,10 @@ public class SysDeptServiceImpl extends ServiceImpl impl @Override public String checkDeptNameUnique(SysDept dept) { Long deptId = Validator.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); - SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); + SysDept info = getOne(new LambdaQueryWrapper() + .eq(SysDept::getDeptName, dept.getDeptName()) + .eq(SysDept::getParentId, dept.getParentId()) + .last("limit 1")); if (Validator.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) { return UserConstants.NOT_UNIQUE; } @@ -165,13 +190,13 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ @Override public int insertDept(SysDept dept) { - SysDept info = deptMapper.selectDeptById(dept.getParentId()); + SysDept info = getById(dept.getParentId()); // 如果父节点不为正常状态,则不允许新增子节点 if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) { throw new CustomException("部门停用,不允许新增"); } dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); - return deptMapper.insertDept(dept); + return baseMapper.insert(dept); } /** @@ -182,15 +207,15 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ @Override public int updateDept(SysDept dept) { - SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); - SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); + SysDept newParentDept = getById(dept.getParentId()); + SysDept oldDept = getById(dept.getDeptId()); if (Validator.isNotNull(newParentDept) && Validator.isNotNull(oldDept)) { String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); String oldAncestors = oldDept.getAncestors(); dept.setAncestors(newAncestors); updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); } - int result = deptMapper.updateDept(dept); + int result = baseMapper.updateById(dept); if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) { // 如果该部门是启用状态,则启用该部门的所有上级部门 updateParentDeptStatus(dept); @@ -205,9 +230,14 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ private void updateParentDeptStatus(SysDept dept) { String updateBy = dept.getUpdateBy(); - dept = deptMapper.selectDeptById(dept.getDeptId()); + dept = getById(dept.getDeptId()); dept.setUpdateBy(updateBy); - deptMapper.updateDeptStatus(dept); + update(null,new LambdaUpdateWrapper() + .set(StrUtil.isNotBlank(dept.getStatus()), + SysDept::getStatus,dept.getStatus()) + .set(StrUtil.isNotBlank(dept.getUpdateBy()), + SysDept::getUpdateBy,dept.getUpdateBy()) + .in(SysDept::getDeptId, Arrays.asList(dept.getAncestors().split(",")))); } /** @@ -218,12 +248,13 @@ public class SysDeptServiceImpl extends ServiceImpl impl * @param oldAncestors 旧的父ID集合 */ public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) { - List children = deptMapper.selectChildrenDeptById(deptId); + List children = list(new LambdaQueryWrapper() + .apply("find_in_set({0},ancestors)",deptId)); for (SysDept child : children) { child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors)); } if (children.size() > 0) { - deptMapper.updateDeptChildren(children); + updateBatchById(children); } } @@ -235,7 +266,7 @@ public class SysDeptServiceImpl extends ServiceImpl impl */ @Override public int deleteDeptById(Long deptId) { - return deptMapper.deleteDeptById(deptId); + return baseMapper.deleteById(deptId); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java index a096a26e..aa5aebc2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java @@ -1,13 +1,15 @@ package com.ruoyi.system.service.impl; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.service.ISysDictDataService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; import java.util.List; /** @@ -17,8 +19,6 @@ import java.util.List; */ @Service public class SysDictDataServiceImpl extends ServiceImpl implements ISysDictDataService { - @Autowired - private SysDictDataMapper dictDataMapper; /** * 根据条件分页查询字典数据 @@ -28,7 +28,10 @@ public class SysDictDataServiceImpl extends ServiceImpl selectDictDataList(SysDictData dictData) { - return dictDataMapper.selectDictDataList(dictData); + return list(new LambdaQueryWrapper().eq(StrUtil.isNotBlank(dictData.getDictType()), SysDictData::getDictType, dictData.getDictType()) + .like(StrUtil.isNotBlank(dictData.getDictLabel()), SysDictData::getDictLabel, dictData.getDictLabel()) + .eq(StrUtil.isNotBlank(dictData.getStatus()), SysDictData::getStatus, dictData.getStatus()) + .orderByAsc(SysDictData::getDictSort)); } /** @@ -40,7 +43,11 @@ public class SysDictDataServiceImpl extends ServiceImpl() + .select(SysDictData::getDictLabel) + .eq(SysDictData::getDictType, dictType) + .eq(SysDictData::getDictValue, dictValue)) + .getDictLabel(); } /** @@ -51,7 +58,7 @@ public class SysDictDataServiceImpl extends ServiceImpl 0) { DictUtils.clearDictCache(); } @@ -77,7 +84,7 @@ public class SysDictDataServiceImpl extends ServiceImpl 0) { DictUtils.clearDictCache(); } @@ -92,7 +99,7 @@ public class SysDictDataServiceImpl extends ServiceImpl 0) { DictUtils.clearDictCache(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index 19d9652d..935311cd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -2,6 +2,8 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Validator; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysDictData; @@ -16,7 +18,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; +import java.util.Arrays; import java.util.List; +import java.util.Map; /** * 字典 业务层处理 @@ -36,9 +40,13 @@ public class SysDictTypeServiceImpl extends ServiceImpl dictTypeList = dictTypeMapper.selectDictTypeAll(); + List dictTypeList = list(); for (SysDictType dictType : dictTypeList) { - List dictDatas = dictDataMapper.selectDictDataByType(dictType.getDictType()); + List dictDatas = dictDataMapper.selectList( + new LambdaQueryWrapper() + .eq(SysDictData::getStatus, 0) + .eq(SysDictData::getDictType, dictType) + .orderByAsc(SysDictData::getDictSort)); DictUtils.setDictCache(dictType.getDictType(), dictDatas); } } @@ -51,7 +59,17 @@ public class SysDictTypeServiceImpl extends ServiceImpl selectDictTypeList(SysDictType dictType) { - return dictTypeMapper.selectDictTypeList(dictType); + Map params = dictType.getParams(); + return list(new LambdaQueryWrapper() + .like(SysDictType::getDictName, dictType.getDictName()) + .eq(SysDictType::getStatus, dictType.getStatus()) + .like(SysDictType::getDictType, dictType.getDictType()) + .apply(params.get("beginTime") != null, + "date_format(create_time,'%y%m%d') >= date_format({0},'%y%m%d')", + params.get("beginTime")) + .apply(params.get("endTime") != null, + "date_format(create_time,'%y%m%d') <= date_format({0},'%y%m%d')", + params.get("endTime"))); } /** @@ -61,7 +79,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl selectDictTypeAll() { - return dictTypeMapper.selectDictTypeAll(); + return list(); } /** @@ -76,7 +94,10 @@ public class SysDictTypeServiceImpl extends ServiceImpl() + .eq(SysDictData::getStatus, 0) + .eq(SysDictData::getDictType, dictType) + .orderByAsc(SysDictData::getDictSort)); if (CollUtil.isNotEmpty(dictDatas)) { DictUtils.setDictCache(dictType, dictDatas); return dictDatas; @@ -92,7 +113,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl().eq(SysDictType::getDictType, dictType)); } /** @@ -116,11 +137,12 @@ public class SysDictTypeServiceImpl extends ServiceImpl 0) { + if (dictDataMapper.selectCount(new LambdaQueryWrapper() + .eq(SysDictData::getDictType, dictType.getDictType())) > 0) { throw new CustomException(String.format("%1$s已分配,不能删除", dictType.getDictName())); } } - int count = dictTypeMapper.deleteDictTypeByIds(dictIds); + int count = baseMapper.deleteBatchIds(Arrays.asList(dictIds)); if (count > 0) { DictUtils.clearDictCache(); } @@ -143,7 +165,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl 0) { DictUtils.clearDictCache(); } @@ -159,9 +181,11 @@ public class SysDictTypeServiceImpl extends ServiceImpl() + .set(SysDictData::getDictType, dictType.getDictType()) + .eq(SysDictData::getDictType, oldDict.getDictType())); + int row = dictTypeMapper.updateById(dictType); if (row > 0) { DictUtils.clearDictCache(); } @@ -177,7 +201,9 @@ public class SysDictTypeServiceImpl extends ServiceImpl() + .eq(SysDictType::getDictType, dict.getDictType()) + .last("limit 1")); if (Validator.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { return UserConstants.NOT_UNIQUE; } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index 83c7f983..07fc5d62 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -22,39 +22,6 @@ - - select d.dept_id, - d.parent_id, - d.ancestors, - d.dept_name, - d.order_num, - d.leader, - d.phone, - d.email, - d.status, - d.del_flag, - d.create_by, - d.create_time - from sys_dept d - - - - - - - - - - - - - - - - - - insert into sys_dept( - dept_id, - parent_id, - dept_name, - ancestors, - order_num, - leader, - phone, - email, - status, - create_by, - create_time - )values( - #{deptId}, - #{parentId}, - #{deptName}, - #{ancestors}, - #{orderNum}, - #{leader}, - #{phone}, - #{email}, - #{status}, - #{createBy}, - sysdate() - ) - - - - update sys_dept - - parent_id = #{parentId}, - dept_name = #{deptName}, - ancestors = #{ancestors}, - order_num = #{orderNum}, - leader = #{leader}, - phone = #{phone}, - email = #{email}, - status = #{status}, - update_by = #{updateBy}, - update_time = sysdate() - - where dept_id = #{deptId} - - - - update sys_dept set ancestors = - - when #{item.deptId} then #{item.ancestors} - - where dept_id in - - #{item.deptId} - - - - - update sys_dept - - status = #{status}, - update_by = #{updateBy}, - update_time = sysdate() - - where dept_id in (${ancestors}) - - - - update sys_dept - set del_flag = '2' - where dept_id = #{deptId} - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml index e99cebe2..f17d5937 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -20,124 +20,4 @@ - - select dict_code, - dict_sort, - dict_label, - dict_value, - dict_type, - css_class, - list_class, - is_default, - status, - create_by, - create_time, - remark - from sys_dict_data - - - - - - - - - - - - - - delete - from sys_dict_data - where dict_code = #{dictCode} - - - - delete from sys_dict_data where dict_code in - - #{dictCode} - - - - - update sys_dict_data - - dict_sort = #{dictSort}, - dict_label = #{dictLabel}, - dict_value = #{dictValue}, - dict_type = #{dictType}, - css_class = #{cssClass}, - list_class = #{listClass}, - is_default = #{isDefault}, - status = #{status}, - remark = #{remark}, - update_by = #{updateBy}, - update_time = sysdate() - - where dict_code = #{dictCode} - - - - update sys_dict_data - set dict_type = #{newDictType} - where dict_type = #{oldDictType} - - - - insert into sys_dict_data( - dict_sort, - dict_label, - dict_value, - dict_type, - css_class, - list_class, - is_default, - status, - remark, - create_by, - create_time - )values( - #{dictSort}, - #{dictLabel}, - #{dictValue}, - #{dictType}, - #{cssClass}, - #{listClass}, - #{isDefault}, - #{status}, - #{remark}, - #{createBy}, - sysdate() - ) - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml index 73142b65..9778f193 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml @@ -20,27 +20,6 @@ from sys_dict_type - - @@ -60,48 +39,4 @@ where dict_type = #{dictType} limit 1 - - delete - from sys_dict_type - where dict_id = #{dictId} - - - - delete from sys_dict_type where dict_id in - - #{dictId} - - - - - update sys_dict_type - - dict_name = #{dictName}, - dict_type = #{dictType}, - status = #{status}, - remark = #{remark}, - update_by = #{updateBy}, - update_time = sysdate() - - where dict_id = #{dictId} - - - - insert into sys_dict_type( - dict_name, - dict_type, - status, - remark, - create_by, - create_time - )values( - #{dictName}, - #{dictType}, - #{status}, - #{remark}, - #{createBy}, - sysdate() - ) - - \ No newline at end of file