日常BUG任务修改调整

This commit is contained in:
秦鸿展
2026-02-10 11:20:59 +08:00
parent f260b73b80
commit fcb997d4ca
8 changed files with 150 additions and 22 deletions
@@ -117,4 +117,15 @@ public class AssociationWarehouseApplicationService {
public AssociationWarehouseCacheDO getWarehouseInfo(Long correlationId) {
return associationWarehouseDomainService.getWarehouseInfo(correlationId);
}
/**
* @description 直接从数据库查询关联仓库列表根据关联id(不使用缓存)
* @author ZhouGY
* @date 2024/6/11 15:34
* @param correlationId
* @return AssociationWarehouseCacheDO
*/
public AssociationWarehouseCacheDO getWarehouseInfoFromDb(Long correlationId) {
return associationWarehouseDomainService.getWarehouseInfoFromDb(correlationId);
}
}
@@ -146,4 +146,37 @@ public class AssociationWarehouseDomainService {
return associationWarehouseCacheDO;
}
/**
* @description 直接从数据库查询关联仓库列表根据关联id(不使用缓存)
* @author ZhouGY
* @date 2024/6/11 15:34
* @param correlationId
* @return AssociationWarehouseCacheDO
*/
public AssociationWarehouseCacheDO getWarehouseInfoFromDb(Long correlationId) {
LoginUser loginUser = SecurityUtils.getLoginUser();
// 直接从数据库查询,不使用缓存
AssociationWarehouse associationWarehouse = associationWarehouseService.getOne(new QueryWrapper<AssociationWarehouse>().lambda()
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
.eq(AssociationWarehouse::getIsDefault, 2)
.eq(AssociationWarehouse::getDelFlag, 1));
AssociationWarehouseCacheDO associationWarehouseCacheDO = null;
if (ObjectUtil.isNotNull(associationWarehouse)){
associationWarehouseCacheDO = new AssociationWarehouseCacheDO();
BeanUtils.copyProperties(associationWarehouse, associationWarehouseCacheDO);
}else {
//首次 没有查到默认取第一条数据
List<AssociationWarehouse> associationWarehouseList = associationWarehouseService.list(new QueryWrapper<AssociationWarehouse>().lambda()
.eq(AssociationWarehouse::getCorrelationId, loginUser.getUserid())
.orderByAsc(AssociationWarehouse::getAssociationWarehouseId));
if (CollectionUtils.isEmpty(associationWarehouseList)){
return null; // 返回null,不抛异常,允许查询所有仓库
}
AssociationWarehouse associationWarehouseAsc = associationWarehouseList.get(0);
associationWarehouseCacheDO = new AssociationWarehouseCacheDO();
BeanUtils.copyProperties(associationWarehouseAsc, associationWarehouseCacheDO);
}
return associationWarehouseCacheDO;
}
}
@@ -134,4 +134,14 @@ public class AssociationWarehouseApi extends BaseController{
return AjaxResult.success(associationWarehouseCacheDO);
}
/**
* 直接从数据库获取指定用户设置的仓库(不使用缓存)
*/
@ApiOperation("直接从数据库获取指定用户设置的仓库(不使用缓存)")
@GetMapping("/getWarehouseInfoFromDb/{correlationId}")
public AjaxResult getWarehouseInfoFromDb(@PathVariable("correlationId") Long correlationId) {
AssociationWarehouseCacheDO associationWarehouseCacheDO = associationWarehouseApplicationService.getWarehouseInfoFromDb(correlationId);
return AjaxResult.success(associationWarehouseCacheDO);
}
}