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 可删 (放宽权限)
153 lines
11 KiB
XML
153 lines
11 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.ruoyi.business.mapper.BizMeetingMapper">
|
|
<resultMap type="BizMeeting" id="BizMeetingResult">
|
|
<id property="meetingId" column="meeting_id" />
|
|
<result property="businessId" column="business_id" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="projectNo" column="project_no" />
|
|
<result property="projectName" column="project_name" />
|
|
<result property="meetingName" column="meeting_name" />
|
|
<result property="periodNo" column="period_no" />
|
|
<result property="totalPeriods" column="total_periods" />
|
|
<result property="projectForm" column="project_form" />
|
|
<result property="startTime" column="start_time" />
|
|
<result property="endTime" column="end_time" />
|
|
<result property="orgName" column="org_name" />
|
|
<result property="address" column="address" />
|
|
<result property="currentStage" column="current_stage" />
|
|
<result property="supervisionOpinion" column="supervision_opinion" />
|
|
<result property="supervisionBy" column="supervision_by" />
|
|
<result property="supervisionTime" column="supervision_time" />
|
|
<result property="materialAuditStage" column="material_audit_stage" />
|
|
<result property="voucherAuditStage" column="voucher_audit_stage" />
|
|
<result property="invitationUrl" column="invitation_url" />
|
|
<result property="scheduleUrl" column="schedule_url" />
|
|
<result property="laborSigned" column="labor_signed" />
|
|
<result property="createBy" column="create_by" />
|
|
<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, is_deleted
|
|
from biz_meeting
|
|
</sql>
|
|
<select id="selectByPrimaryKey" resultMap="BizMeetingResult" parameterType="Long">
|
|
<include refid="selectFields"/>
|
|
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>
|
|
<if test="periodNo != null">and period_no = #{periodNo}</if>
|
|
<if test="projectForm != null and projectForm != ''">and project_form = #{projectForm}</if>
|
|
<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 中间表, 同时 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>
|
|
<insert id="insert" parameterType="BizMeeting">
|
|
insert into biz_meeting
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="meetingId != null">meeting_id,</if>
|
|
<if test="businessId != null and businessId != ''">business_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="projectNo != null and projectNo != ''">project_no,</if>
|
|
<if test="projectName != null and projectName != ''">project_name,</if>
|
|
<if test="meetingName != null and meetingName != ''">meeting_name,</if>
|
|
<if test="periodNo != null">period_no,</if>
|
|
<if test="totalPeriods != null">total_periods,</if>
|
|
<if test="projectForm != null and projectForm != ''">project_form,</if>
|
|
<if test="startTime != null">start_time,</if>
|
|
<if test="endTime != null">end_time,</if>
|
|
<if test="orgName != null and orgName != ''">org_name,</if>
|
|
<if test="address != null and address != ''">address,</if>
|
|
<if test="currentStage != null and currentStage != ''">current_stage,</if>
|
|
<if test="supervisionOpinion != null and supervisionOpinion != ''">supervision_opinion,</if>
|
|
<if test="supervisionBy != null and supervisionBy != ''">supervision_by,</if>
|
|
<if test="supervisionTime != null">supervision_time,</if>
|
|
<if test="materialAuditStage != null and materialAuditStage != ''">material_audit_stage,</if>
|
|
<if test="voucherAuditStage != null and voucherAuditStage != ''">voucher_audit_stage,</if>
|
|
<if test="invitationUrl != null and invitationUrl != ''">invitation_url,</if>
|
|
<if test="scheduleUrl != null and scheduleUrl != ''">schedule_url,</if>
|
|
<if test="laborSigned != null and laborSigned != ''">labor_signed,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="meetingId != null">#{meetingId},</if>
|
|
<if test="businessId != null and businessId != ''">#{businessId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="projectNo != null and projectNo != ''">#{projectNo},</if>
|
|
<if test="projectName != null and projectName != ''">#{projectName},</if>
|
|
<if test="meetingName != null and meetingName != ''">#{meetingName},</if>
|
|
<if test="periodNo != null">#{periodNo},</if>
|
|
<if test="totalPeriods != null">#{totalPeriods},</if>
|
|
<if test="projectForm != null and projectForm != ''">#{projectForm},</if>
|
|
<if test="startTime != null">#{startTime},</if>
|
|
<if test="endTime != null">#{endTime},</if>
|
|
<if test="orgName != null and orgName != ''">#{orgName},</if>
|
|
<if test="address != null and address != ''">#{address},</if>
|
|
<if test="currentStage != null and currentStage != ''">#{currentStage},</if>
|
|
<if test="supervisionOpinion != null and supervisionOpinion != ''">#{supervisionOpinion},</if>
|
|
<if test="supervisionBy != null and supervisionBy != ''">#{supervisionBy},</if>
|
|
<if test="supervisionTime != null">#{supervisionTime},</if>
|
|
<if test="materialAuditStage != null and materialAuditStage != ''">#{materialAuditStage},</if>
|
|
<if test="voucherAuditStage != null and voucherAuditStage != ''">#{voucherAuditStage},</if>
|
|
<if test="invitationUrl != null and invitationUrl != ''">#{invitationUrl},</if>
|
|
<if test="scheduleUrl != null and scheduleUrl != ''">#{scheduleUrl},</if>
|
|
<if test="laborSigned != null and laborSigned != ''">#{laborSigned},</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKey" parameterType="BizMeeting">
|
|
update biz_meeting
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="businessId != null and businessId != ''">business_id = #{businessId},</if>
|
|
<if test="projectId != null and projectId != ''">project_id = #{projectId},</if>
|
|
<if test="projectNo != null and projectNo != ''">project_no = #{projectNo},</if>
|
|
<if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
|
|
<if test="meetingName != null and meetingName != ''">meeting_name = #{meetingName},</if>
|
|
<if test="periodNo != null and periodNo != ''">period_no = #{periodNo},</if>
|
|
<if test="totalPeriods != null and totalPeriods != ''">total_periods = #{totalPeriods},</if>
|
|
<if test="projectForm != null and projectForm != ''">project_form = #{projectForm},</if>
|
|
<if test="startTime != null and startTime != ''">start_time = #{startTime},</if>
|
|
<if test="endTime != null and endTime != ''">end_time = #{endTime},</if>
|
|
<if test="orgName != null and orgName != ''">org_name = #{orgName},</if>
|
|
<if test="address != null and address != ''">address = #{address},</if>
|
|
<if test="currentStage != null and currentStage != ''">current_stage = #{currentStage},</if>
|
|
<if test="supervisionOpinion != null and supervisionOpinion != ''">supervision_opinion = #{supervisionOpinion},</if>
|
|
<if test="supervisionBy != null and supervisionBy != ''">supervision_by = #{supervisionBy},</if>
|
|
<if test="supervisionTime != null and supervisionTime != ''">supervision_time = #{supervisionTime},</if>
|
|
<if test="materialAuditStage != null and materialAuditStage != ''">material_audit_stage = #{materialAuditStage},</if>
|
|
<if test="voucherAuditStage != null and voucherAuditStage != ''">voucher_audit_stage = #{voucherAuditStage},</if>
|
|
<if test="invitationUrl != null and invitationUrl != ''">invitation_url = #{invitationUrl},</if>
|
|
<if test="scheduleUrl != null and scheduleUrl != ''">schedule_url = #{scheduleUrl},</if>
|
|
<if test="laborSigned != null and laborSigned != ''">labor_signed = #{laborSigned},</if>
|
|
</trim>
|
|
where meeting_id = #{meetingId}
|
|
</update>
|
|
<delete id="deleteByPrimaryKey" parameterType="Long">
|
|
delete from biz_meeting where meeting_id = #{meetingId}
|
|
</delete>
|
|
<delete id="deleteByPrimaryKeys" parameterType="Long">
|
|
delete from biz_meeting where meeting_id in
|
|
<foreach collection="meetingIds" item="meetingId" open="(" separator="," close=")">
|
|
#{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> |