feat(core): 新增项目及相关功能的数据访问层和权限控制切面
- 添加多个Mapper接口及XML文件支持项目、成员、里程碑、任务、风险、资源、 文件附件等模块的数据操作和查询功能,支持复杂查询与统计 - 新增Sa-Token权限配置,集成统一认证管理 - 引入权限常量类,定义系统角色、项目角色及权限编码标准 - 新增项目权限校验切面,实现基于注解的项目权限和角色校验逻辑 - 更新配置文件和依赖,集成MyBatis Plus、MinIO、Spring AI及文档解析相关库 - 调整MyBatis配置的类型别名包路径,统一领域实体引用路径
This commit is contained in:
@@ -3,10 +3,31 @@ package cn.yinlihupo.mapper;
|
||||
import cn.yinlihupo.domain.entity.FileAttachment;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 文件附件Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface FileAttachmentMapper extends BaseMapper<FileAttachment> {
|
||||
|
||||
/**
|
||||
* 查询某业务实体的附件列表(含上传者信息)
|
||||
*/
|
||||
List<Map<String, Object>> selectAttachmentsByRelated(@Param("relatedType") String relatedType,
|
||||
@Param("relatedId") Long relatedId);
|
||||
|
||||
/**
|
||||
* 分页查询项目下所有附件(支持文件类型筛选)
|
||||
*/
|
||||
List<Map<String, Object>> selectAttachmentsByProject(@Param("projectId") Long projectId,
|
||||
@Param("fileType") String fileType);
|
||||
|
||||
/**
|
||||
* 统计用户上传文件数量和总大小
|
||||
*/
|
||||
List<Map<String, Object>> selectUploaderStats(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,46 @@ package cn.yinlihupo.mapper;
|
||||
import cn.yinlihupo.domain.entity.Project;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 项目Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectMapper extends BaseMapper<Project> {
|
||||
|
||||
/**
|
||||
* 分页查询项目列表(支持多条件筛选)
|
||||
*/
|
||||
List<Project> selectPageList(@Param("status") String status,
|
||||
@Param("priority") String priority,
|
||||
@Param("riskLevel") String riskLevel,
|
||||
@Param("managerId") Long managerId,
|
||||
@Param("keyword") String keyword,
|
||||
@Param("planStartDateFrom") LocalDate planStartDateFrom,
|
||||
@Param("planStartDateTo") LocalDate planStartDateTo);
|
||||
|
||||
/**
|
||||
* 查询指定用户有权限的项目列表(仅自己管理或参与的)
|
||||
*/
|
||||
List<Project> selectProjectsByUserId(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 查询项目详情
|
||||
*/
|
||||
Project selectDetailById(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 统计各状态项目数量
|
||||
*/
|
||||
List<Map<String, Object>> countByStatus();
|
||||
|
||||
/**
|
||||
* 查询即将超期的项目(N天内)
|
||||
*/
|
||||
List<Project> selectAboutToExpire(@Param("days") int days);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,30 @@ package cn.yinlihupo.mapper;
|
||||
import cn.yinlihupo.domain.entity.ProjectMember;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 项目成员Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectMemberMapper extends BaseMapper<ProjectMember> {
|
||||
|
||||
/**
|
||||
* 查询项目成员列表(含用户详情)
|
||||
*/
|
||||
List<Map<String, Object>> selectMembersWithUser(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询用户在某项目中的角色
|
||||
*/
|
||||
String selectRoleByUserAndProject(@Param("projectId") Long projectId,
|
||||
@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 统计某用户参与的项目数量(按角色分组)
|
||||
*/
|
||||
List<Map<String, Object>> countUserProjects(@Param("userId") Long userId);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,36 @@ package cn.yinlihupo.mapper;
|
||||
import cn.yinlihupo.domain.entity.ProjectMilestone;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 项目里程碑Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectMilestoneMapper extends BaseMapper<ProjectMilestone> {
|
||||
|
||||
/**
|
||||
* 查询项目里程碑列表(含任务统计)
|
||||
*/
|
||||
List<Map<String, Object>> selectMilestoneListWithStats(@Param("projectId") Long projectId,
|
||||
@Param("status") String status);
|
||||
|
||||
/**
|
||||
* 查询已延期的关键里程碑
|
||||
*/
|
||||
List<ProjectMilestone> selectDelayedKeyMilestones(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询即将到期的里程碑(N天内)
|
||||
*/
|
||||
List<ProjectMilestone> selectUpcomingMilestones(@Param("projectId") Long projectId,
|
||||
@Param("days") int days);
|
||||
|
||||
/**
|
||||
* 查询里程碑完成进度统计
|
||||
*/
|
||||
Map<String, Object> selectMilestoneProgressSummary(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,38 @@ package cn.yinlihupo.mapper;
|
||||
import cn.yinlihupo.domain.entity.Resource;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 资源Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface ResourceMapper extends BaseMapper<Resource> {
|
||||
|
||||
/**
|
||||
* 分页查询资源列表(含负责人信息,支持多条件筛选)
|
||||
*/
|
||||
List<Map<String, Object>> selectResourcePageWithResponsible(@Param("projectId") Long projectId,
|
||||
@Param("resourceType") String resourceType,
|
||||
@Param("status") String status,
|
||||
@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 查询资源预算汇总(按类型统计)
|
||||
*/
|
||||
List<Map<String, Object>> selectResourceBudgetSummary(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询即将到位但尚未到位的资源(N天内)
|
||||
*/
|
||||
List<Resource> selectPendingArrivalResources(@Param("projectId") Long projectId,
|
||||
@Param("days") int days);
|
||||
|
||||
/**
|
||||
* 查询待审批的资源申请
|
||||
*/
|
||||
List<Map<String, Object>> selectPendingApprovalResources(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,38 @@ package cn.yinlihupo.mapper;
|
||||
import cn.yinlihupo.domain.entity.Risk;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 风险Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface RiskMapper extends BaseMapper<Risk> {
|
||||
|
||||
/**
|
||||
* 分页查询风险列表(含负责人信息,支持多条件筛选)
|
||||
*/
|
||||
List<Map<String, Object>> selectRiskPageWithOwner(@Param("projectId") Long projectId,
|
||||
@Param("category") String category,
|
||||
@Param("riskLevel") String riskLevel,
|
||||
@Param("status") String status,
|
||||
@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 查询未解决的高/严重风险(用于预警)
|
||||
*/
|
||||
List<Map<String, Object>> selectHighRisksUnresolved(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 按风险等级统计各分类数量
|
||||
*/
|
||||
List<Map<String, Object>> countRiskByCategoryAndLevel(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询风险处理趋势(近6个月)
|
||||
*/
|
||||
List<Map<String, Object>> selectRiskTrend(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
30
src/main/java/cn/yinlihupo/mapper/SysPermissionMapper.java
Normal file
30
src/main/java/cn/yinlihupo/mapper/SysPermissionMapper.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package cn.yinlihupo.mapper;
|
||||
|
||||
import cn.yinlihupo.domain.entity.SysPermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统权限Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysPermissionMapper extends BaseMapper<SysPermission> {
|
||||
|
||||
/**
|
||||
* 根据角色编码列表查询权限编码列表
|
||||
*/
|
||||
List<String> selectPermissionCodesByRoleCodes(@Param("roleCodes") List<String> roleCodes);
|
||||
|
||||
/**
|
||||
* 查询菜单树(含按钮权限)
|
||||
*/
|
||||
List<SysPermission> selectMenuTree();
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限列表
|
||||
*/
|
||||
List<SysPermission> selectPermsByRoleId(@Param("roleId") Long roleId);
|
||||
}
|
||||
12
src/main/java/cn/yinlihupo/mapper/SysRoleMapper.java
Normal file
12
src/main/java/cn/yinlihupo/mapper/SysRoleMapper.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package cn.yinlihupo.mapper;
|
||||
|
||||
import cn.yinlihupo.domain.entity.SysRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 系统角色Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package cn.yinlihupo.mapper;
|
||||
|
||||
import cn.yinlihupo.domain.entity.SysRolePermission;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 角色权限关联Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysRolePermissionMapper extends BaseMapper<SysRolePermission> {
|
||||
}
|
||||
37
src/main/java/cn/yinlihupo/mapper/SysUserMapper.java
Normal file
37
src/main/java/cn/yinlihupo/mapper/SysUserMapper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package cn.yinlihupo.mapper;
|
||||
|
||||
import cn.yinlihupo.domain.entity.SysUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统用户Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色编码列表
|
||||
*/
|
||||
List<String> selectRoleCodesByUserId(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户名查询用户
|
||||
*/
|
||||
SysUser selectByUsername(@Param("username") String username);
|
||||
|
||||
/**
|
||||
* 分页查询用户列表(支持按部门、状态、关键字筛选)
|
||||
*/
|
||||
List<SysUser> selectPageList(@Param("deptId") Long deptId,
|
||||
@Param("status") Integer status,
|
||||
@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 查询项目成员用户详情列表
|
||||
*/
|
||||
List<SysUser> selectUsersByProjectId(@Param("projectId") Long projectId);
|
||||
}
|
||||
12
src/main/java/cn/yinlihupo/mapper/SysUserRoleMapper.java
Normal file
12
src/main/java/cn/yinlihupo/mapper/SysUserRoleMapper.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package cn.yinlihupo.mapper;
|
||||
|
||||
import cn.yinlihupo.domain.entity.SysUserRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户角色关联Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
||||
}
|
||||
@@ -3,10 +3,45 @@ package cn.yinlihupo.mapper;
|
||||
import cn.yinlihupo.domain.entity.Task;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 任务Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface TaskMapper extends BaseMapper<Task> {
|
||||
|
||||
/**
|
||||
* 分页查询任务列表(含负责人信息,支持多条件筛选)
|
||||
*/
|
||||
List<Map<String, Object>> selectTaskPageWithAssignee(@Param("projectId") Long projectId,
|
||||
@Param("milestoneId") Long milestoneId,
|
||||
@Param("assigneeId") Long assigneeId,
|
||||
@Param("status") String status,
|
||||
@Param("priority") String priority,
|
||||
@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* 查询我的待办任务(按用户ID)
|
||||
*/
|
||||
List<Task> selectMyTasks(@Param("userId") Long userId,
|
||||
@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询超期未完成的任务
|
||||
*/
|
||||
List<Map<String, Object>> selectOverdueTasks(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询任务的前置依赖关系
|
||||
*/
|
||||
List<Map<String, Object>> selectDependencies(@Param("taskId") Long taskId);
|
||||
|
||||
/**
|
||||
* 统计项目任务状态分布
|
||||
*/
|
||||
List<Map<String, Object>> countTasksByStatus(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user