springcloudJava学习笔记Spring Boot

基于springboot 基础开源

2017-07-29  本文已影响169人  jey恒

背景

项目地址

使用文档

aip相关common

web相关common

使用

/**
 *  需要继承下 AbstractMvcConfig
 */
@Configuration
public class WebConfig extends AbstractMvcConfig {

  
}
@RestController
@RequestMapping("/sys")
public class GrayController implements Controller {

  @Autowired
  private GrayService grayService;

  @GetMapping("/getServerInfo")
  public List<GrayConfig> getServerInfo() {
    return grayService.getAllConfig();
  }
{
    "code": "G_0000", 
    "msg": "SUCCESS", 
    "result": [
        {
            "app": "testapp", 
            "graying": true, 
            "serverIdList": [
                "localhost:8080", 
                "localhost:8585"
            ], 
            "toServerId": "localhost:8585", 
            "userList": null
        }
    ], 
    "success": true
}

start user swagger ui


spring:
    swagger:
       enable: true
       info:
         basePackage: com.io.groot.gateway.web
         title: 网关API
         contact: junqing.li@mljr.com
         termsOfServiceUrl: http://xxx.api.com
         description: 网关提供入口
         version: 1.0

添加日志debug功能

spring:
    web:
      debug: true
      

分页使用


# 分页插件
pagehelper:
  helperDialect: mysql
  reasonable: true
  rowboundsWithCount: true
  ÓoffsetAsPageNum: true
  supportMethodsArguments: false

@Override
  public Page<RoleDto> getListByParam(RoleParam roleParam, Pagination pagination) {

    PageStart.now(pagination);
    List<Role> list = roleMapper.getListByParam(roleParam);

    return IamGroot.page(list, RoleDto.class, role -> mapForList(role));
  }

上一篇下一篇

猜你喜欢

热点阅读