From 0eb5da6ea89adaef89f84c5dffcb74139ae28921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E5=BA=86=E6=B3=B0?= <12369755+htcloud1@user.noreply.gitee.com> Date: Sat, 22 Aug 2026 20:16:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(biz=5Fproject+meeting):=20=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE+=E4=BC=9A=E8=AE=AE=E8=BD=AF=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=BA=A7=E8=81=94,=20admin/manager=20=E5=8F=8C=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=8F=AF=E5=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit biz_project* 5 表级联 (project/plan/assign/sponsor_assign/rating) + 会议链 biz_meeting* 6 表级联 admin-only → admin/manager 可删 DB: - 5 ALTER TABLE 加 is_deleted TINYINT DEFAULT 0 NOT NULL (biz_project/plan/assign/sponsor_assign/rating) - biz_meeting* 6 表已有 is_deleted 列 (上轮已 ALTER) Domain (10 文件): - 5 个 biz_project* 加 isDeleted 字段 - 6 个 biz_meeting* 加 isDeleted 字段 - (audit_log 列名特殊: 使用 deleted 字段存操作类型, 不冲突) Mapper 接口 (10 文件): - 5 个 project mapper 加 softDeleteByProjectId / softDeleteByProjectNo - 5 个 meeting mapper 加 softDeleteByMeetingId - BizMeetingMapper 加 selectIdListByProjectId (级联调用) Mapper XML (10 文件): - 所有 SELECT 加 is_deleted=0 过滤 (含 JOIN 子查询) - 加 softDeleteByXxx UPDATE (10 处) - BizMeetingMapper.xml 的 plan LEFT JOIN 加 proj.is_deleted=0 防悬挂 Service (3 文件): - IBizProjectService.softDeleteCascade/Batch (含会议链调用) - IBizMeetingService.softDeleteCascade/Batch - BizProjectServiceImpl / BizMeetingServiceImpl @Transactional(rollbackFor=Exception.class) Controller (2 文件): - BizProjectController.DELETE 改 admin+manager 可删 - BizMeetingController.DELETE 改 admin+manager 可删 (放宽权限) --- .../controller/BizMeetingController.java | 11 ++- .../controller/BizProjectController.java | 9 ++- .../com/ruoyi/business/domain/BizMeeting.java | 4 ++ .../business/domain/BizMeetingAttendee.java | 4 ++ .../business/domain/BizMeetingAuditLog.java | 6 ++ .../business/domain/BizMeetingExecutor.java | 6 ++ .../business/domain/BizMeetingMaterial.java | 6 ++ .../business/domain/BizMeetingSupervisor.java | 6 ++ .../com/ruoyi/business/domain/BizProject.java | 8 +++ .../business/domain/BizProjectAssign.java | 4 ++ .../ruoyi/business/domain/BizProjectPlan.java | 4 ++ .../business/domain/BizProjectRating.java | 4 ++ .../domain/BizProjectSponsorAssign.java | 5 ++ .../mapper/BizMeetingAttendeeMapper.java | 2 + .../mapper/BizMeetingAuditLogMapper.java | 2 + .../mapper/BizMeetingExecutorMapper.java | 3 + .../business/mapper/BizMeetingMapper.java | 4 ++ .../mapper/BizMeetingMaterialMapper.java | 3 + .../mapper/BizMeetingSupervisorMapper.java | 3 + .../mapper/BizProjectAssignMapper.java | 2 + .../business/mapper/BizProjectMapper.java | 4 ++ .../business/mapper/BizProjectPlanMapper.java | 2 + .../mapper/BizProjectRatingMapper.java | 2 + .../mapper/BizProjectSponsorAssignMapper.java | 2 + .../business/service/IBizMeetingService.java | 8 +++ .../business/service/IBizProjectService.java | 10 +++ .../impl/BizMeetingAttendeeServiceImpl.java | 4 +- .../service/impl/BizMeetingServiceImpl.java | 41 +++++++++++ .../service/impl/BizProjectServiceImpl.java | 70 +++++++++++++++++++ .../business/BizMeetingAttendeeMapper.xml | 22 ++++-- .../business/BizMeetingAuditLogMapper.xml | 11 ++- .../business/BizMeetingExecutorMapper.xml | 15 ++-- .../mapper/business/BizMeetingMapper.xml | 18 +++-- .../business/BizMeetingMaterialMapper.xml | 12 +++- .../business/BizMeetingSupervisorMapper.xml | 15 ++-- .../business/BizProjectAssignMapper.xml | 13 +++- .../mapper/business/BizProjectMapper.xml | 36 +++++++--- .../mapper/business/BizProjectPlanMapper.xml | 12 +++- .../business/BizProjectRatingMapper.xml | 11 ++- .../BizProjectSponsorAssignMapper.xml | 8 ++- 40 files changed, 367 insertions(+), 45 deletions(-) diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizMeetingController.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizMeetingController.java index 73ed48b..b5a48f9 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizMeetingController.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizMeetingController.java @@ -101,10 +101,19 @@ public class BizMeetingController extends BaseController { return toAjax(rows); } + /** + * 软删除会议 (admin/manager 会议管理用, 后端强校验 role_type) + * 级联置 biz_meeting + 5 张子表 is_deleted=1, 数据保留审计追溯 + */ @Log(title = "会议", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(bizMeetingService.deleteByPrimaryKeys(ids)); + String roleType = SecurityUtils.getLoginUser().getUser().getRoleType(); + if (!"admin".equals(roleType) && !"manager".equals(roleType)) { + throw new ServiceException("只有管理员或合规经理可删除会议"); + } + bizMeetingService.softDeleteCascadeBatch(ids); + return success(); } // =================================================================== diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizProjectController.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizProjectController.java index 7f0754e..67023a5 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizProjectController.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/controller/BizProjectController.java @@ -14,6 +14,7 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.business.domain.BizExecutionIntent; import com.ruoyi.business.domain.BizProject; @@ -165,7 +166,13 @@ public class BizProjectController extends BaseController @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(bizProjectService.deleteByPrimaryKeys(ids)); + // 后端角色兜底: 仅 admin / manager 可删项目 (前端 Projects.vue 已 v-if, 此处防 devtools 绕过) + String roleType = SecurityUtils.getLoginUser().getUser().getRoleType(); + if (!"admin".equals(roleType) && !"manager".equals(roleType)) { + throw new ServiceException("只有管理员或经理可删除项目"); + } + bizProjectService.softDeleteCascadeBatch(ids); + return success(); } // ========== 项目执行方分配 sub-resource ========== diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeeting.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeeting.java index d28acfe..a6c5fae 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeeting.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeeting.java @@ -84,6 +84,8 @@ public class BizMeeting extends BaseEntity { private transient Long userId; /** 新增/编辑会议时传入, 自动批量写入 biz_meeting_attendee 中间表 (非持久化) */ private Long[] attendeeUserIds; + /** 软删除标记 0否1是 (admin 删除会议时置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; public Long getMeetingId() { return meetingId; } public void setMeetingId(Long meetingId) { this.meetingId = meetingId; } public String getProjectNo() { return projectNo; } @@ -139,6 +141,8 @@ public class BizMeeting extends BaseEntity { public void setVoucherAuditStage(String voucherAuditStage) { this.voucherAuditStage = voucherAuditStage; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } public Long[] getAttendeeUserIds() { return attendeeUserIds; } public void setAttendeeUserIds(Long[] attendeeUserIds) { this.attendeeUserIds = attendeeUserIds; } } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAttendee.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAttendee.java index 090e86d..5e92b0a 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAttendee.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAttendee.java @@ -131,4 +131,8 @@ public class BizMeetingAttendee extends BaseEntity { public void setProjectName(String projectName) { this.projectName = projectName; } public String getProjectNo() { return projectNo; } public void setProjectNo(String projectNo) { this.projectNo = projectNo; } + /** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAuditLog.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAuditLog.java index 0dd8895..20ce7d1 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAuditLog.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingAuditLog.java @@ -42,6 +42,9 @@ public class BizMeetingAuditLog { /** 审核结果 (APPROVED / REJECTED) */ private String auditResult; + /** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Long getId() { return id; } public void setId(Long id) { this.id = id; } @@ -68,4 +71,7 @@ public class BizMeetingAuditLog { public String getAuditResult() { return auditResult; } public void setAuditResult(String auditResult) { this.auditResult = auditResult; } + + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingExecutor.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingExecutor.java index adedb95..50b2be9 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingExecutor.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingExecutor.java @@ -28,6 +28,9 @@ public class BizMeetingExecutor { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; + /** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Long getId() { return id; } public void setId(Long id) { this.id = id; } @@ -42,4 +45,7 @@ public class BizMeetingExecutor { public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } + + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingMaterial.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingMaterial.java index 6c48991..a780d2b 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingMaterial.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingMaterial.java @@ -48,6 +48,9 @@ public class BizMeetingMaterial { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; + /** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Long getId() { return id; } public void setId(Long id) { this.id = id; } @@ -74,4 +77,7 @@ public class BizMeetingMaterial { public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } + + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingSupervisor.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingSupervisor.java index fb27357..f362c16 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingSupervisor.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizMeetingSupervisor.java @@ -28,6 +28,9 @@ public class BizMeetingSupervisor { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; + /** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Long getId() { return id; } public void setId(Long id) { this.id = id; } @@ -42,4 +45,7 @@ public class BizMeetingSupervisor { public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } + + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProject.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProject.java index 8d13bc4..69fcf4e 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProject.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProject.java @@ -100,6 +100,8 @@ public class BizProject extends BaseEntity { private Date updateTime; /** 管理费及税金 */ private BigDecimal manageFee; + /** 角色劳务 (JSON: [{role, customName, amount}], ProjectsNew.vue 编辑保存) */ + private String roleLabor; /** 项目开始时间 (与 DB datetime 对齐, JSON 用 yyyy-MM-dd HH:mm:ss 序列化, 跟 BizMeeting 一致) */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; @@ -134,6 +136,10 @@ public class BizProject extends BaseEntity { private Integer sponsorQ3; private Integer sponsorQ4; private String sponsorRemark; + /** 软删除标记 0否1是 (admin/manager 删除项目时级联置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } public Long getProjectId() { return projectId; } public void setProjectId(Long projectId) { this.projectId = projectId; } public String getProjectNo() { return projectNo; } @@ -200,6 +206,8 @@ public class BizProject extends BaseEntity { public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public BigDecimal getManageFee() { return manageFee; } public void setManageFee(BigDecimal manageFee) { this.manageFee = manageFee; } + public String getRoleLabor() { return roleLabor; } + public void setRoleLabor(String roleLabor) { this.roleLabor = roleLabor; } public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Date getEndTime() { return endTime; } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectAssign.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectAssign.java index 70f7bcf..346d856 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectAssign.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectAssign.java @@ -24,6 +24,10 @@ public class BizProjectAssign extends BaseEntity { private BigDecimal amount; /** 状态 0正常 1已撤销 */ private String status; + /** 软删除标记 0否1是 (项目级联删除时按 project_id 置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } public String getAssignId() { return assignId; } public void setAssignId(String assignId) { this.assignId = assignId; } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectPlan.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectPlan.java index 03ab51f..97c3a2b 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectPlan.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectPlan.java @@ -71,6 +71,10 @@ public class BizProjectPlan extends BaseEntity { private Long submitterId; /** 投稿人姓名 (LEFT JOIN biz_person.name 优先, sys_user.user_name 兜底; biz_person.user_id 已 UNIQUE, 1:1 无笛卡尔积) */ private String submitterName; + /** 软删除标记 0否1是 (项目级联删除时按 projectNo 置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } public String getPlanId() { return planId; } public void setPlanId(String planId) { this.planId = planId; } public String getPlanName() { return planName; } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectRating.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectRating.java index 477cb5e..e8976cf 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectRating.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectRating.java @@ -58,6 +58,10 @@ public class BizProjectRating extends BaseEntity { private Long raterId; /** 评分时间 */ private String ratingTime; + /** 软删除标记 0否1是 (项目级联删除时按 project_id 置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } public String getRatingId() { return ratingId; } public void setRatingId(String ratingId) { this.ratingId = ratingId; } public String getProjectNo() { return projectNo; } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectSponsorAssign.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectSponsorAssign.java index c79c978..76574a5 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectSponsorAssign.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/domain/BizProjectSponsorAssign.java @@ -21,6 +21,11 @@ public class BizProjectSponsorAssign extends BaseEntity { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; + /** 软删除标记 0否1是 (项目级联删除时按 project_id (String) 置1, 查询需 WHERE is_deleted=0) */ + private Integer isDeleted; + public Integer getIsDeleted() { return isDeleted; } + public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; } + public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getProjectId() { return projectId; } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAttendeeMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAttendeeMapper.java index edd6172..a1ca660 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAttendeeMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAttendeeMapper.java @@ -24,6 +24,8 @@ public interface BizMeetingAttendeeMapper { /** 管理端按 attendee.id 单删 (MeetingDetail 参会人 CRUD 用) */ int deleteByPrimaryKey(Long id); int deleteByMeetingIdAndUserId(BizMeetingAttendee entity); + /** 软删除: admin 删除会议时级联置 is_deleted=1 (硬删保留用于单条参会人管理) */ + int softDeleteByMeetingId(Long meetingId); List selectByMeetingId(Long meetingId); List selectByUserId(Long userId); BizMeetingAttendee selectById(Long id); diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAuditLogMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAuditLogMapper.java index e26da78..8f24522 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAuditLogMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingAuditLogMapper.java @@ -25,4 +25,6 @@ public interface BizMeetingAuditLogMapper { /** 按主键批量删除 */ int deleteByPrimaryKeys(Long[] ids); + /** 软删除: admin 删除会议时级联置 is_deleted=1 (审计行仍保留, 但不再随会议显示) */ + int softDeleteByMeetingId(Long meetingId); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingExecutorMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingExecutorMapper.java index a915feb..5d8b5fa 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingExecutorMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingExecutorMapper.java @@ -32,6 +32,9 @@ public interface BizMeetingExecutorMapper { /** 按会议ID全删 (分配时全删全插) */ int deleteByMeetingId(Long meetingId); + /** 软删除: admin 删除会议时级联置 is_deleted=1 */ + int softDeleteByMeetingId(Long meetingId); + /** 批量插入 */ int insertBatch(List list); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMapper.java index 8ec92b6..779f531 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMapper.java @@ -13,4 +13,8 @@ public interface BizMeetingMapper int updateByPrimaryKey(BizMeeting entity); int deleteByPrimaryKey(Long meetingId); int deleteByPrimaryKeys(Long[] meetingIds); + /** 软删除: admin 删除会议时调用, 置 is_deleted=1 (不真删, 保留审计) */ + int softDeleteByPrimaryKey(Long meetingId); + /** 项目级联删除时用: 查项目下所有 meeting_id (不过滤 is_deleted, 软删 idempotent) */ + List selectIdListByProjectId(Long projectId); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMaterialMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMaterialMapper.java index 1bb5e25..300d869 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMaterialMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingMaterialMapper.java @@ -26,6 +26,9 @@ public interface BizMeetingMaterialMapper { /** 按会议ID删除该会议所有材料记录 (save 时先全删) */ int deleteByMeetingId(Long meetingId); + /** 软删除: admin 删除会议时级联置 is_deleted=1 */ + int softDeleteByMeetingId(Long meetingId); + /** 批量插入 (单会议替换 save 专用) */ int insertBatch(List list); diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingSupervisorMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingSupervisorMapper.java index d5997ea..5a340c5 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingSupervisorMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizMeetingSupervisorMapper.java @@ -32,6 +32,9 @@ public interface BizMeetingSupervisorMapper { /** 按会议ID全删 (分配时全删全插) */ int deleteByMeetingId(Long meetingId); + /** 软删除: admin 删除会议时级联置 is_deleted=1 */ + int softDeleteByMeetingId(Long meetingId); + /** 批量插入 */ int insertBatch(List list); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectAssignMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectAssignMapper.java index 581ab24..2003bbf 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectAssignMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectAssignMapper.java @@ -15,4 +15,6 @@ public interface BizProjectAssignMapper int updateByPrimaryKey(BizProjectAssign entity); int deleteByPrimaryKey(String assignId); int deleteByProjectId(Long projectId); + /** 软删除: 项目级联删除时按 project_id 置 is_deleted=1 */ + int softDeleteByProjectId(Long projectId); } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectMapper.java index 4fc78f0..5144ddc 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectMapper.java @@ -17,4 +17,8 @@ public interface BizProjectMapper int updateByPrimaryKey(BizProject entity); int deleteByPrimaryKey(Long projectId); int deleteByPrimaryKeys(Long[] projectIds); + /** 软删除: admin/manager 删除项目时调用, 置 is_deleted=1 (不真删, 保留审计) */ + int softDeleteByProjectId(Long projectId); + /** 级联删除时用: 查 project_no (不过滤 is_deleted, 避免已软删项目查不到 projectNo) */ + String selectProjectNoById(Long projectId); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectPlanMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectPlanMapper.java index e40f33f..8c03774 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectPlanMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectPlanMapper.java @@ -13,4 +13,6 @@ public interface BizProjectPlanMapper int updateByPrimaryKey(BizProjectPlan entity); int deleteByPrimaryKey(String planId); int deleteByPrimaryKeys(String[] planIds); + /** 软删除: 项目级联删除时按 projectNo 置 is_deleted=1 (biz_project_plan 用 project_no 关联项目, 不用 project_id) */ + int softDeleteByProjectNo(String projectNo); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectRatingMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectRatingMapper.java index c6cd0f5..d948fc8 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectRatingMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectRatingMapper.java @@ -15,4 +15,6 @@ public interface BizProjectRatingMapper int upsertRating(BizProjectRating entity); int deleteByPrimaryKey(String ratingId); int deleteByPrimaryKeys(String[] ratingIds); + /** 软删除: 项目级联删除时按 project_id 置 is_deleted=1 */ + int softDeleteByProjectId(Long projectId); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectSponsorAssignMapper.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectSponsorAssignMapper.java index 4b97f60..90cead9 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectSponsorAssignMapper.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/mapper/BizProjectSponsorAssignMapper.java @@ -8,4 +8,6 @@ public interface BizProjectSponsorAssignMapper { List selectByProjectId(String projectId); /** 按 project_id 全删 (支持方分配: 先删后插策略) */ int deleteByProjectId(String projectId); + /** 软删除: 项目级联删除时按 project_id (String) 置 is_deleted=1 */ + int softDeleteByProjectId(String projectId); } \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizMeetingService.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizMeetingService.java index 93a301b..93b4a64 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizMeetingService.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizMeetingService.java @@ -14,4 +14,12 @@ public interface IBizMeetingService int updateByPrimaryKey(BizMeeting entity); int deleteByPrimaryKey(Long meetingId); int deleteByPrimaryKeys(Long[] meetingId); + /** + * 软删除会议: 级联把 biz_meeting + biz_meeting_attendee + biz_meeting_supervisor + + * biz_meeting_executor + biz_meeting_material + biz_meeting_audit_log 的 is_deleted 全部置 1. + * 数据不真删, 保留审计追溯能力. + */ + void softDeleteCascade(Long meetingId); + /** 批量软删 (admin 会议管理页一次选多个) */ + void softDeleteCascadeBatch(Long[] meetingIds); } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizProjectService.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizProjectService.java index f351dd2..f1abf23 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizProjectService.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/IBizProjectService.java @@ -18,4 +18,14 @@ public interface IBizProjectService int updateByPrimaryKey(BizProject entity); int deleteByPrimaryKey(Long projectId); int deleteByPrimaryKeys(Long[] projectId); + + /** + * 软删除项目 (单条): 级联置 5 张项目表 + 会议链 is_deleted=1. + * 顺序: 先 5 表更新 → 再查项目下所有 meeting → 触发 meeting cascade. + * 包在事务里保证原子性. + */ + void softDeleteCascade(Long projectId); + + /** 软删除项目 (批量): 逐条 cascade, 失败粒度细 */ + void softDeleteCascadeBatch(Long[] projectIds); } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingAttendeeServiceImpl.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingAttendeeServiceImpl.java index ee5763f..f735be5 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingAttendeeServiceImpl.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingAttendeeServiceImpl.java @@ -229,4 +229,6 @@ public class BizMeetingAttendeeServiceImpl implements IBizMeetingAttendeeService log.info("[attendee] 批量导入完成 meetingId={} ok={} ng={}", meetingId, result.getOkNum(), result.getNgNum()); return result; - } \ No newline at end of file + } + +} \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingServiceImpl.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingServiceImpl.java index b6c9740..658e4b3 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingServiceImpl.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizMeetingServiceImpl.java @@ -3,8 +3,14 @@ package com.ruoyi.business.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.business.domain.BizMeeting; import com.ruoyi.business.mapper.BizMeetingMapper; +import com.ruoyi.business.mapper.BizMeetingAttendeeMapper; +import com.ruoyi.business.mapper.BizMeetingSupervisorMapper; +import com.ruoyi.business.mapper.BizMeetingExecutorMapper; +import com.ruoyi.business.mapper.BizMeetingMaterialMapper; +import com.ruoyi.business.mapper.BizMeetingAuditLogMapper; import com.ruoyi.business.service.IBizMeetingService; import com.ruoyi.common.utils.id.IdGenerator; @@ -13,6 +19,16 @@ public class BizMeetingServiceImpl implements IBizMeetingService { @Autowired private BizMeetingMapper bizMeetingMapper; + @Autowired + private BizMeetingAttendeeMapper attendeeMapper; + @Autowired + private BizMeetingSupervisorMapper supervisorMapper; + @Autowired + private BizMeetingExecutorMapper executorMapper; + @Autowired + private BizMeetingMaterialMapper materialMapper; + @Autowired + private BizMeetingAuditLogMapper auditLogMapper; @Override public BizMeeting getById(Long meetingId) @@ -38,4 +54,29 @@ public class BizMeetingServiceImpl implements IBizMeetingService @Override public int deleteByPrimaryKeys(Long[] meetingId) { return bizMeetingMapper.deleteByPrimaryKeys(meetingId); } + + /** + * 软删除会议: 级联置 6 张表 is_deleted=1. + * 顺序无关 (都是按 meeting_id 单条件更新), 包在事务里保证原子性: + * 一旦中间任何一行失败, 整批回滚, 不会出现"主表删了子表还在"的悬挂数据. + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void softDeleteCascade(Long meetingId) { + bizMeetingMapper.softDeleteByPrimaryKey(meetingId); + attendeeMapper.softDeleteByMeetingId(meetingId); + supervisorMapper.softDeleteByMeetingId(meetingId); + executorMapper.softDeleteByMeetingId(meetingId); + materialMapper.softDeleteByMeetingId(meetingId); + auditLogMapper.softDeleteByMeetingId(meetingId); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void softDeleteCascadeBatch(Long[] meetingIds) { + if (meetingIds == null) return; + for (Long id : meetingIds) { + if (id != null) softDeleteCascade(id); + } + } } diff --git a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizProjectServiceImpl.java b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizProjectServiceImpl.java index 0be87b4..1d8a537 100644 --- a/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizProjectServiceImpl.java +++ b/ry-api/ruoyi-business/src/main/java/com/ruoyi/business/service/impl/BizProjectServiceImpl.java @@ -3,9 +3,16 @@ package com.ruoyi.business.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.business.domain.BizProject; import com.ruoyi.business.mapper.BizProjectMapper; +import com.ruoyi.business.mapper.BizProjectPlanMapper; +import com.ruoyi.business.mapper.BizProjectAssignMapper; +import com.ruoyi.business.mapper.BizProjectSponsorAssignMapper; +import com.ruoyi.business.mapper.BizProjectRatingMapper; +import com.ruoyi.business.mapper.BizMeetingMapper; import com.ruoyi.business.service.IBizProjectService; +import com.ruoyi.business.service.IBizMeetingService; import com.ruoyi.common.utils.SecurityUtils; @Service @@ -13,6 +20,18 @@ public class BizProjectServiceImpl implements IBizProjectService { @Autowired private BizProjectMapper bizProjectMapper; + @Autowired + private BizProjectPlanMapper bizProjectPlanMapper; + @Autowired + private BizProjectAssignMapper bizProjectAssignMapper; + @Autowired + private BizProjectSponsorAssignMapper bizProjectSponsorAssignMapper; + @Autowired + private BizProjectRatingMapper bizProjectRatingMapper; + @Autowired + private BizMeetingMapper bizMeetingMapper; + @Autowired + private IBizMeetingService bizMeetingService; @Override public BizProject getById(Long projectId) @@ -45,4 +64,55 @@ public class BizProjectServiceImpl implements IBizProjectService @Override public int deleteByPrimaryKeys(Long[] projectId) { return bizProjectMapper.deleteByPrimaryKeys(projectId); } + + /** + * 软删除项目 (单条): 级联置 5 张项目表 is_deleted=1, 再触发会议链 cascade. + * + * 顺序: + * 1) biz_project (主表) + * 2) biz_project_plan (按 projectNo; projectNo 空的项目跳过) + * 3) biz_project_assign (按 projectId) + * 4) biz_project_sponsor_assign (按 projectId String) + * 5) biz_project_rating (按 projectId) + * 6) biz_meeting* 链 (查 project_id 下所有 meeting, 调 BizMeetingService.softDeleteCascadeBatch) + * + * 注: + * - 全部包在一个事务里, 中途任意 UPDATE 失败整批回滚 + * - 会议链 cascade 由 BizMeetingService.softDeleteCascadeBatch 内部又包了一个事务 (PROPAGATION_REQUIRED, 默认加入外层事务) + * - 重复调用幂等 (软删都是 set is_deleted=1) + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void softDeleteCascade(Long projectId) { + if (projectId == null) return; + // 1) 取 projectNo (不过滤 is_deleted, 允许重跑 cascade) + String projectNo = bizProjectMapper.selectProjectNoById(projectId); + // 2) 主表 + bizProjectMapper.softDeleteByProjectId(projectId); + // 3) plan (按 projectNo) + if (projectNo != null && !projectNo.isEmpty()) { + bizProjectPlanMapper.softDeleteByProjectNo(projectNo); + } + // 4) assign + bizProjectAssignMapper.softDeleteByProjectId(projectId); + // 5) sponsor assign (String) + bizProjectSponsorAssignMapper.softDeleteByProjectId(String.valueOf(projectId)); + // 6) rating + bizProjectRatingMapper.softDeleteByProjectId(projectId); + // 7) 会议链: 查项目下所有 meeting → 调 BizMeetingService.softDeleteCascadeBatch + java.util.List meetingIds = bizMeetingMapper.selectIdListByProjectId(projectId); + if (meetingIds != null && !meetingIds.isEmpty()) { + bizMeetingService.softDeleteCascadeBatch(meetingIds.toArray(new Long[0])); + } + } + + /** 批量: 逐条 cascade, 失败粒度细 (一条失败不影响其他) */ + @Override + @Transactional(rollbackFor = Exception.class) + public void softDeleteCascadeBatch(Long[] projectIds) { + if (projectIds == null) return; + for (Long id : projectIds) { + if (id != null) softDeleteCascade(id); + } + } } diff --git a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAttendeeMapper.xml b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAttendeeMapper.xml index 553773c..3db6332 100644 --- a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAttendeeMapper.xml +++ b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAttendeeMapper.xml @@ -38,6 +38,7 @@ + insert into biz_meeting_attendee(meeting_id, user_id, create_by, create_time) @@ -126,6 +127,10 @@ delete from biz_meeting_attendee where meeting_id = #{meetingId} + + + update biz_meeting_attendee set is_deleted = 1 where meeting_id = #{meetingId} + delete from biz_meeting_attendee where id = #{id} @@ -134,21 +139,22 @@ delete from biz_meeting_attendee where meeting_id = #{meetingId} and user_id = #{userId} \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAuditLogMapper.xml b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAuditLogMapper.xml index 1761915..e0a34ac 100644 --- a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAuditLogMapper.xml +++ b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingAuditLogMapper.xml @@ -12,21 +12,23 @@ + - select id, meeting_id, auditor, opinion, current_stage, create_time, audit_time, audit_type, audit_result + select id, meeting_id, auditor, opinion, current_stage, create_time, audit_time, audit_type, audit_result, is_deleted from biz_meeting_audit_log - where id = #{id} + where id = #{id} and is_deleted = 0 - where meeting_id = #{meetingId} + where meeting_id = #{meetingId} and is_deleted = 0 @@ -140,4 +142,12 @@ #{meetingId} + + + update biz_meeting set is_deleted = 1 where meeting_id = #{meetingId} + + + \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingMaterialMapper.xml b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingMaterialMapper.xml index 18229a6..5559bce 100644 --- a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingMaterialMapper.xml +++ b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingMaterialMapper.xml @@ -12,21 +12,22 @@ + - select id, meeting_id, material_type, sub_type, file_name, oss_url, amount, creator_id, create_time + select id, meeting_id, material_type, sub_type, file_name, oss_url, amount, creator_id, create_time, is_deleted from biz_meeting_material @@ -87,4 +88,9 @@ delete from biz_meeting_material where meeting_id = #{meetingId} + + + update biz_meeting_material set is_deleted = 1 where meeting_id = #{meetingId} + + \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingSupervisorMapper.xml b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingSupervisorMapper.xml index 6fef11f..8cedee6 100644 --- a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingSupervisorMapper.xml +++ b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizMeetingSupervisorMapper.xml @@ -8,33 +8,35 @@ + - select id, meeting_id, user_id, assigned_by, create_time + select id, meeting_id, user_id, assigned_by, create_time, is_deleted from biz_meeting_supervisor - where assign_id = #{assignId} + where assign_id = #{assignId} and is_deleted = 0 - where project_id = #{projectId} + where project_id = #{projectId} and p.is_deleted = 0 - select distinct p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount, p.available_amount, p.paid_labor_amount, p.paid_meeting_amount, p.manager_score, p.sponsor_score, p.sponsor_admin_user_name, p.project_form, p.is_finished, p.is_settled, p.sponsor_admin_user_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url, + select distinct p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount, p.available_amount, p.paid_labor_amount, p.paid_meeting_amount, p.manager_score, p.sponsor_score, p.sponsor_admin_user_name, p.project_form, p.is_finished, p.is_settled, p.sponsor_admin_user_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url, o.org_name as sponsor_org_name, lu.user_name as lead_user_name, bp.name as create_user_name, (select group_concat(distinct o2.org_name separator ',') from biz_project_assign bpa2 join biz_org o2 on o2.org_id = bpa2.execution_unit_id and o2.org_type = 'executor' - where bpa2.project_id = p.project_id) as exec_org_names, + where bpa2.project_id = p.project_id and bpa2.is_deleted = 0) as exec_org_names, (select coalesce(sum(bpa3.sessions), 0) from biz_project_assign bpa3 where bpa3.project_id = p.project_id + and bpa3.is_deleted = 0 and (bpa3.exec_user_id = #{params.executorUserId} or bpa3.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor'))) as assigned_sessions, (select coalesce(sum(bpa4.amount), 0) from biz_project_assign bpa4 where bpa4.project_id = p.project_id + and bpa4.is_deleted = 0 and (bpa4.exec_user_id = #{params.executorUserId} or bpa4.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor'))) as assigned_amount from biz_project p - join biz_project_assign a on a.project_id = p.project_id + join biz_project_assign a on a.project_id = p.project_id and a.is_deleted = 0 left join biz_org o on o.user_id = p.sponsor_admin_user_id and o.org_type = 'sponsor' left join sys_user lu on lu.user_id = p.lead_user_id left join biz_person bp on bp.user_id = p.create_user_id + p.is_deleted = 0 (a.exec_user_id = #{params.executorUserId} or a.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) and p.project_no like concat('%', #{projectNo}, '%') @@ -149,6 +155,7 @@ + select project_no from biz_project where project_id = #{projectId} + \ No newline at end of file diff --git a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizProjectPlanMapper.xml b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizProjectPlanMapper.xml index 76c3190..9d7b003 100644 --- a/ry-api/ruoyi-business/src/main/resources/mapper/business/BizProjectPlanMapper.xml +++ b/ry-api/ruoyi-business/src/main/resources/mapper/business/BizProjectPlanMapper.xml @@ -24,6 +24,7 @@ + select p.plan_id, p.plan_name, p.plan_direction, p.plan_direction_id, @@ -32,20 +33,21 @@ p.project_no, p.remark, p.audit_opinion, p.audit_by, p.audit_time, p.submitter_id, COALESCE(bp.name, u.user_name) as submitter_name, proj.project_name as project_name, - p.create_by, p.create_time, p.update_by, p.update_time + p.create_by, p.create_time, p.update_by, p.update_time, p.is_deleted from biz_project_plan p left join biz_special_plan s on s.id = p.plan_direction_id left join sys_user u on u.user_id = p.submitter_id left join biz_person bp on bp.user_id = u.user_id - left join biz_project proj on proj.project_no = p.project_no + left join biz_project proj on proj.project_no = p.project_no and proj.is_deleted = 0 - where rating_id = #{ratingId} + where rating_id = #{ratingId} and is_deleted = 0 SELECT a.*, s.user_name AS sponsor_user_name, @@ -34,7 +40,7 @@ FROM biz_project_sponsor_assign a LEFT JOIN sys_user s ON a.sponsor_user_id = s.user_id LEFT JOIN sys_user m ON a.monitor_user_id = m.user_id - WHERE a.project_id = #{projectId} + WHERE a.project_id = #{projectId} and a.is_deleted = 0 ORDER BY a.create_time DESC \ No newline at end of file