仓储动态表单;
This commit is contained in:
+2
-2
@@ -25,14 +25,14 @@ public interface ISysTableConfigService extends IService<SysTableConfig> {
|
||||
* @param key 配置键
|
||||
* @return 配置信息
|
||||
*/
|
||||
SysTableConfig getByOrgIdAndKey(Long organizationId, String key);
|
||||
SysTableConfig getByOrgIdAndKey(Long organizationId, String key,Long warehouseId);
|
||||
|
||||
/**
|
||||
* 根据组织 ID 查询所有配置
|
||||
* @param organizationId 组织 ID
|
||||
* @return 配置列表
|
||||
*/
|
||||
List<SysTableConfig> listByOrgId(Long organizationId);
|
||||
List<SysTableConfig> listByOrgId(Long organizationId,Long warehouseId);
|
||||
|
||||
/**
|
||||
* 保存或更新配置(根据组织 ID 和键判断是新增还是更新)
|
||||
|
||||
+5
-5
@@ -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}")
|
||||
SysTableConfig getByOrgIdAndKey(@Param("organizationId") Long organizationId, @Param("key") String key);
|
||||
@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);
|
||||
|
||||
/**
|
||||
* 根据组织 ID 查询所有配置
|
||||
* @param organizationId 组织 ID
|
||||
* @return 配置列表
|
||||
*/
|
||||
@Select("SELECT * FROM sys_table_config WHERE organization_id = #{organizationId} ORDER BY create_time DESC")
|
||||
List<SysTableConfig> listByOrgId(@Param("organizationId") Long organizationId);
|
||||
@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);
|
||||
|
||||
/**
|
||||
* 分页查询配置列表
|
||||
@@ -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("key") String key, @Param("warehouseId") Long warehouseId);
|
||||
}
|
||||
+15
-6
@@ -41,24 +41,30 @@ public class SysTableConfigServiceImpl extends ServiceImpl<SysTableConfigMapper,
|
||||
|
||||
List<SysTableConfigVO> list = sysTableConfigMapper.queryList(page,
|
||||
sysTableConfigDTO.getOrganizationId() != null ? sysTableConfigDTO.getOrganizationId().longValue() : null,
|
||||
sysTableConfigDTO.getKey());
|
||||
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId());
|
||||
return page.setRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysTableConfig getByOrgIdAndKey(Long organizationId, String key) {
|
||||
public SysTableConfig getByOrgIdAndKey(Long organizationId, String key,Long warehouseId) {
|
||||
if (organizationId == null || StringUtils.isBlank(key)) {
|
||||
throw new ServiceException("组织 ID 和键不能为空");
|
||||
}
|
||||
return sysTableConfigMapper.getByOrgIdAndKey(organizationId, key);
|
||||
if (warehouseId == null) {
|
||||
throw new ServiceException("仓库 ID 不能为空");
|
||||
}
|
||||
return sysTableConfigMapper.getByOrgIdAndKey(organizationId, key,warehouseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysTableConfig> listByOrgId(Long organizationId) {
|
||||
public List<SysTableConfig> listByOrgId(Long organizationId, Long warehouseId) {
|
||||
if (organizationId == null) {
|
||||
throw new ServiceException("组织 ID 不能为空");
|
||||
}
|
||||
return sysTableConfigMapper.listByOrgId(organizationId);
|
||||
if (warehouseId == null) {
|
||||
throw new ServiceException("仓库 ID 不能为空");
|
||||
}
|
||||
return sysTableConfigMapper.listByOrgId(organizationId, warehouseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,6 +79,9 @@ public class SysTableConfigServiceImpl extends ServiceImpl<SysTableConfigMapper,
|
||||
if (StringUtils.isBlank(sysTableConfigDTO.getValue())) {
|
||||
throw new ServiceException("配置值不能为空");
|
||||
}
|
||||
if (sysTableConfigDTO.getWarehouseId() == null) {
|
||||
throw new ServiceException("仓库 ID 不能为空");
|
||||
}
|
||||
|
||||
// 获取登录人信息
|
||||
WlhyLoginUser loginUser = SecurityUtils.getLoginUser().getWlhyLoginUser();
|
||||
@@ -81,7 +90,7 @@ public class SysTableConfigServiceImpl extends ServiceImpl<SysTableConfigMapper,
|
||||
// 判断是新增还是更新
|
||||
SysTableConfig existingConfig = sysTableConfigMapper.getByOrgIdAndKey(
|
||||
sysTableConfigDTO.getOrganizationId().longValue(),
|
||||
sysTableConfigDTO.getKey());
|
||||
sysTableConfigDTO.getKey(), sysTableConfigDTO.getWarehouseId());
|
||||
|
||||
if (existingConfig != null) {
|
||||
// 更新
|
||||
|
||||
+5
-3
@@ -70,9 +70,10 @@ 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="key") String key) {
|
||||
try {
|
||||
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key);
|
||||
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key, warehouseId);
|
||||
if (config == null) {
|
||||
return Result.error("未找到对应配置");
|
||||
}
|
||||
@@ -91,9 +92,10 @@ public class SysTableConfigApi extends BaseController {
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 根据组织 ID 查询所有配置", notes = "系统表配置 - 根据组织 ID 查询所有配置")
|
||||
@GetMapping(value = "/listByOrgId")
|
||||
public Result<?> listByOrgId(@RequestParam(name="organizationId") Long organizationId) {
|
||||
public Result<?> listByOrgId(@RequestParam(name="organizationId") Long organizationId,
|
||||
@RequestParam(name="warehouseId") Long warehouseId) {
|
||||
try {
|
||||
List<SysTableConfig> list = sysTableConfigService.listByOrgId(organizationId);
|
||||
List<SysTableConfig> list = sysTableConfigService.listByOrgId(organizationId, warehouseId);
|
||||
return Result.ok(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
<if test="organizationId != null">
|
||||
AND a.organization_id = #{organizationId}
|
||||
</if>
|
||||
<if test="warehouseId != null">
|
||||
AND a.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="key != null and key != ''">
|
||||
AND a.key LIKE CONCAT('%', #{key}, '%')
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user