Merge remote-tracking branch 'origin/dev_WMS20260401' into dev_WMS20260401

This commit is contained in:
秦鸿展
2026-05-08 10:00:27 +08:00
5 changed files with 24 additions and 19 deletions
@@ -25,14 +25,14 @@ public interface ISysTableConfigService extends IService<SysTableConfig> {
* @param key 配置键
* @return 配置信息
*/
SysTableConfig getByOrgIdAndKey(Long organizationId, String key,Long warehouseId);
SysTableConfig getByOrgIdAndKey(Long organizationId, String key,Long warehouseId,Long shipperId);
/**
* 根据组织 ID 查询所有配置
* @param organizationId 组织 ID
* @return 配置列表
*/
List<SysTableConfig> listByOrgId(Long organizationId,Long warehouseId);
List<SysTableConfig> listByOrgId(Long organizationId,Long warehouseId,Long shipperId);
/**
* 保存或更新配置(根据组织 ID 和键判断是新增还是更新)
@@ -23,16 +23,16 @@ public interface SysTableConfigMapper extends BaseMapper<SysTableConfig> {
* @param key 配置键
* @return 配置信息
*/
@Select("SELECT * FROM sys_table_config WHERE organization_id = #{organizationId} AND key = #{key} and warehouse_id = #{warehouseId}")
SysTableConfig getByOrgIdAndKey(@Param("organizationId") Long organizationId, @Param("key") String key, @Param("warehouseId") Long warehouseId);
@Select("SELECT * FROM sys_table_config WHERE organization_id = #{organizationId} AND key = #{key} and warehouse_id = #{warehouseId} and shipper_id = #{shipperId}")
SysTableConfig getByOrgIdAndKey(@Param("organizationId") Long organizationId, @Param("key") String key, @Param("warehouseId") Long warehouseId, @Param("shipperId") Long shipperId);
/**
* 根据组织 ID 查询所有配置
* @param organizationId 组织 ID
* @return 配置列表
*/
@Select("SELECT * FROM sys_table_config WHERE organization_id = #{organizationId} and warehouse_id = #{warehouseId} ORDER BY create_time DESC")
List<SysTableConfig> listByOrgId(@Param("organizationId") Long organizationId, @Param("warehouseId") Long warehouseId);
@Select("SELECT * FROM sys_table_config WHERE organization_id = #{organizationId} and warehouse_id = #{warehouseId} and shipper_id = #{shipperId} ORDER BY create_time DESC")
List<SysTableConfig> listByOrgId(@Param("organizationId") Long organizationId, @Param("warehouseId") Long warehouseId, @Param("shipperId") Long shipperId);
/**
* 分页查询配置列表
@@ -43,5 +43,5 @@ public interface SysTableConfigMapper extends BaseMapper<SysTableConfig> {
*/
List<SysTableConfigVO> queryList(Page<SysTableConfigVO> page,
@Param("organizationId") Long organizationId,
@Param("key") String key, @Param("warehouseId") Long warehouseId);
@Param("key") String key, @Param("warehouseId") Long warehouseId, @Param("shipperId") Long shipperId);
}
@@ -41,30 +41,30 @@ public class SysTableConfigServiceImpl extends ServiceImpl<SysTableConfigMapper,
List<SysTableConfigVO> list = sysTableConfigMapper.queryList(page,
sysTableConfigDTO.getOrganizationId() != null ? sysTableConfigDTO.getOrganizationId().longValue() : null,
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId());
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId(), sysTableConfigDTO.getShipperId());
return page.setRecords(list);
}
@Override
public SysTableConfig getByOrgIdAndKey(Long organizationId, String key,Long warehouseId) {
public SysTableConfig getByOrgIdAndKey(Long organizationId, String key, Long warehouseId, Long shipperId) {
if (organizationId == null || StringUtils.isBlank(key)) {
throw new ServiceException("组织 ID 和键不能为空");
}
if (warehouseId == null) {
throw new ServiceException("仓库 ID 不能为空");
if (warehouseId == null && shipperId == null) {
throw new ServiceException("仓库或客户 ID 不能为空");
}
return sysTableConfigMapper.getByOrgIdAndKey(organizationId, key,warehouseId);
return sysTableConfigMapper.getByOrgIdAndKey(organizationId, key, warehouseId, shipperId);
}
@Override
public List<SysTableConfig> listByOrgId(Long organizationId, Long warehouseId) {
public List<SysTableConfig> listByOrgId(Long organizationId, Long warehouseId, Long shipperId) {
if (organizationId == null) {
throw new ServiceException("组织 ID 不能为空");
}
if (warehouseId == null) {
throw new ServiceException("仓库 ID 不能为空");
}
return sysTableConfigMapper.listByOrgId(organizationId, warehouseId);
return sysTableConfigMapper.listByOrgId(organizationId, warehouseId, shipperId);
}
@Override
@@ -90,7 +90,7 @@ public class SysTableConfigServiceImpl extends ServiceImpl<SysTableConfigMapper,
// 判断是新增还是更新
SysTableConfig existingConfig = sysTableConfigMapper.getByOrgIdAndKey(
sysTableConfigDTO.getOrganizationId().longValue(),
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId());
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId(), sysTableConfigDTO.getShipperId());
if (existingConfig != null) {
// 更新
@@ -62,10 +62,11 @@ public class SysTableConfigApi extends BaseController {
@ApiOperation(value = "系统表配置 - 根据组织 ID 和键查询", notes = "系统表配置 - 根据组织 ID 和键查询")
@GetMapping(value = "/getByOrgIdAndKey")
public Result<?> getByOrgIdAndKey(@RequestParam(name="organizationId") Long organizationId,
@RequestParam(name="warehouseId") Long warehouseId,
@RequestParam(name="warehouseId", required=false) Long warehouseId,
@RequestParam(name="shipperId", required=false) Long shipperId,
@RequestParam(name="key") String key) {
try {
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key, warehouseId);
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key, warehouseId,shipperId);
if (config == null) {
return Result.ok("未找到对应配置");
}
@@ -85,9 +86,10 @@ public class SysTableConfigApi extends BaseController {
@ApiOperation(value = "系统表配置 - 根据组织 ID 查询所有配置", notes = "系统表配置 - 根据组织 ID 查询所有配置")
@GetMapping(value = "/listByOrgId")
public Result<?> listByOrgId(@RequestParam(name="organizationId") Long organizationId,
@RequestParam(name="warehouseId") Long warehouseId) {
@RequestParam(name="warehouseId", required=false) Long warehouseId,
@RequestParam(name="shipperId", required=false) Long shipperId) {
try {
List<SysTableConfig> list = sysTableConfigService.listByOrgId(organizationId, warehouseId);
List<SysTableConfig> list = sysTableConfigService.listByOrgId(organizationId, warehouseId, shipperId);
return Result.ok(list);
} catch (Exception e) {
log.error(e.getMessage(), e);
@@ -28,6 +28,9 @@
<if test="warehouseId != null">
AND a.warehouse_id = #{warehouseId}
</if>
<if test="shipperId != null">
AND a.shipper_id = #{shipperId}
</if>
<if test="key != null and key != ''">
AND a.key LIKE CONCAT('%', #{key}, '%')
</if>