fix(oa): 解决项目客户ID更新与查询问题
- 添加客户ID字段更新策略,允许设置为null - 增加客户ID作为项目查询的筛选条件- 处理客户ID为0时的特殊逻辑,自动转换为null- 优化项目列表查询,支持按客户ID过滤
This commit is contained in:
@@ -162,6 +162,7 @@ public class SysOaProject extends BaseEntity {
|
|||||||
private Integer postponeCount;
|
private Integer postponeCount;
|
||||||
|
|
||||||
//客户id
|
//客户id
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,6 +190,8 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
|
|||||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||||
SysOaProject::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
SysOaProject::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||||
lqw.orderByDesc(SysOaProject::getCreateTime);
|
lqw.orderByDesc(SysOaProject::getCreateTime);
|
||||||
|
//客户id作为筛选条件
|
||||||
|
lqw.eq(bo.getCustomerId() != null, SysOaProject::getCustomerId, bo.getCustomerId());
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +222,14 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
|
|||||||
// 只有当前缀在上面列表里,才真正去生成新编号
|
// 只有当前缀在上面列表里,才真正去生成新编号
|
||||||
bo.setProjectCode(codeGeneratorService.nextCode(prefix));
|
bo.setProjectCode(codeGeneratorService.nextCode(prefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
SysOaProject update = BeanUtil.toBean(bo, SysOaProject.class);
|
SysOaProject update = BeanUtil.toBean(bo, SysOaProject.class);
|
||||||
|
|
||||||
|
// 当 customerId 为 0 时,设置为 null
|
||||||
|
if (bo.getCustomerId() == 0) {
|
||||||
|
update.setCustomerId(null);
|
||||||
|
}
|
||||||
|
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user