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:
+13
@@ -11,6 +11,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.business.domain.BizOrg;
|
||||
import com.ruoyi.business.service.IBizOrgService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
||||
/**
|
||||
* 公司Controller (支持方 + 执行方 共用)
|
||||
@@ -62,6 +63,18 @@ public class BizOrgController extends BaseController {
|
||||
return success(bizOrgService.getById(orgId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前登录 sponsor 的所属公司 (供 /sponsor/account 页面回显)
|
||||
* 返回 { orgId, orgName, isOwner: 1|0 }
|
||||
* 主账号 isOwner=1 可改名, 子账号 isOwner=0 只读
|
||||
*/
|
||||
@GetMapping("/myCompany")
|
||||
public AjaxResult myCompany() {
|
||||
Long uid = SecurityUtils.getUserId();
|
||||
Map<String, Object> data = bizOrgService.selectMySponsorCompany(uid);
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@Log(title = "公司管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BizOrg bizOrg) {
|
||||
|
||||
+35
-2
@@ -83,6 +83,37 @@ public class BizProjectController extends BaseController
|
||||
List<BizProject> list = bizProjectService.selectList(bizProject);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* sponsor 专属项目列表 (按当前登录 sponsor 的 user_id 过滤)
|
||||
* GET /business/project/sponsorList
|
||||
* 注: biz_project.sponsor_admin_user_id 永远是主账号 user_id, 子账号登录也应能看主账号的项目 — 简化: 直接用当前 user_id 过滤
|
||||
* 若需要子账号看主账号项目, 改 SQL 改为 (sponsor_admin_user_id = uid OR sponsor_admin_user_id IN (parent_user_id=uid 的子账号所属主账号))
|
||||
*/
|
||||
@GetMapping("/sponsorList")
|
||||
public TableDataInfo sponsorList(BizProject bizProject)
|
||||
{
|
||||
bizProject.getParams().put("sponsorAdminUserId", SecurityUtils.getUserId());
|
||||
startPage();
|
||||
List<BizProject> list = bizProjectService.selectSponsorList(bizProject);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* executor 专属项目列表 (按当前 user_id + 其 executor biz_org.org_id 过滤 biz_project_assign)
|
||||
* GET /business/project/executorList
|
||||
* 匹配规则 (任一):
|
||||
* 1) biz_project_assign.exec_user_id = uid
|
||||
* 2) biz_project_assign.execution_unit_id = uid 对应的 executor biz_org.org_id
|
||||
*/
|
||||
@GetMapping("/executorList")
|
||||
public TableDataInfo executorList(BizProject bizProject)
|
||||
{
|
||||
bizProject.getParams().put("executorUserId", SecurityUtils.getUserId());
|
||||
startPage();
|
||||
List<BizProject> list = bizProjectService.selectExecutorList(bizProject);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@GetMapping("/{projectId}")
|
||||
public AjaxResult getInfo(@PathVariable("projectId") String projectId)
|
||||
{
|
||||
@@ -144,9 +175,11 @@ public class BizProjectController extends BaseController
|
||||
@PostMapping("/rate")
|
||||
public AjaxResult rate(@RequestBody BizProjectRating body)
|
||||
{
|
||||
if (body.getProjectId() == null || body.getRaterId() == null || body.getRaterRole() == null) {
|
||||
return error("projectId / raterId / raterRole 必填");
|
||||
if (body.getProjectId() == null || body.getRaterRole() == null) {
|
||||
return error("projectId / raterRole 必填");
|
||||
}
|
||||
// 评分人以当前登录用户为准, 不信任前端传入的 raterId
|
||||
body.setRaterId(SecurityUtils.getUserId());
|
||||
body.setCreateBy(SecurityUtils.getUsername());
|
||||
body.setUpdateBy(SecurityUtils.getUsername());
|
||||
int rows = bizProjectRatingService.upsertRating(body);
|
||||
|
||||
+4
-2
@@ -47,9 +47,11 @@ public class BizProjectRatingController extends BaseController
|
||||
@PostMapping("/rate")
|
||||
public AjaxResult rate(@RequestBody BizProjectRating body)
|
||||
{
|
||||
if (body.getProjectId() == null || body.getRaterId() == null || body.getRaterRole() == null) {
|
||||
return error("projectId / raterId / raterRole 必填");
|
||||
if (body.getProjectId() == null || body.getRaterRole() == null) {
|
||||
return error("projectId / raterRole 必填");
|
||||
}
|
||||
// 评分人以当前登录用户为准
|
||||
body.setRaterId(getUserId());
|
||||
body.setCreateBy(getUsername());
|
||||
body.setUpdateBy(getUsername());
|
||||
int rows = bizProjectRatingService.upsertRating(body);
|
||||
|
||||
+20
@@ -32,6 +32,26 @@ public class BizSpecialPlanController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 专项计划下拉选项 (供 manager/Plans 等页面填充 "项目方向" 下拉)
|
||||
* 返回 [{id, title}], 仅启用项 (status='0'), 按 sort_order 升序
|
||||
* 注: 不加 @PreAuthorize, 与 BizProjectController 一致 — manager 是业务角色, 不走 RuoYi RBAC 权限
|
||||
*/
|
||||
@GetMapping("/options")
|
||||
public AjaxResult options()
|
||||
{
|
||||
List<BizSpecialPlan> all = specialPlanService.selectList(new BizSpecialPlan());
|
||||
java.util.List<java.util.Map<String, Object>> opts = new java.util.ArrayList<>();
|
||||
for (BizSpecialPlan p : all) {
|
||||
if (p.getStatus() != null && !"0".equals(p.getStatus())) continue;
|
||||
java.util.Map<String, Object> m = new java.util.LinkedHashMap<>();
|
||||
m.put("id", p.getId());
|
||||
m.put("title", p.getTitle());
|
||||
opts.add(m);
|
||||
}
|
||||
return success(opts);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('business:specialPlan:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
|
||||
@@ -20,6 +20,10 @@ public class BizProject extends BaseEntity {
|
||||
/** total_sessions */
|
||||
@Excel(name = "total_sessions")
|
||||
private Long totalSessions;
|
||||
/** 分配给当前执行方的场次 (biz_project_assign.sessions 之和, 仅 executor 端使用) */
|
||||
private Long assignedSessions;
|
||||
/** 分配给当前执行方的金额 (biz_project_assign.amount 之和, 仅 executor 端使用) */
|
||||
private java.math.BigDecimal assignedAmount;
|
||||
/** done_sessions */
|
||||
@Excel(name = "done_sessions")
|
||||
private Long doneSessions;
|
||||
@@ -38,17 +42,12 @@ public class BizProject extends BaseEntity {
|
||||
/** paid_meeting_amount */
|
||||
@Excel(name = "paid_meeting_amount")
|
||||
private BigDecimal paidMeetingAmount;
|
||||
/** rating_score (平均分) */
|
||||
@Excel(name = "rating_score")
|
||||
private BigDecimal ratingScore;
|
||||
/** 评分维度: 履约质量 */
|
||||
private BigDecimal ratingQ1;
|
||||
/** 评分维度: 时效响应 */
|
||||
private BigDecimal ratingQ2;
|
||||
/** 评分维度: 配合度 */
|
||||
private BigDecimal ratingQ3;
|
||||
/** 评分维度: 合规安全 */
|
||||
private BigDecimal ratingQ4;
|
||||
/** manager_score (合规管理员评均分) */
|
||||
@Excel(name = "manager_score")
|
||||
private BigDecimal managerScore;
|
||||
/** sponsor_score (支持方评均分) */
|
||||
@Excel(name = "sponsor_score")
|
||||
private BigDecimal sponsorScore;
|
||||
/** 支持方负责人用户名(冗余) — 原 org_name */
|
||||
@Excel(name = "sponsor_admin_user_name")
|
||||
private String sponsorAdminUserName;
|
||||
@@ -138,6 +137,10 @@ public class BizProject extends BaseEntity {
|
||||
public void setProjectName(String projectName) { this.projectName = projectName; }
|
||||
public Long getTotalSessions() { return totalSessions; }
|
||||
public void setTotalSessions(Long totalSessions) { this.totalSessions = totalSessions; }
|
||||
public Long getAssignedSessions() { return assignedSessions; }
|
||||
public void setAssignedSessions(Long assignedSessions) { this.assignedSessions = assignedSessions; }
|
||||
public java.math.BigDecimal getAssignedAmount() { return assignedAmount; }
|
||||
public void setAssignedAmount(java.math.BigDecimal assignedAmount) { this.assignedAmount = assignedAmount; }
|
||||
public Long getDoneSessions() { return doneSessions; }
|
||||
public void setDoneSessions(Long doneSessions) { this.doneSessions = doneSessions; }
|
||||
public Long getTodoSessions() { return todoSessions; }
|
||||
@@ -150,16 +153,10 @@ public class BizProject extends BaseEntity {
|
||||
public void setPaidLaborAmount(BigDecimal paidLaborAmount) { this.paidLaborAmount = paidLaborAmount; }
|
||||
public BigDecimal getPaidMeetingAmount() { return paidMeetingAmount; }
|
||||
public void setPaidMeetingAmount(BigDecimal paidMeetingAmount) { this.paidMeetingAmount = paidMeetingAmount; }
|
||||
public BigDecimal getRatingScore() { return ratingScore; }
|
||||
public void setRatingScore(BigDecimal ratingScore) { this.ratingScore = ratingScore; }
|
||||
public BigDecimal getRatingQ1() { return ratingQ1; }
|
||||
public void setRatingQ1(BigDecimal ratingQ1) { this.ratingQ1 = ratingQ1; }
|
||||
public BigDecimal getRatingQ2() { return ratingQ2; }
|
||||
public void setRatingQ2(BigDecimal ratingQ2) { this.ratingQ2 = ratingQ2; }
|
||||
public BigDecimal getRatingQ3() { return ratingQ3; }
|
||||
public void setRatingQ3(BigDecimal ratingQ3) { this.ratingQ3 = ratingQ3; }
|
||||
public BigDecimal getRatingQ4() { return ratingQ4; }
|
||||
public void setRatingQ4(BigDecimal ratingQ4) { this.ratingQ4 = ratingQ4; }
|
||||
public BigDecimal getManagerScore() { return managerScore; }
|
||||
public void setManagerScore(BigDecimal managerScore) { this.managerScore = managerScore; }
|
||||
public BigDecimal getSponsorScore() { return sponsorScore; }
|
||||
public void setSponsorScore(BigDecimal sponsorScore) { this.sponsorScore = sponsorScore; }
|
||||
public String getSponsorAdminUserName() { return sponsorAdminUserName; }
|
||||
public void setSponsorAdminUserName(String sponsorAdminUserName) { this.sponsorAdminUserName = sponsorAdminUserName; }
|
||||
public String getSponsorOrgName() { return sponsorOrgName; }
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BizProjectRating extends BaseEntity {
|
||||
private String raterRole;
|
||||
/** quality_score */
|
||||
@Excel(name = "quality_score")
|
||||
private String qualityScore;
|
||||
private Long qualityScore;
|
||||
/** response_score */
|
||||
@Excel(name = "response_score")
|
||||
private Long responseScore;
|
||||
@@ -35,9 +35,6 @@ public class BizProjectRating extends BaseEntity {
|
||||
/** compliance_score */
|
||||
@Excel(name = "compliance_score")
|
||||
private Long complianceScore;
|
||||
/** total_score */
|
||||
@Excel(name = "total_score")
|
||||
private BigDecimal totalScore;
|
||||
/** remark */
|
||||
@Excel(name = "remark")
|
||||
private String remark;
|
||||
@@ -71,16 +68,14 @@ public class BizProjectRating extends BaseEntity {
|
||||
public void setRaterName(String raterName) { this.raterName = raterName; }
|
||||
public String getRaterRole() { return raterRole; }
|
||||
public void setRaterRole(String raterRole) { this.raterRole = raterRole; }
|
||||
public String getQualityScore() { return qualityScore; }
|
||||
public void setQualityScore(String qualityScore) { this.qualityScore = qualityScore; }
|
||||
public Long getQualityScore() { return qualityScore; }
|
||||
public void setQualityScore(Long qualityScore) { this.qualityScore = qualityScore; }
|
||||
public Long getResponseScore() { return responseScore; }
|
||||
public void setResponseScore(Long responseScore) { this.responseScore = responseScore; }
|
||||
public Long getCooperationScore() { return cooperationScore; }
|
||||
public void setCooperationScore(Long cooperationScore) { this.cooperationScore = cooperationScore; }
|
||||
public Long getComplianceScore() { return complianceScore; }
|
||||
public void setComplianceScore(Long complianceScore) { this.complianceScore = complianceScore; }
|
||||
public BigDecimal getTotalScore() { return totalScore; }
|
||||
public void setTotalScore(BigDecimal totalScore) { this.totalScore = totalScore; }
|
||||
public String getRemark() { return remark; }
|
||||
public void setRemark(String remark) { this.remark = remark; }
|
||||
public String getCreateBy() { return createBy; }
|
||||
|
||||
@@ -18,4 +18,10 @@ public interface BizOrgMapper {
|
||||
* 注意: value 必须 MAIN user_id (写入 biz_project_assign.exec_user_id);
|
||||
* label 必须 org_name, 不用 user_name 以避免把同公司的普通员工带出来 */
|
||||
List<Map<String, Object>> selectExecutorOrgOptions(BizOrg entity);
|
||||
/** 当前登录 sponsor 的所属公司
|
||||
* 主账号 (sys_user.parent_user_id IS NULL): biz_org.user_id = #{userId}
|
||||
* 子账号 (有 biz_person 记录): biz_org.org_id = biz_person.org_id
|
||||
* 返回 Map: orgId / orgName / isOwner (1=主账号, 0=子账号)
|
||||
* 用于 /sponsor/account 页面回显 + 主账号修改 org_name */
|
||||
Map<String, Object> selectMySponsorCompany(Long userId);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ public interface BizProjectMapper
|
||||
List<BizProject> selectList(BizProject entity);
|
||||
/** sponsor 端专属: projectIds + LEFT JOIN 当前 login 用户评分, 用于评分回显 */
|
||||
List<BizProject> selectSponsorList(BizProject entity);
|
||||
/** executor 端专属: JOIN biz_project_assign 过滤, 只返回分给当前 user 的项目 */
|
||||
List<BizProject> selectExecutorList(BizProject entity);
|
||||
int insert(BizProject entity);
|
||||
int updateByPrimaryKey(BizProject entity);
|
||||
int deleteByPrimaryKey(String projectId);
|
||||
|
||||
@@ -15,4 +15,6 @@ public interface IBizOrgService {
|
||||
/** 执行方下拉选项 (userId/orgName/userName), 用于 manager 项目分配弹窗
|
||||
* 只返回 biz_org.org_type='executor' 对应的 MAIN 账号 (parent_user_id IS NULL) */
|
||||
List<Map<String, Object>> selectExecutorOrgOptions(BizOrg entity);
|
||||
/** 当前登录 sponsor 的所属公司 (主账号可改, 子账号只读) */
|
||||
Map<String, Object> selectMySponsorCompany(Long userId);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ public interface IBizProjectService
|
||||
List<BizProject> selectList(BizProject entity);
|
||||
/** sponsor 端专属: LEFT JOIN 当前 login 用户评分回显 */
|
||||
List<BizProject> selectSponsorList(BizProject entity);
|
||||
/** executor 端专属: JOIN biz_project_assign 过滤, 只返回分给当前 user 的项目 */
|
||||
List<BizProject> selectExecutorList(BizProject entity);
|
||||
int insert(BizProject entity);
|
||||
int updateByPrimaryKey(BizProject entity);
|
||||
int deleteByPrimaryKey(String projectId);
|
||||
|
||||
+5
@@ -45,4 +45,9 @@ public class BizOrgServiceImpl implements IBizOrgService {
|
||||
public List<Map<String, Object>> selectExecutorOrgOptions(BizOrg entity) {
|
||||
return bizOrgMapper.selectExecutorOrgOptions(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> selectMySponsorCompany(Long userId) {
|
||||
return bizOrgMapper.selectMySponsorCompany(userId);
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -23,6 +23,9 @@ public class BizProjectServiceImpl implements IBizProjectService
|
||||
public List<BizProject> selectSponsorList(BizProject entity)
|
||||
{ return bizProjectMapper.selectSponsorList(entity); }
|
||||
@Override
|
||||
public List<BizProject> selectExecutorList(BizProject entity)
|
||||
{ return bizProjectMapper.selectExecutorList(entity); }
|
||||
@Override
|
||||
public int insert(BizProject entity) { com.ruoyi.common.utils.id.SnowflakeId.injectIfEmpty(entity, "projectId"); return bizProjectMapper.insert(entity); }
|
||||
@Override
|
||||
public int updateByPrimaryKey(BizProject entity)
|
||||
|
||||
@@ -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