mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 优化 用户头像 改为存储 ossId 使用转换模块转为 url 展示
This commit is contained in:
		@@ -22,6 +22,8 @@ public class OssUrlTranslationImpl implements TranslationInterface {
 | 
				
			|||||||
    public String translation(Object key, String other) {
 | 
					    public String translation(Object key, String other) {
 | 
				
			||||||
        if (key instanceof String ids) {
 | 
					        if (key instanceof String ids) {
 | 
				
			||||||
            return ossService.selectUrlByIds(ids);
 | 
					            return ossService.selectUrlByIds(ids);
 | 
				
			||||||
 | 
					        } else if (key instanceof Long id) {
 | 
				
			||||||
 | 
					            return ossService.selectUrlByIds(id.toString());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,7 +65,7 @@ public class SysUser extends BaseEntity {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 用户头像
 | 
					     * 用户头像
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private String avatar;
 | 
					    private Long avatar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 密码
 | 
					     * 密码
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,7 +78,7 @@ public class SysUserBo extends BaseEntity {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 头像地址
 | 
					     * 头像地址
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private String avatar;
 | 
					    private Long avatar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 密码
 | 
					     * 密码
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
package com.ruoyi.system.domain.vo;
 | 
					package com.ruoyi.system.domain.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.ruoyi.common.core.constant.UserConstants;
 | 
					import com.ruoyi.common.core.constant.UserConstants;
 | 
				
			||||||
 | 
					import com.ruoyi.common.translation.annotation.Translation;
 | 
				
			||||||
 | 
					import com.ruoyi.common.translation.constant.TransConstant;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.Serial;
 | 
					import java.io.Serial;
 | 
				
			||||||
@@ -64,7 +66,8 @@ public class SysUserVo implements Serializable {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 头像地址
 | 
					     * 头像地址
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private String avatar;
 | 
					    @Translation(type = TransConstant.OSS_ID_TO_URL)
 | 
				
			||||||
 | 
					    private Long avatar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 密码
 | 
					     * 密码
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -174,7 +174,7 @@ public interface ISysUserService {
 | 
				
			|||||||
     * @param avatar   头像地址
 | 
					     * @param avatar   头像地址
 | 
				
			||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    boolean updateUserAvatar(String userName, String avatar);
 | 
					    boolean updateUserAvatar(String userName, Long avatar);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 重置用户密码
 | 
					     * 重置用户密码
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,7 +65,7 @@ create table sys_user (
 | 
				
			|||||||
  email             varchar2(50)    default '',
 | 
					  email             varchar2(50)    default '',
 | 
				
			||||||
  phonenumber       varchar2(11)    default '',
 | 
					  phonenumber       varchar2(11)    default '',
 | 
				
			||||||
  sex               char(1)         default '0',
 | 
					  sex               char(1)         default '0',
 | 
				
			||||||
  avatar            varchar2(100)   default '',
 | 
					  avatar            number(20)      default null,
 | 
				
			||||||
  password          varchar2(100)   default '',
 | 
					  password          varchar2(100)   default '',
 | 
				
			||||||
  status            char(1)         default '0',
 | 
					  status            char(1)         default '0',
 | 
				
			||||||
  del_flag          char(1)         default '0',
 | 
					  del_flag          char(1)         default '0',
 | 
				
			||||||
@@ -106,8 +106,8 @@ comment on column sys_user.remark       is '备注';
 | 
				
			|||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
-- 初始化-用户信息表数据
 | 
					-- 初始化-用户信息表数据
 | 
				
			||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
insert into sys_user values(1,  103, 'admin', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 103, 1, sysdate, null, null, '管理员');
 | 
					insert into sys_user values(1,  103, 'admin', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 103, 1, sysdate, null, null, '管理员');
 | 
				
			||||||
insert into sys_user values(2,  105, 'lionli', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@qq.com',  '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 103, 1, sysdate, null, null, '测试员');
 | 
					insert into sys_user values(2,  105, 'lionli', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@qq.com',  '15666666666', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 103, 1, sysdate, null, null, '测试员');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,7 +67,7 @@ create table if not exists sys_user
 | 
				
			|||||||
    email       varchar(50)  default ''::varchar,
 | 
					    email       varchar(50)  default ''::varchar,
 | 
				
			||||||
    phonenumber varchar(11)  default ''::varchar,
 | 
					    phonenumber varchar(11)  default ''::varchar,
 | 
				
			||||||
    sex         char         default '0'::bpchar,
 | 
					    sex         char         default '0'::bpchar,
 | 
				
			||||||
    avatar      varchar(100) default ''::varchar,
 | 
					    avatar      int8,
 | 
				
			||||||
    password    varchar(100) default ''::varchar,
 | 
					    password    varchar(100) default ''::varchar,
 | 
				
			||||||
    status      char         default '0'::bpchar,
 | 
					    status      char         default '0'::bpchar,
 | 
				
			||||||
    del_flag    char         default '0'::bpchar,
 | 
					    del_flag    char         default '0'::bpchar,
 | 
				
			||||||
@@ -108,8 +108,8 @@ comment on column sys_user.remark is '备注';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
-- 初始化-用户信息表数据
 | 
					-- 初始化-用户信息表数据
 | 
				
			||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
insert into sys_user values(1,  103, 'admin', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', now(), 103, 1, now(), null, null, '管理员');
 | 
					insert into sys_user values(1,  103, 'admin', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', now(), 103, 1, now(), null, null, '管理员');
 | 
				
			||||||
insert into sys_user values(2,  105, 'ry',    '疯狂的狮子Li', 'sys_user', 'crazyLionLi@qq.com',  '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', now(), 103, 1, now(), null, null, '测试员');
 | 
					insert into sys_user values(2,  105, 'ry',    '疯狂的狮子Li', 'sys_user', 'crazyLionLi@qq.com',  '15666666666', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', now(), 103, 1, now(), null, null, '测试员');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@ create table sys_user (
 | 
				
			|||||||
  email             varchar(50)     default ''                 comment '用户邮箱',
 | 
					  email             varchar(50)     default ''                 comment '用户邮箱',
 | 
				
			||||||
  phonenumber       varchar(11)     default ''                 comment '手机号码',
 | 
					  phonenumber       varchar(11)     default ''                 comment '手机号码',
 | 
				
			||||||
  sex               char(1)         default '0'                comment '用户性别(0男 1女 2未知)',
 | 
					  sex               char(1)         default '0'                comment '用户性别(0男 1女 2未知)',
 | 
				
			||||||
  avatar            varchar(100)    default ''                 comment '头像地址',
 | 
					  avatar            bigint(20)                                 comment '头像地址',
 | 
				
			||||||
  password          varchar(100)    default ''                 comment '密码',
 | 
					  password          varchar(100)    default ''                 comment '密码',
 | 
				
			||||||
  status            char(1)         default '0'                comment '帐号状态(0正常 1停用)',
 | 
					  status            char(1)         default '0'                comment '帐号状态(0正常 1停用)',
 | 
				
			||||||
  del_flag          char(1)         default '0'                comment '删除标志(0代表存在 2代表删除)',
 | 
					  del_flag          char(1)         default '0'                comment '删除标志(0代表存在 2代表删除)',
 | 
				
			||||||
@@ -69,8 +69,8 @@ create table sys_user (
 | 
				
			|||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
-- 初始化-用户信息表数据
 | 
					-- 初始化-用户信息表数据
 | 
				
			||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
insert into sys_user values(1,  103, 'admin', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 103, 1, sysdate(), null, null, '管理员');
 | 
					insert into sys_user values(1,  103, 'admin', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@163.com', '15888888888', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 103, 1, sysdate(), null, null, '管理员');
 | 
				
			||||||
insert into sys_user values(2,  105, 'lionli', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@qq.com',  '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 103, 1, sysdate(), null, null, '测试员');
 | 
					insert into sys_user values(2,  105, 'lionli', '疯狂的狮子Li', 'sys_user', 'crazyLionLi@qq.com',  '15666666666', '1', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 103, 1, sysdate(), null, null, '测试员');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- ----------------------------
 | 
					-- ----------------------------
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1960,7 +1960,7 @@ CREATE TABLE [sys_user]
 | 
				
			|||||||
    [email]       nvarchar(50)  DEFAULT ''           NULL,
 | 
					    [email]       nvarchar(50)  DEFAULT ''           NULL,
 | 
				
			||||||
    [phonenumber] nvarchar(11)  DEFAULT ''           NULL,
 | 
					    [phonenumber] nvarchar(11)  DEFAULT ''           NULL,
 | 
				
			||||||
    [sex]         nchar(1)      DEFAULT ('0')        NULL,
 | 
					    [sex]         nchar(1)      DEFAULT ('0')        NULL,
 | 
				
			||||||
    [avatar]      nvarchar(100) DEFAULT ''           NULL,
 | 
					    [avatar]      bigint                             NULL,
 | 
				
			||||||
    [password]    nvarchar(100) DEFAULT ''           NULL,
 | 
					    [password]    nvarchar(100) DEFAULT ''           NULL,
 | 
				
			||||||
    [status]      nchar(1)      DEFAULT ('0')        NULL,
 | 
					    [status]      nchar(1)      DEFAULT ('0')        NULL,
 | 
				
			||||||
    [del_flag]    nchar(1)      DEFAULT ('0')        NULL,
 | 
					    [del_flag]    nchar(1)      DEFAULT ('0')        NULL,
 | 
				
			||||||
@@ -2105,9 +2105,9 @@ EXEC sys.sp_addextendedproperty
 | 
				
			|||||||
    'TABLE', N'sys_user'
 | 
					    'TABLE', N'sys_user'
 | 
				
			||||||
GO
 | 
					GO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INSERT [sys_user] ([user_id], [dept_id], [user_name], [nick_name], [user_type], [email], [phonenumber], [sex], [avatar], [password], [status], [del_flag], [login_ip], [login_date], [create_dept], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1, 103, N'admin', N'疯狂的狮子Li', N'sys_user', N'crazyLionLi@163.com', N'15888888888', N'1', N'', N'$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', N'0', N'0', N'127.0.0.1', getdate(), 103, 1, getdate(), NULL, getdate(), N'管理员')
 | 
					INSERT [sys_user] ([user_id], [dept_id], [user_name], [nick_name], [user_type], [email], [phonenumber], [sex], [avatar], [password], [status], [del_flag], [login_ip], [login_date], [create_dept], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (1, 103, N'admin', N'疯狂的狮子Li', N'sys_user', N'crazyLionLi@163.com', N'15888888888', N'1', NULL, N'$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', N'0', N'0', N'127.0.0.1', getdate(), 103, 1, getdate(), NULL, getdate(), N'管理员')
 | 
				
			||||||
GO
 | 
					GO
 | 
				
			||||||
INSERT [sys_user] ([user_id], [dept_id], [user_name], [nick_name], [user_type], [email], [phonenumber], [sex], [avatar], [password], [status], [del_flag], [login_ip], [login_date], [create_dept], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (2, 105, N'ry', N'疯狂的狮子Li', N'sys_user', N'crazyLionLi@qq.com', N'15666666666', N'1', N'', N'$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', N'0', N'0', N'127.0.0.1', getdate(), 103, 1, getdate(), 1, getdate(), N'测试员')
 | 
					INSERT [sys_user] ([user_id], [dept_id], [user_name], [nick_name], [user_type], [email], [phonenumber], [sex], [avatar], [password], [status], [del_flag], [login_ip], [login_date], [create_dept], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (2, 105, N'ry', N'疯狂的狮子Li', N'sys_user', N'crazyLionLi@qq.com', N'15666666666', N'1', NULL, N'$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', N'0', N'0', N'127.0.0.1', getdate(), 103, 1, getdate(), 1, getdate(), N'测试员')
 | 
				
			||||||
GO
 | 
					GO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CREATE TABLE [sys_user_post]
 | 
					CREATE TABLE [sys_user_post]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user