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 可删 (放宽权限)
105 lines
5.9 KiB
XML
105 lines
5.9 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.BizProjectRatingMapper">
|
|
<resultMap type="BizProjectRating" id="BizProjectRatingResult">
|
|
<id property="ratingId" column="rating_id" />
|
|
<result property="projectNo" column="project_no" />
|
|
<result property="projectName" column="project_name" />
|
|
<result property="raterName" column="rater_name" />
|
|
<result property="raterRole" column="rater_role" />
|
|
<result property="qualityScore" column="quality_score" />
|
|
<result property="responseScore" column="response_score" />
|
|
<result property="cooperationScore" column="cooperation_score" />
|
|
<result property="complianceScore" column="compliance_score" />
|
|
<result property="remark" column="remark" />
|
|
<result property="projectId" column="project_id" />
|
|
<result property="raterId" column="rater_id" />
|
|
<result property="ratingTime" column="rating_time" />
|
|
<result property="isDeleted" column="is_deleted" />
|
|
</resultMap>
|
|
<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, is_deleted
|
|
from biz_project_rating
|
|
</sql>
|
|
<select id="selectByPrimaryKey" resultMap="BizProjectRatingResult" parameterType="String">
|
|
<include refid="selectFields"/>
|
|
where rating_id = #{ratingId} and is_deleted = 0
|
|
</select>
|
|
<select id="selectList" resultMap="BizProjectRatingResult" parameterType="BizProjectRating">
|
|
<include refid="selectFields"/>
|
|
<where>
|
|
is_deleted = 0
|
|
<if test="projectId != null"> and project_id = #{projectId}</if>
|
|
<if test="raterId != null"> and rater_id = #{raterId}</if>
|
|
<if test="raterRole != null and raterRole != ''"> and rater_role = #{raterRole}</if>
|
|
<if test="remark != null and remark != ''"> and remark = #{remark}</if>
|
|
</where>
|
|
order by rating_id desc
|
|
</select>
|
|
<insert id="insert" parameterType="BizProjectRating">
|
|
insert into biz_project_rating
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="ratingId != null and ratingId != ''">rating_id,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="ratingId != null and ratingId != ''">#{ratingId},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateByPrimaryKey" parameterType="BizProjectRating">
|
|
update biz_project_rating
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<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="raterId != null and raterId != ''">rater_id = #{raterId},</if>
|
|
<if test="raterName != null and raterName != ''">rater_name = #{raterName},</if>
|
|
<if test="raterRole != null and raterRole != ''">rater_role = #{raterRole},</if>
|
|
<if test="qualityScore != null">quality_score = #{qualityScore},</if>
|
|
<if test="responseScore != null">response_score = #{responseScore},</if>
|
|
<if test="cooperationScore != null">cooperation_score = #{cooperationScore},</if>
|
|
<if test="complianceScore != null">compliance_score = #{complianceScore},</if>
|
|
<if test="ratingTime != null and ratingTime != ''">rating_time = #{ratingTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where rating_id = #{ratingId}
|
|
</update>
|
|
<delete id="deleteByPrimaryKey" parameterType="String">
|
|
delete from biz_project_rating where rating_id = #{ratingId}
|
|
</delete>
|
|
<delete id="deleteByPrimaryKeys" parameterType="String">
|
|
delete from biz_project_rating where rating_id in
|
|
<foreach collection="ratingIds" item="ratingId" open="(" separator="," close=")">
|
|
#{ratingId}
|
|
</foreach>
|
|
</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 评分 -->
|
|
<insert id="upsertRating" parameterType="BizProjectRating">
|
|
INSERT INTO biz_project_rating
|
|
(project_id, project_no, project_name, rater_id, rater_name, rater_role,
|
|
quality_score, response_score, cooperation_score, compliance_score,
|
|
remark, create_by, create_time, update_by, update_time)
|
|
VALUES
|
|
(#{projectId}, #{projectNo}, #{projectName}, #{raterId}, #{raterName}, #{raterRole},
|
|
#{qualityScore}, #{responseScore}, #{cooperationScore}, #{complianceScore},
|
|
#{remark}, #{createBy}, sysdate(), #{updateBy}, sysdate())
|
|
ON DUPLICATE KEY UPDATE
|
|
project_no = VALUES(project_no),
|
|
project_name = VALUES(project_name),
|
|
rater_name = VALUES(rater_name),
|
|
quality_score = VALUES(quality_score),
|
|
response_score = VALUES(response_score),
|
|
cooperation_score= VALUES(cooperation_score),
|
|
compliance_score = VALUES(compliance_score),
|
|
remark = VALUES(remark),
|
|
update_by = VALUES(update_by),
|
|
update_time = sysdate()
|
|
</insert>
|
|
</mapper> |