| @@ -0,0 +1,35 @@ | |||||
| package com.ruoyi.platform.controller.autoML; | |||||
| import com.ruoyi.common.core.web.controller.BaseController; | |||||
| import com.ruoyi.common.core.web.domain.GenericsAjaxResult; | |||||
| import com.ruoyi.platform.domain.AutoMl; | |||||
| import com.ruoyi.platform.service.AutoMLService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageRequest; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RequestParam; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import javax.annotation.Resource; | |||||
| @RestController | |||||
| @RequestMapping("autoML") | |||||
| @Api("自动机器学习") | |||||
| public class AutoMLController extends BaseController { | |||||
| @Resource | |||||
| private AutoMLService autoMLService; | |||||
| @GetMapping | |||||
| @ApiOperation("分页查询") | |||||
| public GenericsAjaxResult<Page<AutoMl>> queryByPage(@RequestParam("page") int page, | |||||
| @RequestParam("size") int size, | |||||
| @RequestParam(value = "mlName", required = false) String mlName) { | |||||
| PageRequest pageRequest = PageRequest.of(page, size); | |||||
| return genericsSuccess(this.autoMLService.queryByPage(mlName, pageRequest)); | |||||
| } | |||||
| } | |||||
| @@ -7,7 +7,6 @@ import com.ruoyi.platform.service.CodeConfigService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| import org.springframework.http.ResponseEntity; | |||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| @@ -0,0 +1,31 @@ | |||||
| package com.ruoyi.platform.domain; | |||||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | |||||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||||
| import lombok.Data; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | |||||
| public class AutoMl { | |||||
| private Long id; | |||||
| private String mlName; | |||||
| private String mlDescription; | |||||
| private Integer state; | |||||
| private String runState; | |||||
| private Double progress; | |||||
| private String createBy; | |||||
| private Date createTime; | |||||
| private String updateBy; | |||||
| private Date updateTime; | |||||
| } | |||||
| @@ -0,0 +1,13 @@ | |||||
| package com.ruoyi.platform.mapper; | |||||
| import com.ruoyi.platform.domain.AutoMl; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import org.springframework.data.domain.Pageable; | |||||
| import java.util.List; | |||||
| public interface AutoMLDao { | |||||
| long count(@Param("mlName") String mlName); | |||||
| List<AutoMl> queryByPage(@Param("mlName") String mlName, @Param("pageable") Pageable pageable); | |||||
| } | |||||
| @@ -0,0 +1,9 @@ | |||||
| package com.ruoyi.platform.service; | |||||
| import com.ruoyi.platform.domain.AutoMl; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageRequest; | |||||
| public interface AutoMLService { | |||||
| Page<AutoMl> queryByPage(String mlName, PageRequest pageRequest); | |||||
| } | |||||
| @@ -0,0 +1,25 @@ | |||||
| package com.ruoyi.platform.service.impl; | |||||
| import com.ruoyi.platform.domain.AutoMl; | |||||
| import com.ruoyi.platform.mapper.AutoMLDao; | |||||
| import com.ruoyi.platform.service.AutoMLService; | |||||
| import org.springframework.data.domain.Page; | |||||
| import org.springframework.data.domain.PageImpl; | |||||
| import org.springframework.data.domain.PageRequest; | |||||
| import org.springframework.stereotype.Service; | |||||
| import javax.annotation.Resource; | |||||
| import java.util.List; | |||||
| @Service("autoMLService") | |||||
| public class AutoMLServiceImpl implements AutoMLService { | |||||
| @Resource | |||||
| private AutoMLDao autoMLDao; | |||||
| @Override | |||||
| public Page<AutoMl> queryByPage(String mlName, PageRequest pageRequest) { | |||||
| long total = autoMLDao.count(mlName); | |||||
| List<AutoMl> autoMls = autoMLDao.queryByPage(mlName, pageRequest); | |||||
| return new PageImpl<>(autoMls, pageRequest, total); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,23 @@ | |||||
| <?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.mapper.AutoMLDao"> | |||||
| <select id="count" resultType="java.lang.Long"> | |||||
| select count(1) from auto_ml | |||||
| <include refid="common_condition"></include> | |||||
| </select> | |||||
| <select id="queryByPage" resultType="com.ruoyi.platform.domain.AutoMl"> | |||||
| select * from auto_ml | |||||
| <include refid="common_condition"></include> | |||||
| </select> | |||||
| <sql id="common_condition"> | |||||
| <where> | |||||
| state = 1 | |||||
| <if test="mlName != null and mlName != ''"> | |||||
| and ml_name like concat('%', #{mlName}, '%') | |||||
| </if> | |||||
| </where> | |||||
| </sql> | |||||
| </mapper> | |||||