提交 ba71deec authored 作者: 000516's avatar 000516

添加获取系统人员nick_name方法

......@@ -43,11 +43,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope> <!-- 确保运行时可用 -->
</dependency>
<!-- RuoYi Common DataSource -->
......
......@@ -81,7 +81,9 @@ public class SysDeptController extends BaseController
{
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(SecurityUtils.getUsername());
dept.setCreateUserId(SecurityUtils.getUserId());
dept.setCreateBy(SecurityUtils.getNickName());
return toAjax(deptDao.insertDept(dept));
}
......
......@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.sfa.common.core.enums.ECode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sfa.common.core.constant.UserConstants;
......@@ -215,7 +217,7 @@ public class SysDeptDaoImpl implements ISysDeptDao
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus()))
{
throw new ServiceException("部门停用,不允许新增");
throw new ServiceException(ECode.DEPT_STOP_ERROR);
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
return deptMapper.insertDept(dept);
......
......@@ -5,11 +5,11 @@ spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
server-addr: 192.168.100.38:8848
group: sfa
namespace: 9fb64726-e415-43e4-9e79-9be8d2666671
config:
server-addr: 127.0.0.1:8848
server-addr: 192.168.100.38:8848
file-extension: yaml
group: sfa
namespace: 9fb64726-e415-43e4-9e79-9be8d2666671
spring:
application:
name: wangxiaolu-sfa-system
cloud:
nacos:
discovery:
server-addr: 192.168.100.38:8848
group: sfa
namespace: 5ae12140-31d8-490a-9798-f923cb0e30d4
config:
server-addr: 192.168.100.38:8848
file-extension: yaml
group: sfa
namespace: 5ae12140-31d8-490a-9798-f923cb0e30d4
......@@ -114,7 +114,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertDept" parameterType="com.sfa.system.api.domain.SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptCode != null">dept_code,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
......@@ -123,9 +124,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createUserId != null and createUserId != ''">create_user_id,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="deptCode != null">#{deptCode},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
......@@ -135,6 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createUserId != null and createUserId != ''">#{createUserId},</if>
sysdate()
)
</insert>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论