diff --git a/src/main/java/com/aos/fileidentify/AosFileIdentifyApplication.java b/src/main/java/com/aos/fileidentify/AosFileIdentifyApplication.java index 923012a..1275a70 100644 --- a/src/main/java/com/aos/fileidentify/AosFileIdentifyApplication.java +++ b/src/main/java/com/aos/fileidentify/AosFileIdentifyApplication.java @@ -15,7 +15,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * @since 0.0.1 */ @SpringBootApplication -@MapperScan("com.aos.fileidentify.mapper") public class AosFileIdentifyApplication { /** diff --git a/src/main/java/com/aos/fileidentify/config/MybatisPlusConfig.java b/src/main/java/com/aos/fileidentify/config/MybatisPlusConfig.java new file mode 100644 index 0000000..408a3ae --- /dev/null +++ b/src/main/java/com/aos/fileidentify/config/MybatisPlusConfig.java @@ -0,0 +1,29 @@ +package com.aos.fileidentify.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@MapperScan("com.aos.fileidentify.mapper") +public class MybatisPlusConfig { + /** + * IPage的分页使用的是拦截器,属于物理分页,好处就是处理大量数据时,查询速度快。 + * 有兴趣的同学可以看看什么是物理分页和逻辑分页。 + * + * @return + */ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + //向Mybatis过滤器链中添加分页拦截器 + interceptor.addInnerInterceptor(new + PaginationInnerInterceptor(DbType.MYSQL)); + return interceptor; + } + +} diff --git a/src/main/java/com/aos/fileidentify/controller/EmployeeController.java b/src/main/java/com/aos/fileidentify/controller/EmployeeController.java index 7c3ac44..20946f3 100644 --- a/src/main/java/com/aos/fileidentify/controller/EmployeeController.java +++ b/src/main/java/com/aos/fileidentify/controller/EmployeeController.java @@ -4,6 +4,7 @@ import com.aos.fileidentify.common.ResultDTO; import com.aos.fileidentify.entity.Employee; import com.aos.fileidentify.service.EmployeeService; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,6 +15,8 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; +import javax.validation.constraints.NotBlank; + /** *
Company: 成都返空汇网络技术有限公司
*Description:
@@ -45,4 +48,16 @@ public class EmployeeController { return this.employeeService.getAllEmployee(); } + /** + * Gets all employee * + * + * @return the all employee + * @since 0.0.1 + */ + @ApiOperation(value = "员工所有数据查询") + @GetMapping(value = "/page") + public ResultDTO