chore: biz_org 合并 / BizProject 重构 / 各角色页面调整 (上次重构遗留)
涵盖改动范围: - 后端 BizOrg / BizProject / BizProjectRating / BizSpecialPlan controller + domain + mapper + service - 前端 admin (BizSpecialPlanAdmin, ProjectCategory) / executor / leader / manager / sponsor 多页调整 - api/dict.js + AdminLayout.vue 同步
This commit is contained in:
@@ -142,4 +142,23 @@
|
||||
<if test="orgName != null and orgName != ''">and o.org_name like concat('%', #{orgName}, '%')</if>
|
||||
order by o.org_id desc
|
||||
</select>
|
||||
|
||||
<!--
|
||||
当前登录 sponsor 的所属公司 (供 /sponsor/account 页面回显 + 主账号改名)
|
||||
主账号 (sys_user.parent_user_id IS NULL): 用 own (biz_org.user_id = #{userId})
|
||||
子账号 (有 biz_person.user_id = #{userId}): 用 biz_person.org_id → biz_org
|
||||
COALESCE(own.org_id, p.org_id) 二选一, isOwner 标识主账号
|
||||
返回 Map: orgId / orgName / isOwner (1=主账号, 0=子账号)
|
||||
-->
|
||||
<select id="selectMySponsorCompany" parameterType="Long" resultType="java.util.LinkedHashMap">
|
||||
select o.org_id as orgId,
|
||||
o.org_name as orgName,
|
||||
case when p.user_id is null then 1 else 0 end as isOwner
|
||||
from sys_user u
|
||||
left join biz_person p on p.user_id = u.user_id and p.unit_type = 'sponsor'
|
||||
left join biz_org own on own.user_id = u.user_id and own.org_type = 'sponsor'
|
||||
left join biz_org o on o.org_id = COALESCE(own.org_id, p.org_id)
|
||||
where u.user_id = #{userId}
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
<result property="projectNo" column="project_no" />
|
||||
<result property="projectName" column="project_name" />
|
||||
<result property="totalSessions" column="total_sessions" />
|
||||
<result property="assignedSessions" column="assigned_sessions" />
|
||||
<result property="assignedAmount" column="assigned_amount" />
|
||||
<result property="doneSessions" column="done_sessions" />
|
||||
<result property="todoSessions" column="todo_sessions" />
|
||||
<result property="totalAmount" column="total_amount" />
|
||||
<result property="availableAmount" column="available_amount" />
|
||||
<result property="paidLaborAmount" column="paid_labor_amount" />
|
||||
<result property="paidMeetingAmount" column="paid_meeting_amount" />
|
||||
<result property="ratingScore" column="rating_score" />
|
||||
<result property="managerScore" column="manager_score" />
|
||||
<result property="sponsorScore" column="sponsor_score" />
|
||||
<result property="sponsorAdminUserName" column="sponsor_admin_user_name" />
|
||||
<result property="sponsorAdminUserId" column="sponsor_admin_user_id" />
|
||||
<result property="leadUserId" column="lead_user_id" />
|
||||
@@ -38,7 +41,7 @@
|
||||
<result property="publishUrl" column="publish_url" />
|
||||
</resultMap>
|
||||
<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.rating_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_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_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,
|
||||
o.org_name as sponsor_org_name,
|
||||
lu.user_name as lead_user_name,
|
||||
(select group_concat(distinct o2.org_name separator ',')
|
||||
@@ -54,7 +57,7 @@
|
||||
<sql id="selectFieldsForSponsor">
|
||||
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.rating_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.create_by, p.create_time, p.update_by, p.update_time, p.manage_fee,
|
||||
p.start_time, p.end_time, p.submit_deadline_days,
|
||||
@@ -84,6 +87,48 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="params.sponsorAdminUserId != null">and p.sponsor_admin_user_id = #{params.sponsorAdminUserId}</if>
|
||||
<if test="projectNo != null and projectNo != ''">and p.project_no like concat('%', #{projectNo}, '%')</if>
|
||||
<if test="projectName != null and projectName != ''">and p.project_name like concat('%', #{projectName}, '%')</if>
|
||||
<if test="startTime != null and startTime != ''">and p.start_time >= #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''">and p.end_time <= #{endTime}</if>
|
||||
<if test="isFinished != null and isFinished != ''">and p.is_finished = #{isFinished}</if>
|
||||
</where>
|
||||
order by p.project_id desc
|
||||
</select>
|
||||
|
||||
<!--
|
||||
executor 专属列表: 只查 biz_project_assign 里分给当前用户的项目
|
||||
匹配规则 (任一):
|
||||
1) a.exec_user_id = 当前 user_id (子账号直接被指派)
|
||||
2) a.execution_unit_id = 当前 user_id 对应的 executor biz_org.org_id (主账号整公司被指派)
|
||||
注: executor 角色无评分/聚合分需求, 复用 selectFields (含 sponsor_score / manager_score)
|
||||
-->
|
||||
<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_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,
|
||||
o.org_name as sponsor_org_name,
|
||||
lu.user_name as lead_user_name,
|
||||
(select group_concat(distinct o2.org_name separator ',')
|
||||
from biz_project_assign bpa2
|
||||
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,
|
||||
(select coalesce(sum(bpa3.sessions), 0)
|
||||
from biz_project_assign bpa3
|
||||
where bpa3.project_id = p.project_id
|
||||
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,
|
||||
(select coalesce(sum(bpa4.amount), 0)
|
||||
from biz_project_assign bpa4
|
||||
where bpa4.project_id = p.project_id
|
||||
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
|
||||
from biz_project p
|
||||
join biz_project_assign a on a.project_id = p.project_id
|
||||
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
|
||||
<where>
|
||||
(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'))
|
||||
<if test="projectNo != null and projectNo != ''">and p.project_no like concat('%', #{projectNo}, '%')</if>
|
||||
<if test="projectName != null and projectName != ''">and p.project_name like concat('%', #{projectName}, '%')</if>
|
||||
<if test="startTime != null and startTime != ''">and p.start_time >= #{startTime}</if>
|
||||
@@ -149,7 +194,8 @@
|
||||
<if test="availableAmount != null">available_amount,</if>
|
||||
<if test="paidLaborAmount != null">paid_labor_amount,</if>
|
||||
<if test="paidMeetingAmount != null">paid_meeting_amount,</if>
|
||||
<if test="ratingScore != null">rating_score,</if>
|
||||
<if test="managerScore != null">manager_score,</if>
|
||||
<if test="sponsorScore != null">sponsor_score,</if>
|
||||
<if test="sponsorAdminUserName != null and sponsorAdminUserName != ''">sponsor_admin_user_name,</if>
|
||||
<if test="projectForm != null and projectForm != ''">project_form,</if>
|
||||
<if test="isFinished != null and isFinished != ''">is_finished,</if>
|
||||
@@ -182,7 +228,8 @@
|
||||
<if test="availableAmount != null">#{availableAmount},</if>
|
||||
<if test="paidLaborAmount != null">#{paidLaborAmount},</if>
|
||||
<if test="paidMeetingAmount != null">#{paidMeetingAmount},</if>
|
||||
<if test="ratingScore != null">#{ratingScore},</if>
|
||||
<if test="managerScore != null">#{managerScore},</if>
|
||||
<if test="sponsorScore != null">#{sponsorScore},</if>
|
||||
<if test="sponsorAdminUserName != null and sponsorAdminUserName != ''">#{sponsorAdminUserName},</if>
|
||||
<if test="projectForm != null and projectForm != ''">#{projectForm},</if>
|
||||
<if test="isFinished != null and isFinished != ''">#{isFinished},</if>
|
||||
@@ -226,7 +273,8 @@
|
||||
<if test="availableAmount != null">available_amount = #{availableAmount},</if>
|
||||
<if test="paidLaborAmount != null">paid_labor_amount = #{paidLaborAmount},</if>
|
||||
<if test="paidMeetingAmount != null">paid_meeting_amount = #{paidMeetingAmount},</if>
|
||||
<if test="ratingScore != null">rating_score = #{ratingScore},</if>
|
||||
<if test="managerScore != null">manager_score = #{managerScore},</if>
|
||||
<if test="sponsorScore != null">sponsor_score = #{sponsorScore},</if>
|
||||
<if test="sponsorAdminUserName != null and sponsorAdminUserName != ''">sponsor_admin_user_name = #{sponsorAdminUserName},</if>
|
||||
<if test="projectForm != null and projectForm != ''">project_form = #{projectForm},</if>
|
||||
<if test="isFinished != null and isFinished != ''">is_finished = #{isFinished},</if>
|
||||
|
||||
+13
-10
@@ -11,11 +11,13 @@
|
||||
<result property="responseScore" column="response_score" />
|
||||
<result property="cooperationScore" column="cooperation_score" />
|
||||
<result property="complianceScore" column="compliance_score" />
|
||||
<result property="totalScore" column="total_score" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="raterId" column="rater_id" />
|
||||
<result property="ratingTime" column="rating_time" />
|
||||
</resultMap>
|
||||
<sql id="selectFields">
|
||||
select rating_id, project_no, project_name, rater_name, rater_role, quality_score, response_score, cooperation_score, compliance_score, total_score, remark, 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
|
||||
from biz_project_rating
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" resultMap="BizProjectRatingResult" parameterType="String">
|
||||
@@ -25,6 +27,9 @@
|
||||
<select id="selectList" resultMap="BizProjectRatingResult" parameterType="BizProjectRating">
|
||||
<include refid="selectFields"/>
|
||||
<where>
|
||||
<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
|
||||
@@ -49,11 +54,10 @@
|
||||
<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 and qualityScore != ''">quality_score = #{qualityScore},</if>
|
||||
<if test="responseScore != null and responseScore != ''">response_score = #{responseScore},</if>
|
||||
<if test="cooperationScore != null and cooperationScore != ''">cooperation_score = #{cooperationScore},</if>
|
||||
<if test="complianceScore != null and complianceScore != ''">compliance_score = #{complianceScore},</if>
|
||||
<if test="totalScore != null and totalScore != ''">total_score = #{totalScore},</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>
|
||||
@@ -73,11 +77,11 @@
|
||||
<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, total_score,
|
||||
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}, #{totalScore},
|
||||
#{qualityScore}, #{responseScore}, #{cooperationScore}, #{complianceScore},
|
||||
#{remark}, #{createBy}, sysdate(), #{updateBy}, sysdate())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
project_no = VALUES(project_no),
|
||||
@@ -87,7 +91,6 @@
|
||||
response_score = VALUES(response_score),
|
||||
cooperation_score= VALUES(cooperation_score),
|
||||
compliance_score = VALUES(compliance_score),
|
||||
total_score = VALUES(total_score),
|
||||
remark = VALUES(remark),
|
||||
update_by = VALUES(update_by),
|
||||
update_time = sysdate()
|
||||
|
||||
Reference in New Issue
Block a user