xiangpei
2025-02-19 e3b2e29d1501e4e35806fa74105b3af4ffe1b768
部门新增修改接口调整
3个文件已修改
9 ■■■■■ 已修改文件
start/src/main/java/com/ycl/web/controller/system/SysDeptController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
system/src/main/java/com/ycl/system/service/impl/SysDeptServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
system/src/main/resources/mapper/system/SysDeptMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
start/src/main/java/com/ycl/web/controller/system/SysDeptController.java
@@ -1,6 +1,7 @@
package com.ycl.web.controller.system;
import java.util.List;
import java.util.Objects;
import com.ycl.common.base.Result;
import com.ycl.common.core.domain.StringTreeSelect;
@@ -113,7 +114,7 @@
        {
            return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
        }
        else if (dept.getParentId().equals(deptId))
        else if (Objects.nonNull(dept.getParentId()) && dept.getParentId().equals(deptId))
        {
            return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
        }
system/src/main/java/com/ycl/system/service/impl/SysDeptServiceImpl.java
@@ -299,7 +299,7 @@
                updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors);
            }
        } else {
            dept.setDeptId(0L);
            dept.setParentId(0L);
            dept.setAncestors("");
        }
        int result = deptMapper.updateDept(dept);
system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -135,9 +135,9 @@
    <update id="updateDept" parameterType="SysDept">
         update sys_dept
         <set>
             <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
             <if test="parentId != null">parent_id = #{parentId},</if>
             <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
             <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
             <if test="ancestors != null">ancestors = #{ancestors},</if>
             <if test="orderNum != null">order_num = #{orderNum},</if>
             <if test="leader != null">leader = #{leader},</if>
             <if test="phone != null">phone = #{phone},</if>