Forráskód Böngészése

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/wlyy2.0 into dev

Conflicts:
	svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageEndpoint.java
yeshijie 6 éve
szülő
commit
41f3335209

+ 33 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceDO.java

@ -5,6 +5,8 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
/**
 * 接口
@ -25,6 +27,10 @@ public class InterfaceDO extends UuidIdentityEntity {
    private String remark;//接口说明
    private String url;//https请求地址
    private List<InterfaceParamDO> entryParams;//入参
    private List<InterfaceParamDO> outParams;//出参
    private List<InterfaceErrorCodeDO> errorCodes;//错误说明
    @Column(name = "name")
    public String getName() {
        return name;
@ -114,4 +120,31 @@ public class InterfaceDO extends UuidIdentityEntity {
    public void setUrl(String url) {
        this.url = url;
    }
    @Transient
    public List<InterfaceParamDO> getEntryParams() {
        return entryParams;
    }
    public void setEntryParams(List<InterfaceParamDO> entryParams) {
        this.entryParams = entryParams;
    }
    @Transient
    public List<InterfaceParamDO> getOutParams() {
        return outParams;
    }
    public void setOutParams(List<InterfaceParamDO> outParams) {
        this.outParams = outParams;
    }
    @Transient
    public List<InterfaceErrorCodeDO> getErrorCodes() {
        return errorCodes;
    }
    public void setErrorCodes(List<InterfaceErrorCodeDO> errorCodes) {
        this.errorCodes = errorCodes;
    }
}

+ 26 - 6
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceErrorCodeDO.java

@ -16,8 +16,10 @@ public class InterfaceErrorCodeDO extends UuidIdentityEntity {
    private String interfaceId;//接口id
    private String name;//错误码名称
    private String describe;//错误码描述
    private String description;//错误码描述
    private String solution;//解决方案
    private Integer sort;//排序
    private Integer del;//删除标志
    @Column(name = "interface_id")
    public String getInterfaceId() {
@ -37,13 +39,13 @@ public class InterfaceErrorCodeDO extends UuidIdentityEntity {
        this.name = name;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "solution")
@ -54,4 +56,22 @@ public class InterfaceErrorCodeDO extends UuidIdentityEntity {
    public void setSolution(String solution) {
        this.solution = solution;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 58 - 7
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceParamDO.java

@ -13,16 +13,49 @@ import javax.persistence.Table;
@Entity
@Table(name = "base_interface_param")
public class InterfaceParamDO extends UuidIdentityEntity {
    
    /**
     *
     */
    public enum Type{
        entry("入参",1),
        out("出参",2);
        private String name;
        private Integer value;
        Type(String name, Integer value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public Integer getValue() {
            return value;
        }
        public void setValue(Integer value) {
            this.value = value;
        }
    }
    private String interfaceId;//接口id
    private String name;//参数名
    private Integer paramType;//参数类型
    private Integer dataType;//数据类型
    private Integer isRequire;//是否必填(1是,0否)
    private Integer maxLength;//最大长度
    private String describe;//描述
    private String description;//描述
    private String example;//示例
    private Integer type;//类型(1入参,2出参)
    private Integer sort;//排序
    private Integer del;//删除标志
    @Column(name = "interface_id")
    public String getInterfaceId() {
@ -78,13 +111,13 @@ public class InterfaceParamDO extends UuidIdentityEntity {
        this.maxLength = maxLength;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    @Column(name = "description")
    public String getDescription() {
        return description;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "example")
@ -104,4 +137,22 @@ public class InterfaceParamDO extends UuidIdentityEntity {
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 11 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -18,6 +18,7 @@ public class BaseRequestMapping {
        public static final String UPDATE = "/update";
        public static final String PAGE = "/page";
        public static final String LIST = "/list";
        public static final String FINDBYID = "/findById";
    }
    /**
@ -60,6 +61,16 @@ public class BaseRequestMapping {
        public static final String FIND_ALL  = "/findAll";
    }
    /**
     * 接口
     */
    public static class Interface extends Basic {
        public static final String PREFIX  = "/interface";
        public static final String STATUS  = "/status";
        public static final String IS_NAME_EXIST  = "/isNameExist";
        public static final String FIND_ALL  = "/findAll";
    }
    /**
     * 功能
     */

+ 24 - 12
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceErrorCodeVO.java

@ -3,20 +3,19 @@ package com.yihu.jw.restmodel.base.module;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import javax.persistence.Column;
/**
 * @author yeshijie on 2018/9/28.
 */
@ApiModel(value = "InterfaceVO", description = "接口错误说明")
@ApiModel(value = "InterfaceErrorCodeVO", description = "接口错误说明")
public class InterfaceErrorCodeVO extends UuidIdentityVO {
    private String interfaceId;//接口id
    private String name;//错误码名称
    private String describe;//错误码描述
    private String description;//错误码描述
    private String solution;//解决方案
    private Integer sort;//排序
    private Integer del;//删除标志
    @Column(name = "interface_id")
    public String getInterfaceId() {
        return interfaceId;
    }
@ -25,7 +24,6 @@ public class InterfaceErrorCodeVO extends UuidIdentityVO {
        this.interfaceId = interfaceId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
@ -34,16 +32,14 @@ public class InterfaceErrorCodeVO extends UuidIdentityVO {
        this.name = name;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    public String getDescription() {
        return description;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "solution")
    public String getSolution() {
        return solution;
    }
@ -51,4 +47,20 @@ public class InterfaceErrorCodeVO extends UuidIdentityVO {
    public void setSolution(String solution) {
        this.solution = solution;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 24 - 17
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceParamVO.java

@ -3,12 +3,10 @@ package com.yihu.jw.restmodel.base.module;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import javax.persistence.Column;
/**
 * @author yeshijie on 2018/9/28.
 */
@ApiModel(value = "InterfaceVO", description = "接口入参出参")
@ApiModel(value = "InterfaceParamVO", description = "接口入参出参")
public class InterfaceParamVO extends UuidIdentityVO {
    
    private String interfaceId;//接口id
@ -17,11 +15,12 @@ public class InterfaceParamVO extends UuidIdentityVO {
    private Integer dataType;//数据类型
    private Integer isRequire;//是否必填(1是,0否)
    private Integer maxLength;//最大长度
    private String describe;//描述
    private String description;//描述
    private String example;//示例
    private Integer type;//类型(1入参,2出参)
    private Integer sort;//排序
    private Integer del;//删除标志
    @Column(name = "interface_id")
    public String getInterfaceId() {
        return interfaceId;
    }
@ -30,7 +29,6 @@ public class InterfaceParamVO extends UuidIdentityVO {
        this.interfaceId = interfaceId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
@ -39,7 +37,6 @@ public class InterfaceParamVO extends UuidIdentityVO {
        this.name = name;
    }
    @Column(name = "param_type")
    public Integer getParamType() {
        return paramType;
    }
@ -48,7 +45,6 @@ public class InterfaceParamVO extends UuidIdentityVO {
        this.paramType = paramType;
    }
    @Column(name = "data_type")
    public Integer getDataType() {
        return dataType;
    }
@ -57,7 +53,6 @@ public class InterfaceParamVO extends UuidIdentityVO {
        this.dataType = dataType;
    }
    @Column(name = "is_require")
    public Integer getIsRequire() {
        return isRequire;
    }
@ -66,7 +61,6 @@ public class InterfaceParamVO extends UuidIdentityVO {
        this.isRequire = isRequire;
    }
    @Column(name = "max_length")
    public Integer getMaxLength() {
        return maxLength;
    }
@ -75,16 +69,14 @@ public class InterfaceParamVO extends UuidIdentityVO {
        this.maxLength = maxLength;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    public String getDescription() {
        return description;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "example")
    public String getExample() {
        return example;
    }
@ -93,7 +85,6 @@ public class InterfaceParamVO extends UuidIdentityVO {
        this.example = example;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
@ -101,4 +92,20 @@ public class InterfaceParamVO extends UuidIdentityVO {
    public void setType(Integer type) {
        this.type = type;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 34 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceVO.java

@ -4,6 +4,8 @@ import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * @author yeshijie on 2018/9/28.
 */
@ -28,9 +30,16 @@ public class InterfaceVO extends UuidIdentityVO {
    private Integer status;
    @ApiModelProperty(value = "接口说明", example = "明")
    private String remark;
    @ApiModelProperty(value = "https请求地址", example = "https://")
    @ApiModelProperty(value = "https请求地址", example = "")
    private String url;
    @ApiModelProperty(value = "入参", example = "")
    private List<InterfaceParamVO> entryParams;
    @ApiModelProperty(value = "出参", example = "")
    private List<InterfaceParamVO> outParams;
    @ApiModelProperty(value = "错误说明", example = "")
    private List<InterfaceErrorCodeVO> errorCodes;
    public String getName() {
        return name;
    }
@ -110,4 +119,28 @@ public class InterfaceVO extends UuidIdentityVO {
    public void setUrl(String url) {
        this.url = url;
    }
    public List<InterfaceParamVO> getEntryParams() {
        return entryParams;
    }
    public void setEntryParams(List<InterfaceParamVO> entryParams) {
        this.entryParams = entryParams;
    }
    public List<InterfaceParamVO> getOutParams() {
        return outParams;
    }
    public void setOutParams(List<InterfaceParamVO> outParams) {
        this.outParams = outParams;
    }
    public List<InterfaceErrorCodeVO> getErrorCodes() {
        return errorCodes;
    }
    public void setErrorCodes(List<InterfaceErrorCodeVO> errorCodes) {
        this.errorCodes = errorCodes;
    }
}

+ 5 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.base.dao.module;
import com.yihu.jw.entity.base.module.InterfaceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -11,4 +13,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface InterfaceDao extends PagingAndSortingRepository<InterfaceDO, String>, JpaSpecificationExecutor<InterfaceDO> {
    @Modifying
    @Query("update InterfaceDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,Integer status);
}

+ 9 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceErrorCodeDao.java

@ -2,13 +2,22 @@ package com.yihu.jw.base.dao.module;
import com.yihu.jw.entity.base.module.InterfaceErrorCodeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 接口错误说明
 * @author yeshijie on 2018/9/28.
 */
public interface InterfaceErrorCodeDao extends PagingAndSortingRepository<InterfaceErrorCodeDO, String>, JpaSpecificationExecutor<InterfaceErrorCodeDO> {
    @Query("from InterfaceErrorCodeDO w where w.interfaceId =?1 and w.del=1")
    List<InterfaceErrorCodeDO> findByInterfaceId(String interfaceId);
    @Modifying
    @Query("delete from InterfaceErrorCodeDO p where p.interfaceId=?1")
    void deleteByInterfaceId(String interfaceId);
}

+ 10 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceParamDao.java

@ -2,13 +2,22 @@ package com.yihu.jw.base.dao.module;
import com.yihu.jw.entity.base.module.InterfaceParamDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 接口入参出参
 * @author yeshijie on 2018/9/28.
 */
public interface InterfaceParamDao extends PagingAndSortingRepository<InterfaceParamDO, String>, JpaSpecificationExecutor<InterfaceParamDO> {
    
    @Query("from InterfaceParamDO w where w.interfaceId =?1 and w.del=1")
    List<InterfaceParamDO> findByInterfaceId(String interfaceId);
    @Modifying
    @Query("delete from InterfaceParamDO p where p.interfaceId=?1")
    void deleteByInterfaceId(String interfaceId);
}

+ 121 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/module/InterfaceEndpoint.java

@ -0,0 +1,121 @@
package com.yihu.jw.base.endpoint.module;
import com.yihu.jw.base.service.module.InterfaceService;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.entity.base.module.InterfaceDO;
import com.yihu.jw.exception.code.BaseErrorCode;
import com.yihu.jw.restmodel.base.module.InterfaceVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * 接口
 * @author yeshijie on 2018/9/29.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.Interface.PREFIX)
@Api(value = "接口管理", description = "接口管理服务接口", tags = {"基础服务 - 接口管理服务接口"})
public class InterfaceEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private InterfaceService interfaceService;
    @Autowired
    private ErrorCodeUtil errorCodeUtil;
    @PostMapping(value = BaseRequestMapping.Interface.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<InterfaceVO> create (
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        InterfaceDO interfaceDO = toEntity(jsonData, InterfaceDO.class);
        interfaceDO = interfaceService.addInterface(interfaceDO);
        return success(interfaceDO, InterfaceVO.class);
    }
    @GetMapping(value = BaseRequestMapping.Interface.FINDBYID)
    @ApiOperation(value = "按id查找")
    public ObjEnvelop<InterfaceVO> findById (
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) throws Exception {
        InterfaceDO interfaceDO = interfaceService.findById(id);
        return success(interfaceDO, InterfaceVO.class);
    }
    @PostMapping(value = BaseRequestMapping.Interface.STATUS)
    @ApiOperation(value = "生效/失效")
    public Envelop status(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id,
            @ApiParam(name = "status", value = "1生效,0失效", required = true)
            @RequestParam(value = "status") Integer status) {
        interfaceService.updateStatus(id, status);
        return success("修改成功");
    }
    @PostMapping(value = BaseRequestMapping.Interface.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        interfaceService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.Interface.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<InterfaceVO> update (
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        InterfaceDO interfaceDO = toEntity(jsonData, InterfaceDO.class);
        if (null == interfaceDO.getId()) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Common.ID_IS_NULL), ObjEnvelop.class);
        }
        interfaceDO = interfaceService.addInterface(interfaceDO);
        return success(interfaceDO, InterfaceVO.class);
    }
    @GetMapping(value = BaseRequestMapping.Interface.PAGE)
    @ApiOperation(value = "获取分页")
    public PageEnvelop<InterfaceVO> page (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<InterfaceDO> modules = interfaceService.search(fields, filters, sorts, page, size);
        int count = (int)interfaceService.getCount(filters);
        return success(modules, count, page, size, InterfaceVO.class);
    }
    @GetMapping(value = BaseRequestMapping.Interface.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<InterfaceVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<InterfaceDO> interfaceDOs = interfaceService.search(fields, filters, sorts);
        return success(interfaceDOs, InterfaceVO.class);
    }
}

+ 81 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/module/InterfaceService.java

@ -1,9 +1,19 @@
package com.yihu.jw.base.service.module;
import com.yihu.jw.base.dao.module.InterfaceDao;
import com.yihu.jw.base.dao.module.InterfaceErrorCodeDao;
import com.yihu.jw.base.dao.module.InterfaceParamDao;
import com.yihu.jw.entity.base.module.InterfaceDO;
import com.yihu.jw.entity.base.module.InterfaceErrorCodeDO;
import com.yihu.jw.entity.base.module.InterfaceParamDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
/**
 * 接口
@ -12,5 +22,76 @@ import org.springframework.stereotype.Service;
@Service
public class InterfaceService extends BaseJpaService<InterfaceDO, InterfaceDao> {
    @Autowired
    private InterfaceDao interfaceDao;
    @Autowired
    private InterfaceParamDao interfaceParamDao;
    @Autowired
    private InterfaceErrorCodeDao interfaceErrorCodeDao;
    /**
     * 返回接口
     * @param id
     * @return
     */
    public InterfaceDO findById(String id){
        InterfaceDO interfaceDO = interfaceDao.findOne(id);
        List<InterfaceParamDO> paramDOList = interfaceParamDao.findByInterfaceId(id);
        List<InterfaceParamDO> entryParams = paramDOList.stream()
                .filter(interfaceParamDO -> InterfaceParamDO.Type.entry.getValue().equals(interfaceParamDO.getType()))
                .collect(Collectors.toList());
        List<InterfaceParamDO> outParams = paramDOList.stream()
                .filter(interfaceParamDO -> InterfaceParamDO.Type.out.getValue().equals(interfaceParamDO.getType()))
                .collect(Collectors.toList());
        List<InterfaceErrorCodeDO> errorCodeDOList = interfaceErrorCodeDao.findByInterfaceId(id);
        interfaceDO.setErrorCodes(errorCodeDOList);
        interfaceDO.setEntryParams(entryParams);
        interfaceDO.setOutParams(outParams);
        return interfaceDO;
    }
    /**
     * 新增接口
     * @param interfaceDO
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public InterfaceDO addInterface(InterfaceDO interfaceDO){
        if(StringUtils.isNotBlank(interfaceDO.getId())){
            interfaceParamDao.deleteByInterfaceId(interfaceDO.getId());
            interfaceErrorCodeDao.deleteByInterfaceId(interfaceDO.getId());
        }
        List<InterfaceParamDO> entryParams = interfaceDO.getEntryParams();
        List<InterfaceParamDO> outParams = interfaceDO.getOutParams();
        List<InterfaceErrorCodeDO> errorCodes = interfaceDO.getErrorCodes();
        interfaceDao.save(interfaceDO);
        entryParams.forEach(interfaceParamDO -> {
            interfaceParamDO.setInterfaceId(interfaceDO.getId());
        });
        outParams.forEach(interfaceParamDO -> {
            interfaceParamDO.setInterfaceId(interfaceDO.getId());
        });
        errorCodes.forEach(interfaceErrorCodeDO -> {
            interfaceErrorCodeDO.setInterfaceId(interfaceDO.getId());
        });
        interfaceParamDao.save(entryParams);
        interfaceParamDao.save(outParams);
        interfaceErrorCodeDao.save(errorCodes);
        return interfaceDO;
    }
    /**
     * 设置生效和失效
     * @param id
     * @param status
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateStatus(String id,Integer status){
        interfaceDao.updateStatus(id,status);
    }
}