From 07590f30f634d3953e7aeea0f4f211cf6d9e884a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sun, 5 Feb 2023 12:15:43 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=A4=B4=E5=83=8F=20=E6=94=B9=E4=B8=BA=E5=AD=98?= =?UTF-8?q?=E5=82=A8=20ossId=20=E4=BD=BF=E7=94=A8=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E8=BD=AC=E4=B8=BA=20url=20=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/translation/core/impl/OssUrlTranslationImpl.java | 2 ++ .../src/main/java/com/ruoyi/system/domain/SysUser.java | 2 +- .../src/main/java/com/ruoyi/system/domain/bo/SysUserBo.java | 2 +- .../src/main/java/com/ruoyi/system/domain/vo/SysUserVo.java | 5 ++++- .../main/java/com/ruoyi/system/service/ISysUserService.java | 2 +- script/sql/oracle/oracle_ry_vue_5.X.sql | 6 +++--- script/sql/postgres/postgres_ry_vue_5.X.sql | 6 +++--- script/sql/ry_vue_5.X.sql | 6 +++--- script/sql/sqlserver/sqlserver_ry_vue_5.X.sql | 6 +++--- 9 files changed, 21 insertions(+), 16 deletions(-) diff --git a/ruoyi-common/ruoyi-common-translation/src/main/java/com/ruoyi/common/translation/core/impl/OssUrlTranslationImpl.java b/ruoyi-common/ruoyi-common-translation/src/main/java/com/ruoyi/common/translation/core/impl/OssUrlTranslationImpl.java index 00a3f384..02eff57f 100644 --- a/ruoyi-common/ruoyi-common-translation/src/main/java/com/ruoyi/common/translation/core/impl/OssUrlTranslationImpl.java +++ b/ruoyi-common/ruoyi-common-translation/src/main/java/com/ruoyi/common/translation/core/impl/OssUrlTranslationImpl.java @@ -22,6 +22,8 @@ public class OssUrlTranslationImpl implements TranslationInterface { public String translation(Object key, String other) { if (key instanceof String ids) { return ossService.selectUrlByIds(ids); + } else if (key instanceof Long id) { + return ossService.selectUrlByIds(id.toString()); } return null; } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java index 42cfb96e..0338b376 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java @@ -65,7 +65,7 @@ public class SysUser extends BaseEntity { /** * 用户头像 */ - private String avatar; + private Long avatar; /** * 密码 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysUserBo.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysUserBo.java index 10dd782b..286f678e 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysUserBo.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SysUserBo.java @@ -78,7 +78,7 @@ public class SysUserBo extends BaseEntity { /** * 头像地址 */ - private String avatar; + private Long avatar; /** * 密码 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserVo.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserVo.java index fb7fc0eb..a847c3fa 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserVo.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserVo.java @@ -1,6 +1,8 @@ package com.ruoyi.system.domain.vo; 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 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; /** * 密码 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java index 49bb38e3..dd9bccc4 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -174,7 +174,7 @@ public interface ISysUserService { * @param avatar 头像地址 * @return 结果 */ - boolean updateUserAvatar(String userName, String avatar); + boolean updateUserAvatar(String userName, Long avatar); /** * 重置用户密码 diff --git a/script/sql/oracle/oracle_ry_vue_5.X.sql b/script/sql/oracle/oracle_ry_vue_5.X.sql index e1e805d4..46e3ba1d 100644 --- a/script/sql/oracle/oracle_ry_vue_5.X.sql +++ b/script/sql/oracle/oracle_ry_vue_5.X.sql @@ -65,7 +65,7 @@ create table sys_user ( email varchar2(50) default '', phonenumber varchar2(11) default '', sex char(1) default '0', - avatar varchar2(100) default '', + avatar number(20) default null, password varchar2(100) default '', status 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(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(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', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate, 103, 1, sysdate, null, null, '测试员'); -- ---------------------------- diff --git a/script/sql/postgres/postgres_ry_vue_5.X.sql b/script/sql/postgres/postgres_ry_vue_5.X.sql index afdbb359..a50251fe 100644 --- a/script/sql/postgres/postgres_ry_vue_5.X.sql +++ b/script/sql/postgres/postgres_ry_vue_5.X.sql @@ -67,7 +67,7 @@ create table if not exists sys_user email varchar(50) default ''::varchar, phonenumber varchar(11) default ''::varchar, sex char default '0'::bpchar, - avatar varchar(100) default ''::varchar, + avatar int8, password varchar(100) default ''::varchar, status 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(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(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', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', now(), 103, 1, now(), null, null, '测试员'); -- ---------------------------- diff --git a/script/sql/ry_vue_5.X.sql b/script/sql/ry_vue_5.X.sql index a91bb5c5..608b1dc2 100644 --- a/script/sql/ry_vue_5.X.sql +++ b/script/sql/ry_vue_5.X.sql @@ -51,7 +51,7 @@ create table sys_user ( email varchar(50) default '' comment '用户邮箱', phonenumber varchar(11) default '' comment '手机号码', sex char(1) default '0' comment '用户性别(0男 1女 2未知)', - avatar varchar(100) default '' comment '头像地址', + avatar bigint(20) comment '头像地址', password varchar(100) default '' comment '密码', status char(1) default '0' comment '帐号状态(0正常 1停用)', 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(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(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', null, '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 103, 1, sysdate(), null, null, '测试员'); -- ---------------------------- diff --git a/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql index f225b379..212067d6 100644 --- a/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql +++ b/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql @@ -1960,7 +1960,7 @@ CREATE TABLE [sys_user] [email] nvarchar(50) DEFAULT '' NULL, [phonenumber] nvarchar(11) DEFAULT '' NULL, [sex] nchar(1) DEFAULT ('0') NULL, - [avatar] nvarchar(100) DEFAULT '' NULL, + [avatar] bigint NULL, [password] nvarchar(100) DEFAULT '' NULL, [status] nchar(1) DEFAULT ('0') NULL, [del_flag] nchar(1) DEFAULT ('0') NULL, @@ -2105,9 +2105,9 @@ EXEC sys.sp_addextendedproperty 'TABLE', N'sys_user' 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 -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 CREATE TABLE [sys_user_post]