master
冯凯 2023-11-21 09:14:37 +08:00
parent 4cfdee9a3a
commit 7f4984655b
1 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.validation.Validator; import javax.validation.Validator;
@ -241,8 +242,12 @@ public class SysUserServiceImpl implements ISysUserService {
* @return * @return
*/ */
@Override @Override
@Transactional
public boolean registerUser(SysUser user) { public boolean registerUser(SysUser user) {
return userMapper.insertUser(user) > 0; Assert.state(userMapper.insertUser(user) > 0,StringUtils.format("添加{}失败",user.getUserName()));
user.setRoleId(3L);
this.insertUserRole(user);//新增用户角色 默认给公司角色
return true;
} }
/** /**