| @@ -51,10 +51,22 @@ public class ImageController { | |||||
| * @return 单条数据 | * @return 单条数据 | ||||
| */ | */ | ||||
| @GetMapping("{id}") | @GetMapping("{id}") | ||||
| @ApiOperation("按id查询镜像") | |||||
| public AjaxResult queryById(@PathVariable("id") Integer id) { | public AjaxResult queryById(@PathVariable("id") Integer id) { | ||||
| return AjaxResult.success(this.imageService.queryById(id)); | return AjaxResult.success(this.imageService.queryById(id)); | ||||
| } | } | ||||
| /** | |||||
| * 按镜像名字模糊查询 | |||||
| * | |||||
| * @param name 筛选条件 | |||||
| * @return 查询结果 | |||||
| */ | |||||
| @GetMapping("name/{name}") | |||||
| @ApiOperation("按名字模糊查询镜像") | |||||
| public AjaxResult queryByName(@PathVariable("name") String name) { | |||||
| return AjaxResult.success(this.imageService.queryByName(name)); | |||||
| } | |||||
| /** | /** | ||||
| * 新增数据 | * 新增数据 | ||||
| * | * | ||||
| @@ -76,7 +76,7 @@ public class WorkflowController { | |||||
| * @return 新增结果 | * @return 新增结果 | ||||
| */ | */ | ||||
| @PostMapping | @PostMapping | ||||
| @ApiOperation("新增") | |||||
| @ApiOperation("新增流水线") | |||||
| public AjaxResult add(@RequestBody Workflow workflow) { | public AjaxResult add(@RequestBody Workflow workflow) { | ||||
| return AjaxResult.success(this.workflowService.insert(workflow)); | return AjaxResult.success(this.workflowService.insert(workflow)); | ||||
| } | } | ||||
| @@ -79,5 +79,6 @@ public interface ImageDao { | |||||
| */ | */ | ||||
| int deleteById(Integer id); | int deleteById(Integer id); | ||||
| List<Image> queryByName(String name); | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.ruoyi.platform.service; | package com.ruoyi.platform.service; | ||||
| import com.ruoyi.platform.domain.Image; | import com.ruoyi.platform.domain.Image; | ||||
| import com.ruoyi.platform.domain.Workflow; | |||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| @@ -58,4 +59,6 @@ public interface ImageService { | |||||
| boolean deleteById(Integer id); | boolean deleteById(Integer id); | ||||
| String removeById(Integer id); | String removeById(Integer id); | ||||
| Page<Image> queryByName(String name); | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.ruoyi.common.security.utils.SecurityUtils; | |||||
| import com.ruoyi.platform.domain.Image; | import com.ruoyi.platform.domain.Image; | ||||
| import com.ruoyi.platform.domain.ImageVersion; | import com.ruoyi.platform.domain.ImageVersion; | ||||
| import com.ruoyi.platform.domain.Models; | import com.ruoyi.platform.domain.Models; | ||||
| import com.ruoyi.platform.domain.Workflow; | |||||
| import com.ruoyi.platform.mapper.ImageDao; | import com.ruoyi.platform.mapper.ImageDao; | ||||
| import com.ruoyi.platform.mapper.ImageVersionDao; | import com.ruoyi.platform.mapper.ImageVersionDao; | ||||
| import com.ruoyi.platform.service.ImageService; | import com.ruoyi.platform.service.ImageService; | ||||
| @@ -136,4 +137,9 @@ public class ImageServiceImpl implements ImageService { | |||||
| } | } | ||||
| @Override | |||||
| public Page<Image> queryByName(String name) { | |||||
| return new PageImpl<>(this.imageDao.queryByName(name)); | |||||
| } | |||||
| } | } | ||||
| @@ -60,6 +60,19 @@ | |||||
| limit #{pageable.offset}, #{pageable.pageSize} | limit #{pageable.offset}, #{pageable.pageSize} | ||||
| </select> | </select> | ||||
| <!--通过镜像名字进行模糊查询--> | |||||
| <select id="queryByName" resultMap="ImageMap"> | |||||
| select | |||||
| id, name, description, image_type, create_by, create_time, update_by, update_time, state | |||||
| from image | |||||
| <where> | |||||
| state = 1 | |||||
| <if test="name != null and name != ''"> | |||||
| and name like "%"#{name}"%" | |||||
| </if> | |||||
| </where> | |||||
| </select> | |||||
| <!--统计总行数--> | <!--统计总行数--> | ||||
| <select id="count" resultType="java.lang.Long"> | <select id="count" resultType="java.lang.Long"> | ||||