refactor all
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.imyeyu.api.modules.user.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.user.entity.Permission;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限 Mapper
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface PermissionMapper extends BaseMapper<Permission, String> {
|
||||
|
||||
List<Permission> selectByIdList(List<String> list);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.imyeyu.api.modules.user.mapper;
|
||||
|
||||
import com.imyeyu.api.bean.ModuleCode;
|
||||
import com.imyeyu.api.modules.user.entity.Role;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 Mapper
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface RoleMapper extends BaseMapper<Role, String> {
|
||||
|
||||
List<Role> selectByIdList(List<String> idList);
|
||||
|
||||
List<Role> selectByModuleCodeAndCodeList(@Param("moduleCode") ModuleCode moduleCode, @Param("codeList") List<String> codeList);
|
||||
|
||||
List<Role> selectByModuleCode(@Param("moduleCode") ModuleCode moduleCode);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.imyeyu.api.modules.user.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.user.entity.Permission;
|
||||
import com.imyeyu.api.modules.user.entity.RolePermission;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色权限 Mapper
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface RolePermissionMapper extends BaseMapper<RolePermission, String> {
|
||||
|
||||
default List<RolePermission> selectByRoleId(String roleId) {
|
||||
return selectByRoleIdList(List.of(roleId));
|
||||
}
|
||||
|
||||
List<RolePermission> selectByRoleIdList(List<String> roleIdList);
|
||||
|
||||
List<Permission> selectPermissionByRoleIdList(List<String> roleIdList);
|
||||
|
||||
void createBatch(List<RolePermission> rolePermissionList);
|
||||
|
||||
void deleteByPermissionIdList(String roleId, List<String> permissionIdList);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.imyeyu.api.modules.user.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.user.entity.RoleRelation;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色关联 Mapper
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface RoleRelationMapper extends BaseMapper<RoleRelation, String> {
|
||||
|
||||
List<RoleRelation> selectByParentRoleId(String parentRoleId);
|
||||
|
||||
List<String> selectChildRoleIdListByParentRoleId(String parentRoleId);
|
||||
|
||||
List<String> selectChildRoleIdListByParentRoleIdList(List<String> parentRoleIdList);
|
||||
|
||||
void createBatch(List<RoleRelation> roleRelationList);
|
||||
|
||||
void deleteByChildRoleIdList(String parentRoleId, List<String> childRoleIdList);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.imyeyu.api.modules.user.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.user.entity.UserBehaviorRecord;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户行为记录 Mapper
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-05-27 17:10
|
||||
*/
|
||||
public interface UserBehaviorRecordMapper extends BaseMapper<UserBehaviorRecord, String> {
|
||||
|
||||
/**
|
||||
* 查询有效行为记录
|
||||
*
|
||||
* @param bizType 业务类型
|
||||
* @param userId 用户 ID
|
||||
* @param targetType 目标类型
|
||||
* @param targetId 目标 ID
|
||||
* @param actionType 行为类型
|
||||
* @return 行为记录,不存在时返回 {@code null}
|
||||
*/
|
||||
UserBehaviorRecord selectActive(String bizType, String userId, String targetType, String targetId, String actionType);
|
||||
|
||||
/**
|
||||
* 查询用户有效行为目标 ID 列表
|
||||
*
|
||||
* @param bizType 业务类型
|
||||
* @param userId 用户 ID
|
||||
* @param targetType 目标类型
|
||||
* @param actionType 行为类型
|
||||
* @param targetIdList 目标 ID 列表
|
||||
* @return 目标 ID 列表
|
||||
*/
|
||||
List<String> selectActiveTargetIdList(String bizType, String userId, String targetType, String actionType, List<String> targetIdList);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.imyeyu.api.modules.user.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.user.entity.User;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2021-02-23 21:33
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<User, String> {
|
||||
|
||||
@Select("SELECT * FROM `user` WHERE `email` = #{email} AND `email_verify_at` IS NULL" + NOT_DELETE + LIMIT_1)
|
||||
User selectByEmail(String email);
|
||||
|
||||
@Select("SELECT * FROM `user` WHERE `email` = #{email} AND `email_verify_at` < " + UNIX_TIME + NOT_DELETE + LIMIT_1)
|
||||
User selectByVerifiedEmail(String email);
|
||||
|
||||
@Select("SELECT * FROM `user` WHERE `phone_no` = #{phoneNo}" + NOT_DELETE + LIMIT_1)
|
||||
User selectByPhoneNo(String phoneNo);
|
||||
|
||||
@Select("SELECT * FROM `user` WHERE `phone_no` = #{phoneNo} AND `phone_no_verify_at` < " + UNIX_TIME + NOT_DELETE + LIMIT_1)
|
||||
User selectByVerifiedPhoneNo(String phoneNo);
|
||||
|
||||
/**
|
||||
* 根据 ID 列表查询用户
|
||||
*
|
||||
* @param idList 用户 ID 列表
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<User> listByIdList(List<String> idList);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.imyeyu.api.modules.user.mapper;
|
||||
|
||||
import com.imyeyu.api.modules.user.entity.UserRole;
|
||||
import com.imyeyu.spring.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户角色 Mapper
|
||||
*
|
||||
* @author 夜雨
|
||||
* @since 2026-05-13 14:46
|
||||
*/
|
||||
public interface UserRoleMapper extends BaseMapper<UserRole, String> {
|
||||
|
||||
void createBatch(List<UserRole> userRoleList);
|
||||
|
||||
void deleteByRoleIdList(String userId, List<String> roleIdList);
|
||||
}
|
||||
Reference in New Issue
Block a user