fix(aihr): scope candidate materials to tenant
This commit is contained in:
+11
-5
@@ -1,6 +1,7 @@
|
||||
package org.dromara.aihr.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
@@ -48,7 +49,7 @@ public class AihrCandidateMaterialService {
|
||||
(tenant_id, candidate_id, candidate_name, material_type, file_name, file_size, content_type, oss_id, status, create_time, update_time)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, now(), now())
|
||||
""", Statement.RETURN_GENERATED_KEYS);
|
||||
ps.setString(1, TENANT_ID);
|
||||
ps.setString(1, tenantId());
|
||||
ps.setString(2, boundCandidateId);
|
||||
ps.setString(3, clean(candidateName, "候选人"));
|
||||
ps.setString(4, type);
|
||||
@@ -80,7 +81,7 @@ public class AihrCandidateMaterialService {
|
||||
rs.getLong("file_size"),
|
||||
rs.getString("status"),
|
||||
rs.getTimestamp("create_time").toLocalDateTime().format(TIME_FORMAT)
|
||||
), TENANT_ID, boundCandidateId);
|
||||
), tenantId(), boundCandidateId);
|
||||
}
|
||||
|
||||
public List<MaterialReviewResponse> reviewList(String status) {
|
||||
@@ -102,7 +103,7 @@ public class AihrCandidateMaterialService {
|
||||
rs.getLong("file_size"),
|
||||
rs.getString("status"),
|
||||
rs.getTimestamp("create_time").toLocalDateTime()
|
||||
), TENANT_ID, normalizedStatus, normalizedStatus);
|
||||
), tenantId(), normalizedStatus, normalizedStatus);
|
||||
}
|
||||
|
||||
public MaterialReviewResponse review(Long id, ReviewRequest request) {
|
||||
@@ -112,7 +113,7 @@ public class AihrCandidateMaterialService {
|
||||
update aihr_candidate_material
|
||||
set status = ?, update_time = now()
|
||||
where tenant_id = ? and id = ?
|
||||
""", status, TENANT_ID, id);
|
||||
""", status, tenantId(), id);
|
||||
if (updated == 0) {
|
||||
throw new IllegalArgumentException("候选资料不存在");
|
||||
}
|
||||
@@ -166,7 +167,12 @@ public class AihrCandidateMaterialService {
|
||||
rs.getLong("file_size"),
|
||||
rs.getString("status"),
|
||||
rs.getTimestamp("create_time").toLocalDateTime()
|
||||
), TENANT_ID, id);
|
||||
), tenantId(), id);
|
||||
}
|
||||
|
||||
private String tenantId() {
|
||||
String tenantId = LoginHelper.getTenantId();
|
||||
return clean(tenantId, TENANT_ID);
|
||||
}
|
||||
|
||||
private static MaterialReviewResponse reviewRow(Long id, String candidateId, String candidateName, Long ossId,
|
||||
|
||||
Reference in New Issue
Block a user