Java后端正式版:表名规范化 + Flyway启用 + 数据库导出
- 所有实体 @TableName 改为规范格式(t_sys_/t_biz_/t_ugc_/t_user_)
- Flyway 启用(V1重命名+V2新审计字段)
- BaseEntity 启用新审计字段(create_by/update_by/deleted)
- 逻辑删除启用(deleted字段)
- SysUserMapper.xml 和 SysLogMapper SQL 更新为新表名
- 导出规范化数据库: backend-java/src/main/resources/db/competition_management_java.sql
- 41张表,全部 t_{module}_ 前缀
- 含完整数据(用户/租户/权限/活动/作品/评分等)
- admin 密码统一为 admin123
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a6b056520d
commit
58c232dadc
@ -8,7 +8,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 基础实体类,所有实体继承此类
|
||||
* 当前阶段使用现有数据库列名,新审计字段暂不映射(待 Flyway 迁移后启用)
|
||||
* 包含新审计字段(Java规范)和旧审计字段(过渡期兼容)
|
||||
*/
|
||||
@Data
|
||||
public abstract class BaseEntity implements Serializable {
|
||||
@ -17,21 +17,22 @@ public abstract class BaseEntity implements Serializable {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
// ====== 新审计字段(列尚未存在,暂不映射到数据库) ======
|
||||
// ====== 新审计字段(Java 规范) ======
|
||||
|
||||
/** 创建人账号(待 Flyway V2 后启用) */
|
||||
@TableField(exist = false)
|
||||
/** 创建人账号 */
|
||||
@TableField(value = "create_by", fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/** 更新人账号(待 Flyway V2 后启用) */
|
||||
@TableField(exist = false)
|
||||
/** 更新人账号 */
|
||||
@TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/** 逻辑删除标识(待 Flyway V2 后启用) */
|
||||
@TableField(exist = false)
|
||||
/** 逻辑删除标识(0-未删除,1-已删除) */
|
||||
@TableLogic
|
||||
@TableField(value = "deleted", fill = FieldFill.INSERT)
|
||||
private Integer deleted;
|
||||
|
||||
// ====== 现有审计字段(与当前数据库一致) ======
|
||||
// ====== 旧审计字段(过渡期保留) ======
|
||||
|
||||
/** 创建人 ID */
|
||||
@TableField(value = "creator", fill = FieldFill.INSERT)
|
||||
@ -45,7 +46,7 @@ public abstract class BaseEntity implements Serializable {
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 修改时间(数据库列名为 modify_time) */
|
||||
/** 修改时间 */
|
||||
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime modifyTime;
|
||||
|
||||
|
||||
@ -19,8 +19,15 @@ public class AuditMetaObjectHandler implements MetaObjectHandler {
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String username = SecurityUtil.getCurrentUsername();
|
||||
Long userId = SecurityUtil.getCurrentUserIdOrNull();
|
||||
|
||||
// 新审计字段
|
||||
this.strictInsertFill(metaObject, "createBy", String.class, username);
|
||||
this.strictInsertFill(metaObject, "updateBy", String.class, username);
|
||||
this.strictInsertFill(metaObject, "deleted", Integer.class, 0);
|
||||
|
||||
// 旧审计字段
|
||||
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, now);
|
||||
this.strictInsertFill(metaObject, "modifyTime", LocalDateTime.class, now);
|
||||
this.strictInsertFill(metaObject, "validState", Integer.class, 1);
|
||||
@ -34,8 +41,13 @@ public class AuditMetaObjectHandler implements MetaObjectHandler {
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String username = SecurityUtil.getCurrentUsername();
|
||||
Long userId = SecurityUtil.getCurrentUserIdOrNull();
|
||||
|
||||
// 新审计字段
|
||||
this.strictUpdateFill(metaObject, "updateBy", String.class, username);
|
||||
|
||||
// 旧审计字段
|
||||
this.strictUpdateFill(metaObject, "modifyTime", LocalDateTime.class, now);
|
||||
|
||||
if (userId != null) {
|
||||
|
||||
@ -16,7 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_contest", autoResultMap = true)
|
||||
@TableName(value = "t_biz_contest", autoResultMap = true)
|
||||
public class BizContest extends BaseEntity {
|
||||
|
||||
/** 赛事名称(唯一) */
|
||||
|
||||
@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_contest_attachment")
|
||||
@TableName("t_biz_contest_attachment")
|
||||
public class BizContestAttachment extends BaseEntity {
|
||||
|
||||
@TableField("contest_id")
|
||||
|
||||
@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_contest_notice")
|
||||
@TableName("t_biz_contest_notice")
|
||||
public class BizContestNotice extends BaseEntity {
|
||||
|
||||
@TableField("contest_id")
|
||||
|
||||
@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_contest_registration")
|
||||
@TableName("t_biz_contest_registration")
|
||||
public class BizContestRegistration extends BaseEntity {
|
||||
|
||||
@TableField("contest_id")
|
||||
|
||||
@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("t_contest_registration_teacher")
|
||||
@TableName("t_biz_contest_registration_teacher")
|
||||
public class BizContestRegistrationTeacher implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_contest_team")
|
||||
@TableName("t_biz_contest_team")
|
||||
public class BizContestTeam extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("t_contest_team_member")
|
||||
@TableName("t_biz_contest_team_member")
|
||||
public class BizContestTeamMember implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_contest_work", autoResultMap = true)
|
||||
@TableName(value = "t_biz_contest_work", autoResultMap = true)
|
||||
public class BizContestWork extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("t_contest_work_attachment")
|
||||
@TableName("t_biz_contest_work_attachment")
|
||||
public class BizContestWorkAttachment implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -11,7 +11,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_homework", autoResultMap = true)
|
||||
@TableName(value = "t_biz_homework", autoResultMap = true)
|
||||
public class BizHomework extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_homework_review_rule", autoResultMap = true)
|
||||
@TableName(value = "t_biz_homework_review_rule", autoResultMap = true)
|
||||
public class BizHomeworkReviewRule extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_homework_score", autoResultMap = true)
|
||||
@TableName(value = "t_biz_homework_score", autoResultMap = true)
|
||||
public class BizHomeworkScore extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_homework_submission", autoResultMap = true)
|
||||
@TableName(value = "t_biz_homework_submission", autoResultMap = true)
|
||||
public class BizHomeworkSubmission extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_contest_judge")
|
||||
@TableName("t_biz_contest_judge")
|
||||
public class BizContestJudge extends BaseEntity {
|
||||
|
||||
@TableField("contest_id")
|
||||
|
||||
@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_contest_review_rule", autoResultMap = true)
|
||||
@TableName(value = "t_biz_contest_review_rule", autoResultMap = true)
|
||||
public class BizContestReviewRule extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("t_contest_work_judge_assignment")
|
||||
@TableName("t_biz_contest_work_judge_assignment")
|
||||
public class BizContestWorkJudgeAssignment implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -12,7 +12,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "t_contest_work_score", autoResultMap = true)
|
||||
@TableName(value = "t_biz_contest_work_score", autoResultMap = true)
|
||||
public class BizContestWorkScore extends BaseEntity {
|
||||
|
||||
@TableField("tenant_id")
|
||||
|
||||
@ -10,7 +10,7 @@ import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_preset_comment")
|
||||
@TableName("t_biz_preset_comment")
|
||||
public class BizPresetComment extends BaseEntity {
|
||||
|
||||
@TableField("contest_id")
|
||||
|
||||
@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("configs")
|
||||
@TableName("t_sys_config")
|
||||
public class SysConfig extends BaseEntity {
|
||||
|
||||
/** 租户 ID */
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("dicts")
|
||||
@TableName("t_sys_dict")
|
||||
public class SysDict extends BaseEntity {
|
||||
|
||||
/** 租户 ID */
|
||||
|
||||
@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("dict_items")
|
||||
@TableName("t_sys_dict_item")
|
||||
public class SysDictItem extends BaseEntity {
|
||||
|
||||
/** 字典 ID */
|
||||
|
||||
@ -10,7 +10,7 @@ import java.time.LocalDateTime;
|
||||
* 系统日志实体(不继承 BaseEntity,字段结构不同)
|
||||
*/
|
||||
@Data
|
||||
@TableName("logs")
|
||||
@TableName("t_sys_log")
|
||||
public class SysLog implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("menus")
|
||||
@TableName("t_sys_menu")
|
||||
public class SysMenu extends BaseEntity {
|
||||
|
||||
/** 菜单名称 */
|
||||
|
||||
@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("permissions")
|
||||
@TableName("t_sys_permission")
|
||||
public class SysPermission extends BaseEntity {
|
||||
|
||||
/** 租户 ID */
|
||||
|
||||
@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("roles")
|
||||
@TableName("t_sys_role")
|
||||
public class SysRole extends BaseEntity {
|
||||
|
||||
/** 租户 ID */
|
||||
|
||||
@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
* 角色权限关联实体
|
||||
*/
|
||||
@Data
|
||||
@TableName("role_permissions")
|
||||
@TableName("t_sys_role_permission")
|
||||
public class SysRolePermission implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("tenants")
|
||||
@TableName("t_sys_tenant")
|
||||
public class SysTenant extends BaseEntity {
|
||||
|
||||
/** 租户名称 */
|
||||
|
||||
@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
* 租户菜单关联实体
|
||||
*/
|
||||
@Data
|
||||
@TableName("tenant_menus")
|
||||
@TableName("t_sys_tenant_menu")
|
||||
public class SysTenantMenu implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -13,7 +13,7 @@ import java.time.LocalDate;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("users")
|
||||
@TableName("t_sys_user")
|
||||
public class SysUser extends BaseEntity {
|
||||
|
||||
/** 租户 ID */
|
||||
|
||||
@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
* 用户角色关联实体
|
||||
*/
|
||||
@Data
|
||||
@TableName("user_roles")
|
||||
@TableName("t_sys_user_role")
|
||||
public class SysUserRole implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -14,10 +14,10 @@ import java.util.Map;
|
||||
public interface SysLogMapper extends BaseMapper<SysLog> {
|
||||
|
||||
/** 按操作类型统计(Top 10) */
|
||||
@Select("SELECT action, COUNT(*) AS count FROM logs WHERE create_time >= #{since} GROUP BY action ORDER BY count DESC LIMIT 10")
|
||||
@Select("SELECT action, COUNT(*) AS count FROM t_sys_log WHERE create_time >= #{since} GROUP BY action ORDER BY count DESC LIMIT 10")
|
||||
List<Map<String, Object>> selectActionStats(@Param("since") LocalDateTime since);
|
||||
|
||||
/** 按日期统计 */
|
||||
@Select("SELECT DATE(create_time) AS date, COUNT(*) AS count FROM logs WHERE create_time >= #{since} GROUP BY DATE(create_time) ORDER BY date")
|
||||
@Select("SELECT DATE(create_time) AS date, COUNT(*) AS count FROM t_sys_log WHERE create_time >= #{since} GROUP BY DATE(create_time) ORDER BY date")
|
||||
List<Map<String, Object>> selectDailyStats(@Param("since") LocalDateTime since);
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("content_review_logs")
|
||||
@TableName("t_ugc_review_log")
|
||||
public class UgcReviewLog implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("work_tags")
|
||||
@TableName("t_ugc_tag")
|
||||
public class UgcTag implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -11,7 +11,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName(value = "user_works", autoResultMap = true)
|
||||
@TableName(value = "t_ugc_work", autoResultMap = true)
|
||||
public class UgcWork implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("user_work_comments")
|
||||
@TableName("t_ugc_work_comment")
|
||||
public class UgcWorkComment implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("user_work_favorites")
|
||||
@TableName("t_ugc_work_favorite")
|
||||
public class UgcWorkFavorite implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("user_work_likes")
|
||||
@TableName("t_ugc_work_like")
|
||||
public class UgcWorkLike implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -9,7 +9,7 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("user_work_pages")
|
||||
@TableName("t_ugc_work_page")
|
||||
public class UgcWorkPage implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("user_work_reports")
|
||||
@TableName("t_ugc_work_report")
|
||||
public class UgcWorkReport implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -9,7 +9,7 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("work_tag_relations")
|
||||
@TableName("t_ugc_work_tag")
|
||||
public class UgcWorkTag implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -11,7 +11,7 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("children")
|
||||
@TableName("t_user_child")
|
||||
public class UserChild implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -10,7 +10,7 @@ import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("user_parent_child")
|
||||
@TableName("t_user_parent_child")
|
||||
public class UserParentChild implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@ -13,9 +13,9 @@ spring:
|
||||
time-zone: Asia/Shanghai
|
||||
default-property-inclusion: non_null
|
||||
|
||||
# Flyway 数据库迁移(暂不启用,先用现有表名测试)
|
||||
# Flyway 数据库迁移
|
||||
flyway:
|
||||
enabled: false
|
||||
enabled: true
|
||||
locations: classpath:db/migration
|
||||
baseline-on-migrate: true
|
||||
baseline-version: 0
|
||||
@ -35,10 +35,9 @@ mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
||||
# 逻辑删除暂不启用(待 Flyway V2 添加 deleted 列后启用)
|
||||
# logic-delete-field: deleted
|
||||
# logic-delete-value: 1
|
||||
# logic-not-delete-value: 0
|
||||
logic-delete-field: deleted
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
|
||||
# JWT 配置
|
||||
jwt:
|
||||
|
||||
1791
backend-java/src/main/resources/db/competition_management_java.sql
Normal file
1791
backend-java/src/main/resources/db/competition_management_java.sql
Normal file
File diff suppressed because one or more lines are too long
@ -5,9 +5,9 @@
|
||||
<!-- 查询用户的权限码列表 -->
|
||||
<select id="selectPermissionsByUserId" resultType="java.lang.String">
|
||||
SELECT DISTINCT p.code
|
||||
FROM permissions p
|
||||
JOIN role_permissions rp ON rp.permission_id = p.id
|
||||
JOIN user_roles ur ON ur.role_id = rp.role_id
|
||||
FROM t_sys_permission p
|
||||
JOIN t_sys_role_permission rp ON rp.permission_id = p.id
|
||||
JOIN t_sys_user_role ur ON ur.role_id = rp.role_id
|
||||
WHERE ur.user_id = #{userId}
|
||||
AND p.valid_state = 1
|
||||
</select>
|
||||
@ -15,8 +15,8 @@
|
||||
<!-- 查询用户的角色码列表 -->
|
||||
<select id="selectRolesByUserId" resultType="java.lang.String">
|
||||
SELECT DISTINCT r.code
|
||||
FROM roles r
|
||||
JOIN user_roles ur ON ur.role_id = r.id
|
||||
FROM t_sys_role r
|
||||
JOIN t_sys_user_role ur ON ur.role_id = r.id
|
||||
WHERE ur.user_id = #{userId}
|
||||
AND r.valid_state = 1
|
||||
</select>
|
||||
@ -29,8 +29,8 @@
|
||||
u.city, u.birthday, u.gender, u.avatar, u.organization, u.status,
|
||||
u.valid_state AS validState, u.create_time AS createTime, u.modify_time AS updateTime,
|
||||
t.name AS tenantName, t.code AS tenantCode, t.tenant_type AS tenantType, t.is_super AS tenantIsSuper
|
||||
FROM users u
|
||||
LEFT JOIN tenants t ON t.id = u.tenant_id
|
||||
FROM t_sys_user u
|
||||
LEFT JOIN t_sys_tenant t ON t.id = u.tenant_id
|
||||
<where>
|
||||
u.valid_state = 1 AND (1=1)
|
||||
<if test="params.tenantId != null">
|
||||
@ -71,8 +71,8 @@
|
||||
u.valid_state AS validState, u.create_time AS createTime, u.modify_time AS updateTime,
|
||||
t.id AS tenantId, t.name AS tenantName, t.code AS tenantCode,
|
||||
t.tenant_type AS tenantType, t.is_super AS tenantIsSuper
|
||||
FROM users u
|
||||
LEFT JOIN tenants t ON t.id = u.tenant_id
|
||||
FROM t_sys_user u
|
||||
LEFT JOIN t_sys_tenant t ON t.id = u.tenant_id
|
||||
WHERE u.id = #{userId}
|
||||
AND u.valid_state = 1
|
||||
AND (1=1)
|
||||
@ -86,7 +86,7 @@
|
||||
SELECT
|
||||
u.id, u.tenant_id AS tenantId, u.username, u.password, u.nickname,
|
||||
u.email, u.avatar, u.status, u.valid_state AS validState
|
||||
FROM users u
|
||||
FROM t_sys_user u
|
||||
WHERE u.username = #{username}
|
||||
AND u.valid_state = 1
|
||||
AND (1=1)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user