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:
@@ -28,18 +28,20 @@
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="isDeleted" column="is_deleted" />
|
||||
</resultMap>
|
||||
<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
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" resultMap="BizMeetingResult" parameterType="Long">
|
||||
<include refid="selectFields"/>
|
||||
where meeting_id = #{meetingId}
|
||||
where meeting_id = #{meetingId} and is_deleted = 0
|
||||
</select>
|
||||
<select id="selectList" resultMap="BizMeetingResult" parameterType="BizMeeting">
|
||||
<include refid="selectFields"/>
|
||||
<where>
|
||||
is_deleted = 0
|
||||
<if test="projectNo != null and projectNo != ''">and project_no like concat('%', #{projectNo}, '%')</if>
|
||||
<if test="meetingId != null">and meeting_id = #{meetingId}</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="startTime != null">and start_time >= #{startTime}</if>
|
||||
<if test="endTime != null">and end_time <= #{endTime}</if>
|
||||
<!-- doctor 角色按 user_id 过滤 (走 biz_meeting_attendee 中间表) -->
|
||||
<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>
|
||||
<!-- 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} and a.is_deleted = 0)</if>
|
||||
</where>
|
||||
order by meeting_id desc
|
||||
</select>
|
||||
@@ -140,4 +142,12 @@
|
||||
#{meetingId}
|
||||
</foreach>
|
||||
</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>
|
||||
Reference in New Issue
Block a user