| | |
| | | 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; |
| | |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | else if (Objects.nonNull(dept.getParentId()) && dept.getParentId().equals(deptId)) |
| | | { |
| | | return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } |
| | |
| | | updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); |
| | | } |
| | | } else { |
| | | dept.setDeptId(0L); |
| | | dept.setParentId(0L); |
| | | dept.setAncestors(""); |
| | | } |
| | | int result = deptMapper.updateDept(dept); |
| | |
| | | <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> |