Selaa lähdekoodia

配置swagger

chenyongxing 8 vuotta sitten
vanhempi
commit
7d6c29701f

+ 33 - 1
common/common-swagger/src/main/java/com/yihu/jw/config/SwaggerConfig.java

@ -1,6 +1,7 @@
package com.yihu.jw.config;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.wlyy.WlyyContants;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -15,10 +16,11 @@ import static springfox.documentation.builders.PathSelectors.regex;
@Configuration
@EnableSwagger2
@ComponentScan("com.yihu.jw.*.controller")
@ComponentScan("com.yihu.jw.**")
public class SwaggerConfig {
    public static final String PUBLIC_API = "Default";
    public static final String Base_API = "JwBase";
    public static final String Wlyy_API = "Wlyy";
    @Bean
@ -55,6 +57,36 @@ public class SwaggerConfig {
        return apiInfo;
    }
    @Bean
    public Docket wlyyAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(Wlyy_API)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(false)
                .pathMapping("/")
                .select()
                .paths(or(
                        regex("/" + WlyyContants.Agreement.api_common + "/.*")
                        ,regex("/"+WlyyContants.AgreementKpi.api_common+"/.*")
                        ,regex("/"+WlyyContants.AgreementKpiLog.api_common+"/.*")
                ))
                .build()
                .apiInfo(wlyyApiInfo());
    }
    private ApiInfo wlyyApiInfo() {
        ApiInfo wlyyInfo = new ApiInfo("基卫2.0API",
                "基卫2.0API,提供基础卫生相关服务。",
                "1.0",
                "No terms of service",
                "wenfujian@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return wlyyInfo;
    }
    @Bean
    public Docket jwBaseAPI() {

+ 1 - 1
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/SvrWlyyApplication.java

@ -1,4 +1,4 @@
package com.yihu.jw.wlyy;
package com.yihu.jw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

+ 2 - 1
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/WlyyAgreement.java

@ -1,6 +1,7 @@
package com.yihu.jw.wlyy.entity;
import com.yihu.jw.base.model.base.IdEntity;
import com.yihu.jw.wlyy.entity.base.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;

+ 5 - 2
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/WlyyAgreementKpi.java

@ -1,8 +1,11 @@
package com.yihu.jw.wlyy.entity;
import com.yihu.jw.base.model.base.IdEntity;
import javax.persistence.*;
import com.yihu.jw.wlyy.entity.base.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
/**

+ 6 - 3
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/WlyyAgreementKpiLog.java

@ -1,8 +1,11 @@
package com.yihu.jw.wlyy.entity;
import com.yihu.jw.base.model.base.IdEntity;
import javax.persistence.*;
import com.yihu.jw.wlyy.entity.base.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;
/**
@ -10,7 +13,7 @@ import java.sql.Timestamp;
 */
@Entity
@Table(name = "wlyy_agreement_kpi_log")
public class WlyyAgreementKpiLog extends IdEntity{
public class WlyyAgreementKpiLog extends IdEntity {
    private String code;//业务code
    private String patientCode;//患者code
    private String signCode;

+ 38 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/base/IdEntity.java

@ -0,0 +1,38 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.wlyy.entity.base;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * Oracle需要每个Entity独立定义id的SEQUCENCE时,不继承于本类而改为实现一个Idable的接口。
 * 
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
}