仓储动态表单;
This commit is contained in:
+204
@@ -0,0 +1,204 @@
|
||||
package com.mhd.wms.interfaces.facadeApi.sysTableConfig;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mhd.common.core.utils.sms.Result;
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.wms.application.service.stockShelfOrder.StockShelfOrderApplicationService;
|
||||
import com.mhd.wms.domain.stockShelfOrder.repository.po.StockShelfOrderPO;
|
||||
import com.mhd.wms.domain.stockShelfOrder.repository.todo.StockShelfOrderDO;
|
||||
import com.mhd.wms.domain.sysTableConfig.entity.SysTableConfig;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.facade.ISysTableConfigService;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.todo.SysTableConfigDTO;
|
||||
import com.mhd.wms.domain.sysTableConfig.repository.vo.SysTableConfigVO;
|
||||
import com.mhd.wms.interfaces.assember.stockShelfOrder.StockShelfOrderAssembler;
|
||||
import com.mhd.wms.interfaces.dto.stockShelfOrder.StockShelfOrderDTO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysTableConfigApi")
|
||||
@Slf4j
|
||||
public class SysTableConfigApi extends BaseController {
|
||||
@Autowired
|
||||
private ISysTableConfigService sysTableConfigService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysTableConfigDTO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 分页列表查询", notes = "系统表配置 - 分页列表查询")
|
||||
@GetMapping(value = "/queryList")
|
||||
public Result<?> queryList(SysTableConfigDTO sysTableConfigDTO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysTableConfigVO>> result = new Result<>();
|
||||
Page<SysTableConfigVO> pageList = new Page<>(pageNo, pageSize);
|
||||
pageList = sysTableConfigService.queryList(pageList, sysTableConfigDTO);
|
||||
result.setResult(pageList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织 ID 和键查询配置
|
||||
*
|
||||
* @param organizationId 组织 ID
|
||||
* @param key 配置键
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 根据组织 ID 和键查询", notes = "系统表配置 - 根据组织 ID 和键查询")
|
||||
@GetMapping(value = "/getByOrgIdAndKey")
|
||||
public Result<?> getByOrgIdAndKey(@RequestParam(name="organizationId") Long organizationId,
|
||||
@RequestParam(name="key") String key) {
|
||||
try {
|
||||
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key);
|
||||
if (config == null) {
|
||||
return Result.error("未找到对应配置");
|
||||
}
|
||||
return Result.ok(config);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织 ID 查询所有配置
|
||||
*
|
||||
* @param organizationId 组织 ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 根据组织 ID 查询所有配置", notes = "系统表配置 - 根据组织 ID 查询所有配置")
|
||||
@GetMapping(value = "/listByOrgId")
|
||||
public Result<?> listByOrgId(@RequestParam(name="organizationId") Long organizationId) {
|
||||
try {
|
||||
List<SysTableConfig> list = sysTableConfigService.listByOrgId(organizationId);
|
||||
return Result.ok(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或更新配置
|
||||
*
|
||||
* @param sysTableConfigDTO
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 添加或更新", notes = "系统表配置 - 添加或更新")
|
||||
@PostMapping(value = "/saveOrUpdate")
|
||||
public Result<?> saveOrUpdate(@RequestBody SysTableConfigDTO sysTableConfigDTO) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
boolean success = sysTableConfigService.saveOrUpdateConfig(sysTableConfigDTO);
|
||||
if (success) {
|
||||
result.success("保存成功!");
|
||||
} else {
|
||||
result.error500("保存失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 删除", notes = "系统表配置 - 删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
sysTableConfigService.delete(Arrays.asList(id));
|
||||
result.success("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 批量删除", notes = "系统表配置 - 批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
int count = sysTableConfigService.delete(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功,共删除" + count + "条记录");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织 ID 删除所有配置
|
||||
*
|
||||
* @param organizationId 组织 ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 根据组织 ID 删除所有配置", notes = "系统表配置 - 根据组织 ID 删除所有配置")
|
||||
@DeleteMapping(value = "/deleteByOrgId")
|
||||
public Result<?> deleteByOrgId(@RequestParam(name="organizationId",required=true) Long organizationId) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
int count = sysTableConfigService.deleteByOrgId(organizationId);
|
||||
result.success("删除成功,共删除" + count + "条记录");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 通过 id 查询", notes = "系统表配置 - 通过 id 查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysTableConfig config = sysTableConfigService.getById(id);
|
||||
if (config == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.ok(config);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user