Compare commits
No commits in common. "d2e92ff64e71b634317dbdb39cee22a4d72d2d82" and "2d8ab391fc01d0b88dd061839217862d547da193" have entirely different histories.
d2e92ff64e
...
2d8ab391fc
|
|
@ -1,55 +0,0 @@
|
||||||
package com.unisinsight.project.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import com.unisinsight.project.entity.req.DeleteIdReq;
|
|
||||||
import com.unisinsight.project.entity.req.StoragePoolReq;
|
|
||||||
import com.unisinsight.project.entity.res.PageResult;
|
|
||||||
import com.unisinsight.project.entity.res.StoragePoolRes;
|
|
||||||
import com.unisinsight.project.exception.Result;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池管理
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/nex/v1/network")
|
|
||||||
@Slf4j
|
|
||||||
@Api(tags = "网络管理类")
|
|
||||||
public class NetworkManageController {
|
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询镜像")
|
|
||||||
@PostMapping("/select/page")
|
|
||||||
public Result<PageResult<StoragePoolRes>> selectPage(@RequestBody StoragePoolReq storagePoolReq) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@ApiOperation(value = "新增")
|
|
||||||
@PostMapping("/add")
|
|
||||||
public Result<?> insertImageVirtualMachines(@RequestBody StoragePoolReq storagePoolReq) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@ApiOperation(value = "修改状态")
|
|
||||||
@PostMapping("/update")
|
|
||||||
public Result<?> updateUser(@RequestBody StoragePoolReq storagePoolReq) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除")
|
|
||||||
@PostMapping("/delete")
|
|
||||||
public Result<?> delete(@RequestBody DeleteIdReq deleteIdReq) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "同步状态")
|
|
||||||
@GetMapping("/synchStatus")
|
|
||||||
public Result<?> synchStatus() {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
package com.unisinsight.project.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.unisinsight.project.entity.req.DeleteIdReq;
|
|
||||||
import com.unisinsight.project.entity.req.ImageVirtualMachinesReq;
|
|
||||||
import com.unisinsight.project.entity.req.StoragePoolReq;
|
|
||||||
import com.unisinsight.project.entity.res.ImageVirtualMachinesRes;
|
|
||||||
import com.unisinsight.project.entity.res.PageResult;
|
|
||||||
import com.unisinsight.project.entity.res.StoragePoolRes;
|
|
||||||
import com.unisinsight.project.exception.BaseErrorCode;
|
|
||||||
import com.unisinsight.project.exception.Result;
|
|
||||||
import com.unisinsight.project.service.ImageVirtualMachinesService;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池管理
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/nex/v1/storage")
|
|
||||||
@Slf4j
|
|
||||||
@Api(tags = "存储池类")
|
|
||||||
public class StoragePoolController {
|
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询镜像")
|
|
||||||
@PostMapping("/select/page")
|
|
||||||
public Result<PageResult<StoragePoolRes>> selectPage(@RequestBody StoragePoolReq storagePoolReq) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@ApiOperation(value = "新增")
|
|
||||||
@PostMapping("/add")
|
|
||||||
public Result<?> insertImageVirtualMachines(@RequestBody StoragePoolReq storagePoolReq) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
@ApiOperation(value = "修改状态")
|
|
||||||
@PostMapping("/update")
|
|
||||||
public Result<?> updateUser(@RequestBody StoragePoolReq storagePoolReq) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除")
|
|
||||||
@PostMapping("/delete")
|
|
||||||
public Result<?> delete(@RequestBody DeleteIdReq deleteIdReq) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "同步状态")
|
|
||||||
@GetMapping("/synchStatus")
|
|
||||||
public Result<?> synchStatus() {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
package com.unisinsight.project.entity.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络管理实体类
|
|
||||||
*
|
|
||||||
* @author ch
|
|
||||||
* @since 2025-08-25
|
|
||||||
*/
|
|
||||||
@TableName("network_manage")
|
|
||||||
@Data
|
|
||||||
public class NetworkManage {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络名称
|
|
||||||
*/
|
|
||||||
@TableField("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络类型
|
|
||||||
*/
|
|
||||||
@TableField("type")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 桥接名称
|
|
||||||
*/
|
|
||||||
@TableField("bridge_name")
|
|
||||||
private String bridgeName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IP范围
|
|
||||||
*/
|
|
||||||
@TableField("ip_range")
|
|
||||||
private String ipRange;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网关
|
|
||||||
*/
|
|
||||||
@TableField("gateway")
|
|
||||||
private String gateway;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 子网掩码
|
|
||||||
*/
|
|
||||||
@TableField("netmask")
|
|
||||||
private String netmask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DHCP启用状态
|
|
||||||
*/
|
|
||||||
@TableField("dhcp_enabled")
|
|
||||||
private Short dhcpEnabled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DHCP起始地址
|
|
||||||
*/
|
|
||||||
@TableField("dhcp_start")
|
|
||||||
private String dhcpStart;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DHCP结束地址
|
|
||||||
*/
|
|
||||||
@TableField("dhcp_end")
|
|
||||||
private String dhcpEnd;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VLAN ID
|
|
||||||
*/
|
|
||||||
@TableField("vlan_id")
|
|
||||||
private String vlanId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态
|
|
||||||
*/
|
|
||||||
@TableField("status")
|
|
||||||
private Short status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建用户
|
|
||||||
*/
|
|
||||||
@TableField("create_user")
|
|
||||||
private String createUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField("create_time")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField("update_time")
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述信息
|
|
||||||
*/
|
|
||||||
@TableField("description")
|
|
||||||
private String description;
|
|
||||||
}
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
package com.unisinsight.project.entity.dao;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池
|
|
||||||
*
|
|
||||||
* @author ch
|
|
||||||
* @since 2025-08-25 11:42:52
|
|
||||||
*/
|
|
||||||
@TableName(value = "storage_pool")
|
|
||||||
@Data
|
|
||||||
@ApiModel(description = "存储池实体类")
|
|
||||||
public class StoragePool {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键ID
|
|
||||||
*/
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
@ApiModelProperty(value = "主键ID")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池名称
|
|
||||||
*/
|
|
||||||
@TableField("name")
|
|
||||||
@ApiModelProperty(value = "存储池名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池类型
|
|
||||||
*/
|
|
||||||
@TableField("type")
|
|
||||||
@ApiModelProperty(value = "存储池类型")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态
|
|
||||||
*/
|
|
||||||
@TableField("status")
|
|
||||||
@ApiModelProperty(value = "状态")
|
|
||||||
private Short status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述信息
|
|
||||||
*/
|
|
||||||
@TableField("description")
|
|
||||||
@ApiModelProperty(value = "描述信息")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField("create_time")
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间,默认值为当前时间戳
|
|
||||||
*/
|
|
||||||
@TableField("update_time")
|
|
||||||
@ApiModelProperty(value = "更新时间")
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建用户
|
|
||||||
*/
|
|
||||||
@TableField("create_user")
|
|
||||||
@ApiModelProperty(value = "创建用户")
|
|
||||||
private String createUser;
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
package com.unisinsight.project.entity.req;
|
|
||||||
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.unisinsight.project.entity.dao.StoragePool;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池
|
|
||||||
*
|
|
||||||
* @author ch
|
|
||||||
* @since 2025-08-25 11:42:52
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("存储池")
|
|
||||||
public class StoragePoolReq {
|
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty("名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty("类型")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
@ApiModelProperty("路劲")
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态: 1-活跃,2-关闭
|
|
||||||
**/
|
|
||||||
@ApiModelProperty("状态")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询页
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "查询页", notes = "分页查询时再传")
|
|
||||||
@JsonProperty("page_num")
|
|
||||||
private Integer pageNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 每页数量
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "每页数量", notes = "分页查询时再传")
|
|
||||||
@JsonProperty("page_size")
|
|
||||||
private Integer pageSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
package com.unisinsight.project.entity.res;
|
|
||||||
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 镜像虚拟机(ImageVirtualMachines)表实体类
|
|
||||||
*
|
|
||||||
* @author ch
|
|
||||||
* @since 2025-08-25 11:42:57
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("镜像虚拟机")
|
|
||||||
public class StoragePoolRes implements Serializable {
|
|
||||||
@JsonProperty("id")
|
|
||||||
@ApiModelProperty("ID")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@JsonProperty("name")
|
|
||||||
@ApiModelProperty("名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@JsonProperty("type")
|
|
||||||
@ApiModelProperty("类型")
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
@JsonProperty("path")
|
|
||||||
@ApiModelProperty("路劲")
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 镜像状态: 1-活跃,2-关闭
|
|
||||||
**/
|
|
||||||
@JsonProperty("image_status")
|
|
||||||
@ApiModelProperty("状态")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
**/
|
|
||||||
@JsonProperty("create_time")
|
|
||||||
@ApiModelProperty("创建时间")
|
|
||||||
private String createTime;
|
|
||||||
/**
|
|
||||||
* 创建人
|
|
||||||
**/
|
|
||||||
@JsonProperty("create_user")
|
|
||||||
@ApiModelProperty("创建人")
|
|
||||||
private String createUser;
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
**/
|
|
||||||
@JsonProperty("update_time")
|
|
||||||
@ApiModelProperty("更新时间")
|
|
||||||
private String updateTime;
|
|
||||||
/**
|
|
||||||
* 更新人
|
|
||||||
**/
|
|
||||||
@JsonProperty("update_user")
|
|
||||||
@ApiModelProperty("更新人")
|
|
||||||
private String updateUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述
|
|
||||||
**/
|
|
||||||
@JsonProperty("description")
|
|
||||||
@ApiModelProperty("描述")
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
package com.unisinsight.project.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.unisinsight.project.entity.dao.NetworkManage;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface NetworkManageMapper extends BaseMapper<NetworkManage> {
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
package com.unisinsight.project.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.unisinsight.project.entity.dao.StoragePool;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface StoragePoolMapper extends BaseMapper<StoragePool> {
|
|
||||||
}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
package com.unisinsight.project.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.unisinsight.project.entity.dao.NetworkManage;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络管理服务接口
|
|
||||||
*/
|
|
||||||
public interface NetworkManageService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增网络管理信息
|
|
||||||
*
|
|
||||||
* @param networkManage 网络管理对象
|
|
||||||
* @return NetworkManage 返回新增的网络管理对象
|
|
||||||
*/
|
|
||||||
NetworkManage addNetworkManage(NetworkManage networkManage);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID更新网络管理信息
|
|
||||||
*
|
|
||||||
* @param networkManage 网络管理对象
|
|
||||||
* @return boolean 是否更新成功
|
|
||||||
*/
|
|
||||||
boolean updateNetworkManage(NetworkManage networkManage);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID删除网络管理信息
|
|
||||||
*
|
|
||||||
* @param id 网络管理ID
|
|
||||||
* @return boolean 是否删除成功
|
|
||||||
*/
|
|
||||||
boolean deleteNetworkManage(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID获取网络管理详情
|
|
||||||
*
|
|
||||||
* @param id 网络管理ID
|
|
||||||
* @return NetworkManage 网络管理对象
|
|
||||||
*/
|
|
||||||
NetworkManage getNetworkManageById(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询网络管理列表
|
|
||||||
*
|
|
||||||
* @param name 网络名称(可选查询条件)
|
|
||||||
* @param type 网络类型(可选查询条件)
|
|
||||||
* @param status 状态(可选查询条件)
|
|
||||||
* @return List<NetworkManage> 网络管理列表
|
|
||||||
*/
|
|
||||||
List<NetworkManage> listNetworkManages(String name, String type, Short status);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询网络管理列表
|
|
||||||
*
|
|
||||||
* @param currentPage 当前页码
|
|
||||||
* @param pageSize 每页大小
|
|
||||||
* @param name 网络名称(可选查询条件)
|
|
||||||
* @param type 网络类型(可选查询条件)
|
|
||||||
* @param status 状态(可选查询条件)
|
|
||||||
* @return Page<NetworkManage> 分页结果
|
|
||||||
*/
|
|
||||||
Page<NetworkManage> pageNetworkManages(Integer currentPage, Integer pageSize, String name, String type, Short status);
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
package com.unisinsight.project.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.unisinsight.project.entity.dao.StoragePool;
|
|
||||||
import com.unisinsight.project.entity.req.StoragePoolReq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池服务接口
|
|
||||||
*/
|
|
||||||
public interface StoragePoolService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增存储池
|
|
||||||
*
|
|
||||||
* @param storagePool 存储池对象
|
|
||||||
* @return StoragePool 返回新增的存储池对象
|
|
||||||
*/
|
|
||||||
StoragePool addStoragePool(StoragePool storagePool);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID更新存储池信息
|
|
||||||
*
|
|
||||||
* @param storagePool 存储池对象
|
|
||||||
* @return boolean 是否更新成功
|
|
||||||
*/
|
|
||||||
boolean updateStoragePool(StoragePool storagePool);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID删除存储池
|
|
||||||
*
|
|
||||||
* @param id 存储池ID
|
|
||||||
* @return boolean 是否删除成功
|
|
||||||
*/
|
|
||||||
boolean deleteStoragePool(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID获取存储池详情
|
|
||||||
*
|
|
||||||
* @param id 存储池ID
|
|
||||||
* @return StoragePool 存储池对象
|
|
||||||
*/
|
|
||||||
StoragePool getStoragePoolById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询存储池列表
|
|
||||||
*
|
|
||||||
* @param currentPage 当前页码
|
|
||||||
* @param pageSize 每页大小
|
|
||||||
* @param name 存储池名称(可选查询条件)
|
|
||||||
* @param type 存储池类型(可选查询条件)
|
|
||||||
* @param status 存储池状态(可选查询条件)
|
|
||||||
* @return Page<StoragePool> 分页结果
|
|
||||||
*/
|
|
||||||
Page<StoragePool> pageStoragePools(StoragePoolReq storagePoolReq);
|
|
||||||
}
|
|
||||||
|
|
@ -1,132 +0,0 @@
|
||||||
package com.unisinsight.project.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.unisinsight.project.entity.dao.NetworkManage;
|
|
||||||
import com.unisinsight.project.mapper.NetworkManageMapper;
|
|
||||||
import com.unisinsight.project.service.NetworkManageService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络管理服务实现类
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class NetworkManageServiceImpl extends ServiceImpl<NetworkManageMapper, NetworkManage> implements NetworkManageService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增网络管理信息
|
|
||||||
*
|
|
||||||
* @param networkManage 网络管理对象
|
|
||||||
* @return NetworkManage 返回新增的网络管理对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public NetworkManage addNetworkManage(NetworkManage networkManage) {
|
|
||||||
networkManage.setCreateTime(new Date());
|
|
||||||
networkManage.setUpdateTime(new Date());
|
|
||||||
this.save(networkManage);
|
|
||||||
return networkManage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID更新网络管理信息
|
|
||||||
*
|
|
||||||
* @param networkManage 网络管理对象
|
|
||||||
* @return boolean 是否更新成功
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public boolean updateNetworkManage(NetworkManage networkManage) {
|
|
||||||
NetworkManage existing = this.getById(networkManage.getId());
|
|
||||||
if (existing == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
networkManage.setUpdateTime(new Date());
|
|
||||||
return this.updateById(networkManage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID删除网络管理信息
|
|
||||||
*
|
|
||||||
* @param id 网络管理ID
|
|
||||||
* @return boolean 是否删除成功
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public boolean deleteNetworkManage(Integer id) {
|
|
||||||
return this.removeById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID获取网络管理详情
|
|
||||||
*
|
|
||||||
* @param id 网络管理ID
|
|
||||||
* @return NetworkManage 网络管理对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public NetworkManage getNetworkManageById(Integer id) {
|
|
||||||
return this.getById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询网络管理列表
|
|
||||||
*
|
|
||||||
* @param name 网络名称(可选查询条件)
|
|
||||||
* @param type 网络类型(可选查询条件)
|
|
||||||
* @param status 状态(可选查询条件)
|
|
||||||
* @return List<NetworkManage> 网络管理列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<NetworkManage> listNetworkManages(String name, String type, Short status) {
|
|
||||||
QueryWrapper<NetworkManage> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
// 添加查询条件
|
|
||||||
if (name != null && !name.isEmpty()) {
|
|
||||||
queryWrapper.like("name", name);
|
|
||||||
}
|
|
||||||
if (type != null && !type.isEmpty()) {
|
|
||||||
queryWrapper.eq("type", type);
|
|
||||||
}
|
|
||||||
if (status != null) {
|
|
||||||
queryWrapper.eq("status", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
|
||||||
return this.list(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询网络管理列表
|
|
||||||
*
|
|
||||||
* @param currentPage 当前页码
|
|
||||||
* @param pageSize 每页大小
|
|
||||||
* @param name 网络名称(可选查询条件)
|
|
||||||
* @param type 网络类型(可选查询条件)
|
|
||||||
* @param status 状态(可选查询条件)
|
|
||||||
* @return Page<NetworkManage> 分页结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Page<NetworkManage> pageNetworkManages(Integer currentPage, Integer pageSize, String name, String type, Short status) {
|
|
||||||
Page<NetworkManage> page = new Page<>(currentPage, pageSize);
|
|
||||||
QueryWrapper<NetworkManage> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
// 添加查询条件
|
|
||||||
if (name != null && !name.isEmpty()) {
|
|
||||||
queryWrapper.like("name", name);
|
|
||||||
}
|
|
||||||
if (type != null && !type.isEmpty()) {
|
|
||||||
queryWrapper.eq("type", type);
|
|
||||||
}
|
|
||||||
if (status != null) {
|
|
||||||
queryWrapper.eq("status", status);
|
|
||||||
}
|
|
||||||
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
|
||||||
return this.page(page, queryWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
package com.unisinsight.project.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.unisinsight.project.entity.dao.StoragePool;
|
|
||||||
import com.unisinsight.project.entity.req.StoragePoolReq;
|
|
||||||
import com.unisinsight.project.mapper.StoragePoolMapper;
|
|
||||||
import com.unisinsight.project.service.StoragePoolService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存储池服务实现类
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class StoragePoolServiceImpl extends ServiceImpl<StoragePoolMapper, StoragePool> implements StoragePoolService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增存储池
|
|
||||||
*
|
|
||||||
* @param storagePool 存储池对象
|
|
||||||
* @return StoragePool 返回新增的存储池对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public StoragePool addStoragePool(StoragePool storagePool) {
|
|
||||||
storagePool.setCreateTime(new Date());
|
|
||||||
storagePool.setUpdateTime(new Date());
|
|
||||||
this.save(storagePool);
|
|
||||||
return storagePool;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID更新存储池信息
|
|
||||||
*
|
|
||||||
* @param storagePool 存储池对象
|
|
||||||
* @return boolean 是否更新成功
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public boolean updateStoragePool(StoragePool storagePool) {
|
|
||||||
StoragePool existing = this.getById(storagePool.getId());
|
|
||||||
if (existing == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
storagePool.setUpdateTime(new Date());
|
|
||||||
return this.updateById(storagePool);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID删除存储池
|
|
||||||
*
|
|
||||||
* @param id 存储池ID
|
|
||||||
* @return boolean 是否删除成功
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public boolean deleteStoragePool(Long id) {
|
|
||||||
return this.removeById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID获取存储池详情
|
|
||||||
*
|
|
||||||
* @param id 存储池ID
|
|
||||||
* @return StoragePool 存储池对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public StoragePool getStoragePoolById(Long id) {
|
|
||||||
return this.getById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询存储池列表
|
|
||||||
*
|
|
||||||
* @param currentPage 当前页码
|
|
||||||
* @param pageSize 每页大小
|
|
||||||
* @param name 存储池名称(可选查询条件)
|
|
||||||
* @param type 存储池类型(可选查询条件)
|
|
||||||
* @param status 存储池状态(可选查询条件)
|
|
||||||
* @return Page<StoragePool> 分页结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Page<StoragePool> pageStoragePools(StoragePoolReq storagePoolReq) {
|
|
||||||
Page<StoragePool> page = new Page<>(storagePoolReq.getPageNum(), storagePoolReq.getPageSize());
|
|
||||||
QueryWrapper<StoragePool> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
// 添加查询条件
|
|
||||||
if (storagePoolReq.getName() != null && !storagePoolReq.getName().isEmpty()) {
|
|
||||||
queryWrapper.like("name", storagePoolReq.getName());
|
|
||||||
}
|
|
||||||
if (storagePoolReq.getType() != null && !storagePoolReq.getType().isEmpty()) {
|
|
||||||
queryWrapper.eq("type", storagePoolReq.getType());
|
|
||||||
}
|
|
||||||
if (storagePoolReq.getStatus() != null) {
|
|
||||||
queryWrapper.eq("status", storagePoolReq.getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
queryWrapper.orderByDesc("create_time");
|
|
||||||
return this.page(page, queryWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -27,8 +27,6 @@ spring:
|
||||||
init:
|
init:
|
||||||
mode: always
|
mode: always
|
||||||
data-locations: classpath*:db/*.sql
|
data-locations: classpath*:db/*.sql
|
||||||
jackson:
|
|
||||||
property-naming-strategy: SNAKE_CASE
|
|
||||||
|
|
||||||
knife4j:
|
knife4j:
|
||||||
production: false
|
production: false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue