Commit 716dafb9 by Lizh

修复测试过程中发现的问题

parent 22bfd09c
......@@ -32,6 +32,14 @@ public interface SysComposeServerLogService {
SysComposeServerLogVO getById(Long id);
/**
* 根据服务器ID查询最新一条日志
*
* @param composeServerId 服务器id
* @return 日志详情 VO
*/
SysComposeServerLogVO getByComposeServerId(Long composeServerId);
/**
* 批量删除日志
*
* @param idList 日志id列表
......
......@@ -40,6 +40,12 @@ public class SysComposeServerLogServiceImpl implements SysComposeServerLogServic
if (log.getStatus() != null) {
wrapper.eq(SysComposeServerLogEntity::getStatus, log.getStatus());
}
if (StringUtils.hasText(log.getPost())) {
wrapper.like(SysComposeServerLogEntity::getPost, log.getPost());
}
if (StringUtils.hasText(log.getSubOrderNumbers())) {
wrapper.like(SysComposeServerLogEntity::getSubOrderNumbers, log.getSubOrderNumbers());
}
if (StringUtils.hasText(log.getBatchNumber())) {
wrapper.like(SysComposeServerLogEntity::getBatchNumber, log.getBatchNumber());
}
......@@ -50,6 +56,16 @@ public class SysComposeServerLogServiceImpl implements SysComposeServerLogServic
}
@Override
public SysComposeServerLogVO getByComposeServerId(Long composeServerId) {
LambdaQueryWrapper<SysComposeServerLogEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysComposeServerLogEntity::getComposeServerId, composeServerId)
.orderByDesc(SysComposeServerLogEntity::getCreateTime)
.last("LIMIT 1");
SysComposeServerLogEntity entity = sysComposeServerLogDomainService.getOne(wrapper);
return BeanMapper.mapper().convert(entity, SysComposeServerLogVO.class);
}
@Override
public SysComposeServerLogVO getById(Long id) {
SysComposeServerLogEntity entity = sysComposeServerLogMapper.selectLogById(id);
return BeanMapper.mapper().convert(entity, SysComposeServerLogVO.class);
......
......@@ -263,7 +263,7 @@ public class SysUserServiceImpl implements SysUserService {
for (Long userId : userIds) {
SysUserEntity user = new SysUserEntity();
user.setUserId(userId);
user.setDelFlag("1");
user.setDelFlag(SysUserStatusEnums.DELETED.getCode());
sysUserDomainService.updateById(user);
}
log.info("批量删除用户成功: count={}", userIds.length);
......
......@@ -27,7 +27,7 @@ public interface CustomWarehouseInfoService {
* @param page 分页参数
* @return 分页结果
*/
IPage<CustomWarehouseInfoVO> pageList(CustomWarehouseInfoSnakeVO entity, Page<CustomWarehouseInfoSnakeVO> page);
IPage<CustomWarehouseInfoVO> pageList(CustomWarehouseInfoSaveDTO entity, Page<CustomWarehouseInfoVO> page);
/**
* 获取仓库状态列表
......
......@@ -34,19 +34,19 @@ public class CustomWarehouseInfoServiceImpl implements CustomWarehouseInfoServic
private final CustomWarehouseInfoDomainService customWarehouseInfoDomainService;
@Override
public IPage<CustomWarehouseInfoVO> pageList(CustomWarehouseInfoSnakeVO entity, Page<CustomWarehouseInfoSnakeVO> page) {
public IPage<CustomWarehouseInfoVO> pageList(CustomWarehouseInfoSaveDTO entity, Page<CustomWarehouseInfoVO> page) {
LambdaQueryWrapper<CustomWarehouseInfoEntity> wrapper = new LambdaQueryWrapper<>();
// 按仓库名称模糊搜索
if (StringUtils.hasText(entity.getWarehouse_name())) {
wrapper.like(CustomWarehouseInfoEntity::getWarehouseName, entity.getWarehouse_name());
if (StringUtils.hasText(entity.getWarehouseName())) {
wrapper.like(CustomWarehouseInfoEntity::getWarehouseName, entity.getWarehouseName());
}
// 按仓库编码模糊搜索
if (StringUtils.hasText(entity.getWarehouse_code())) {
wrapper.like(CustomWarehouseInfoEntity::getWarehouseCode, entity.getWarehouse_code());
if (StringUtils.hasText(entity.getWarehouseCode())) {
wrapper.like(CustomWarehouseInfoEntity::getWarehouseCode, entity.getWarehouseCode());
}
// 按状态查询
if (entity.getStatus() != null) {
wrapper.eq(CustomWarehouseInfoEntity::getStatus, entity.getStatus());
if (entity.getCountryCode() != null) {
wrapper.eq(CustomWarehouseInfoEntity::getCountryCode, entity.getCountryCode());
}
// 按创建时间降序
wrapper.orderByDesc(CustomWarehouseInfoEntity::getCreateTime);
......
......@@ -7,6 +7,7 @@ import com.jomalls.custom.app.dto.system.SysComposeServerSaveDTO;
import com.jomalls.custom.app.dto.system.SysComposeServerUpdateDTO;
import com.jomalls.custom.app.service.system.SysComposeServerService;
import com.jomalls.custom.app.vo.system.SysComposeServerVO;
import com.jomalls.custom.utils.AjaxResult;
import com.jomalls.custom.utils.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -14,7 +15,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 服务器管理 Controller
......@@ -34,13 +37,19 @@ public class SysComposeServerController {
@Operation(summary = "分页查询服务器列表")
@RequiresPermissions("system:composeServer:list")
@PostMapping("/list")
public R<IPage<SysComposeServerVO>> list(
public AjaxResult list(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
SysComposeServerVO server) {
Page<SysComposeServerVO> page = new Page<>(pageNum, pageSize);
IPage<SysComposeServerVO> result = sysComposeServerService.pageList(server, page);
return R.ok(result);
// 构建前端需要的 {total, rows, code, msg} 结构
Map<String, Object> data = new HashMap<>();
data.put("total", result.getTotal());
data.put("rows", result.getRecords());
data.put("code", AjaxResult.SUCCESS);
data.put("msg", "查询成功");
return AjaxResult.success(data);
}
@Operation(summary = "新增服务器")
......@@ -58,14 +67,14 @@ public class SysComposeServerController {
}
@Operation(summary = "删除服务器")
@DeleteMapping("/deleteById")
@GetMapping("/deleteById")
public R<Void> deleteById(@RequestParam Long id) {
sysComposeServerService.deleteById(id);
return R.ok();
}
@Operation(summary = "更新服务器状态")
@PutMapping("/updateStatusById")
@GetMapping("/updateStatusById")
public R<Void> updateStatusById(@RequestParam Long id, @RequestParam Integer status) {
sysComposeServerService.updateStatusById(id, status);
return R.ok();
......
......@@ -5,14 +5,17 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jomalls.custom.app.annotation.RequiresPermissions;
import com.jomalls.custom.app.service.system.SysComposeServerLogService;
import com.jomalls.custom.app.vo.system.SysComposeServerLogVO;
import com.jomalls.custom.utils.R;
import com.jomalls.custom.utils.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 服务器日志管理 Controller
......@@ -32,19 +35,35 @@ public class SysComposeServerLogController {
@Operation(summary = "分页查询服务器日志列表")
@RequiresPermissions("system:composeServerLog:list")
@PostMapping("/list")
public R<IPage<SysComposeServerLogVO>> list(
public AjaxResult list(
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
SysComposeServerLogVO log) {
@RequestBody SysComposeServerLogVO log) {
Page<SysComposeServerLogVO> page = new Page<>(pageNum, pageSize);
IPage<SysComposeServerLogVO> result = sysComposeServerLogService.pageList(log, page);
return R.ok(result);
// 构建前端需要的 {total, rows, code, msg} 结构
Map<String, Object> data = new HashMap<>();
data.put("total", result.getTotal());
data.put("rows", result.getRecords());
data.put("code", AjaxResult.SUCCESS);
data.put("msg", "查询成功");
return AjaxResult.success(data);
}
@Operation(summary = "根据服务器ID查询日志")
@GetMapping("/getServerLogById")
public AjaxResult getServerLogById(@RequestParam("composeServerId") Long composeServerId) {
SysComposeServerLogVO log = sysComposeServerLogService.getByComposeServerId(composeServerId);
return AjaxResult.success(log);
}
@Operation(summary = "批量删除服务器日志")
@PostMapping("/deleteByIdList")
public R<Void> deleteByIdList(@RequestBody List<Long> idList) {
public AjaxResult deleteByIdList(@RequestBody List<Long> idList) {
if (CollectionUtils.isEmpty(idList)) {
return AjaxResult.error("请选择删除的数据");
}
sysComposeServerLogService.deleteByIdList(idList);
return R.ok();
return AjaxResult.success();
}
}
......@@ -6,6 +6,7 @@ import com.jomalls.custom.app.annotation.RequiresPermissions;
import com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoSaveDTO;
import com.jomalls.custom.app.dto.warehouse.CustomWarehouseInfoUpdateDTO;
import com.jomalls.custom.app.service.warehouse.CustomWarehouseInfoService;
import com.jomalls.custom.app.vo.system.SysUserVO;
import com.jomalls.custom.app.vo.warehouse.CustomWarehouseInfoSnakeVO;
import com.jomalls.custom.app.vo.warehouse.CustomWarehouseInfoVO;
import com.jomalls.custom.utils.AjaxResult;
......@@ -42,8 +43,11 @@ public class CustomWarehouseInfoController {
@Operation(summary = "分页查询仓库列表")
@RequiresPermissions("business:customWarehouse:list")
@GetMapping("/list")
public IPage<CustomWarehouseInfoVO> list(CustomWarehouseInfoSnakeVO entity, Page<CustomWarehouseInfoSnakeVO> page) {
return customWarehouseInfoService.pageList(entity, page);
public IPage<CustomWarehouseInfoVO> list( @RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
CustomWarehouseInfoSaveDTO warehouseInfo) {
Page<CustomWarehouseInfoVO> page = new Page<>(pageNum, pageSize);
return customWarehouseInfoService.pageList(warehouseInfo, page);
}
@Operation(summary = "新增仓库")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment