Browse Source

[fix]

基础资料 部门管理
修改部门管理插入mapper方法,修改创建时间赋值语句;
修改部门管理新增service方法,新增设置当前时间为创建时间语句;
dev
王晓迪 1 month ago
parent
commit
61e3574822
  1. 3
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java
  2. 4
      ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

3
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java

@ -3,6 +3,8 @@ package com.ruoyi.system.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -203,6 +205,7 @@ public class SysDeptServiceImpl implements ISysDeptService
throw new BusinessException("部门停用,不允许新增"); throw new BusinessException("部门停用,不允许新增");
} }
dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
dept.setCreateTime(DateUtils.getNowDate());
return deptMapper.insertDept(dept); return deptMapper.insertDept(dept);
} }

4
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">email,</if> <if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time <if test="createTime != null">create_time</if>
)values( )values(
<if test="deptId != null and deptId != 0">#{deptId},</if> <if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if> <if test="parentId != null and parentId != 0">#{parentId},</if>
@ -108,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">#{email},</if> <if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() <if test="createTime != null">#{createTime}</if>
) )
</insert> </insert>

Loading…
Cancel
Save