refactor(inspection): 优化质检员转办逻辑实现
- 使用 getById 替代复杂查询条件简化代码 - 移除冗余的检查条件提高性能 - 更新数据库关联关系确保数据一致性 - 调整实体类注释描述以匹配实际用途
This commit is contained in:
parent
b400f0a1a7
commit
261f2ee257
|
|
@ -164,12 +164,7 @@ public class IncomingInspectionTaskControllerService {
|
||||||
User inspectorUser;
|
User inspectorUser;
|
||||||
if (Objects.nonNull(inspector.getChangeUserId())) {
|
if (Objects.nonNull(inspector.getChangeUserId())) {
|
||||||
// 转办人是 user.id,需查询对应的 qms_quality_inspector 记录
|
// 转办人是 user.id,需查询对应的 qms_quality_inspector 记录
|
||||||
QmsQualityInspector agentInspector = qualityInspectorService.lambdaQuery()
|
QmsQualityInspector agentInspector = qualityInspectorService.getById(inspector.getChangeUserId());
|
||||||
.eq(QmsQualityInspector::getUserId, inspector.getChangeUserId())
|
|
||||||
.eq(QmsQualityInspector::getInspectionType, 1)
|
|
||||||
.eq(QmsQualityInspector::getEnable, true)
|
|
||||||
.last("LIMIT 1")
|
|
||||||
.one();
|
|
||||||
if (Objects.nonNull(agentInspector)) {
|
if (Objects.nonNull(agentInspector)) {
|
||||||
inspectorId = agentInspector.getId();
|
inspectorId = agentInspector.getId();
|
||||||
inspectorUser = userService.getById(agentInspector.getUserId());
|
inspectorUser = userService.getById(agentInspector.getUserId());
|
||||||
|
|
@ -313,12 +308,7 @@ public class IncomingInspectionTaskControllerService {
|
||||||
String inspectorName;
|
String inspectorName;
|
||||||
User inspectorUser;
|
User inspectorUser;
|
||||||
if (Objects.nonNull(inspector.getChangeUserId())) {
|
if (Objects.nonNull(inspector.getChangeUserId())) {
|
||||||
QmsQualityInspector agentInspector = qualityInspectorService.lambdaQuery()
|
QmsQualityInspector agentInspector = qualityInspectorService.getById(inspector.getChangeUserId());
|
||||||
.eq(QmsQualityInspector::getUserId, inspector.getChangeUserId())
|
|
||||||
.eq(QmsQualityInspector::getInspectionType, 1)
|
|
||||||
.eq(QmsQualityInspector::getEnable, true)
|
|
||||||
.last("LIMIT 1")
|
|
||||||
.one();
|
|
||||||
if (Objects.nonNull(agentInspector)) {
|
if (Objects.nonNull(agentInspector)) {
|
||||||
inspectorId = agentInspector.getId();
|
inspectorId = agentInspector.getId();
|
||||||
inspectorUser = userService.getById(agentInspector.getUserId());
|
inspectorUser = userService.getById(agentInspector.getUserId());
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class QmsQualityInspector implements Serializable {
|
||||||
private Integer inspectionType;
|
private Integer inspectionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转办人ID (user.id),可为空
|
* 转办人ID可为空
|
||||||
*/
|
*/
|
||||||
private Long changeUserId;
|
private Long changeUserId;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@
|
||||||
LEFT JOIN "user" u ON u.id = qi.user_id
|
LEFT JOIN "user" u ON u.id = qi.user_id
|
||||||
LEFT JOIN user_interior ui ON ui.user_id = qi.user_id
|
LEFT JOIN user_interior ui ON ui.user_id = qi.user_id
|
||||||
LEFT JOIN department d ON d.id = ui.dept_id
|
LEFT JOIN department d ON d.id = ui.dept_id
|
||||||
LEFT JOIN "user" cu ON cu.id = qi.change_user_id
|
LEFT JOIN qms_quality_inspector cqi ON cqi.id = qi.change_user_id
|
||||||
|
LEFT JOIN "user" cu ON cu.id = cqi.user_id
|
||||||
<where>
|
<where>
|
||||||
<if test="request.userCode != null and request.userCode != ''">
|
<if test="request.userCode != null and request.userCode != ''">
|
||||||
AND u.user_code = #{request.userCode}
|
AND u.user_code = #{request.userCode}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue