oms配置表添加shipperid;

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