Complete core functions #9

Merged
FatttSnake merged 171 commits from FatttSnake into dev 2024-02-23 11:56:35 +08:00
51 changed files with 1074 additions and 1072 deletions
Showing only changes of commit 251e1278f1 - Show all commits

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_func") @TableName("t_s_func")
class Func : Serializable { class Func : Serializable {
/** /**
* ID * ID

View File

@@ -10,7 +10,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_group") @TableName("t_s_group")
class Group : Serializable { class Group : Serializable {
/** /**
* ID * ID

View File

@@ -11,7 +11,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_menu") @TableName("t_s_menu")
class Menu : Serializable { class Menu : Serializable {
/** /**
* ID * ID

View File

@@ -11,7 +11,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_module") @TableName("t_s_module")
class Module : Serializable { class Module : Serializable {
/** /**
* ID * ID

View File

@@ -11,7 +11,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_operation") @TableName("t_s_operation")
class Operation : Serializable { class Operation : Serializable {
/** /**
* ID * ID

View File

@@ -11,7 +11,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_power") @TableName("t_s_power")
class Power : Serializable { class Power : Serializable {
/** /**
* ID * ID

View File

@@ -9,7 +9,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_power_role") @TableName("t_r_power_role")
class PowerRole : Serializable { class PowerRole : Serializable {
/** /**
* ID * ID

View File

@@ -11,7 +11,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_power_type") @TableName("t_s_power_type")
class PowerType : Serializable { class PowerType : Serializable {
/** /**
* ID * ID

View File

@@ -10,7 +10,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_role") @TableName("t_s_role")
class Role : Serializable { class Role : Serializable {
/** /**
* ID * ID

View File

@@ -9,7 +9,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_role_group") @TableName("t_r_role_group")
class RoleGroup : Serializable { class RoleGroup : Serializable {
/** /**
* ID * ID

View File

@@ -10,7 +10,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_user") @TableName("t_s_user")
class User() : Serializable { class User() : Serializable {
constructor(id: Long?, username: String, password: String, enable: Boolean = true) : this() { constructor(id: Long?, username: String, password: String, enable: Boolean = true) : this() {
this.id = id this.id = id

View File

@@ -9,7 +9,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_user_group") @TableName("t_r_user_group")
class UserGroup : Serializable { class UserGroup : Serializable {
/** /**
* ID * ID

View File

@@ -10,7 +10,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_user_info") @TableName("t_s_user_info")
class UserInfo : Serializable { class UserInfo : Serializable {
/** /**
* ID * ID

View File

@@ -9,7 +9,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_user_role") @TableName("t_r_user_role")
class UserRole : Serializable { class UserRole : Serializable {
/** /**
* ID * ID

View File

@@ -15,7 +15,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_event_log") @TableName("t_l_event_log")
class EventLog : Serializable { class EventLog : Serializable {
enum class Event(@field:EnumValue @field:JsonValue val code: String) { enum class Event(@field:EnumValue @field:JsonValue val code: String) {
LOGIN("LOGIN"), LOGOUT("LOGOUT"), REGISTER("REGISTER"), VERIFY("VERIFY"), API("API") LOGIN("LOGIN"), LOGOUT("LOGOUT"), REGISTER("REGISTER"), VERIFY("VERIFY"), API("API")

View File

@@ -14,7 +14,7 @@ import java.io.Serializable
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_sensitive_word", autoResultMap = true) @TableName("t_s_sensitive_word", autoResultMap = true)
class SensitiveWord : Serializable { class SensitiveWord : Serializable {
enum class Use(@field:EnumValue @field:JsonValue val code: String) { enum class Use(@field:EnumValue @field:JsonValue val code: String) {
USERNAME("USERNAME"), TITLE("TITLE"); USERNAME("USERNAME"), TITLE("TITLE");

View File

@@ -15,7 +15,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_statistics_log") @TableName("t_l_statistics_log")
class StatisticsLog : Serializable { class StatisticsLog : Serializable {
enum class KeyItem(@field:EnumValue @field:JsonValue val code: String) { enum class KeyItem(@field:EnumValue @field:JsonValue val code: String) {
ONLINE_USERS_COUNT("ONLINE_USER_COUNT") ONLINE_USERS_COUNT("ONLINE_USER_COUNT")

View File

@@ -15,7 +15,7 @@ import java.time.LocalDateTime
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@TableName("t_sys_log") @TableName("t_l_sys_log")
class SysLog : Serializable { class SysLog : Serializable {
/** /**
* Log type enum * Log type enum

View File

@@ -1,6 +1,5 @@
package top.fatweb.oxygen.api.service.system.impl package top.fatweb.oxygen.api.service.system.impl
import com.baomidou.dynamic.datasource.annotation.DS
import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper import com.baomidou.mybatisplus.extension.kotlin.KtUpdateWrapper
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
@@ -22,7 +21,6 @@ import top.fatweb.oxygen.api.vo.system.SensitiveWordVo
* @author FatttSnake, fatttsnake@gmail.com * @author FatttSnake, fatttsnake@gmail.com
* @since 1.0.0 * @since 1.0.0
*/ */
@DS("sqlite")
@Service @Service
class SensitiveWordServiceImpl : ServiceImpl<SensitiveWordMapper, SensitiveWord>(), ISensitiveWordService { class SensitiveWordServiceImpl : ServiceImpl<SensitiveWordMapper, SensitiveWord>(), ISensitiveWordService {
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)

View File

@@ -1,11 +1,11 @@
insert into t_power_type (id, name) insert into t_s_power_type (id, name)
values (1, 'module'), values (1, 'module'),
(2, 'menu'), (2, 'menu'),
(3, 'func'), (3, 'func'),
(4, 'operation') as new_value (4, 'operation') as new_value
on duplicate key update name = new_value.name; on duplicate key update name = new_value.name;
insert into t_power (id, type_id) insert into t_s_power (id, type_id)
values (1000000, 1), values (1000000, 1),
(1990000, 2), (1990000, 2),
(1010000, 2), (1010000, 2),
@@ -70,11 +70,11 @@ insert into t_power (id, type_id)
as new_value as new_value
on duplicate key update type_id = new_value.type_id; on duplicate key update type_id = new_value.type_id;
insert into t_module (id, name) insert into t_s_module (id, name)
values (1000000, '系统') as new_value values (1000000, '系统') as new_value
on duplicate key update name = new_value.name; on duplicate key update name = new_value.name;
insert into t_menu (id, name, url, parent_id, module_id) insert into t_s_menu (id, name, url, parent_id, module_id)
values (1990000, '系统管理', '/system', null, 1000000), values (1990000, '系统管理', '/system', null, 1000000),
(1010000, '用户管理', '/system/user', 1990000, 1000000), (1010000, '用户管理', '/system/user', 1990000, 1000000),
(1020000, '角色管理', '/system/role', 1990000, 1000000), (1020000, '角色管理', '/system/role', 1990000, 1000000),
@@ -87,7 +87,7 @@ on duplicate key update name =new_value.name,
url =new_value.url, url =new_value.url,
parent_id =new_value.parent_id; parent_id =new_value.parent_id;
insert into t_func(id, name, menu_id, parent_id) insert into t_s_func(id, name, menu_id, parent_id)
values (1010100, '查询', 1010000, null), values (1010100, '查询', 1010000, null),
(1010200, '增加', 1010000, null), (1010200, '增加', 1010000, null),
(1010300, '修改', 1010000, null), (1010300, '修改', 1010000, null),
@@ -109,7 +109,7 @@ on duplicate key update name = new_value.name,
menu_id = new_value.menu_id, menu_id = new_value.menu_id,
parent_id = new_value.parent_id; parent_id = new_value.parent_id;
insert into t_operation(id, name, code, func_id) insert into t_s_operation(id, name, code, func_id)
values (1010101, '单个', 'system:user:query:one', 1010100), values (1010101, '单个', 'system:user:query:one', 1010100),
(1010102, '全部', 'system:user:query:all', 1010100), (1010102, '全部', 'system:user:query:all', 1010100),
(1010103, '列表', 'system:user:query:list', 1010100), (1010103, '列表', 'system:user:query:list', 1010100),

View File

@@ -0,0 +1,25 @@
drop table if exists t_s_user;
create table if not exists t_s_user
(
id bigint not null primary key,
username varchar(20) not null comment '用户名',
password char(70) not null comment '密码',
verify varchar(144) null comment '验证邮箱',
forget varchar(144) null comment '忘记密码',
locking int not null comment '锁定',
expiration datetime comment '过期时间',
credentials_expiration datetime comment '认证过期时间',
enable int not null comment '启用',
current_login_time datetime comment '当前登录时间',
current_login_ip varchar(128) comment '当前登录 IP',
last_login_time datetime comment '上次登录时间',
last_login_ip varchar(128) comment '上次登录 IP',
create_time datetime not null default (utc_timestamp()) comment '创建时间',
update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0,
version int not null default 0,
constraint t_s_user_unique_username unique (username, deleted),
constraint t_s_user_unique_verify unique (verify, deleted),
constraint t_s_user_unique_forget unique (forget, deleted)
) comment '系统-用户表';

View File

@@ -1,25 +0,0 @@
drop table if exists t_user;
create table if not exists t_user
(
id bigint not null primary key,
username varchar(20) not null comment '用户名',
password char(70) not null comment '密码',
verify varchar(144) null comment '验证邮箱',
forget varchar(144) null comment '忘记密码',
locking int not null comment '锁定',
expiration datetime comment '过期时间',
credentials_expiration datetime comment '认证过期时间',
enable int not null comment '启用',
current_login_time datetime comment '当前登录时间',
current_login_ip varchar(128) comment '当前登录 IP',
last_login_time datetime comment '上次登录时间',
last_login_ip varchar(128) comment '上次登录 IP',
create_time datetime not null default (utc_timestamp()) comment '创建时间',
update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0,
version int not null default 0,
constraint t_user_unique_username unique (username, deleted),
constraint t_user_unique_verify unique (verify, deleted),
constraint t_user_unique_forget unique (forget, deleted)
) comment '用户表';

View File

@@ -1,7 +0,0 @@
drop table if exists t_power_type;
create table if not exists t_power_type
(
id bigint not null primary key,
name varchar(50) not null comment '权限类型名'
) comment '权限类型表';

View File

@@ -0,0 +1,7 @@
drop table if exists t_s_power_type;
create table if not exists t_s_power_type
(
id bigint not null primary key,
name varchar(50) not null comment '权限类型名'
) comment '系统-权限类型表';

View File

@@ -1,7 +0,0 @@
drop table if exists t_power;
create table if not exists t_power
(
id bigint not null primary key,
type_id int not null comment '权限类型'
) comment '权限表';

View File

@@ -0,0 +1,7 @@
drop table if exists t_s_power;
create table if not exists t_s_power
(
id bigint not null primary key,
type_id int not null comment '权限类型'
) comment '系统-权限表';

View File

@@ -1,10 +1,10 @@
drop table if exists t_menu; drop table if exists t_s_menu;
create table if not exists t_menu create table if not exists t_s_menu
( (
id bigint not null primary key, id bigint not null primary key,
name varchar(30) not null comment ' 菜单名', name varchar(30) not null comment ' 菜单名',
url varchar(100) null comment 'URL', url varchar(100) null comment 'URL',
parent_id bigint null comment '父ID', parent_id bigint null comment '父ID',
module_id bigint not null comment '模块ID' module_id bigint not null comment '模块ID'
) comment '菜单表'; ) comment '系统-菜单表';

View File

@@ -1,9 +1,9 @@
drop table if exists t_func; drop table if exists t_s_func;
create table if not exists t_func create table if not exists t_s_func
( (
id bigint not null primary key, id bigint not null primary key,
name varchar(100) not null comment '功能名', name varchar(100) not null comment '功能名',
parent_id bigint null comment '父ID', parent_id bigint null comment '父ID',
menu_id bigint not null comment '菜单ID' menu_id bigint not null comment '菜单ID'
) comment '功能表'; ) comment '系统-功能表';

View File

@@ -1,9 +0,0 @@
drop table if exists t_operation;
create table if not exists t_operation
(
id bigint not null primary key,
name varchar(50) not null comment '操作名',
code varchar(50) null comment '操作编码',
func_id bigint not null comment '功能ID'
) comment '操作表';

View File

@@ -0,0 +1,9 @@
drop table if exists t_s_operation;
create table if not exists t_s_operation
(
id bigint not null primary key,
name varchar(50) not null comment '操作名',
code varchar(50) null comment '操作编码',
func_id bigint not null comment '功能ID'
) comment '系统-操作表';

View File

@@ -1,13 +0,0 @@
drop table if exists t_group;
create table if not exists t_group
(
id bigint not null primary key,
name varchar(30) not null comment '用户组名',
enable int not null comment '启用',
create_time datetime not null default (utc_timestamp()) comment '创建时间',
update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0,
version int not null default 0,
constraint t_group_unique unique (name, deleted)
) comment '用户组表';

View File

@@ -0,0 +1,13 @@
drop table if exists t_s_group;
create table if not exists t_s_group
(
id bigint not null primary key,
name varchar(30) not null comment '用户组名',
enable int not null comment '启用',
create_time datetime not null default (utc_timestamp()) comment '创建时间',
update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0,
version int not null default 0,
constraint t_s_group_unique unique (name, deleted)
) comment '系统-用户组表';

View File

@@ -1,10 +1,10 @@
drop table if exists t_user_group; drop table if exists t_r_user_group;
create table if not exists t_user_group create table if not exists t_r_user_group
( (
id bigint not null primary key, id bigint not null primary key,
user_id bigint not null comment '用户', user_id bigint not null comment '用户',
group_id bigint not null comment '用户组', group_id bigint not null comment '用户组',
deleted bigint not null default 0, deleted bigint not null default 0,
version int not null default 0 version int not null default 0
) comment '中间表-用户-用户组'; ) comment '中间表-系统-用户-用户组';

View File

@@ -1,13 +0,0 @@
drop table if exists t_role;
create table if not exists t_role
(
id bigint not null primary key,
name varchar(20) not null comment '角色名',
enable int not null comment '启用',
create_time datetime not null default (utc_timestamp()) comment '创建时间',
update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0,
version int not null default 0,
constraint t_role_unique unique (name, deleted)
) comment '角色表';

View File

@@ -0,0 +1,13 @@
drop table if exists t_s_role;
create table if not exists t_s_role
(
id bigint not null primary key,
name varchar(20) not null comment '角色名',
enable int not null comment '启用',
create_time datetime not null default (utc_timestamp()) comment '创建时间',
update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0,
version int not null default 0,
constraint t_s_role_unique unique (name, deleted)
) comment '系统-角色表';

View File

@@ -1,10 +1,10 @@
drop table if exists t_role_group; drop table if exists t_r_role_group;
create table if not exists t_role_group create table if not exists t_r_role_group
( (
id bigint not null primary key, id bigint not null primary key,
role_id bigint not null comment '角色', role_id bigint not null comment '角色',
group_id bigint not null comment '用户组', group_id bigint not null comment '用户组',
deleted bigint not null default 0, deleted bigint not null default 0,
version int not null default 0 version int not null default 0
) comment '中间表-角色-用户组'; ) comment '中间表-系统-角色-用户组';

View File

@@ -1,10 +1,10 @@
drop table if exists t_user_role; drop table if exists t_r_user_role;
create table if not exists t_user_role create table if not exists t_r_user_role
( (
id bigint not null primary key, id bigint not null primary key,
user_id bigint not null comment '用户', user_id bigint not null comment '用户',
role_id bigint not null comment '角色', role_id bigint not null comment '角色',
deleted bigint not null default 0, deleted bigint not null default 0,
version int not null default 0 version int not null default 0
) comment '中间表-用户-角色'; ) comment '中间表-系统-用户-角色';

View File

@@ -1,10 +1,10 @@
drop table if exists t_power_role; drop table if exists t_r_power_role;
create table if not exists t_power_role create table if not exists t_r_power_role
( (
id bigint not null primary key, id bigint not null primary key,
power_id bigint not null comment '权限', power_id bigint not null comment '权限',
role_id bigint not null comment '角色', role_id bigint not null comment '角色',
deleted bigint not null default 0, deleted bigint not null default 0,
version int not null default 0 version int not null default 0
) comment '中间表-权限-角色'; ) comment '中间表-系统-权限-角色';

View File

@@ -1,7 +0,0 @@
drop table if exists t_module;
create table if not exists t_module
(
id bigint not null primary key,
name varchar(100) not null comment '模块名'
) comment '模块表';

View File

@@ -0,0 +1,7 @@
drop table if exists t_s_module;
create table if not exists t_s_module
(
id bigint not null primary key,
name varchar(100) not null comment '模块名'
) comment '系统-模块表';

View File

@@ -1,6 +1,6 @@
drop table if exists t_user_info; drop table if exists t_s_user_info;
create table if not exists t_user_info create table if not exists t_s_user_info
( (
id bigint not null primary key, id bigint not null primary key,
user_id bigint not null comment '用户ID', user_id bigint not null comment '用户ID',
@@ -11,6 +11,6 @@ create table if not exists t_user_info
update_time datetime not null default (utc_timestamp()) comment '修改时间', update_time datetime not null default (utc_timestamp()) comment '修改时间',
deleted bigint not null default 0, deleted bigint not null default 0,
version int not null default 0, version int not null default 0,
constraint t_user_info_unique_user_id unique (user_id, deleted), constraint t_s_user_info_unique_user_id unique (user_id, deleted),
constraint t_user_info_unique_email unique (email, deleted) constraint t_s_user_info_unique_email unique (email, deleted)
) comment '用户资料表'; ) comment '系统-用户资料表';

View File

@@ -0,0 +1,12 @@
drop table if exists t_s_sensitive_word;
create table if not exists t_s_sensitive_word
(
id bigint not null primary key,
word varchar(400) not null comment '',
use_for varchar(50) null comment '用于',
enable int not null default 1 comment '启用',
deleted bigint not null default 0,
version int not null default 0,
constraint t_s_sensitive_word_unique_word unique (word, deleted)
) comment '系统-敏感词表';

View File

@@ -1,6 +1,6 @@
drop table if exists t_sys_log; drop table if exists t_l_sys_log;
create table t_sys_log -- 系统日志表 create table t_l_sys_log -- 本地-系统日志表
( (
id integer not null, id integer not null,
log_type text not null, -- 日志类型 log_type text not null, -- 日志类型

View File

@@ -1,6 +1,6 @@
drop table if exists t_event_log; drop table if exists t_l_event_log;
create table if not exists t_event_log -- 事件日志表 create table if not exists t_l_event_log -- 本地-事件日志表
( (
id integer not null primary key, id integer not null primary key,
event text not null, -- 事件, event text not null, -- 事件,

View File

@@ -1,6 +1,6 @@
drop table if exists t_statistics_log; drop table if exists t_l_statistics_log;
create table if not exists t_statistics_log -- 统计日志表 create table if not exists t_l_statistics_log -- 本地-统计日志表
( (
id integer not null primary key, id integer not null primary key,
key text not null, -- 记录键 key text not null, -- 记录键

View File

@@ -1,9 +0,0 @@
drop table if exists t_sensitive_word;
create table if not exists t_sensitive_word -- 敏感词表
(
id integer not null primary key,
word text not null unique, -- 词
use_for text null, -- 用于
enable integer not null default 1 -- 启用
);

View File

@@ -3,16 +3,16 @@
<mapper namespace="top.fatweb.oxygen.api.mapper.permission.GroupMapper"> <mapper namespace="top.fatweb.oxygen.api.mapper.permission.GroupMapper">
<select id="selectPage" resultType="long"> <select id="selectPage" resultType="long">
select id select id
from t_group from t_s_group
<where> <where>
deleted = 0 deleted = 0
<if test="searchName != null"> <if test="searchName != null">
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and t_group.name regexp #{searchName} and t_s_group.name regexp #{searchName}
</when> </when>
<otherwise> <otherwise>
and t_group.name like concat('%' ,#{searchName}, '%') and t_s_group.name like concat('%' ,#{searchName}, '%')
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
@@ -20,25 +20,25 @@
</select> </select>
<select id="selectListWithRoleByIds" resultMap="groupWithRoleMap"> <select id="selectListWithRoleByIds" resultMap="groupWithRoleMap">
select t_group.id as group_id, select t_s_group.id as group_id,
t_group.name as group_name, t_s_group.name as group_name,
t_group.enable as group_enable, t_s_group.enable as group_enable,
t_group.create_time as group_create_time, t_s_group.create_time as group_create_time,
t_group.update_time as group_update_time, t_s_group.update_time as group_update_time,
t_group.deleted as group_deleted, t_s_group.deleted as group_deleted,
t_group.version as group_version, t_s_group.version as group_version,
tr.id as role_id, tsr.id as role_id,
tr.name as role_name, tsr.name as role_name,
tr.enable as role_enable, tsr.enable as role_enable,
tr.create_time as role_create_time, tsr.create_time as role_create_time,
tr.update_time as role_update_time, tsr.update_time as role_update_time,
tr.deleted as role_deleted, tsr.deleted as role_deleted,
tr.version as role_version tsr.version as role_version
from (select * from t_group where deleted = 0) as t_group from (select * from t_s_group where deleted = 0) as t_s_group
left join (select * from t_role_group where deleted = 0) as trg on t_group.id = trg.group_id left join (select * from t_r_role_group where deleted = 0) as trrg on t_s_group.id = trrg.group_id
left join (select * from t_role where deleted = 0) as tr on tr.id = trg.role_id left join (select * from t_s_role where deleted = 0) as tsr on tsr.id = trrg.role_id
<where> <where>
<foreach collection="groupIds" item="item" index="index" open="and t_group.id in (" separator="," close=")" <foreach collection="groupIds" item="item" index="index" open="and t_s_group.id in (" separator="," close=")"
nullable="true"> nullable="true">
#{item} #{item}
</foreach> </foreach>
@@ -46,24 +46,24 @@
</select> </select>
<select id="selectOneById" resultMap="groupWithRoleMap"> <select id="selectOneById" resultMap="groupWithRoleMap">
select t_group.id as group_id, select t_s_group.id as group_id,
t_group.name as group_name, t_s_group.name as group_name,
t_group.enable as group_enable, t_s_group.enable as group_enable,
t_group.create_time as group_create_time, t_s_group.create_time as group_create_time,
t_group.update_time as group_update_time, t_s_group.update_time as group_update_time,
t_group.deleted as group_deleted, t_s_group.deleted as group_deleted,
t_group.version as group_version, t_s_group.version as group_version,
tr.id as role_id, tsr.id as role_id,
tr.name as role_name, tsr.name as role_name,
tr.enable as role_enable, tsr.enable as role_enable,
tr.create_time as role_create_time, tsr.create_time as role_create_time,
tr.update_time as role_update_time, tsr.update_time as role_update_time,
tr.deleted as role_deleted, tsr.deleted as role_deleted,
tr.version as role_version tsr.version as role_version
from (select * from t_group where deleted = 0) as t_group from (select * from t_s_group where deleted = 0) as t_s_group
left join (select * from t_role_group where deleted = 0) as trg on t_group.id = trg.group_id left join (select * from t_r_role_group where deleted = 0) as trrg on t_s_group.id = trrg.group_id
left join (select * from t_role where deleted = 0) as tr on tr.id = trg.role_id left join (select * from t_s_role where deleted = 0) as tsr on tsr.id = trrg.role_id
where t_group.id = #{id} where t_s_group.id = #{id}
</select> </select>
<resultMap id="groupMap" type="group"> <resultMap id="groupMap" type="group">

View File

@@ -3,16 +3,16 @@
<mapper namespace="top.fatweb.oxygen.api.mapper.permission.RoleMapper"> <mapper namespace="top.fatweb.oxygen.api.mapper.permission.RoleMapper">
<select id="selectPage" resultType="long"> <select id="selectPage" resultType="long">
select id select id
from t_role from t_s_role
<where> <where>
deleted = 0 deleted = 0
<if test="searchName != null"> <if test="searchName != null">
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and t_role.name regexp #{searchName} and t_s_role.name regexp #{searchName}
</when> </when>
<otherwise> <otherwise>
and t_role.name like concat('%' ,#{searchName}, '%') and t_s_role.name like concat('%' ,#{searchName}, '%')
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
@@ -20,37 +20,37 @@
</select> </select>
<select id="selectListWithPowerByIds" resultMap="roleWithPowerMap"> <select id="selectListWithPowerByIds" resultMap="roleWithPowerMap">
select distinct t_role.id as role_id, select distinct t_s_role.id as role_id,
t_role.name as role_name, t_s_role.name as role_name,
t_role.enable as role_enable, t_s_role.enable as role_enable,
t_role.create_time as role_create_time, t_s_role.create_time as role_create_time,
t_role.update_time as role_update_time, t_s_role.update_time as role_update_time,
t_role.deleted as role_deleted, t_s_role.deleted as role_deleted,
t_role.version as role_version, t_s_role.version as role_version,
tm.id as module_id, tsm.id as module_id,
tm.name as module_name, tsm.name as module_name,
tmn.id as menu_id, tsmn.id as menu_id,
tmn.name as menu_name, tsmn.name as menu_name,
tmn.url as menu_url, tsmn.url as menu_url,
tmn.parent_id as menu_parent_id, tsmn.parent_id as menu_parent_id,
tmn.module_id as menu_module_id, tsmn.module_id as menu_module_id,
tf.id as func_id, tsf.id as func_id,
tf.name as func_name, tsf.name as func_name,
tf.parent_id as func_parent_id, tsf.parent_id as func_parent_id,
tf.menu_id as func_menu_id, tsf.menu_id as func_menu_id,
t.id as operation_id, tso.id as operation_id,
t.name as operation_name, tso.name as operation_name,
t.code as operation_code, tso.code as operation_code,
t.func_id as operation_func_id tso.func_id as operation_func_id
from (select * from t_role where deleted = 0) as t_role from (select * from t_s_role where deleted = 0) as t_s_role
left join (select * from t_power_role where deleted = 0) as tpr on t_role.id = tpr.role_id left join (select * from t_r_power_role where deleted = 0) as trpr on t_s_role.id = trpr.role_id
left join t_power tp on tp.id = tpr.power_id left join t_s_power tsp on tsp.id = trpr.power_id
left join t_module tm on tp.id = tm.id left join t_s_module tsm on tsp.id = tsm.id
left join t_menu tmn on tp.id = tmn.id left join t_s_menu tsmn on tsp.id = tsmn.id
left join t_func tf on tp.id = tf.id left join t_s_func tsf on tsp.id = tsf.id
left join t_operation t on tp.id = t.id left join t_s_operation tso on tsp.id = tso.id
<where> <where>
<foreach collection="roleIds" item="item" index="index" open="and t_role.id in (" separator="," close=")" <foreach collection="roleIds" item="item" index="index" open="and t_s_role.id in (" separator="," close=")"
nullable="true"> nullable="true">
#{item} #{item}
</foreach> </foreach>
@@ -58,36 +58,36 @@
</select> </select>
<select id="selectOneById" resultMap="roleWithPowerMap"> <select id="selectOneById" resultMap="roleWithPowerMap">
select distinct t_role.id as role_id, select distinct t_s_role.id as role_id,
t_role.name as role_name, t_s_role.name as role_name,
t_role.enable as role_enable, t_s_role.enable as role_enable,
t_role.create_time as role_create_time, t_s_role.create_time as role_create_time,
t_role.update_time as role_update_time, t_s_role.update_time as role_update_time,
t_role.deleted as role_deleted, t_s_role.deleted as role_deleted,
t_role.version as role_version, t_s_role.version as role_version,
tm.id as module_id, tsm.id as module_id,
tm.name as module_name, tsm.name as module_name,
tmn.id as menu_id, tsmn.id as menu_id,
tmn.name as menu_name, tsmn.name as menu_name,
tmn.url as menu_url, tsmn.url as menu_url,
tmn.parent_id as menu_parent_id, tsmn.parent_id as menu_parent_id,
tmn.module_id as menu_module_id, tsmn.module_id as menu_module_id,
tf.id as func_id, tsf.id as func_id,
tf.name as func_name, tsf.name as func_name,
tf.parent_id as func_parent_id, tsf.parent_id as func_parent_id,
tf.menu_id as func_menu_id, tsf.menu_id as func_menu_id,
t.id as operation_id, tso.id as operation_id,
t.name as operation_name, tso.name as operation_name,
t.code as operation_code, tso.code as operation_code,
t.func_id as operation_func_id tso.func_id as operation_func_id
from (select * from t_role where deleted = 0) as t_role from (select * from t_s_role where deleted = 0) as t_s_role
left join (select * from t_power_role where deleted = 0) as tpr on t_role.id = tpr.role_id left join (select * from t_r_power_role where deleted = 0) as trpr on t_s_role.id = trpr.role_id
left join t_power tp on tp.id = tpr.power_id left join t_s_power tsp on tsp.id = trpr.power_id
left join t_module tm on tp.id = tm.id left join t_s_module tsm on tsp.id = tsm.id
left join t_menu tmn on tp.id = tmn.id left join t_s_menu tsmn on tsp.id = tsmn.id
left join t_func tf on tp.id = tf.id left join t_s_func tsf on tsp.id = tsf.id
left join t_operation t on tp.id = t.id left join t_s_operation tso on tsp.id = tso.id
where t_role.id = #{id} where t_s_role.id = #{id}
</select> </select>
<resultMap id="roleMap" type="role"> <resultMap id="roleMap" type="role">
@@ -104,6 +104,7 @@
<collection property="modules" resultMap="top.fatweb.oxygen.api.mapper.permission.ModuleMapper.moduleMap"/> <collection property="modules" resultMap="top.fatweb.oxygen.api.mapper.permission.ModuleMapper.moduleMap"/>
<collection property="menus" resultMap="top.fatweb.oxygen.api.mapper.permission.MenuMapper.menuMap"/> <collection property="menus" resultMap="top.fatweb.oxygen.api.mapper.permission.MenuMapper.menuMap"/>
<collection property="funcs" resultMap="top.fatweb.oxygen.api.mapper.permission.FuncMapper.funcMap"/> <collection property="funcs" resultMap="top.fatweb.oxygen.api.mapper.permission.FuncMapper.funcMap"/>
<collection property="operations" resultMap="top.fatweb.oxygen.api.mapper.permission.OperationMapper.operationMap"/> <collection property="operations"
resultMap="top.fatweb.oxygen.api.mapper.permission.OperationMapper.operationMap"/>
</resultMap> </resultMap>
</mapper> </mapper>

View File

@@ -2,121 +2,121 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.oxygen.api.mapper.permission.UserMapper"> <mapper namespace="top.fatweb.oxygen.api.mapper.permission.UserMapper">
<select id="selectOneWithPowerInfoByAccount" resultMap="userWithPowerInfoMap"> <select id="selectOneWithPowerInfoByAccount" resultMap="userWithPowerInfoMap">
select t_user.id as user_id, select t_s_user.id as user_id,
t_user.username as user_username, t_s_user.username as user_username,
t_user.password as user_password, t_s_user.password as user_password,
t_user.verify as user_verify, t_s_user.verify as user_verify,
t_user.forget as user_forget, t_s_user.forget as user_forget,
t_user.locking as user_locking, t_s_user.locking as user_locking,
t_user.expiration as user_expiration, t_s_user.expiration as user_expiration,
t_user.credentials_expiration as user_credentials_expiration, t_s_user.credentials_expiration as user_credentials_expiration,
t_user.enable as user_enable, t_s_user.enable as user_enable,
t_user.current_login_time as user_current_login_time, t_s_user.current_login_time as user_current_login_time,
t_user.current_login_ip as user_current_login_ip, t_s_user.current_login_ip as user_current_login_ip,
t_user.last_login_time as user_last_login_time, t_s_user.last_login_time as user_last_login_time,
t_user.last_login_ip as user_last_login_ip, t_s_user.last_login_ip as user_last_login_ip,
t_user.create_time as user_create_time, t_s_user.create_time as user_create_time,
t_user.update_time as user_update_time, t_s_user.update_time as user_update_time,
t_user.deleted as user_deleted, t_s_user.deleted as user_deleted,
t_user.version as user_version, t_s_user.version as user_version,
tui.id as user_info_id, tsui.id as user_info_id,
tui.user_id as user_info_user_id, tsui.user_id as user_info_user_id,
tui.nickname as user_info_nickname, tsui.nickname as user_info_nickname,
tui.avatar as user_info_avatar, tsui.avatar as user_info_avatar,
tui.email as user_info_email, tsui.email as user_info_email,
tui.create_time as user_info_create_time, tsui.create_time as user_info_create_time,
tui.update_time as user_info_update_time, tsui.update_time as user_info_update_time,
tui.deleted as user_info_deleted, tsui.deleted as user_info_deleted,
tui.version as user_info_version, tsui.version as user_info_version,
tmo.id as module_id, tsmo.id as module_id,
tmo.name as module_name, tsmo.name as module_name,
tm.id as menu_id, tsm.id as menu_id,
tm.name as menu_name, tsm.name as menu_name,
tm.url as menu_url, tsm.url as menu_url,
tm.parent_id as menu_parent_id, tsm.parent_id as menu_parent_id,
tf.id as func_id, tsf.id as func_id,
tf.name as func_name, tsf.name as func_name,
tf.parent_id as func_parent_id, tsf.parent_id as func_parent_id,
tf.menu_id as func_menu_id, tsf.menu_id as func_menu_id,
t.id as operation_id, tso.id as operation_id,
t.name as operation_name, tso.name as operation_name,
t.code as operation_code, tso.code as operation_code,
t.func_id as operation_func_id tso.func_id as operation_func_id
from t_user from t_s_user
left join (select * from t_user_info where deleted = 0) as tui on t_user.id = tui.user_id left join (select * from t_s_user_info where deleted = 0) as tsui on t_s_user.id = tsui.user_id
left join (select * from t_user_group where deleted = 0) as tug on t_user.id = tug.user_id left join (select * from t_r_user_group where deleted = 0) as trug on t_s_user.id = trug.user_id
left join (select * from t_group where deleted = 0 and enable = 1) as tg on tg.id = tug.group_id left join (select * from t_s_group where deleted = 0 and enable = 1) as tsg on tsg.id = trug.group_id
left join (select * from t_role_group where deleted = 0) as trg on tg.id = trg.group_id left join (select * from t_r_role_group where deleted = 0) as trrg on tsg.id = trrg.group_id
left join (select * from t_user_role where deleted = 0) as tur on t_user.id = tur.user_id left join (select * from t_r_user_role where deleted = 0) as trur on t_s_user.id = trur.user_id
left join (select * from t_role where deleted = 0 and enable = 1) as tr left join (select * from t_s_role where deleted = 0 and enable = 1) as tsr
on tr.id = trg.role_id or tr.id = tur.role_id on tsr.id = trrg.role_id or tsr.id = trur.role_id
left join (select * from t_power_role where deleted = 0) as tpr on tr.id = tpr.role_id left join (select * from t_r_power_role where deleted = 0) as trpr on tsr.id = trpr.role_id
left join t_power as tp on tp.id = tpr.power_id left join t_s_power as tsp on tsp.id = trpr.power_id
left join t_module as tmo on tp.id = tmo.id left join t_s_module as tsmo on tsp.id = tsmo.id
left join t_menu as tm on tp.id = tm.id left join t_s_menu as tsm on tsp.id = tsm.id
left join t_func as tf on tp.id = tf.id left join t_s_func as tsf on tsp.id = tsf.id
left join t_operation as t on tp.id = t.id left join t_s_operation as tso on tsp.id = tso.id
where t_user.deleted = 0 where t_s_user.deleted = 0
and (tui.email = #{account} or t_user.username = #{account}); and (tsui.email = #{account} or t_s_user.username = #{account});
</select> </select>
<select id="selectPage" resultType="long"> <select id="selectPage" resultType="long">
select t_user.id select t_s_user.id
from t_user from t_s_user
left join (select * from t_user_info where deleted = 0) as tui on t_user.id = tui.user_id left join (select * from t_s_user_info where deleted = 0) as tsui on t_s_user.id = tsui.user_id
<where> <where>
t_user.deleted = 0 t_s_user.deleted = 0
<if test="searchValue != null"> <if test="searchValue != null">
<choose> <choose>
<when test="searchType == 'ID'"> <when test="searchType == 'ID'">
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and t_user.id regexp #{searchValue} and t_s_user.id regexp #{searchValue}
</when> </when>
<otherwise> <otherwise>
and t_user.id like concat('%' ,#{searchValue}, '%') and t_s_user.id like concat('%' ,#{searchValue}, '%')
</otherwise> </otherwise>
</choose> </choose>
</when> </when>
<when test="searchType == 'USERNAME'"> <when test="searchType == 'USERNAME'">
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and t_user.username regexp #{searchValue} and t_s_user.username regexp #{searchValue}
</when> </when>
<otherwise> <otherwise>
and t_user.username like concat('%' ,#{searchValue}, '%') and t_s_user.username like concat('%' ,#{searchValue}, '%')
</otherwise> </otherwise>
</choose> </choose>
</when> </when>
<when test="searchType == 'NICKNAME'"> <when test="searchType == 'NICKNAME'">
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and tui.nickname regexp #{searchValue} and tsui.nickname regexp #{searchValue}
</when> </when>
<otherwise> <otherwise>
and tui.nickname like concat('%' ,#{searchValue}, '%') and tsui.nickname like concat('%' ,#{searchValue}, '%')
</otherwise> </otherwise>
</choose> </choose>
</when> </when>
<when test="searchType == 'EMAIL'"> <when test="searchType == 'EMAIL'">
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and tui.email regexp #{searchValue} and tsui.email regexp #{searchValue}
</when> </when>
<otherwise> <otherwise>
and tui.email like concat('%' ,#{searchValue}, '%') and tsui.email like concat('%' ,#{searchValue}, '%')
</otherwise> </otherwise>
</choose> </choose>
</when> </when>
<otherwise> <otherwise>
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and ( t_user.username regexp #{searchValue} or tui.nickname regexp #{searchValue} or and ( t_s_user.username regexp #{searchValue} or tui.nickname regexp #{searchValue} or
tui.email regexp #{searchValue}) tsui.email regexp #{searchValue})
</when> </when>
<otherwise> <otherwise>
and (t_user.username like concat('%' ,#{searchValue}, '%') or tui.nickname like and (t_s_user.username like concat('%' ,#{searchValue}, '%') or tsui.nickname like
concat('%' ,#{searchValue}, '%') or tui.email like concat('%' ,#{searchValue}, '%')) concat('%' ,#{searchValue}, '%') or tsui.email like concat('%' ,#{searchValue}, '%'))
</otherwise> </otherwise>
</choose> </choose>
</otherwise> </otherwise>
@@ -126,51 +126,51 @@
</select> </select>
<select id="selectListWithRoleInfoByIds" resultMap="userWithRoleInfoMap"> <select id="selectListWithRoleInfoByIds" resultMap="userWithRoleInfoMap">
select t_user.id as user_id, select t_s_user.id as user_id,
t_user.username as user_username, t_s_user.username as user_username,
t_user.verify as user_verify, t_s_user.verify as user_verify,
t_user.forget as user_forget, t_s_user.forget as user_forget,
t_user.locking as user_locking, t_s_user.locking as user_locking,
t_user.expiration as user_expiration, t_s_user.expiration as user_expiration,
t_user.credentials_expiration as user_credentials_expiration, t_s_user.credentials_expiration as user_credentials_expiration,
t_user.enable as user_enable, t_s_user.enable as user_enable,
t_user.current_login_time as user_current_login_time, t_s_user.current_login_time as user_current_login_time,
t_user.current_login_ip as user_current_login_ip, t_s_user.current_login_ip as user_current_login_ip,
t_user.last_login_time as user_last_login_time, t_s_user.last_login_time as user_last_login_time,
t_user.last_login_ip as user_last_login_ip, t_s_user.last_login_ip as user_last_login_ip,
t_user.create_time as user_create_time, t_s_user.create_time as user_create_time,
t_user.update_time as user_update_time, t_s_user.update_time as user_update_time,
t_user.deleted as user_deleted, t_s_user.deleted as user_deleted,
t_user.version as user_version, t_s_user.version as user_version,
tui.id as user_info_id, tsui.id as user_info_id,
tui.user_id as user_info_user_id, tsui.user_id as user_info_user_id,
tui.nickname as user_info_nickname, tsui.nickname as user_info_nickname,
tui.avatar as user_info_avatar, tsui.avatar as user_info_avatar,
tui.email as user_info_email, tsui.email as user_info_email,
tui.create_time as user_info_create_time, tsui.create_time as user_info_create_time,
tui.update_time as user_info_update_time, tsui.update_time as user_info_update_time,
tui.deleted as user_info_deleted, tsui.deleted as user_info_deleted,
tui.version as user_info_version, tsui.version as user_info_version,
tr.id as role_id, tsr.id as role_id,
tr.name as role_name, tsr.name as role_name,
tr.enable as role_enable, tsr.enable as role_enable,
tr.deleted as role_deleted, tsr.deleted as role_deleted,
tr.version as role_version, tsr.version as role_version,
tg.id as group_id, tsg.id as group_id,
tg.name as group_name, tsg.name as group_name,
tg.enable as group_enable, tsg.enable as group_enable,
tg.deleted as group_deleted, tsg.deleted as group_deleted,
tg.version as group_version tsg.version as group_version
from t_user from t_s_user
left join (select * from t_user_info where deleted = 0) as tui on t_user.id = tui.user_id left join (select * from t_s_user_info where deleted = 0) as tsui on t_s_user.id = tsui.user_id
left join (select * from t_user_group where deleted = 0) as tug on t_user.id = tug.user_id left join (select * from t_r_user_group where deleted = 0) as trug on t_s_user.id = trug.user_id
left join (select * from t_group where deleted = 0) as tg on tg.id = tug.group_id left join (select * from t_s_group where deleted = 0) as tsg on tsg.id = trug.group_id
left join (select * from t_role_group where deleted = 0) as trg on tg.id = trg.group_id left join (select * from t_r_role_group where deleted = 0) as trrg on tsg.id = trrg.group_id
left join (select * from t_user_role where deleted = 0) as tur on t_user.id = tur.user_id left join (select * from t_r_user_role where deleted = 0) as trur on t_s_user.id = trur.user_id
left join (select * from t_role where deleted = 0) as tr left join (select * from t_s_role where deleted = 0) as tsr
on tr.id = trg.role_id or tr.id = tur.role_id on tsr.id = trrg.role_id or tsr.id = trur.role_id
<where> <where>
<foreach collection="userIds" item="item" index="index" open="and t_user.id in (" separator="," close=")" <foreach collection="userIds" item="item" index="index" open="and t_s_user.id in (" separator="," close=")"
nullable="true"> nullable="true">
#{item} #{item}
</foreach> </foreach>
@@ -178,92 +178,92 @@
</select> </select>
<select id="selectOneWithRoleInfoById" resultMap="userWithRoleInfoMap"> <select id="selectOneWithRoleInfoById" resultMap="userWithRoleInfoMap">
select t_user.id as user_id, select t_s_user.id as user_id,
t_user.username as user_username, t_s_user.username as user_username,
t_user.verify as user_verify, t_s_user.verify as user_verify,
t_user.forget as user_forget, t_s_user.forget as user_forget,
t_user.locking as user_locking, t_s_user.locking as user_locking,
t_user.expiration as user_expiration, t_s_user.expiration as user_expiration,
t_user.credentials_expiration as user_credentials_expiration, t_s_user.credentials_expiration as user_credentials_expiration,
t_user.enable as user_enable, t_s_user.enable as user_enable,
t_user.current_login_time as user_current_login_time, t_s_user.current_login_time as user_current_login_time,
t_user.current_login_ip as user_current_login_ip, t_s_user.current_login_ip as user_current_login_ip,
t_user.last_login_time as user_last_login_time, t_s_user.last_login_time as user_last_login_time,
t_user.last_login_ip as user_last_login_ip, t_s_user.last_login_ip as user_last_login_ip,
t_user.create_time as user_create_time, t_s_user.create_time as user_create_time,
t_user.update_time as user_update_time, t_s_user.update_time as user_update_time,
t_user.deleted as user_deleted, t_s_user.deleted as user_deleted,
t_user.version as user_version, t_s_user.version as user_version,
tui.id as user_info_id, tsui.id as user_info_id,
tui.user_id as user_info_user_id, tsui.user_id as user_info_user_id,
tui.nickname as user_info_nickname, tsui.nickname as user_info_nickname,
tui.avatar as user_info_avatar, tsui.avatar as user_info_avatar,
tui.email as user_info_email, tsui.email as user_info_email,
tui.create_time as user_info_create_time, tsui.create_time as user_info_create_time,
tui.update_time as user_info_update_time, tsui.update_time as user_info_update_time,
tui.deleted as user_info_deleted, tsui.deleted as user_info_deleted,
tui.version as user_info_version, tsui.version as user_info_version,
tr.id as role_id, tsr.id as role_id,
tr.name as role_name, tsr.name as role_name,
tr.enable as role_enable, tsr.enable as role_enable,
tr.deleted as role_deleted, tsr.deleted as role_deleted,
tr.version as role_version, tsr.version as role_version,
tg.id as group_id, tsg.id as group_id,
tg.name as group_name, tsg.name as group_name,
tg.enable as group_enable, tsg.enable as group_enable,
tg.deleted as group_deleted, tsg.deleted as group_deleted,
tg.version as group_version tsg.version as group_version
from t_user from t_s_user
left join (select * from t_user_info where deleted = 0) as tui on t_user.id = tui.user_id left join (select * from t_s_user_info where deleted = 0) as tsui on t_s_user.id = tsui.user_id
left join (select * from t_user_group where deleted = 0) as tug on t_user.id = tug.user_id left join (select * from t_r_user_group where deleted = 0) as trug on t_s_user.id = trug.user_id
left join (select * from t_group where deleted = 0) as tg on tg.id = tug.group_id left join (select * from t_s_group where deleted = 0) as tsg on tsg.id = trug.group_id
left join (select * from t_role_group where deleted = 0) as trg on tg.id = trg.group_id left join (select * from t_r_role_group where deleted = 0) as trrg on tsg.id = trrg.group_id
left join (select * from t_user_role where deleted = 0) as tur on t_user.id = tur.user_id left join (select * from t_r_user_role where deleted = 0) as trur on t_s_user.id = trur.user_id
left join (select * from t_role where deleted = 0) as tr left join (select * from t_s_role where deleted = 0) as tsr
on tr.id = trg.role_id or tr.id = tur.role_id on tsr.id = trrg.role_id or tsr.id = trur.role_id
where t_user.deleted = 0 where t_s_user.deleted = 0
and t_user.id = #{id} and t_s_user.id = #{id}
</select> </select>
<select id="selectListWithInfo" resultMap="userWithInfoMap"> <select id="selectListWithInfo" resultMap="userWithInfoMap">
select t_user.id as user_id, select t_s_user.id as user_id,
t_user.username as user_username, t_s_user.username as user_username,
t_user.verify as user_verify, t_s_user.verify as user_verify,
t_user.locking as user_locking, t_s_user.locking as user_locking,
t_user.forget as user_forget, t_s_user.forget as user_forget,
t_user.expiration as user_expiration, t_s_user.expiration as user_expiration,
t_user.credentials_expiration as user_credentials_expiration, t_s_user.credentials_expiration as user_credentials_expiration,
t_user.enable as user_enable, t_s_user.enable as user_enable,
t_user.current_login_time as user_current_login_time, t_s_user.current_login_time as user_current_login_time,
t_user.current_login_ip as user_current_login_ip, t_s_user.current_login_ip as user_current_login_ip,
t_user.last_login_time as user_last_login_time, t_s_user.last_login_time as user_last_login_time,
t_user.last_login_ip as user_last_login_ip, t_s_user.last_login_ip as user_last_login_ip,
t_user.create_time as user_create_time, t_s_user.create_time as user_create_time,
t_user.update_time as user_update_time, t_s_user.update_time as user_update_time,
t_user.deleted as user_deleted, t_s_user.deleted as user_deleted,
t_user.version as user_version, t_s_user.version as user_version,
tui.id as user_info_id, tsui.id as user_info_id,
tui.user_id as user_info_user_id, tsui.user_id as user_info_user_id,
tui.nickname as user_info_nickname, tsui.nickname as user_info_nickname,
tui.avatar as user_info_avatar, tsui.avatar as user_info_avatar,
tui.email as user_info_email, tsui.email as user_info_email,
tui.create_time as user_info_create_time, tsui.create_time as user_info_create_time,
tui.update_time as user_info_update_time, tsui.update_time as user_info_update_time,
tui.deleted as user_info_deleted, tsui.deleted as user_info_deleted,
tui.version as user_info_version tsui.version as user_info_version
from t_user from t_s_user
left join (select * from t_user_info where deleted = 0) as tui on t_user.id = tui.user_id left join (select * from t_s_user_info where deleted = 0) as tsui on t_s_user.id = tsui.user_id
where t_user.deleted = 0 where t_s_user.deleted = 0
</select> </select>
<select id="selectIdsWithRoleIds" resultType="long"> <select id="selectIdsWithRoleIds" resultType="long">
select t_user.id select t_s_user.id
from t_user from t_s_user
left join (select * from t_user_role where deleted = 0) as tur on t_user.id = tur.user_id left join (select * from t_r_user_role where deleted = 0) as trur on t_s_user.id = trur.user_id
left join (select * from t_role where deleted = 0) as tr on tr.id = tur.role_id left join (select * from t_s_role where deleted = 0) as tsr on tsr.id = trur.role_id
<where> <where>
t_user.deleted = 0 t_s_user.deleted = 0
<foreach collection="roleIds" item="item" index="index" open="and tr.id in (" separator="," close=")" <foreach collection="roleIds" item="item" index="index" open="and tsr.id in (" separator="," close=")"
nullable="true"> nullable="true">
#{item} #{item}
</foreach> </foreach>
@@ -271,13 +271,13 @@
</select> </select>
<select id="selectIdsWithGroupIds" resultType="long"> <select id="selectIdsWithGroupIds" resultType="long">
select t_user.id select t_s_user.id
from t_user from t_s_user
left join (select * from t_user_group where deleted = 0) as tug on t_user.id = tug.user_id left join (select * from t_r_user_group where deleted = 0) as trug on t_s_user.id = trug.user_id
left join (select * from t_group where deleted = 0) as tg on tg.id = tug.group_id left join (select * from t_s_group where deleted = 0) as tsg on tsg.id = trug.group_id
<where> <where>
t_user.deleted = 0 t_s_user.deleted = 0
<foreach collection="groupIds" item="item" index="index" open="and tg.id in (" separator="," close=")" <foreach collection="groupIds" item="item" index="index" open="and tsg.id in (" separator="," close=")"
nullable="true"> nullable="true">
#{item} #{item}
</foreach> </foreach>

View File

@@ -2,38 +2,38 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.oxygen.api.mapper.system.SysLogMapper"> <mapper namespace="top.fatweb.oxygen.api.mapper.system.SysLogMapper">
<select id="selectPage" resultMap="sysLogMap"> <select id="selectPage" resultMap="sysLogMap">
select t_sys_log.id as sys_log_id, select t_l_sys_log.id as sys_log_id,
t_sys_log.log_type as sys_log_log_type, t_l_sys_log.log_type as sys_log_log_type,
t_sys_log.operate_user_id as sys_log_operate_user_id, t_l_sys_log.operate_user_id as sys_log_operate_user_id,
t_sys_log.operate_time as sys_log_operate_time, t_l_sys_log.operate_time as sys_log_operate_time,
t_sys_log.request_uri as sys_log_request_uri, t_l_sys_log.request_uri as sys_log_request_uri,
t_sys_log.request_method as sys_log_request_method, t_l_sys_log.request_method as sys_log_request_method,
t_sys_log.request_params as sys_log_request_params, t_l_sys_log.request_params as sys_log_request_params,
t_sys_log.request_ip as sys_log_request_ip, t_l_sys_log.request_ip as sys_log_request_ip,
t_sys_log.request_server_address as sys_log_request_server_address, t_l_sys_log.request_server_address as sys_log_request_server_address,
t_sys_log.exception as sys_log_exception, t_l_sys_log.exception as sys_log_exception,
t_sys_log.exception_info as sys_log_exception_info, t_l_sys_log.exception_info as sys_log_exception_info,
t_sys_log.start_time as sys_log_start_time, t_l_sys_log.start_time as sys_log_start_time,
t_sys_log.end_time as sys_log_end_time, t_l_sys_log.end_time as sys_log_end_time,
t_sys_log.execute_time as sys_log_execute_time, t_l_sys_log.execute_time as sys_log_execute_time,
t_sys_log.user_agent as sys_log_user_agent t_l_sys_log.user_agent as sys_log_user_agent
from t_sys_log from t_l_sys_log
<where> <where>
<foreach collection="logType" item="item" index="index" open="and t_sys_log.log_type in (" separator="," <foreach collection="logType" item="item" index="index" open="and t_l_sys_log.log_type in (" separator=","
close=")" nullable="true"> close=")" nullable="true">
#{item} #{item}
</foreach> </foreach>
<foreach collection="requestMethod" item="item" index="index" open="and t_sys_log.request_method in (" <foreach collection="requestMethod" item="item" index="index" open="and t_l_sys_log.request_method in ("
separator="," close=")" nullable="true"> separator="," close=")" nullable="true">
#{item} #{item}
</foreach> </foreach>
<if test="searchRequestUrl != null"> <if test="searchRequestUrl != null">
and ((t_sys_log.request_server_address || t_sys_log.request_uri || and ((t_l_sys_log.request_server_address || t_l_sys_log.request_uri ||
(case when length(t_sys_log.request_params) != 0 then '?' || t_sys_log.request_params else '' end)) (case when length(t_l_sys_log.request_params) != 0 then '?' || t_l_sys_log.request_params else '' end))
like #{searchRequestUrl}) like #{searchRequestUrl})
</if> </if>
<if test="searchStartTime != null and searchEndTime != null"> <if test="searchStartTime != null and searchEndTime != null">
and t_sys_log.start_time between #{searchStartTime} and #{searchEndTime} and t_l_sys_log.start_time between #{searchStartTime} and #{searchEndTime}
</if> </if>
</where> </where>
</select> </select>