test.App Maven / Gradle / Ivy
package test;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jchanghong.autoconfig.AutoConfig;
import jchanghong.kotlin.AnysKt;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import test.test.MapperTest1;
import test.test.dao.DOTable1;
import test.test2.MapperTest2;
import test.test2.dao.AutoMapperTable12;
import java.util.List;
import java.util.Map;
@SpringBootApplication
@EnableSwagger2
@MapperScan("test.test")
public class App implements CommandLineRunner {
@Autowired
MapperTest1 mapperTest1;
@Autowired
AutoMapperTable12 autoMapperTable2;
@Autowired
test.test.dao.AutoMapperTable1 autoMapperTable1;
@Autowired
MapperTest2 mapperTest2;
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
// 自行修改为自己的包路径
.apis(RequestHandlerSelectors.basePackage("com.hikvision.cq.check"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("运维平台接口文档")
.description("运维平台所有相关的接口")
//服务条款网址
//.termsOfServiceUrl("http://blog.csdn.net/forezp")
.version("1.0")
//.contact(new Contact("岳阳", "url", "email"))
.build();
}
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
@Override
public void run(String... args) throws Exception {
AutoConfig.INSTANCE.setLogSql(true);
Page page = new Page<>(1, 1);
autoMapperTable1.selectPage(page,null);
// table1s = autoMapperTable1.selectList(new QueryWrapper()
// .lambda().eq(DOTable1::getId,1L));
autoMapperTable1.insert(new DOTable1(1111L, "sadasdsa"));
List doTable1s = autoMapperTable2.selectList(null);
List doTable1s1 = mapperTest1.selectBlog();
List