mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-12-12 20:29:27 +08:00
⚡ 增加创建部门ID入库逻辑
This commit is contained in:
parent
823bdca0b4
commit
945efc8fbf
@ -25,6 +25,7 @@ import org.springblade.core.secure.BladeUser;
|
|||||||
import org.springblade.core.secure.utils.SecureUtil;
|
import org.springblade.core.secure.utils.SecureUtil;
|
||||||
import org.springblade.core.tool.constant.BladeConstant;
|
import org.springblade.core.tool.constant.BladeConstant;
|
||||||
import org.springblade.core.tool.utils.DateUtil;
|
import org.springblade.core.tool.utils.DateUtil;
|
||||||
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
@ -86,6 +87,7 @@ public class BaseServiceImpl<M extends BaseMapper<T>, T extends BaseEntity> exte
|
|||||||
BladeUser user = SecureUtil.getUser();
|
BladeUser user = SecureUtil.getUser();
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
entity.setCreateUser(user.getUserId());
|
entity.setCreateUser(user.getUserId());
|
||||||
|
entity.setCreateDept(Func.firstLong(user.getDeptId()));
|
||||||
entity.setUpdateUser(user.getUserId());
|
entity.setUpdateUser(user.getUserId());
|
||||||
}
|
}
|
||||||
Date now = DateUtil.now();
|
Date now = DateUtil.now();
|
||||||
|
@ -726,6 +726,32 @@ public class Func {
|
|||||||
return Arrays.asList(toLongArray(split, str));
|
return Arrays.asList(toLongArray(split, str));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取第一位Long数值
|
||||||
|
*
|
||||||
|
* @param str 被转换的值
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Long firstLong(String str) {
|
||||||
|
return firstLong(",", str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取第一位Long数值
|
||||||
|
*
|
||||||
|
* @param split 分隔符
|
||||||
|
* @param str 被转换的值
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static Long firstLong(String split, String str) {
|
||||||
|
List<Long> longs = toLongList(split, str);
|
||||||
|
if (isEmpty(longs)) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return longs.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为String数组<br>
|
* 转换为String数组<br>
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user