Files
guoju0808/ry-api/ruoyi-business/src/main/resources/mapper/business/BizProjectPlanMapper.xml
T
郭庆泰 67be5345ad refactor(submissions): 方案A — mapper submitter_name + 页面样式对齐 + 紧急迁移
- mapper: selectFields 加 COALESCE(bp.name, u.user_name), LEFT JOIN biz_person (uk_person_user_id 防笛卡尔积)
- mapper: insert 补 7 字段 (plan_name/plan_direction/plan_category/project_form/design_file_url/is_settled/project_no), plan_name NOT NULL 缺默认
- SQL: 紧急迁移脚本 add submitter_id + idx + biz_person UNIQUE (ALTER, 不 DROP)
- SubmissionNew: page-card + breadcrumb + max-width 1200px, accept=.pdf/.png/.jpg/.jpeg, __silentError 防双 toast
- SubmissionNew: el-upload drag 模式 A (对齐 Meetings.vue, 删 design-uploader 自定义 CSS)
- SubmissionDetail: 删状态/投稿人/投稿时间/审计, 改 Preview 组件展示设计文件
2026-08-18 00:51:53 +08:00

115 lines
7.1 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.BizProjectPlanMapper">
<resultMap type="BizProjectPlan" id="BizProjectPlanResult">
<id property="planId" column="plan_id" />
<result property="planName" column="plan_name" />
<result property="planDirection" column="plan_direction" />
<result property="planDirectionId" column="plan_direction_id" />
<result property="planDirectionTitle" column="plan_direction_title" />
<result property="planCategory" column="plan_category" />
<result property="projectForm" column="project_form" />
<result property="designFileUrl" column="design_file_url" />
<result property="status" column="status" />
<result property="isSettled" column="is_settled" />
<result property="projectNo" column="project_no" />
<result property="remark" column="remark" />
<result property="submitterId" column="submitter_id" />
<result property="submitterName" column="submitter_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectFields">
select p.plan_id, p.plan_name, p.plan_direction, p.plan_direction_id,
s.title as plan_direction_title,
p.plan_category, p.project_form, p.design_file_url, p.status, p.is_settled,
p.project_no, p.remark, p.submitter_id,
COALESCE(bp.name, u.user_name) as submitter_name,
p.create_by, p.create_time, p.update_by, p.update_time
from biz_project_plan p
left join biz_special_plan s on s.id = p.plan_direction_id
left join sys_user u on u.user_id = p.submitter_id
left join biz_person bp on bp.user_id = u.user_id
</sql>
<select id="selectByPrimaryKey" resultMap="BizProjectPlanResult" parameterType="String">
<include refid="selectFields"/>
where p.plan_id = #{planId}
</select>
<select id="selectList" resultMap="BizProjectPlanResult" parameterType="BizProjectPlan">
<include refid="selectFields"/>
<where>
<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="submitterId != null"> and p.submitter_id = #{submitterId}</if>
<choose>
<!-- 选了具体状态: 等值匹配 -->
<when test="status != null and status != ''"> and p.status = #{status}</when>
<!-- 未选: 不加 status 过滤, 由前端按角色决定默认值 (经理侧默认查 1/2/3, 医生侧默认查全部含 0) -->
</choose>
<if test="remark != null and remark != ''"> and p.remark = #{remark}</if>
</where>
order by p.plan_id desc
</select>
<insert id="insert" parameterType="BizProjectPlan">
insert into biz_project_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planId != null and planId != ''">plan_id,</if>
<if test="planName != null and planName != ''">plan_name,</if>
<if test="planDirection != null and planDirection != ''">plan_direction,</if>
<if test="planDirectionId != null">plan_direction_id,</if>
<if test="planCategory != null and planCategory != ''">plan_category,</if>
<if test="projectForm != null and projectForm != ''">project_form,</if>
<if test="designFileUrl != null and designFileUrl != ''">design_file_url,</if>
<if test="status != null">status,</if>
<if test="isSettled != null and isSettled != ''">is_settled,</if>
<if test="projectNo != null and projectNo != ''">project_no,</if>
<if test="remark != null">remark,</if>
<if test="submitterId != null">submitter_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planId != null and planId != ''">#{planId},</if>
<if test="planName != null and planName != ''">#{planName},</if>
<if test="planDirection != null and planDirection != ''">#{planDirection},</if>
<if test="planDirectionId != null">#{planDirectionId},</if>
<if test="planCategory != null and planCategory != ''">#{planCategory},</if>
<if test="projectForm != null and projectForm != ''">#{projectForm},</if>
<if test="designFileUrl != null and designFileUrl != ''">#{designFileUrl},</if>
<if test="status != null">#{status},</if>
<if test="isSettled != null and isSettled != ''">#{isSettled},</if>
<if test="projectNo != null and projectNo != ''">#{projectNo},</if>
<if test="remark != null">#{remark},</if>
<if test="submitterId != null">#{submitterId},</if>
</trim>
</insert>
<update id="updateByPrimaryKey" parameterType="BizProjectPlan">
update biz_project_plan
<trim prefix="SET" suffixOverrides=",">
<if test="planName != null and planName != ''">plan_name = #{planName},</if>
<if test="planDirection != null and planDirection != ''">plan_direction = #{planDirection},</if>
<if test="planDirectionId != null">plan_direction_id = #{planDirectionId},</if>
<if test="planCategory != null and planCategory != ''">plan_category = #{planCategory},</if>
<if test="projectForm != null and projectForm != ''">project_form = #{projectForm},</if>
<if test="designFileUrl != null and designFileUrl != ''">design_file_url = #{designFileUrl},</if>
<if test="isSettled != null and isSettled != ''">is_settled = #{isSettled},</if>
<if test="projectNo != null and projectNo != ''">project_no = #{projectNo},</if>
<if test="auditOpinion != null and auditOpinion != ''">audit_opinion = #{auditOpinion},</if>
<if test="auditBy != null and auditBy != ''">audit_by = #{auditBy},</if>
<if test="auditTime != null and auditTime != ''">audit_time = #{auditTime},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="submitterId != null">submitter_id = #{submitterId},</if>
</trim>
where plan_id = #{planId}
</update>
<delete id="deleteByPrimaryKey" parameterType="String">
delete from biz_project_plan where plan_id = #{planId}
</delete>
<delete id="deleteByPrimaryKeys" parameterType="String">
delete from biz_project_plan where plan_id in
<foreach collection="planIds" item="planId" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
</mapper>