| @@ -111,7 +111,7 @@ public class DatasetVersionController { | |||
| * @return 删除是否成功 | |||
| */ | |||
| @DeleteMapping("/deleteVersion") | |||
| @ApiOperation(value = "逻辑删除模型版本", notes = "根据模型ID和版本逻辑删除模型版本记录。") | |||
| @ApiOperation(value = "逻辑删除模型版本", notes = "根据数据集ID和版本逻辑删除模型版本记录。") | |||
| public AjaxResult deleteModelsVersion(@RequestParam("dataset_id") Integer datasetId, | |||
| @RequestParam("version") String version) { | |||
| return AjaxResult.success(this.datasetVersionService.deleteDatasetVersion(datasetId, version)); | |||
| @@ -4,6 +4,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult; | |||
| import com.ruoyi.platform.domain.Image; | |||
| import com.ruoyi.platform.domain.Models; | |||
| import com.ruoyi.platform.service.ImageService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageRequest; | |||
| @@ -20,6 +21,7 @@ import javax.annotation.Resource; | |||
| */ | |||
| @RestController | |||
| @RequestMapping("image") | |||
| @Api("镜像管理") | |||
| public class ImageController { | |||
| /** | |||
| * 服务对象 | |||
| @@ -60,7 +62,8 @@ public class ImageController { | |||
| * @return 新增结果 | |||
| */ | |||
| @PostMapping | |||
| public AjaxResult add(Image image) { | |||
| @ApiOperation("新增镜像") | |||
| public AjaxResult add(@RequestBody Image image) { | |||
| return AjaxResult.success(this.imageService.insert(image)); | |||
| } | |||
| @@ -71,7 +74,7 @@ public class ImageController { | |||
| * @return 编辑结果 | |||
| */ | |||
| @PutMapping | |||
| public AjaxResult edit(Image image) { | |||
| public AjaxResult edit(@RequestBody Image image) { | |||
| return AjaxResult.success(this.imageService.update(image)); | |||
| } | |||
| @@ -81,8 +84,9 @@ public class ImageController { | |||
| * @param id 主键 | |||
| * @return 删除是否成功 | |||
| */ | |||
| @DeleteMapping | |||
| public AjaxResult deleteById(Integer id) { | |||
| @DeleteMapping("{id}") | |||
| public AjaxResult deleteById(@PathVariable("id") Integer id) { | |||
| return AjaxResult.success(this.imageService.removeById(id)); | |||
| } | |||
| @@ -1,5 +1,7 @@ | |||
| package com.ruoyi.platform.domain; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import java.util.Date; | |||
| import java.io.Serializable; | |||
| @@ -18,34 +20,44 @@ public class Image implements Serializable { | |||
| /** | |||
| * 镜像名称 | |||
| */ | |||
| @ApiModelProperty(name = "name") | |||
| private String name; | |||
| /** | |||
| * 镜像描述 | |||
| */ | |||
| @ApiModelProperty(name = "description") | |||
| private String description; | |||
| /** | |||
| * 镜像类型 | |||
| */ | |||
| @ApiModelProperty(name = "image_type") | |||
| private Integer imageType; | |||
| /** | |||
| * 创建者 | |||
| */ | |||
| @ApiModelProperty(name = "create_by") | |||
| private String createBy; | |||
| /** | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @ApiModelProperty(name = "create_time") | |||
| private Date createTime; | |||
| /** | |||
| /** | |||
| * 更新者 | |||
| */ | |||
| @ApiModelProperty(name = "update_by") | |||
| private String updateBy; | |||
| /** | |||
| /** | |||
| * 更新时间 | |||
| */ | |||
| @ApiModelProperty(name = "update_time") | |||
| private Date updateTime; | |||
| /** | |||
| /** | |||
| * 状态,0失效,1生效 | |||
| */ | |||
| @ApiModelProperty(name = "state") | |||
| private Integer state; | |||
| @@ -1,5 +1,7 @@ | |||
| package com.ruoyi.platform.domain; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import java.util.Date; | |||
| import java.io.Serializable; | |||
| @@ -11,53 +13,67 @@ import java.io.Serializable; | |||
| */ | |||
| public class ImageVersion implements Serializable { | |||
| private static final long serialVersionUID = 251017725389874890L; | |||
| /** | |||
| /** | |||
| * 主键 | |||
| */ | |||
| @ApiModelProperty(name = "id") | |||
| private Integer id; | |||
| /** | |||
| /** | |||
| * 对应的镜像id | |||
| */ | |||
| @ApiModelProperty(name = "image_id") | |||
| private Integer imageId; | |||
| /** | |||
| /** | |||
| * 镜像版本 | |||
| */ | |||
| @ApiModelProperty(name = "version") | |||
| private String version; | |||
| /** | |||
| /** | |||
| * 镜像推送地址 | |||
| */ | |||
| @ApiModelProperty(name = "url") | |||
| private String url; | |||
| /** | |||
| /** | |||
| * 镜像tag名称 | |||
| */ | |||
| @ApiModelProperty(name = "tag_name") | |||
| private String tagName; | |||
| /** | |||
| /** | |||
| * 镜像文件大小 | |||
| */ | |||
| @ApiModelProperty(name = "file_size") | |||
| private String fileSize; | |||
| /** | |||
| /** | |||
| * 镜像构建状态 | |||
| */ | |||
| @ApiModelProperty(name = "status") | |||
| private String status; | |||
| /** | |||
| /** | |||
| * 创建者 | |||
| */ | |||
| @ApiModelProperty(name = "create_by") | |||
| private String createBy; | |||
| /** | |||
| /** | |||
| * 创建时间 | |||
| */ | |||
| @ApiModelProperty(name = "create_time") | |||
| private Date createTime; | |||
| /** | |||
| /** | |||
| * 更新者 | |||
| */ | |||
| @ApiModelProperty(name = "update_by") | |||
| private String updateBy; | |||
| /** | |||
| /** | |||
| * 更新时间 | |||
| */ | |||
| @ApiModelProperty(name = "update_time") | |||
| private Date updateTime; | |||
| /** | |||
| /** | |||
| * 状态,0失效,1生效 | |||
| */ | |||
| @ApiModelProperty(name = "state") | |||
| private Integer state; | |||
| @@ -116,7 +116,7 @@ public class ImageServiceImpl implements ImageService { | |||
| public String removeById(Integer id) { | |||
| Image image = this.imageDao.queryById(id); | |||
| if (image == null){ | |||
| return "模型不存在"; | |||
| return "镜像不存在"; | |||
| } | |||
| //判断权限,只有admin和创建者本身可以删除该数据集 | |||
| @@ -25,81 +25,84 @@ | |||
| <!--查询指定行数据--> | |||
| <select id="queryAllByLimit" resultMap="ImageMap"> | |||
| select | |||
| id,name,description,image_type,create_by,create_time,update_by,update_time,state | |||
| id, name, description, image_type, create_by, create_time, update_by, update_time, state | |||
| from image | |||
| <where> | |||
| <if test="id != null"> | |||
| and id = #{id} | |||
| state = 1 | |||
| <if test="image.id != null"> | |||
| and id = #{image.id} | |||
| </if> | |||
| <if test="name != null and name != ''"> | |||
| and name = #{name} | |||
| <if test="image.name != null and image.name != ''"> | |||
| and name = #{image.name} | |||
| </if> | |||
| <if test="description != null and description != ''"> | |||
| and description = #{description} | |||
| <if test="image.description != null and image.description != ''"> | |||
| and description = #{image.description} | |||
| </if> | |||
| <if test="imageType != null"> | |||
| and image_type = #{imageType} | |||
| <if test="image.imageType != null"> | |||
| and image_type = #{image.imageType} | |||
| </if> | |||
| <if test="createBy != null and createBy != ''"> | |||
| and create_by = #{createBy} | |||
| <if test="image.createBy != null and image.createBy != ''"> | |||
| and create_by = #{image.createBy} | |||
| </if> | |||
| <if test="createTime != null"> | |||
| and create_time = #{createTime} | |||
| <if test="image.createTime != null"> | |||
| and create_time = #{image.createTime} | |||
| </if> | |||
| <if test="updateBy != null and updateBy != ''"> | |||
| and update_by = #{updateBy} | |||
| <if test="image.updateBy != null and image.updateBy != ''"> | |||
| and update_by = #{image.updateBy} | |||
| </if> | |||
| <if test="updateTime != null"> | |||
| and update_time = #{updateTime} | |||
| <if test="image.updateTime != null"> | |||
| and update_time = #{image.updateTime} | |||
| </if> | |||
| <if test="state != null and state != ''"> | |||
| and state = #{state} | |||
| <if test="image.state != null and image.state != ''"> | |||
| and state = #{image.state} | |||
| </if> | |||
| </where> | |||
| limit #{pageable.offset}, #{pageable.pageSize} | |||
| </select> | |||
| <!--统计总行数--> | |||
| <select id="count" resultType="java.lang.Long"> | |||
| select count(1) | |||
| from image | |||
| <where> | |||
| <if test="id != null"> | |||
| and id = #{id} | |||
| state = 1 | |||
| <if test="image.id != null"> | |||
| and id = #{image.id} | |||
| </if> | |||
| <if test="name != null and name != ''"> | |||
| and name = #{name} | |||
| <if test="image.name != null and image.name != ''"> | |||
| and name = #{image.name} | |||
| </if> | |||
| <if test="description != null and description != ''"> | |||
| and description = #{description} | |||
| <if test="image.description != null and image.description != ''"> | |||
| and description = #{image.description} | |||
| </if> | |||
| <if test="imageType != null"> | |||
| and image_type = #{imageType} | |||
| <if test="image.imageType != null"> | |||
| and image_type = #{image.imageType} | |||
| </if> | |||
| <if test="createBy != null and createBy != ''"> | |||
| and create_by = #{createBy} | |||
| <if test="image.createBy != null and image.createBy != ''"> | |||
| and create_by = #{image.createBy} | |||
| </if> | |||
| <if test="createTime != null"> | |||
| and create_time = #{createTime} | |||
| <if test="image.createTime != null"> | |||
| and create_time = #{image.createTime} | |||
| </if> | |||
| <if test="updateBy != null and updateBy != ''"> | |||
| and update_by = #{updateBy} | |||
| <if test="image.updateBy != null and image.updateBy != ''"> | |||
| and update_by = #{image.updateBy} | |||
| </if> | |||
| <if test="updateTime != null"> | |||
| and update_time = #{updateTime} | |||
| <if test="image.updateTime != null"> | |||
| and update_time = #{image.updateTime} | |||
| </if> | |||
| <if test="state != null and state != ''"> | |||
| and state = #{state} | |||
| <if test="image.state != null and image.state != ''"> | |||
| and state = #{image.state} | |||
| </if> | |||
| </where> | |||
| </select> | |||
| <!--新增所有列--> | |||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into image(name,description,image_type,create_by,create_time,update_by,update_time,state) | |||
| values (#{name}#{description}#{imageType}#{createBy}#{createTime}#{updateBy}#{updateTime}#{state}) | |||
| values (#{image.name}, #{image.description}, #{image.imageType}, #{image.createBy}, #{image.createTime}, #{image.updateBy}, #{image.updateTime}, #{image.state}) | |||
| </insert> | |||
| <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into image(name,description,image_type,create_by,create_time,update_by,update_time,state) | |||
| values | |||
| @@ -122,32 +125,32 @@ name = values(name)description = values(description)image_type = values(image_ty | |||
| <update id="update"> | |||
| update image | |||
| <set> | |||
| <if test="name != null and name != ''"> | |||
| name = #{name}, | |||
| <if test="image.name != null and image.name != ''"> | |||
| name = #{image.name}, | |||
| </if> | |||
| <if test="description != null and description != ''"> | |||
| description = #{description}, | |||
| <if test="image.description != null and image.description != ''"> | |||
| description = #{image.description}, | |||
| </if> | |||
| <if test="imageType != null"> | |||
| image_type = #{imageType}, | |||
| <if test="image.imageType != null"> | |||
| image_type = #{image.imageType}, | |||
| </if> | |||
| <if test="createBy != null and createBy != ''"> | |||
| create_by = #{createBy}, | |||
| <if test="image.createBy != null and image.createBy != ''"> | |||
| create_by = #{image.createBy}, | |||
| </if> | |||
| <if test="createTime != null"> | |||
| create_time = #{createTime}, | |||
| <if test="image.createTime != null"> | |||
| create_time = #{image.createTime}, | |||
| </if> | |||
| <if test="updateBy != null and updateBy != ''"> | |||
| update_by = #{updateBy}, | |||
| <if test="image.updateBy != null and image.updateBy != ''"> | |||
| update_by = #{image.updateBy}, | |||
| </if> | |||
| <if test="updateTime != null"> | |||
| update_time = #{updateTime}, | |||
| <if test="image.updateTime != null"> | |||
| update_time = #{image.updateTime}, | |||
| </if> | |||
| <if test="state != null and state != ''"> | |||
| state = #{state}, | |||
| <if test="image.state != null and image.state != ''"> | |||
| state = #{image.state}, | |||
| </if> | |||
| </set> | |||
| where id = #{id} | |||
| where id = #{image.id} | |||
| </update> | |||
| <!--通过主键删除--> | |||
| @@ -1,6 +1,6 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.ruoyi.platform.dao.ImageVersionDao"> | |||
| <mapper namespace="com.ruoyi.platform.mapper.ImageVersionDao"> | |||
| <resultMap type="com.ruoyi.platform.domain.ImageVersion" id="ImageVersionMap"> | |||
| <result property="id" column="id" jdbcType="INTEGER"/> | |||
| @@ -18,7 +18,7 @@ | |||
| </resultMap> | |||
| <!--根据模型id返回版本列表--> | |||
| <select id="queryByModelsId" resultMap="ModelsVersionMap"> | |||
| <select id="queryByImageId" resultMap="ImageVersionMap"> | |||
| select * | |||
| from image_version | |||
| where image_id = #{imageId} and state = 1 | |||
| @@ -28,7 +28,7 @@ | |||
| <select id="queryById" resultMap="ImageVersionMap"> | |||
| select * | |||
| from image_version | |||
| where id = #{id} | |||
| where id = #{id} and state = 1 | |||
| </select> | |||
| <!--查询指定行数据--> | |||
| @@ -36,41 +36,42 @@ | |||
| select * | |||
| from image_version | |||
| <where> | |||
| <if test="id != null"> | |||
| and id = #{id} | |||
| state = 1 | |||
| <if test="imageVersion.id != null"> | |||
| and id = #{imageVersion.id} | |||
| </if> | |||
| <if test="imageId != null"> | |||
| and image_id = #{imageId} | |||
| <if test="imageVersion.imageId != null"> | |||
| and image_id = #{imageVersion.imageId} | |||
| </if> | |||
| <if test="version != null and version != ''"> | |||
| and version = #{version} | |||
| <if test="imageVersion.version != null and imageVersion.version != ''"> | |||
| and version = #{imageVersion.version} | |||
| </if> | |||
| <if test="url != null and url != ''"> | |||
| and url = #{url} | |||
| <if test="imageVersion.url != null and imageVersion.url != ''"> | |||
| and url = #{imageVersion.url} | |||
| </if> | |||
| <if test="tagName != null and tagName != ''"> | |||
| and tag_name = #{tagName} | |||
| <if test="imageVersion.tagName != null and imageVersion.tagName != ''"> | |||
| and tag_name = #{imageVersion.tagName} | |||
| </if> | |||
| <if test="fileSize != null and fileSize != ''"> | |||
| and file_size = #{fileSize} | |||
| <if test="imageVersion.fileSize != null and imageVersion.fileSize != ''"> | |||
| and file_size = #{imageVersion.fileSize} | |||
| </if> | |||
| <if test="status != null and status != ''"> | |||
| and status = #{status} | |||
| <if test="imageVersion.status != null and imageVersion.status != ''"> | |||
| and status = #{imageVersion.status} | |||
| </if> | |||
| <if test="createBy != null and createBy != ''"> | |||
| and create_by = #{createBy} | |||
| <if test="imageVersion.createBy != null and imageVersion.createBy != ''"> | |||
| and create_by = #{imageVersion.createBy} | |||
| </if> | |||
| <if test="createTime != null"> | |||
| and create_time = #{createTime} | |||
| <if test="imageVersion.createTime != null"> | |||
| and create_time = #{imageVersion.createTime} | |||
| </if> | |||
| <if test="updateBy != null and updateBy != ''"> | |||
| and update_by = #{updateBy} | |||
| <if test="imageVersion.updateBy != null and imageVersion.updateBy != ''"> | |||
| and update_by = #{imageVersion.updateBy} | |||
| </if> | |||
| <if test="updateTime != null"> | |||
| and update_time = #{updateTime} | |||
| <if test="imageVersion.updateTime != null"> | |||
| and update_time = #{imageVersion.updateTime} | |||
| </if> | |||
| <if test="state != null"> | |||
| and state = #{state} | |||
| <if test="imageVersion.state != null"> | |||
| and state = #{imageVersion.state} | |||
| </if> | |||
| </where> | |||
| limit #{pageable.offset}, #{pageable.pageSize} | |||
| @@ -81,51 +82,53 @@ | |||
| select count(1) | |||
| from image_version | |||
| <where> | |||
| <if test="id != null"> | |||
| and id = #{id} | |||
| state = 1 | |||
| <if test="imageVersion.id != null"> | |||
| and id = #{imageVersion.id} | |||
| </if> | |||
| <if test="imageId != null"> | |||
| and image_id = #{imageId} | |||
| <if test="imageVersion.imageId != null"> | |||
| and image_id = #{imageVersion.imageId} | |||
| </if> | |||
| <if test="version != null and version != ''"> | |||
| and version = #{version} | |||
| <if test="imageVersion.version != null and imageVersion.version != ''"> | |||
| and version = #{imageVersion.version} | |||
| </if> | |||
| <if test="url != null and url != ''"> | |||
| and url = #{url} | |||
| <if test="imageVersion.url != null and imageVersion.url != ''"> | |||
| and url = #{imageVersion.url} | |||
| </if> | |||
| <if test="tagName != null and tagName != ''"> | |||
| and tag_name = #{tagName} | |||
| <if test="imageVersion.tagName != null and imageVersion.tagName != ''"> | |||
| and tag_name = #{imageVersion.tagName} | |||
| </if> | |||
| <if test="fileSize != null and fileSize != ''"> | |||
| and file_size = #{fileSize} | |||
| <if test="imageVersion.fileSize != null and imageVersion.fileSize != ''"> | |||
| and file_size = #{imageVersion.fileSize} | |||
| </if> | |||
| <if test="status != null and status != ''"> | |||
| and status = #{status} | |||
| <if test="imageVersion.status != null and imageVersion.status != ''"> | |||
| and status = #{imageVersion.status} | |||
| </if> | |||
| <if test="createBy != null and createBy != ''"> | |||
| and create_by = #{createBy} | |||
| <if test="imageVersion.createBy != null and imageVersion.createBy != ''"> | |||
| and create_by = #{imageVersion.createBy} | |||
| </if> | |||
| <if test="createTime != null"> | |||
| and create_time = #{createTime} | |||
| <if test="imageVersion.createTime != null"> | |||
| and create_time = #{imageVersion.createTime} | |||
| </if> | |||
| <if test="updateBy != null and updateBy != ''"> | |||
| and update_by = #{updateBy} | |||
| <if test="imageVersion.updateBy != null and imageVersion.updateBy != ''"> | |||
| and update_by = #{imageVersion.updateBy} | |||
| </if> | |||
| <if test="updateTime != null"> | |||
| and update_time = #{updateTime} | |||
| <if test="imageVersion.updateTime != null"> | |||
| and update_time = #{imageVersion.updateTime} | |||
| </if> | |||
| <if test="state != null"> | |||
| and state = #{state} | |||
| <if test="imageVersion.state != null"> | |||
| and state = #{imageVersion.state} | |||
| </if> | |||
| </where> | |||
| </select> | |||
| <!--新增所有列--> | |||
| <insert id="insert" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into image_version(image_id,version,url,tag_name,file_size,status,create_by,create_time,update_by,update_time,state) | |||
| values (#{imageId}#{version}#{url}#{tagName}#{fileSize}#{status}#{createBy}#{createTime}#{updateBy}#{updateTime}#{state}) | |||
| insert into image_version(image_id, version, url, tag_name, file_size, status, create_by, create_time, update_by, update_time, state) | |||
| values (#{imageVersion.imageId}, #{imageVersion.version}, #{imageVersion.url}, #{imageVersion.tagName}, #{imageVersion.fileSize}, #{imageVersion.status}, #{imageVersion.createBy}, #{imageVersion.createTime}, #{imageVersion.updateBy}, #{imageVersion.updateTime}, #{imageVersion.state}) | |||
| </insert> | |||
| <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into image_version(image_id,version,url,tag_name,file_size,status,create_by,create_time,update_by,update_time,state) | |||
| values | |||
| @@ -148,41 +151,41 @@ image_id = values(image_id)version = values(version)url = values(url)tag_name = | |||
| <update id="update"> | |||
| update image_version | |||
| <set> | |||
| <if test="imageId != null"> | |||
| image_id = #{imageId}, | |||
| <if test="imageVersion.imageId != null"> | |||
| image_id = #{imageVersion.imageId}, | |||
| </if> | |||
| <if test="version != null and version != ''"> | |||
| version = #{version}, | |||
| <if test="imageVersion.version != null and imageVersion.version != ''"> | |||
| version = #{imageVersion.version}, | |||
| </if> | |||
| <if test="url != null and url != ''"> | |||
| url = #{url}, | |||
| <if test="imageVersion.url != null and imageVersion.url != ''"> | |||
| url = #{imageVersion.url}, | |||
| </if> | |||
| <if test="tagName != null and tagName != ''"> | |||
| tag_name = #{tagName}, | |||
| <if test="imageVersion.tagName != null and imageVersion.tagName != ''"> | |||
| tag_name = #{imageVersion.tagName}, | |||
| </if> | |||
| <if test="fileSize != null and fileSize != ''"> | |||
| file_size = #{fileSize}, | |||
| <if test="imageVersion.fileSize != null and imageVersion.fileSize != ''"> | |||
| file_size = #{imageVersion.fileSize}, | |||
| </if> | |||
| <if test="status != null and status != ''"> | |||
| status = #{status}, | |||
| <if test="imageVersion.status != null and imageVersion.status != ''"> | |||
| status = #{imageVersion.status}, | |||
| </if> | |||
| <if test="createBy != null and createBy != ''"> | |||
| create_by = #{createBy}, | |||
| <if test="imageVersion.createBy != null and imageVersion.createBy != ''"> | |||
| create_by = #{imageVersion.createBy}, | |||
| </if> | |||
| <if test="createTime != null"> | |||
| create_time = #{createTime}, | |||
| <if test="imageVersion.createTime != null"> | |||
| create_time = #{imageVersion.createTime}, | |||
| </if> | |||
| <if test="updateBy != null and updateBy != ''"> | |||
| update_by = #{updateBy}, | |||
| <if test="imageVersion.updateBy != null and imageVersion.updateBy != ''"> | |||
| update_by = #{imageVersion.updateBy}, | |||
| </if> | |||
| <if test="updateTime != null"> | |||
| update_time = #{updateTime}, | |||
| <if test="imageVersion.updateTime != null"> | |||
| update_time = #{imageVersion.updateTime}, | |||
| </if> | |||
| <if test="state != null"> | |||
| state = #{state}, | |||
| <if test="imageVersion.state != null"> | |||
| state = #{imageVersion.state}, | |||
| </if> | |||
| </set> | |||
| where id = #{id} | |||
| where id = #{imageVersion.id} | |||
| </update> | |||
| <!--通过主键删除--> | |||