feat(biz_project+meeting): 项目+会议软删除级联, admin/manager 双角色可删

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 可删 (放宽权限)
This commit is contained in:
郭庆泰
2026-08-22 20:16:40 +08:00
parent da46a45682
commit 0eb5da6ea8
40 changed files with 367 additions and 45 deletions
@@ -101,10 +101,19 @@ public class BizMeetingController extends BaseController {
return toAjax(rows); return toAjax(rows);
} }
/**
* 软删除会议 (admin/manager 会议管理用, 后端强校验 role_type)
* 级联置 biz_meeting + 5 张子表 is_deleted=1, 数据保留审计追溯
*/
@Log(title = "会议", businessType = BusinessType.DELETE) @Log(title = "会议", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] 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();
} }
// =================================================================== // ===================================================================
@@ -14,6 +14,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.business.domain.BizExecutionIntent; import com.ruoyi.business.domain.BizExecutionIntent;
import com.ruoyi.business.domain.BizProject; import com.ruoyi.business.domain.BizProject;
@@ -165,7 +166,13 @@ public class BizProjectController extends BaseController
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] 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 ========== // ========== 项目执行方分配 sub-resource ==========
@@ -84,6 +84,8 @@ public class BizMeeting extends BaseEntity {
private transient Long userId; private transient Long userId;
/** 新增/编辑会议时传入, 自动批量写入 biz_meeting_attendee 中间表 (非持久化) */ /** 新增/编辑会议时传入, 自动批量写入 biz_meeting_attendee 中间表 (非持久化) */
private Long[] attendeeUserIds; private Long[] attendeeUserIds;
/** 软删除标记 0否1是 (admin 删除会议时置1, 查询需 WHERE is_deleted=0) */
private Integer isDeleted;
public Long getMeetingId() { return meetingId; } public Long getMeetingId() { return meetingId; }
public void setMeetingId(Long meetingId) { this.meetingId = meetingId; } public void setMeetingId(Long meetingId) { this.meetingId = meetingId; }
public String getProjectNo() { return projectNo; } public String getProjectNo() { return projectNo; }
@@ -139,6 +141,8 @@ public class BizMeeting extends BaseEntity {
public void setVoucherAuditStage(String voucherAuditStage) { this.voucherAuditStage = voucherAuditStage; } public void setVoucherAuditStage(String voucherAuditStage) { this.voucherAuditStage = voucherAuditStage; }
public Long getUserId() { return userId; } public Long getUserId() { return userId; }
public void setUserId(Long userId) { this.userId = 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 Long[] getAttendeeUserIds() { return attendeeUserIds; }
public void setAttendeeUserIds(Long[] attendeeUserIds) { this.attendeeUserIds = attendeeUserIds; } public void setAttendeeUserIds(Long[] attendeeUserIds) { this.attendeeUserIds = attendeeUserIds; }
} }
@@ -131,4 +131,8 @@ public class BizMeetingAttendee extends BaseEntity {
public void setProjectName(String projectName) { this.projectName = projectName; } public void setProjectName(String projectName) { this.projectName = projectName; }
public String getProjectNo() { return projectNo; } public String getProjectNo() { return projectNo; }
public void setProjectNo(String projectNo) { this.projectNo = 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; }
} }
@@ -42,6 +42,9 @@ public class BizMeetingAuditLog {
/** 审核结果 (APPROVED / REJECTED) */ /** 审核结果 (APPROVED / REJECTED) */
private String auditResult; private String auditResult;
/** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */
private Integer isDeleted;
public Long getId() { return id; } public Long getId() { return id; }
public void setId(Long id) { this.id = id; } public void setId(Long id) { this.id = id; }
@@ -68,4 +71,7 @@ public class BizMeetingAuditLog {
public String getAuditResult() { return auditResult; } public String getAuditResult() { return auditResult; }
public void setAuditResult(String auditResult) { this.auditResult = auditResult; } public void setAuditResult(String auditResult) { this.auditResult = auditResult; }
public Integer getIsDeleted() { return isDeleted; }
public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; }
} }
@@ -28,6 +28,9 @@ public class BizMeetingExecutor {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */
private Integer isDeleted;
public Long getId() { return id; } public Long getId() { return id; }
public void setId(Long id) { this.id = id; } public void setId(Long id) { this.id = id; }
@@ -42,4 +45,7 @@ public class BizMeetingExecutor {
public Date getCreateTime() { return createTime; } public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; }
public Integer getIsDeleted() { return isDeleted; }
public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; }
} }
@@ -48,6 +48,9 @@ public class BizMeetingMaterial {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */
private Integer isDeleted;
public Long getId() { return id; } public Long getId() { return id; }
public void setId(Long id) { this.id = id; } public void setId(Long id) { this.id = id; }
@@ -74,4 +77,7 @@ public class BizMeetingMaterial {
public Date getCreateTime() { return createTime; } public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; }
public Integer getIsDeleted() { return isDeleted; }
public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; }
} }
@@ -28,6 +28,9 @@ public class BizMeetingSupervisor {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
/** 软删除标记 0否1是 (admin 删除会议时级联置1, 查询需 WHERE is_deleted=0) */
private Integer isDeleted;
public Long getId() { return id; } public Long getId() { return id; }
public void setId(Long id) { this.id = id; } public void setId(Long id) { this.id = id; }
@@ -42,4 +45,7 @@ public class BizMeetingSupervisor {
public Date getCreateTime() { return createTime; } public Date getCreateTime() { return createTime; }
public void setCreateTime(Date createTime) { this.createTime = createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; }
public Integer getIsDeleted() { return isDeleted; }
public void setIsDeleted(Integer isDeleted) { this.isDeleted = isDeleted; }
} }
@@ -100,6 +100,8 @@ public class BizProject extends BaseEntity {
private Date updateTime; private Date updateTime;
/** 管理费及税金 */ /** 管理费及税金 */
private BigDecimal manageFee; private BigDecimal manageFee;
/** 角色劳务 (JSON: [{role, customName, amount}], ProjectsNew.vue 编辑保存) */
private String roleLabor;
/** 项目开始时间 (与 DB datetime 对齐, JSON 用 yyyy-MM-dd HH:mm:ss 序列化, 跟 BizMeeting 一致) */ /** 项目开始时间 (与 DB datetime 对齐, JSON 用 yyyy-MM-dd HH:mm:ss 序列化, 跟 BizMeeting 一致) */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime; private Date startTime;
@@ -134,6 +136,10 @@ public class BizProject extends BaseEntity {
private Integer sponsorQ3; private Integer sponsorQ3;
private Integer sponsorQ4; private Integer sponsorQ4;
private String sponsorRemark; 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 Long getProjectId() { return projectId; }
public void setProjectId(Long projectId) { this.projectId = projectId; } public void setProjectId(Long projectId) { this.projectId = projectId; }
public String getProjectNo() { return projectNo; } public String getProjectNo() { return projectNo; }
@@ -200,6 +206,8 @@ public class BizProject extends BaseEntity {
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
public BigDecimal getManageFee() { return manageFee; } public BigDecimal getManageFee() { return manageFee; }
public void setManageFee(BigDecimal manageFee) { this.manageFee = 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 Date getStartTime() { return startTime; }
public void setStartTime(Date startTime) { this.startTime = startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; }
public Date getEndTime() { return endTime; } public Date getEndTime() { return endTime; }
@@ -24,6 +24,10 @@ public class BizProjectAssign extends BaseEntity {
private BigDecimal amount; private BigDecimal amount;
/** 状态 0正常 1已撤销 */ /** 状态 0正常 1已撤销 */
private String status; 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 String getAssignId() { return assignId; }
public void setAssignId(String assignId) { this.assignId = assignId; } public void setAssignId(String assignId) { this.assignId = assignId; }
@@ -71,6 +71,10 @@ public class BizProjectPlan extends BaseEntity {
private Long submitterId; private Long submitterId;
/** 投稿人姓名 (LEFT JOIN biz_person.name 优先, sys_user.user_name 兜底; biz_person.user_id 已 UNIQUE, 1:1 无笛卡尔积) */ /** 投稿人姓名 (LEFT JOIN biz_person.name 优先, sys_user.user_name 兜底; biz_person.user_id 已 UNIQUE, 1:1 无笛卡尔积) */
private String submitterName; 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 String getPlanId() { return planId; }
public void setPlanId(String planId) { this.planId = planId; } public void setPlanId(String planId) { this.planId = planId; }
public String getPlanName() { return planName; } public String getPlanName() { return planName; }
@@ -58,6 +58,10 @@ public class BizProjectRating extends BaseEntity {
private Long raterId; private Long raterId;
/** 评分时间 */ /** 评分时间 */
private String ratingTime; 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 String getRatingId() { return ratingId; }
public void setRatingId(String ratingId) { this.ratingId = ratingId; } public void setRatingId(String ratingId) { this.ratingId = ratingId; }
public String getProjectNo() { return projectNo; } public String getProjectNo() { return projectNo; }
@@ -21,6 +21,11 @@ public class BizProjectSponsorAssign extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; 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 Long getId() { return id; }
public void setId(Long id) { this.id = id; } public void setId(Long id) { this.id = id; }
public String getProjectId() { return projectId; } public String getProjectId() { return projectId; }
@@ -24,6 +24,8 @@ public interface BizMeetingAttendeeMapper {
/** 管理端按 attendee.id 单删 (MeetingDetail 参会人 CRUD 用) */ /** 管理端按 attendee.id 单删 (MeetingDetail 参会人 CRUD 用) */
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
int deleteByMeetingIdAndUserId(BizMeetingAttendee entity); int deleteByMeetingIdAndUserId(BizMeetingAttendee entity);
/** 软删除: admin 删除会议时级联置 is_deleted=1 (硬删保留用于单条参会人管理) */
int softDeleteByMeetingId(Long meetingId);
List<BizMeetingAttendee> selectByMeetingId(Long meetingId); List<BizMeetingAttendee> selectByMeetingId(Long meetingId);
List<BizMeetingAttendee> selectByUserId(Long userId); List<BizMeetingAttendee> selectByUserId(Long userId);
BizMeetingAttendee selectById(Long id); BizMeetingAttendee selectById(Long id);
@@ -25,4 +25,6 @@ public interface BizMeetingAuditLogMapper {
/** 按主键批量删除 */ /** 按主键批量删除 */
int deleteByPrimaryKeys(Long[] ids); int deleteByPrimaryKeys(Long[] ids);
/** 软删除: admin 删除会议时级联置 is_deleted=1 (审计行仍保留, 但不再随会议显示) */
int softDeleteByMeetingId(Long meetingId);
} }
@@ -32,6 +32,9 @@ public interface BizMeetingExecutorMapper {
/** 按会议ID全删 (分配时全删全插) */ /** 按会议ID全删 (分配时全删全插) */
int deleteByMeetingId(Long meetingId); int deleteByMeetingId(Long meetingId);
/** 软删除: admin 删除会议时级联置 is_deleted=1 */
int softDeleteByMeetingId(Long meetingId);
/** 批量插入 */ /** 批量插入 */
int insertBatch(List<BizMeetingExecutor> list); int insertBatch(List<BizMeetingExecutor> list);
} }
@@ -13,4 +13,8 @@ public interface BizMeetingMapper
int updateByPrimaryKey(BizMeeting entity); int updateByPrimaryKey(BizMeeting entity);
int deleteByPrimaryKey(Long meetingId); int deleteByPrimaryKey(Long meetingId);
int deleteByPrimaryKeys(Long[] meetingIds); int deleteByPrimaryKeys(Long[] meetingIds);
/** 软删除: admin 删除会议时调用, 置 is_deleted=1 (不真删, 保留审计) */
int softDeleteByPrimaryKey(Long meetingId);
/** 项目级联删除时用: 查项目下所有 meeting_id (不过滤 is_deleted, 软删 idempotent) */
List<Long> selectIdListByProjectId(Long projectId);
} }
@@ -26,6 +26,9 @@ public interface BizMeetingMaterialMapper {
/** 按会议ID删除该会议所有材料记录 (save 时先全删) */ /** 按会议ID删除该会议所有材料记录 (save 时先全删) */
int deleteByMeetingId(Long meetingId); int deleteByMeetingId(Long meetingId);
/** 软删除: admin 删除会议时级联置 is_deleted=1 */
int softDeleteByMeetingId(Long meetingId);
/** 批量插入 (单会议替换 save 专用) */ /** 批量插入 (单会议替换 save 专用) */
int insertBatch(List<BizMeetingMaterial> list); int insertBatch(List<BizMeetingMaterial> list);
@@ -32,6 +32,9 @@ public interface BizMeetingSupervisorMapper {
/** 按会议ID全删 (分配时全删全插) */ /** 按会议ID全删 (分配时全删全插) */
int deleteByMeetingId(Long meetingId); int deleteByMeetingId(Long meetingId);
/** 软删除: admin 删除会议时级联置 is_deleted=1 */
int softDeleteByMeetingId(Long meetingId);
/** 批量插入 */ /** 批量插入 */
int insertBatch(List<BizMeetingSupervisor> list); int insertBatch(List<BizMeetingSupervisor> list);
} }
@@ -15,4 +15,6 @@ public interface BizProjectAssignMapper
int updateByPrimaryKey(BizProjectAssign entity); int updateByPrimaryKey(BizProjectAssign entity);
int deleteByPrimaryKey(String assignId); int deleteByPrimaryKey(String assignId);
int deleteByProjectId(Long projectId); int deleteByProjectId(Long projectId);
/** 软删除: 项目级联删除时按 project_id 置 is_deleted=1 */
int softDeleteByProjectId(Long projectId);
} }
@@ -17,4 +17,8 @@ public interface BizProjectMapper
int updateByPrimaryKey(BizProject entity); int updateByPrimaryKey(BizProject entity);
int deleteByPrimaryKey(Long projectId); int deleteByPrimaryKey(Long projectId);
int deleteByPrimaryKeys(Long[] projectIds); int deleteByPrimaryKeys(Long[] projectIds);
/** 软删除: admin/manager 删除项目时调用, 置 is_deleted=1 (不真删, 保留审计) */
int softDeleteByProjectId(Long projectId);
/** 级联删除时用: 查 project_no (不过滤 is_deleted, 避免已软删项目查不到 projectNo) */
String selectProjectNoById(Long projectId);
} }
@@ -13,4 +13,6 @@ public interface BizProjectPlanMapper
int updateByPrimaryKey(BizProjectPlan entity); int updateByPrimaryKey(BizProjectPlan entity);
int deleteByPrimaryKey(String planId); int deleteByPrimaryKey(String planId);
int deleteByPrimaryKeys(String[] planIds); int deleteByPrimaryKeys(String[] planIds);
/** 软删除: 项目级联删除时按 projectNo 置 is_deleted=1 (biz_project_plan 用 project_no 关联项目, 不用 project_id) */
int softDeleteByProjectNo(String projectNo);
} }
@@ -15,4 +15,6 @@ public interface BizProjectRatingMapper
int upsertRating(BizProjectRating entity); int upsertRating(BizProjectRating entity);
int deleteByPrimaryKey(String ratingId); int deleteByPrimaryKey(String ratingId);
int deleteByPrimaryKeys(String[] ratingIds); int deleteByPrimaryKeys(String[] ratingIds);
/** 软删除: 项目级联删除时按 project_id 置 is_deleted=1 */
int softDeleteByProjectId(Long projectId);
} }
@@ -8,4 +8,6 @@ public interface BizProjectSponsorAssignMapper {
List<BizProjectSponsorAssign> selectByProjectId(String projectId); List<BizProjectSponsorAssign> selectByProjectId(String projectId);
/** 按 project_id 全删 (支持方分配: 先删后插策略) */ /** 按 project_id 全删 (支持方分配: 先删后插策略) */
int deleteByProjectId(String projectId); int deleteByProjectId(String projectId);
/** 软删除: 项目级联删除时按 project_id (String) 置 is_deleted=1 */
int softDeleteByProjectId(String projectId);
} }
@@ -14,4 +14,12 @@ public interface IBizMeetingService
int updateByPrimaryKey(BizMeeting entity); int updateByPrimaryKey(BizMeeting entity);
int deleteByPrimaryKey(Long meetingId); int deleteByPrimaryKey(Long meetingId);
int deleteByPrimaryKeys(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);
} }
@@ -18,4 +18,14 @@ public interface IBizProjectService
int updateByPrimaryKey(BizProject entity); int updateByPrimaryKey(BizProject entity);
int deleteByPrimaryKey(Long projectId); int deleteByPrimaryKey(Long projectId);
int deleteByPrimaryKeys(Long[] projectId); int deleteByPrimaryKeys(Long[] projectId);
/**
* 软删除项目 (单条): 级联置 5 张项目表 + 会议链 is_deleted=1.
* 顺序: 先 5 表更新 → 再查项目下所有 meeting → 触发 meeting cascade.
* 包在事务里保证原子性.
*/
void softDeleteCascade(Long projectId);
/** 软删除项目 (批量): 逐条 cascade, 失败粒度细 */
void softDeleteCascadeBatch(Long[] projectIds);
} }
@@ -230,3 +230,5 @@ public class BizMeetingAttendeeServiceImpl implements IBizMeetingAttendeeService
meetingId, result.getOkNum(), result.getNgNum()); meetingId, result.getOkNum(), result.getNgNum());
return result; return result;
} }
}
@@ -3,8 +3,14 @@ package com.ruoyi.business.service.impl;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.business.domain.BizMeeting; import com.ruoyi.business.domain.BizMeeting;
import com.ruoyi.business.mapper.BizMeetingMapper; 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.business.service.IBizMeetingService;
import com.ruoyi.common.utils.id.IdGenerator; import com.ruoyi.common.utils.id.IdGenerator;
@@ -13,6 +19,16 @@ public class BizMeetingServiceImpl implements IBizMeetingService
{ {
@Autowired @Autowired
private BizMeetingMapper bizMeetingMapper; private BizMeetingMapper bizMeetingMapper;
@Autowired
private BizMeetingAttendeeMapper attendeeMapper;
@Autowired
private BizMeetingSupervisorMapper supervisorMapper;
@Autowired
private BizMeetingExecutorMapper executorMapper;
@Autowired
private BizMeetingMaterialMapper materialMapper;
@Autowired
private BizMeetingAuditLogMapper auditLogMapper;
@Override @Override
public BizMeeting getById(Long meetingId) public BizMeeting getById(Long meetingId)
@@ -38,4 +54,29 @@ public class BizMeetingServiceImpl implements IBizMeetingService
@Override @Override
public int deleteByPrimaryKeys(Long[] meetingId) public int deleteByPrimaryKeys(Long[] meetingId)
{ return bizMeetingMapper.deleteByPrimaryKeys(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);
}
}
} }
@@ -3,9 +3,16 @@ package com.ruoyi.business.service.impl;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.business.domain.BizProject; import com.ruoyi.business.domain.BizProject;
import com.ruoyi.business.mapper.BizProjectMapper; 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.IBizProjectService;
import com.ruoyi.business.service.IBizMeetingService;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
@Service @Service
@@ -13,6 +20,18 @@ public class BizProjectServiceImpl implements IBizProjectService
{ {
@Autowired @Autowired
private BizProjectMapper bizProjectMapper; 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 @Override
public BizProject getById(Long projectId) public BizProject getById(Long projectId)
@@ -45,4 +64,55 @@ public class BizProjectServiceImpl implements IBizProjectService
@Override @Override
public int deleteByPrimaryKeys(Long[] projectId) public int deleteByPrimaryKeys(Long[] projectId)
{ return bizProjectMapper.deleteByPrimaryKeys(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<Long> 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);
}
}
} }
@@ -38,6 +38,7 @@
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time" />
<result property="projectName" column="project_name" /> <result property="projectName" column="project_name" />
<result property="projectNo" column="project_no" /> <result property="projectNo" column="project_no" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<insert id="insert" parameterType="BizMeetingAttendee"> <insert id="insert" parameterType="BizMeetingAttendee">
insert into biz_meeting_attendee(meeting_id, user_id, create_by, create_time) insert into biz_meeting_attendee(meeting_id, user_id, create_by, create_time)
@@ -126,6 +127,10 @@
<delete id="deleteByMeetingId" parameterType="Long"> <delete id="deleteByMeetingId" parameterType="Long">
delete from biz_meeting_attendee where meeting_id = #{meetingId} delete from biz_meeting_attendee where meeting_id = #{meetingId}
</delete> </delete>
<!-- 软删除: admin 删除会议时级联置 is_deleted=1 (硬删保留, 用于单条参会人管理) -->
<update id="softDeleteByMeetingId" parameterType="Long">
update biz_meeting_attendee set is_deleted = 1 where meeting_id = #{meetingId}
</update>
<!-- MeetingDetail 参会人 CRUD 用: 按 id 单删 --> <!-- MeetingDetail 参会人 CRUD 用: 按 id 单删 -->
<delete id="deleteByPrimaryKey" parameterType="Long"> <delete id="deleteByPrimaryKey" parameterType="Long">
delete from biz_meeting_attendee where id = #{id} 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} delete from biz_meeting_attendee where meeting_id = #{meetingId} and user_id = #{userId}
</delete> </delete>
<select id="selectByMeetingId" resultMap="BizMeetingAttendeeResult" parameterType="Long"> <select id="selectByMeetingId" resultMap="BizMeetingAttendeeResult" parameterType="Long">
select id, meeting_id, user_id, name, phone, work_unit, department, title, id_card, bank_card, bank_name, bank_branch, bank_region, bank_address, account_name, id_card_attachments, labor_form, fee_pre_tax, tax, fee, vat_and_surcharge, summary, on_site_photos, signed_at, signed_ip, handsign, labor_protocol, create_by, create_time select id, meeting_id, user_id, name, phone, work_unit, department, title, id_card, bank_card, bank_name, bank_branch, bank_region, bank_address, account_name, id_card_attachments, labor_form, fee_pre_tax, tax, fee, vat_and_surcharge, summary, on_site_photos, signed_at, signed_ip, handsign, labor_protocol, create_by, create_time, is_deleted
from biz_meeting_attendee where meeting_id = #{meetingId} from biz_meeting_attendee where meeting_id = #{meetingId} and is_deleted = 0
</select> </select>
<select id="selectByUserId" resultMap="BizMeetingAttendeeResult" parameterType="Long"> <select id="selectByUserId" resultMap="BizMeetingAttendeeResult" parameterType="Long">
select id, meeting_id, user_id, name, phone, work_unit, department, title, id_card, bank_card, bank_name, bank_branch, bank_region, bank_address, account_name, id_card_attachments, labor_form, fee_pre_tax, tax, fee, vat_and_surcharge, summary, on_site_photos, signed_at, signed_ip, handsign, labor_protocol, create_by, create_time select id, meeting_id, user_id, name, phone, work_unit, department, title, id_card, bank_card, bank_name, bank_branch, bank_region, bank_address, account_name, id_card_attachments, labor_form, fee_pre_tax, tax, fee, vat_and_surcharge, summary, on_site_photos, signed_at, signed_ip, handsign, labor_protocol, create_by, create_time, is_deleted
from biz_meeting_attendee where user_id = #{userId} from biz_meeting_attendee where user_id = #{userId} and is_deleted = 0
</select> </select>
<select id="selectById" resultMap="BizMeetingAttendeeResult" parameterType="Long"> <select id="selectById" resultMap="BizMeetingAttendeeResult" parameterType="Long">
select id, meeting_id, user_id, name, phone, work_unit, department, title, id_card, bank_card, bank_name, bank_branch, bank_region, bank_address, account_name, id_card_attachments, labor_form, fee_pre_tax, tax, fee, vat_and_surcharge, summary, on_site_photos, signed_at, signed_ip, handsign, labor_protocol, create_by, create_time select id, meeting_id, user_id, name, phone, work_unit, department, title, id_card, bank_card, bank_name, bank_branch, bank_region, bank_address, account_name, id_card_attachments, labor_form, fee_pre_tax, tax, fee, vat_and_surcharge, summary, on_site_photos, signed_at, signed_ip, handsign, labor_protocol, create_by, create_time, is_deleted
from biz_meeting_attendee where id = #{id} from biz_meeting_attendee where id = #{id} and is_deleted = 0
</select> </select>
<!-- <!--
当前用户的"待签署"会议列表 (任一未签: handsign 或 labor_protocol 为 NULL) 当前用户的"待签署"会议列表 (任一未签: handsign 或 labor_protocol 为 NULL)
INNER JOIN biz_meeting 取会议名/时间/项目名, 用于 /doctor/home 工作台 INNER JOIN biz_meeting 取会议名/时间/项目名, 用于 /doctor/home 工作台
字段别名 + resultMap 上面的 transient property 接收 字段别名 + resultMap 上面的 transient property 接收
两表都需 is_deleted=0 过滤: 删除会议后, 参会人的待签署列表也不显示
--> -->
<select id="selectUnsignedByUserId" resultType="BizMeetingAttendee" parameterType="Long"> <select id="selectUnsignedByUserId" resultType="BizMeetingAttendee" parameterType="Long">
select a.id, a.meeting_id, a.user_id, a.handsign, a.labor_protocol, a.create_by, a.create_time, select a.id, a.meeting_id, a.user_id, a.handsign, a.labor_protocol, a.create_by, a.create_time,
@@ -157,14 +163,16 @@
from biz_meeting_attendee a from biz_meeting_attendee a
inner join biz_meeting m on m.meeting_id = a.meeting_id inner join biz_meeting m on m.meeting_id = a.meeting_id
where a.user_id = #{userId} where a.user_id = #{userId}
and a.is_deleted = 0 and m.is_deleted = 0
and (a.handsign is null or a.handsign = '' or a.labor_protocol is null or a.labor_protocol = '') and (a.handsign is null or a.handsign = '' or a.labor_protocol is null or a.labor_protocol = '')
order by m.start_time asc order by m.start_time asc
</select> </select>
<!-- <!--
给 BizMeetingController.edit 做差集用: 查该会议已存在的参会人 userId 列表. 给 BizMeetingController.edit 做差集用: 查该会议已存在的参会人 userId 列表.
用于 #5 会议邀请: 仅给"新加入"的 userId 发通知, 已存在的用户不重发. 用于 #5 会议邀请: 仅给"新加入"的 userId 发通知, 已存在的用户不重发.
软删的参会人不算"已存在", 新加入时仍触发 #5.
--> -->
<select id="selectUserIdsByMeetingId" resultType="java.lang.Long" parameterType="Long"> <select id="selectUserIdsByMeetingId" resultType="java.lang.Long" parameterType="Long">
select user_id from biz_meeting_attendee where meeting_id = #{meetingId} select user_id from biz_meeting_attendee where meeting_id = #{meetingId} and is_deleted = 0
</select> </select>
</mapper> </mapper>
@@ -12,21 +12,23 @@
<result property="auditTime" column="audit_time" /> <result property="auditTime" column="audit_time" />
<result property="auditType" column="audit_type" /> <result property="auditType" column="audit_type" />
<result property="auditResult" column="audit_result" /> <result property="auditResult" column="audit_result" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
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 from biz_meeting_audit_log
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizMeetingAuditLogResult" parameterType="Long"> <select id="selectByPrimaryKey" resultMap="BizMeetingAuditLogResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where id = #{id} where id = #{id} and is_deleted = 0
</select> </select>
<select id="selectList" resultMap="BizMeetingAuditLogResult" parameterType="BizMeetingAuditLog"> <select id="selectList" resultMap="BizMeetingAuditLogResult" parameterType="BizMeetingAuditLog">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
is_deleted = 0
<if test="meetingId != null">and meeting_id = #{meetingId}</if> <if test="meetingId != null">and meeting_id = #{meetingId}</if>
<if test="currentStage != null and currentStage != ''">and current_stage = #{currentStage}</if> <if test="currentStage != null and currentStage != ''">and current_stage = #{currentStage}</if>
<if test="auditor != null and auditor != ''">and auditor = #{auditor}</if> <if test="auditor != null and auditor != ''">and auditor = #{auditor}</if>
@@ -83,4 +85,9 @@
</foreach> </foreach>
</delete> </delete>
<!-- 软删除: admin 删除会议时级联置 is_deleted=1 (audit_log 历史保留为后续审计; 但不再随会议显示) -->
<update id="softDeleteByMeetingId" parameterType="Long">
update biz_meeting_audit_log set is_deleted = 1 where meeting_id = #{meetingId}
</update>
</mapper> </mapper>
@@ -8,33 +8,35 @@
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="assignedBy" column="assigned_by" /> <result property="assignedBy" column="assigned_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
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_executor from biz_meeting_executor
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizMeetingExecutorResult" parameterType="Long"> <select id="selectByPrimaryKey" resultMap="BizMeetingExecutorResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where id = #{id} where id = #{id} and is_deleted = 0
</select> </select>
<select id="selectByMeetingId" resultMap="BizMeetingExecutorResult" parameterType="Long"> <select id="selectByMeetingId" resultMap="BizMeetingExecutorResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where meeting_id = #{meetingId} where meeting_id = #{meetingId} and is_deleted = 0
order by id asc order by id asc
</select> </select>
<select id="selectByUserId" resultMap="BizMeetingExecutorResult" parameterType="Long"> <select id="selectByUserId" resultMap="BizMeetingExecutorResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where user_id = #{userId} where user_id = #{userId} and is_deleted = 0
order by id desc order by id desc
</select> </select>
<select id="selectList" resultMap="BizMeetingExecutorResult" parameterType="BizMeetingExecutor"> <select id="selectList" resultMap="BizMeetingExecutorResult" parameterType="BizMeetingExecutor">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
is_deleted = 0
<if test="meetingId != null">and meeting_id = #{meetingId}</if> <if test="meetingId != null">and meeting_id = #{meetingId}</if>
<if test="userId != null">and user_id = #{userId}</if> <if test="userId != null">and user_id = #{userId}</if>
</where> </where>
@@ -82,4 +84,9 @@
delete from biz_meeting_executor where meeting_id = #{meetingId} delete from biz_meeting_executor where meeting_id = #{meetingId}
</delete> </delete>
<!-- 软删除: admin 删除会议时级联置 is_deleted=1 -->
<update id="softDeleteByMeetingId" parameterType="Long">
update biz_meeting_executor set is_deleted = 1 where meeting_id = #{meetingId}
</update>
</mapper> </mapper>
@@ -28,18 +28,20 @@
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
select meeting_id, business_id, project_id, project_no, project_name, meeting_name, period_no, total_periods, project_form, start_time, end_time, org_name, address, current_stage, supervision_opinion, supervision_by, supervision_time, material_audit_stage, voucher_audit_stage, invitation_url, schedule_url, labor_signed, create_by, create_time, update_by, update_time select meeting_id, business_id, project_id, project_no, project_name, meeting_name, period_no, total_periods, project_form, start_time, end_time, org_name, address, current_stage, supervision_opinion, supervision_by, supervision_time, material_audit_stage, voucher_audit_stage, invitation_url, schedule_url, labor_signed, create_by, create_time, update_by, update_time, is_deleted
from biz_meeting from biz_meeting
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizMeetingResult" parameterType="Long"> <select id="selectByPrimaryKey" resultMap="BizMeetingResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where meeting_id = #{meetingId} where meeting_id = #{meetingId} and is_deleted = 0
</select> </select>
<select id="selectList" resultMap="BizMeetingResult" parameterType="BizMeeting"> <select id="selectList" resultMap="BizMeetingResult" parameterType="BizMeeting">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
is_deleted = 0
<if test="projectNo != null and projectNo != ''">and project_no like concat('%', #{projectNo}, '%')</if> <if test="projectNo != null and projectNo != ''">and project_no like concat('%', #{projectNo}, '%')</if>
<if test="meetingId != null">and meeting_id = #{meetingId}</if> <if test="meetingId != null">and meeting_id = #{meetingId}</if>
<if test="meetingName != null and meetingName != ''">and meeting_name like concat('%', #{meetingName}, '%')</if> <if test="meetingName != null and meetingName != ''">and meeting_name like concat('%', #{meetingName}, '%')</if>
@@ -48,8 +50,8 @@
<if test="currentStage != null and currentStage != ''">and current_stage = #{currentStage}</if> <if test="currentStage != null and currentStage != ''">and current_stage = #{currentStage}</if>
<if test="startTime != null">and start_time &gt;= #{startTime}</if> <if test="startTime != null">and start_time &gt;= #{startTime}</if>
<if test="endTime != null">and end_time &lt;= #{endTime}</if> <if test="endTime != null">and end_time &lt;= #{endTime}</if>
<!-- doctor 角色按 user_id 过滤 (走 biz_meeting_attendee 中间表) --> <!-- doctor 角色按 user_id 过滤 (走 biz_meeting_attendee 中间表, 同时 attendee 也需 is_deleted=0) -->
<if test="userId != null">and exists (select 1 from biz_meeting_attendee a where a.meeting_id = biz_meeting.meeting_id and a.user_id = #{userId})</if> <if test="userId != null">and exists (select 1 from biz_meeting_attendee a where a.meeting_id = biz_meeting.meeting_id and a.user_id = #{userId} and a.is_deleted = 0)</if>
</where> </where>
order by meeting_id desc order by meeting_id desc
</select> </select>
@@ -140,4 +142,12 @@
#{meetingId} #{meetingId}
</foreach> </foreach>
</delete> </delete>
<!-- 软删除: admin 删除会议时级联调用, 置 is_deleted=1 (不真删) -->
<update id="softDeleteByPrimaryKey" parameterType="Long">
update biz_meeting set is_deleted = 1 where meeting_id = #{meetingId}
</update>
<!-- 项目级联删除时用: 列 project_id 下所有 meeting_id, 不带 is_deleted 过滤 (软删 idempotent, 已删的再删一次无副作用) -->
<select id="selectIdListByProjectId" resultType="Long" parameterType="Long">
select meeting_id from biz_meeting where project_id = #{projectId}
</select>
</mapper> </mapper>
@@ -12,21 +12,22 @@
<result property="amount" column="amount" /> <result property="amount" column="amount" />
<result property="creatorId" column="creator_id" /> <result property="creatorId" column="creator_id" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
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 from biz_meeting_material
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizMeetingMaterialResult" parameterType="Long"> <select id="selectByPrimaryKey" resultMap="BizMeetingMaterialResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where id = #{id} where id = #{id} and is_deleted = 0
</select> </select>
<select id="selectByMeetingId" resultMap="BizMeetingMaterialResult" parameterType="Long"> <select id="selectByMeetingId" resultMap="BizMeetingMaterialResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where meeting_id = #{meetingId} where meeting_id = #{meetingId} and is_deleted = 0
order by id asc order by id asc
</select> </select>
@@ -87,4 +88,9 @@
delete from biz_meeting_material where meeting_id = #{meetingId} delete from biz_meeting_material where meeting_id = #{meetingId}
</delete> </delete>
<!-- 软删除: admin 删除会议时级联置 is_deleted=1 -->
<update id="softDeleteByMeetingId" parameterType="Long">
update biz_meeting_material set is_deleted = 1 where meeting_id = #{meetingId}
</update>
</mapper> </mapper>
@@ -8,33 +8,35 @@
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
<result property="assignedBy" column="assigned_by" /> <result property="assignedBy" column="assigned_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
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 from biz_meeting_supervisor
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizMeetingSupervisorResult" parameterType="Long"> <select id="selectByPrimaryKey" resultMap="BizMeetingSupervisorResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where id = #{id} where id = #{id} and is_deleted = 0
</select> </select>
<select id="selectByMeetingId" resultMap="BizMeetingSupervisorResult" parameterType="Long"> <select id="selectByMeetingId" resultMap="BizMeetingSupervisorResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where meeting_id = #{meetingId} where meeting_id = #{meetingId} and is_deleted = 0
order by id asc order by id asc
</select> </select>
<select id="selectByUserId" resultMap="BizMeetingSupervisorResult" parameterType="Long"> <select id="selectByUserId" resultMap="BizMeetingSupervisorResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where user_id = #{userId} where user_id = #{userId} and is_deleted = 0
order by id desc order by id desc
</select> </select>
<select id="selectList" resultMap="BizMeetingSupervisorResult" parameterType="BizMeetingSupervisor"> <select id="selectList" resultMap="BizMeetingSupervisorResult" parameterType="BizMeetingSupervisor">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
is_deleted = 0
<if test="meetingId != null">and meeting_id = #{meetingId}</if> <if test="meetingId != null">and meeting_id = #{meetingId}</if>
<if test="userId != null">and user_id = #{userId}</if> <if test="userId != null">and user_id = #{userId}</if>
</where> </where>
@@ -82,4 +84,9 @@
delete from biz_meeting_supervisor where meeting_id = #{meetingId} delete from biz_meeting_supervisor where meeting_id = #{meetingId}
</delete> </delete>
<!-- 软删除: admin 删除会议时级联置 is_deleted=1 -->
<update id="softDeleteByMeetingId" parameterType="Long">
update biz_meeting_supervisor set is_deleted = 1 where meeting_id = #{meetingId}
</update>
</mapper> </mapper>
@@ -14,29 +14,31 @@
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
select assign_id, project_id, execution_unit_id, exec_user_id, select assign_id, project_id, execution_unit_id, exec_user_id,
sessions, amount, remark, status, sessions, amount, remark, status,
create_by, create_time, update_by, update_time create_by, create_time, update_by, update_time, is_deleted
from biz_project_assign from biz_project_assign
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizProjectAssignResult" parameterType="String"> <select id="selectByPrimaryKey" resultMap="BizProjectAssignResult" parameterType="String">
<include refid="selectFields"/> <include refid="selectFields"/>
where assign_id = #{assignId} where assign_id = #{assignId} and is_deleted = 0
</select> </select>
<select id="selectByProjectId" resultMap="BizProjectAssignResult" parameterType="Long"> <select id="selectByProjectId" resultMap="BizProjectAssignResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where project_id = #{projectId} and status = '0' where project_id = #{projectId} and status = '0' and is_deleted = 0
order by assign_id asc order by assign_id asc
</select> </select>
<select id="selectList" resultMap="BizProjectAssignResult" parameterType="BizProjectAssign"> <select id="selectList" resultMap="BizProjectAssignResult" parameterType="BizProjectAssign">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
is_deleted = 0
<if test="projectId != null"> and project_id = #{projectId}</if> <if test="projectId != null"> and project_id = #{projectId}</if>
<if test="executionUnitId != null"> and execution_unit_id = #{executionUnitId}</if> <if test="executionUnitId != null"> and execution_unit_id = #{executionUnitId}</if>
<if test="execUserId != null"> and exec_user_id = #{execUserId}</if> <if test="execUserId != null"> and exec_user_id = #{execUserId}</if>
@@ -103,4 +105,9 @@
<delete id="deleteByProjectId" parameterType="Long"> <delete id="deleteByProjectId" parameterType="Long">
delete from biz_project_assign where project_id = #{projectId} delete from biz_project_assign where project_id = #{projectId}
</delete> </delete>
<!-- 软删除: 项目级联删除时按 project_id 置 is_deleted=1 -->
<update id="softDeleteByProjectId" parameterType="Long">
update biz_project_assign set is_deleted = 1 where project_id = #{projectId}
</update>
</mapper> </mapper>
@@ -33,6 +33,7 @@
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="manageFee" column="manage_fee" /> <result property="manageFee" column="manage_fee" />
<result property="roleLabor" column="role_labor" />
<result property="startTime" column="start_time" /> <result property="startTime" column="start_time" />
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time" />
<result property="submitDeadlineDays" column="submit_deadline_days" /> <result property="submitDeadlineDays" column="submit_deadline_days" />
@@ -41,16 +42,17 @@
<result property="invitationUrl" column="invitation_url" /> <result property="invitationUrl" column="invitation_url" />
<result property="supportLetterUrl" column="support_letter_url" /> <result property="supportLetterUrl" column="support_letter_url" />
<result property="publishUrl" column="publish_url" /> <result property="publishUrl" column="publish_url" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
select 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 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, p.is_deleted,
o.org_name as sponsor_org_name, o.org_name as sponsor_org_name,
lu.user_name as lead_user_name, lu.user_name as lead_user_name,
bp.name as create_user_name, bp.name as create_user_name,
(select group_concat(distinct o2.org_name separator ',') (select group_concat(distinct o2.org_name separator ',')
from biz_project_assign bpa from biz_project_assign bpa
join biz_org o2 on o2.org_id = bpa.execution_unit_id and o2.org_type = 'executor' join biz_org o2 on o2.org_id = bpa.execution_unit_id and o2.org_type = 'executor'
where bpa.project_id = p.project_id) as exec_org_names where bpa.project_id = p.project_id and bpa.is_deleted = 0) as exec_org_names
from biz_project p from biz_project p
left join biz_org o on o.user_id = p.sponsor_admin_user_id and o.org_type = 'sponsor' 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 sys_user lu on lu.user_id = p.lead_user_id
@@ -63,17 +65,17 @@
p.total_amount, p.available_amount, p.paid_labor_amount, p.paid_meeting_amount, 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.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.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.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.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.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url,
p.publish_url, p.publish_url, p.is_deleted,
o.org_name as sponsor_org_name, o.org_name as sponsor_org_name,
lu.user_name as lead_user_name, lu.user_name as lead_user_name,
bp.name as create_user_name, bp.name as create_user_name,
(select group_concat(distinct o2.org_name separator ',') (select group_concat(distinct o2.org_name separator ',')
from biz_project_assign bpa from biz_project_assign bpa
join biz_org o2 on o2.org_id = bpa.execution_unit_id and o2.org_type = 'executor' join biz_org o2 on o2.org_id = bpa.execution_unit_id and o2.org_type = 'executor'
where bpa.project_id = p.project_id) as exec_org_names where bpa.project_id = p.project_id and bpa.is_deleted = 0) as exec_org_names
from biz_project p from biz_project p
left join biz_org o on o.user_id = p.sponsor_admin_user_id and o.org_type = 'sponsor' 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 sys_user lu on lu.user_id = p.lead_user_id
@@ -81,12 +83,13 @@
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizProjectResult" parameterType="Long"> <select id="selectByPrimaryKey" resultMap="BizProjectResult" parameterType="Long">
<include refid="selectFields"/> <include refid="selectFields"/>
where project_id = #{projectId} where project_id = #{projectId} and p.is_deleted = 0
</select> </select>
<!-- sponsor 专属列表 (走 params.projectIds + LEFT JOIN 当前 login 用户评分) --> <!-- sponsor 专属列表 (走 params.projectIds + LEFT JOIN 当前 login 用户评分) -->
<select id="selectSponsorList" resultMap="BizProjectResult" parameterType="BizProject"> <select id="selectSponsorList" resultMap="BizProjectResult" parameterType="BizProject">
<include refid="selectFieldsForSponsor"/> <include refid="selectFieldsForSponsor"/>
<where> <where>
p.is_deleted = 0
<if test="params.projectIds != null and params.projectIds.size() > 0"> <if test="params.projectIds != null and params.projectIds.size() > 0">
and p.project_id in and p.project_id in
<foreach collection="params.projectIds" item="id" open="(" separator="," close=")"> <foreach collection="params.projectIds" item="id" open="(" separator="," close=")">
@@ -111,30 +114,33 @@
注: executor 角色无评分/聚合分需求, 复用 selectFields (含 sponsor_score / manager_score) 注: executor 角色无评分/聚合分需求, 复用 selectFields (含 sponsor_score / manager_score)
--> -->
<select id="selectExecutorList" resultMap="BizProjectResult" parameterType="BizProject"> <select id="selectExecutorList" resultMap="BizProjectResult" parameterType="BizProject">
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, o.org_name as sponsor_org_name,
lu.user_name as lead_user_name, lu.user_name as lead_user_name,
bp.name as create_user_name, bp.name as create_user_name,
(select group_concat(distinct o2.org_name separator ',') (select group_concat(distinct o2.org_name separator ',')
from biz_project_assign bpa2 from biz_project_assign bpa2
join biz_org o2 on o2.org_id = bpa2.execution_unit_id and o2.org_type = 'executor' 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) (select coalesce(sum(bpa3.sessions), 0)
from biz_project_assign bpa3 from biz_project_assign bpa3
where bpa3.project_id = p.project_id where bpa3.project_id = p.project_id
and bpa3.is_deleted = 0
and (bpa3.exec_user_id = #{params.executorUserId} 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, 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) (select coalesce(sum(bpa4.amount), 0)
from biz_project_assign bpa4 from biz_project_assign bpa4
where bpa4.project_id = p.project_id where bpa4.project_id = p.project_id
and bpa4.is_deleted = 0
and (bpa4.exec_user_id = #{params.executorUserId} 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 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 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 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 sys_user lu on lu.user_id = p.lead_user_id
left join biz_person bp on bp.user_id = p.create_user_id left join biz_person bp on bp.user_id = p.create_user_id
<where> <where>
p.is_deleted = 0
(a.exec_user_id = #{params.executorUserId} (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')) or a.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor'))
<if test="projectNo != null and projectNo != ''">and p.project_no like concat('%', #{projectNo}, '%')</if> <if test="projectNo != null and projectNo != ''">and p.project_no like concat('%', #{projectNo}, '%')</if>
@@ -149,6 +155,7 @@
<select id="selectList" resultMap="BizProjectResult" parameterType="BizProject"> <select id="selectList" resultMap="BizProjectResult" parameterType="BizProject">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
p.is_deleted = 0
<if test="params.projectIds != null and params.projectIds.size() > 0"> <if test="params.projectIds != null and params.projectIds.size() > 0">
and project_id in and project_id in
<foreach collection="params.projectIds" item="id" open="(" separator="," close=")"> <foreach collection="params.projectIds" item="id" open="(" separator="," close=")">
@@ -214,6 +221,7 @@
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="manageFee != null">manage_fee,</if> <if test="manageFee != null">manage_fee,</if>
<if test="roleLabor != null">role_labor,</if>
<if test="startTime != null">start_time,</if> <if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if> <if test="endTime != null">end_time,</if>
<if test="submitDeadlineDays != null">submit_deadline_days,</if> <if test="submitDeadlineDays != null">submit_deadline_days,</if>
@@ -249,6 +257,7 @@
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="manageFee != null">#{manageFee},</if> <if test="manageFee != null">#{manageFee},</if>
<if test="roleLabor != null">#{roleLabor},</if>
<if test="startTime != null">#{startTime},</if> <if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if> <if test="endTime != null">#{endTime},</if>
<if test="submitDeadlineDays != null">#{submitDeadlineDays},</if> <if test="submitDeadlineDays != null">#{submitDeadlineDays},</if>
@@ -263,6 +272,7 @@
update biz_project update biz_project
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="manageFee != null and manageFee != ''">manage_fee = #{manageFee},</if> <if test="manageFee != null and manageFee != ''">manage_fee = #{manageFee},</if>
<if test="roleLabor != null">role_labor = #{roleLabor},</if>
<if test="startTime != null">start_time = #{startTime},</if> <if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if> <if test="endTime != null">end_time = #{endTime},</if>
<if test="submitDeadlineDays != null and submitDeadlineDays != ''">submit_deadline_days = #{submitDeadlineDays},</if> <if test="submitDeadlineDays != null and submitDeadlineDays != ''">submit_deadline_days = #{submitDeadlineDays},</if>
@@ -306,4 +316,12 @@
#{projectId} #{projectId}
</foreach> </foreach>
</delete> </delete>
<!-- 软删除: admin/manager 删除项目时调用, 置 is_deleted=1 (不真删, 保留审计追溯) -->
<update id="softDeleteByProjectId" parameterType="Long">
update biz_project set is_deleted = 1 where project_id = #{projectId}
</update>
<!-- 级联删除时用: 取 projectNo (给 plan 级联, 不带 is_deleted 过滤, 允许已软删项目重跑 cascade) -->
<select id="selectProjectNoById" resultType="String" parameterType="Long">
select project_no from biz_project where project_id = #{projectId}
</select>
</mapper> </mapper>
@@ -24,6 +24,7 @@
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
select p.plan_id, p.plan_name, p.plan_direction, p.plan_direction_id, 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, 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, COALESCE(bp.name, u.user_name) as submitter_name,
proj.project_name as project_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 from biz_project_plan p
left join biz_special_plan s on s.id = p.plan_direction_id 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 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_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
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizProjectPlanResult" parameterType="String"> <select id="selectByPrimaryKey" resultMap="BizProjectPlanResult" parameterType="String">
<include refid="selectFields"/> <include refid="selectFields"/>
where p.plan_id = #{planId} where p.plan_id = #{planId} and p.is_deleted = 0
</select> </select>
<select id="selectList" resultMap="BizProjectPlanResult" parameterType="BizProjectPlan"> <select id="selectList" resultMap="BizProjectPlanResult" parameterType="BizProjectPlan">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
p.is_deleted = 0
<if test="planDirectionId != null"> and p.plan_direction_id = #{planDirectionId}</if> <if test="planDirectionId != null"> and p.plan_direction_id = #{planDirectionId}</if>
<if test="planCategory != null and planCategory != ''"> and p.plan_category = #{planCategory}</if> <if test="planCategory != null and planCategory != ''"> and p.plan_category = #{planCategory}</if>
<if test="submitterId != null"> and p.submitter_id = #{submitterId}</if> <if test="submitterId != null"> and p.submitter_id = #{submitterId}</if>
@@ -118,4 +120,8 @@
#{planId} #{planId}
</foreach> </foreach>
</delete> </delete>
<!-- 软删除: 项目级联删除时按 projectNo 置 is_deleted=1 (biz_project_plan 用 project_no 关联项目) -->
<update id="softDeleteByProjectNo" parameterType="String">
update biz_project_plan set is_deleted = 1 where project_no = #{projectNo}
</update>
</mapper> </mapper>
@@ -15,18 +15,20 @@
<result property="projectId" column="project_id" /> <result property="projectId" column="project_id" />
<result property="raterId" column="rater_id" /> <result property="raterId" column="rater_id" />
<result property="ratingTime" column="rating_time" /> <result property="ratingTime" column="rating_time" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<sql id="selectFields"> <sql id="selectFields">
select rating_id, project_id, project_no, project_name, rater_id, rater_name, rater_role, quality_score, response_score, cooperation_score, compliance_score, remark, rating_time, create_by, create_time, update_by, update_time select rating_id, project_id, project_no, project_name, rater_id, rater_name, rater_role, quality_score, response_score, cooperation_score, compliance_score, remark, rating_time, create_by, create_time, update_by, update_time, is_deleted
from biz_project_rating from biz_project_rating
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BizProjectRatingResult" parameterType="String"> <select id="selectByPrimaryKey" resultMap="BizProjectRatingResult" parameterType="String">
<include refid="selectFields"/> <include refid="selectFields"/>
where rating_id = #{ratingId} where rating_id = #{ratingId} and is_deleted = 0
</select> </select>
<select id="selectList" resultMap="BizProjectRatingResult" parameterType="BizProjectRating"> <select id="selectList" resultMap="BizProjectRatingResult" parameterType="BizProjectRating">
<include refid="selectFields"/> <include refid="selectFields"/>
<where> <where>
is_deleted = 0
<if test="projectId != null"> and project_id = #{projectId}</if> <if test="projectId != null"> and project_id = #{projectId}</if>
<if test="raterId != null"> and rater_id = #{raterId}</if> <if test="raterId != null"> and rater_id = #{raterId}</if>
<if test="raterRole != null and raterRole != ''"> and rater_role = #{raterRole}</if> <if test="raterRole != null and raterRole != ''"> and rater_role = #{raterRole}</if>
@@ -73,6 +75,11 @@
</foreach> </foreach>
</delete> </delete>
<!-- 软删除: 项目级联删除时按 project_id 置 is_deleted=1 -->
<update id="softDeleteByProjectId" parameterType="Long">
update biz_project_rating set is_deleted = 1 where project_id = #{projectId}
</update>
<!-- 按 (project_id + rater_id + rater_role) upsert 评分 --> <!-- 按 (project_id + rater_id + rater_role) upsert 评分 -->
<insert id="upsertRating" parameterType="BizProjectRating"> <insert id="upsertRating" parameterType="BizProjectRating">
INSERT INTO biz_project_rating INSERT INTO biz_project_rating
@@ -13,6 +13,7 @@
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="sponsorUserName" column="sponsor_user_name" /> <result property="sponsorUserName" column="sponsor_user_name" />
<result property="monitorUserName" column="monitor_user_name" /> <result property="monitorUserName" column="monitor_user_name" />
<result property="isDeleted" column="is_deleted" />
</resultMap> </resultMap>
<insert id="insertAssign" parameterType="BizProjectSponsorAssign" useGeneratedKeys="true" keyProperty="id"> <insert id="insertAssign" parameterType="BizProjectSponsorAssign" useGeneratedKeys="true" keyProperty="id">
@@ -27,6 +28,11 @@
delete from biz_project_sponsor_assign where project_id = #{projectId} delete from biz_project_sponsor_assign where project_id = #{projectId}
</delete> </delete>
<!-- 软删除: 项目级联删除时按 project_id (String) 置 is_deleted=1 -->
<update id="softDeleteByProjectId" parameterType="String">
update biz_project_sponsor_assign set is_deleted = 1 where project_id = #{projectId}
</update>
<select id="selectByProjectId" resultMap="BaseResultMap"> <select id="selectByProjectId" resultMap="BaseResultMap">
SELECT a.*, SELECT a.*,
s.user_name AS sponsor_user_name, s.user_name AS sponsor_user_name,
@@ -34,7 +40,7 @@
FROM biz_project_sponsor_assign a FROM biz_project_sponsor_assign a
LEFT JOIN sys_user s ON a.sponsor_user_id = s.user_id 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 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 ORDER BY a.create_time DESC
</select> </select>
</mapper> </mapper>