Commit 46a11738 authored by zhaochengming's avatar zhaochengming

赵呈明 -- 修改swagger注解

parent 0218aadd
...@@ -34,9 +34,9 @@ public class OcpApiTreeController { ...@@ -34,9 +34,9 @@ public class OcpApiTreeController {
*/ */
@GetMapping("/getTree") @GetMapping("/getTree")
@ApiOperation("服务树分类") @ApiOperation("服务树分类")
public ApiTreeGroupDto getTree(){ public ResponseVO<ApiTreeGroupDto> getTree(){
ApiTreeGroupDto byGroup = service.getByGroup(); ApiTreeGroupDto byGroup = service.getByGroup();
return byGroup; return ResponseVO.ok(byGroup);
} }
...@@ -51,17 +51,11 @@ public class OcpApiTreeController { ...@@ -51,17 +51,11 @@ public class OcpApiTreeController {
} }
/*@GetMapping("/getone")
@ApiOperation("服务树分类--分级数据")
public List<OcpApiGroup> getOne(int pageSize,int pageNum,int apiGroupLevel){
List<OcpApiGroup> onePage = service.getOnePage(pageSize, pageNum, apiGroupLevel);
return onePage;
}*/
@PostMapping("/getone") @PostMapping("/getone")
@ApiOperation("服务树分类--分级数据") @ApiOperation("服务树分类--分级数据")
public Page<OcpApiGroup> getOne(@RequestBody PageGroupDto pageGroupDto){ public ResponseVO<Page<OcpApiGroup>> getOne(@RequestBody PageGroupDto pageGroupDto){
Page<OcpApiGroup> onePages = service.getOnePages(pageGroupDto); Page<OcpApiGroup> onePages = service.getOnePages(pageGroupDto);
return onePages; return ResponseVO.ok(onePages);
} }
......
package com.pms.ocp.controller;
import com.pms.ocp.model.dto.OcpTenantGroupDto;
import com.pms.ocp.model.entity.OcpTenantGroup;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.TenantService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RequestMapping("/api-tenant/v1")
@RestController
@Api(tags = "应用树管理接口")
public class OcpTenantController {
@Autowired
private TenantService tenantService;
/**
* 应用树分类
*/
@GetMapping("/tenanttree")
@ApiModelProperty("应用树分类")
private OcpTenantGroupDto getTenantTree(){
OcpTenantGroupDto tree = tenantService.getTree();
return tree;
}
@PostMapping("/tenantinster")
@ApiModelProperty("新增应用")
public ResponseVO tenantInster(@RequestBody OcpTenantGroup ocpTenantGroup){
boolean falg = tenantService.getTenanInster(ocpTenantGroup);
if (falg){
return ResponseVO.ok("新建成功!");
}
return ResponseVO.error("应用code已经存在!");
}
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.OcpTenantGroup;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TenantMapper extends BaseMapper<OcpTenantGroup> {
/**
*
* @param tenantGroupCompanyCode
* @return
*/
OcpTenantGroup oneTenantGroup(String tenantGroupCompanyCode);
List<OcpTenantGroup> twoTenantGroups(String tenantGroupCompanyPCode);
}
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.sql.Date;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -101,6 +102,55 @@ public class OcpApiGroupDtos { ...@@ -101,6 +102,55 @@ public class OcpApiGroupDtos {
@ApiModelProperty("服务版本(最新版本)") @ApiModelProperty("服务版本(最新版本)")
private long apiVersion; private long apiVersion;
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public Timestamp getApiGroupCtime() {
return apiGroupCtime;
}
public void setApiGroupCtime(Timestamp apiGroupCtime) {
this.apiGroupCtime = apiGroupCtime;
}
public Timestamp getApiGroupMtime() {
return apiGroupMtime;
}
public void setApiGroupMtime(Timestamp apiGroupMtime) {
this.apiGroupMtime = apiGroupMtime;
}
public Timestamp getApiCtime() {
return apiCtime;
}
public void setApiCtime(Timestamp apiCtime) {
this.apiCtime = apiCtime;
}
public Timestamp getApiMtime() {
return apiMtime;
}
public void setApiMtime(Timestamp apiMtime) {
this.apiMtime = apiMtime;
}
public String getApiGroupCode() { public String getApiGroupCode() {
return apiGroupCode; return apiGroupCode;
} }
...@@ -165,21 +215,7 @@ public class OcpApiGroupDtos { ...@@ -165,21 +215,7 @@ public class OcpApiGroupDtos {
this.apiGroupUserName = apiGroupUserName; this.apiGroupUserName = apiGroupUserName;
} }
public Timestamp getApiGroupCtime() {
return apiGroupCtime;
}
public void setApiGroupCtime(Timestamp apiGroupCtime) {
this.apiGroupCtime = apiGroupCtime;
}
public Timestamp getApiGroupMtime() {
return apiGroupMtime;
}
public void setApiGroupMtime(Timestamp apiGroupMtime) {
this.apiGroupMtime = apiGroupMtime;
}
public String getApiGroupPcode() { public String getApiGroupPcode() {
return apiGroupPcode; return apiGroupPcode;
...@@ -253,21 +289,6 @@ public class OcpApiGroupDtos { ...@@ -253,21 +289,6 @@ public class OcpApiGroupDtos {
this.apiUrl = apiUrl; this.apiUrl = apiUrl;
} }
public Timestamp getApiCtime() {
return apiCtime;
}
public void setApiCtime(Timestamp apiCtime) {
this.apiCtime = apiCtime;
}
public Timestamp getApiMtime() {
return apiMtime;
}
public void setApiMtime(Timestamp apiMtime) {
this.apiMtime = apiMtime;
}
public String getApiUserId() { public String getApiUserId() {
return apiUserId; return apiUserId;
......
package com.pms.ocp.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Set;
@ApiModel(value = "应用返回参数")
@Data
public class OcpTenantGroupDto {
@ApiModelProperty("创建公司")
private Set<String> oneList;
@ApiModelProperty("应用管理")
private List<TwoTenanList> twoList;
@ApiModelProperty("应用层")
private List<ThreeTenanList> ThreeList;
public Set<String> getOneList() {
return oneList;
}
public void setOneList(Set<String> oneList) {
this.oneList = oneList;
}
public List<TwoTenanList> getTwoList() {
return twoList;
}
public void setTwoList(List<TwoTenanList> twoList) {
this.twoList = twoList;
}
public List<ThreeTenanList> getThreeList() {
return ThreeList;
}
public void setThreeList(List<ThreeTenanList> threeList) {
ThreeList = threeList;
}
}
package com.pms.ocp.model.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@EqualsAndHashCode(callSuper=false)
@ApiModel(value = "一级创建公司")
@Data
public class OneTenanList {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty("主键")
private String objId;
/**
* 应用分类编码
*/
@ApiModelProperty("应用分类编码")
private String tenantGroupCode;
/**
* 应用分类名称
*/
@ApiModelProperty("应用分类名称")
private String tenantGroupName;
/**
* 分类创建公司
*/
@ApiModelProperty("分类创建公司")
private String tenantGroupCompanyCode;
/**
* 上级code
*/
@ApiModelProperty("上级code")
private String tenantGroupPcode;
/**
* 应用类别设备级、生态级等
*/
@ApiModelProperty("应用类别设备级、生态级等")
private String tenantType;
/**
* 分类版本
*/
@ApiModelProperty("分类版本")
private String tenantGroupVersion;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
private Integer tenantGroupOrderNo;
/**
* 提交人id
*/
@ApiModelProperty("提交人id")
private String tenantGroupUserId;
/**
* 提交人姓名
*/
@ApiModelProperty("提交人姓名")
private String tenantGroupUserName;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date tenantGroupCtime;
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
private Date tenantGroupMtime;
/**
* 是否删除
*/
@ApiModelProperty("是否删除")
private Short isDelete;
/**
* 应用树层级 1:应用分组层 2:应用层
*/
@ApiModelProperty("应用树层级 1:应用分组层 2:应用层")
private Short tenantGroupLevel;
public String getObjId() {
return objId;
}
public void setObjId(String objId) {
this.objId = objId;
}
public String getTenantGroupCode() {
return tenantGroupCode;
}
public void setTenantGroupCode(String tenantGroupCode) {
this.tenantGroupCode = tenantGroupCode;
}
public String getTenantGroupName() {
return tenantGroupName;
}
public void setTenantGroupName(String tenantGroupName) {
this.tenantGroupName = tenantGroupName;
}
public String getTenantGroupCompanyCode() {
return tenantGroupCompanyCode;
}
public void setTenantGroupCompanyCode(String tenantGroupCompanyCode) {
this.tenantGroupCompanyCode = tenantGroupCompanyCode;
}
public String getTenantGroupPcode() {
return tenantGroupPcode;
}
public void setTenantGroupPcode(String tenantGroupPcode) {
this.tenantGroupPcode = tenantGroupPcode;
}
public String getTenantType() {
return tenantType;
}
public void setTenantType(String tenantType) {
this.tenantType = tenantType;
}
public String getTenantGroupVersion() {
return tenantGroupVersion;
}
public void setTenantGroupVersion(String tenantGroupVersion) {
this.tenantGroupVersion = tenantGroupVersion;
}
public Integer getTenantGroupOrderNo() {
return tenantGroupOrderNo;
}
public void setTenantGroupOrderNo(Integer tenantGroupOrderNo) {
this.tenantGroupOrderNo = tenantGroupOrderNo;
}
public String getTenantGroupUserId() {
return tenantGroupUserId;
}
public void setTenantGroupUserId(String tenantGroupUserId) {
this.tenantGroupUserId = tenantGroupUserId;
}
public String getTenantGroupUserName() {
return tenantGroupUserName;
}
public void setTenantGroupUserName(String tenantGroupUserName) {
this.tenantGroupUserName = tenantGroupUserName;
}
public Date getTenantGroupCtime() {
return tenantGroupCtime;
}
public void setTenantGroupCtime(Date tenantGroupCtime) {
this.tenantGroupCtime = tenantGroupCtime;
}
public Date getTenantGroupMtime() {
return tenantGroupMtime;
}
public void setTenantGroupMtime(Date tenantGroupMtime) {
this.tenantGroupMtime = tenantGroupMtime;
}
public Short getIsDelete() {
return isDelete;
}
public void setIsDelete(Short isDelete) {
this.isDelete = isDelete;
}
public Short getTenantGroupLevel() {
return tenantGroupLevel;
}
public void setTenantGroupLevel(Short tenantGroupLevel) {
this.tenantGroupLevel = tenantGroupLevel;
}
}
package com.pms.ocp.model.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@EqualsAndHashCode(callSuper=false)
@ApiModel(value = "三级应用")
@Data
public class ThreeTenanList {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty("主键")
private String objId;
/**
* 应用分类编码
*/
@ApiModelProperty("应用分类编码")
private String tenantGroupCode;
/**
* 应用分类名称
*/
@ApiModelProperty("应用分类名称")
private String tenantGroupName;
/**
* 分类创建公司
*/
@ApiModelProperty("分类创建公司")
private String tenantGroupCompanyCode;
/**
* 上级code
*/
@ApiModelProperty("上级code")
private String tenantGroupPcode;
/**
* 应用类别设备级、生态级等
*/
@ApiModelProperty("应用类别设备级、生态级等")
private String tenantType;
/**
* 分类版本
*/
@ApiModelProperty("分类版本")
private String tenantGroupVersion;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
private Integer tenantGroupOrderNo;
/**
* 提交人id
*/
@ApiModelProperty("提交人id")
private String tenantGroupUserId;
/**
* 提交人姓名
*/
@ApiModelProperty("提交人姓名")
private String tenantGroupUserName;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date tenantGroupCtime;
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
private Date tenantGroupMtime;
/**
* 是否删除
*/
@ApiModelProperty("是否删除")
private Short isDelete;
/**
* 应用树层级 1:应用分组层 2:应用层
*/
@ApiModelProperty("应用树层级 1:应用分组层 2:应用层")
private Short tenantGroupLevel;
public String getObjId() {
return objId;
}
public void setObjId(String objId) {
this.objId = objId;
}
public String getTenantGroupCode() {
return tenantGroupCode;
}
public void setTenantGroupCode(String tenantGroupCode) {
this.tenantGroupCode = tenantGroupCode;
}
public String getTenantGroupName() {
return tenantGroupName;
}
public void setTenantGroupName(String tenantGroupName) {
this.tenantGroupName = tenantGroupName;
}
public String getTenantGroupCompanyCode() {
return tenantGroupCompanyCode;
}
public void setTenantGroupCompanyCode(String tenantGroupCompanyCode) {
this.tenantGroupCompanyCode = tenantGroupCompanyCode;
}
public String getTenantGroupPcode() {
return tenantGroupPcode;
}
public void setTenantGroupPcode(String tenantGroupPcode) {
this.tenantGroupPcode = tenantGroupPcode;
}
public String getTenantType() {
return tenantType;
}
public void setTenantType(String tenantType) {
this.tenantType = tenantType;
}
public String getTenantGroupVersion() {
return tenantGroupVersion;
}
public void setTenantGroupVersion(String tenantGroupVersion) {
this.tenantGroupVersion = tenantGroupVersion;
}
public Integer getTenantGroupOrderNo() {
return tenantGroupOrderNo;
}
public void setTenantGroupOrderNo(Integer tenantGroupOrderNo) {
this.tenantGroupOrderNo = tenantGroupOrderNo;
}
public String getTenantGroupUserId() {
return tenantGroupUserId;
}
public void setTenantGroupUserId(String tenantGroupUserId) {
this.tenantGroupUserId = tenantGroupUserId;
}
public String getTenantGroupUserName() {
return tenantGroupUserName;
}
public void setTenantGroupUserName(String tenantGroupUserName) {
this.tenantGroupUserName = tenantGroupUserName;
}
public Date getTenantGroupCtime() {
return tenantGroupCtime;
}
public void setTenantGroupCtime(Date tenantGroupCtime) {
this.tenantGroupCtime = tenantGroupCtime;
}
public Date getTenantGroupMtime() {
return tenantGroupMtime;
}
public void setTenantGroupMtime(Date tenantGroupMtime) {
this.tenantGroupMtime = tenantGroupMtime;
}
public Short getIsDelete() {
return isDelete;
}
public void setIsDelete(Short isDelete) {
this.isDelete = isDelete;
}
public Short getTenantGroupLevel() {
return tenantGroupLevel;
}
public void setTenantGroupLevel(Short tenantGroupLevel) {
this.tenantGroupLevel = tenantGroupLevel;
}
}
package com.pms.ocp.model.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
@EqualsAndHashCode(callSuper=false)
@ApiModel(value = "二级应用管理")
@Data
public class TwoTenanList {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty("主键")
private String objId;
/**
* 应用分类编码
*/
@ApiModelProperty("应用分类编码")
private String tenantGroupCode;
/**
* 应用分类名称
*/
@ApiModelProperty("应用分类名称")
private String tenantGroupName;
/**
* 分类创建公司
*/
@ApiModelProperty("分类创建公司")
private String tenantGroupCompanyCode;
/**
* 上级code
*/
@ApiModelProperty("上级code")
private String tenantGroupPcode;
/**
* 应用类别设备级、生态级等
*/
@ApiModelProperty("应用类别设备级、生态级等")
private String tenantType;
/**
* 分类版本
*/
@ApiModelProperty("分类版本")
private String tenantGroupVersion;
/**
* 显示顺序
*/
@ApiModelProperty("显示顺序")
private Integer tenantGroupOrderNo;
/**
* 提交人id
*/
@ApiModelProperty("提交人id")
private String tenantGroupUserId;
/**
* 提交人姓名
*/
@ApiModelProperty("提交人姓名")
private String tenantGroupUserName;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date tenantGroupCtime;
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
private Date tenantGroupMtime;
/**
* 是否删除
*/
@ApiModelProperty("是否删除")
private Short isDelete;
/**
* 应用树层级 1:应用分组层 2:应用层
*/
@ApiModelProperty("应用树层级 1:应用分组层 2:应用层")
private Short tenantGroupLevel;
public String getObjId() {
return objId;
}
public void setObjId(String objId) {
this.objId = objId;
}
public String getTenantGroupCode() {
return tenantGroupCode;
}
public void setTenantGroupCode(String tenantGroupCode) {
this.tenantGroupCode = tenantGroupCode;
}
public String getTenantGroupName() {
return tenantGroupName;
}
public void setTenantGroupName(String tenantGroupName) {
this.tenantGroupName = tenantGroupName;
}
public String getTenantGroupCompanyCode() {
return tenantGroupCompanyCode;
}
public void setTenantGroupCompanyCode(String tenantGroupCompanyCode) {
this.tenantGroupCompanyCode = tenantGroupCompanyCode;
}
public String getTenantGroupPcode() {
return tenantGroupPcode;
}
public void setTenantGroupPcode(String tenantGroupPcode) {
this.tenantGroupPcode = tenantGroupPcode;
}
public String getTenantType() {
return tenantType;
}
public void setTenantType(String tenantType) {
this.tenantType = tenantType;
}
public String getTenantGroupVersion() {
return tenantGroupVersion;
}
public void setTenantGroupVersion(String tenantGroupVersion) {
this.tenantGroupVersion = tenantGroupVersion;
}
public Integer getTenantGroupOrderNo() {
return tenantGroupOrderNo;
}
public void setTenantGroupOrderNo(Integer tenantGroupOrderNo) {
this.tenantGroupOrderNo = tenantGroupOrderNo;
}
public String getTenantGroupUserId() {
return tenantGroupUserId;
}
public void setTenantGroupUserId(String tenantGroupUserId) {
this.tenantGroupUserId = tenantGroupUserId;
}
public String getTenantGroupUserName() {
return tenantGroupUserName;
}
public void setTenantGroupUserName(String tenantGroupUserName) {
this.tenantGroupUserName = tenantGroupUserName;
}
public Date getTenantGroupCtime() {
return tenantGroupCtime;
}
public void setTenantGroupCtime(Date tenantGroupCtime) {
this.tenantGroupCtime = tenantGroupCtime;
}
public Date getTenantGroupMtime() {
return tenantGroupMtime;
}
public void setTenantGroupMtime(Date tenantGroupMtime) {
this.tenantGroupMtime = tenantGroupMtime;
}
public Short getIsDelete() {
return isDelete;
}
public void setIsDelete(Short isDelete) {
this.isDelete = isDelete;
}
public Short getTenantGroupLevel() {
return tenantGroupLevel;
}
public void setTenantGroupLevel(Short tenantGroupLevel) {
this.tenantGroupLevel = tenantGroupLevel;
}
}
...@@ -7,6 +7,8 @@ import io.swagger.annotations.ApiModel; ...@@ -7,6 +7,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.sql.Date;
import java.sql.Timestamp; import java.sql.Timestamp;
@Data @Data
...@@ -175,7 +177,6 @@ public class OcpApiBase { ...@@ -175,7 +177,6 @@ public class OcpApiBase {
this.apiCtime = apiCtime; this.apiCtime = apiCtime;
} }
public Timestamp getApiMtime() { public Timestamp getApiMtime() {
return apiMtime; return apiMtime;
} }
...@@ -184,7 +185,6 @@ public class OcpApiBase { ...@@ -184,7 +185,6 @@ public class OcpApiBase {
this.apiMtime = apiMtime; this.apiMtime = apiMtime;
} }
public String getApiUserId() { public String getApiUserId() {
return apiUserId; return apiUserId;
} }
......
package com.pms.ocp.model.entity; package com.pms.ocp.model.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -8,10 +9,11 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -8,10 +9,11 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("ocp_api_Group") @TableName("ocp_api_group")
@ApiModel("服务分类表") @ApiModel("服务分类表")
public class OcpApiGroup { public class OcpApiGroup {
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
...@@ -58,6 +60,7 @@ public class OcpApiGroup { ...@@ -58,6 +60,7 @@ public class OcpApiGroup {
private long apiGroupLevel; private long apiGroupLevel;
public long getApiGroupLevel() { public long getApiGroupLevel() {
return apiGroupLevel; return apiGroupLevel;
} }
......
package com.pms.ocp.model.entity; package com.pms.ocp.model.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -10,6 +11,7 @@ import lombok.experimental.Accessors; ...@@ -10,6 +11,7 @@ import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 应用分类表 * 应用分类表
...@@ -105,6 +107,12 @@ public class OcpTenantGroup implements Serializable { ...@@ -105,6 +107,12 @@ public class OcpTenantGroup implements Serializable {
@ApiModelProperty("应用树层级 1:应用分组层 2:应用层") @ApiModelProperty("应用树层级 1:应用分组层 2:应用层")
private Short tenantGroupLevel; private Short tenantGroupLevel;
public static long getSerialVersionUID() {
return serialVersionUID;
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
......
package com.pms.ocp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pms.ocp.model.dto.OcpTenantGroupDto;
import com.pms.ocp.model.entity.OcpTenantGroup;
import java.util.List;
public interface TenantService extends IService<OcpTenantGroup> {
/**
* 应用树分类管理
* @return
*/
OcpTenantGroupDto getTree();
/**
* 应用新增
* @param ocpTenantGroup
* @return
*/
boolean getTenanInster(OcpTenantGroup ocpTenantGroup);
}
package com.pms.ocp.service.impl; package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pms.ocp.common.utils.RandomStringUtil; import com.pms.ocp.common.utils.RandomStringUtil;
import com.pms.ocp.mapper.OcpApiBaseMapper; import com.pms.ocp.mapper.OcpApiBaseMapper;
import com.pms.ocp.mapper.OcpApiTreeMapper; import com.pms.ocp.mapper.OcpApiTreeMapper;
import com.pms.ocp.model.dto.*; import com.pms.ocp.model.dto.*;
import com.pms.ocp.model.entity.OcpApiBase; import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiGroup; import com.pms.ocp.model.entity.OcpApiGroup;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.OcpApiTreeService; import com.pms.ocp.service.OcpApiTreeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.sql.Date;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -169,6 +171,7 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -169,6 +171,7 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
break; break;
} }
} }
if (flag == true) { if (flag == true) {
OcpApiBase ocpApiBase = new OcpApiBase(); OcpApiBase ocpApiBase = new OcpApiBase();
ocpApiBase.setApiCode(ocpApiGroupDtos.getApiGroupCode()); ocpApiBase.setApiCode(ocpApiGroupDtos.getApiGroupCode());
...@@ -177,11 +180,12 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -177,11 +180,12 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
ocpApiBase.setApiName("新增服务分类"); ocpApiBase.setApiName("新增服务分类");
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
ocpApiBase.setApiMtime(timestamp); ocpApiBase.setApiMtime(timestamp);
ocpApiBase.setApiCtime(ocpApiGroupDtos.getApiGroupCtime()); ocpApiBase.setApiCtime(timestamp);
ocpApiBase.setApiUserId(ocpApiGroupDtos.getApiGroupUserId()); ocpApiBase.setApiUserId(ocpApiGroupDtos.getApiGroupUserId());
ocpApiBase.setObjId(""); ocpApiBase.setObjId("");
OcpApiGroup ocpApiGroup1 = new OcpApiGroup(); OcpApiGroup ocpApiGroup1 = new OcpApiGroup();
ocpApiGroup1.setObjId(""); ocpApiGroup1.setObjId("");
ocpApiBase.setApiMtime(timestamp);
BeanUtils.copyProperties(ocpApiGroupDtos, ocpApiGroup1); BeanUtils.copyProperties(ocpApiGroupDtos, ocpApiGroup1);
ocpApiGroup1.setApiGroupCode(code); ocpApiGroup1.setApiGroupCode(code);
ocpApiBaseMapper.insert(ocpApiBase); ocpApiBaseMapper.insert(ocpApiBase);
......
package com.pms.ocp.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pms.ocp.common.utils.RandomStringUtil;
import com.pms.ocp.mapper.TenantMapper;
import com.pms.ocp.model.dto.OcpTenantGroupDto;
import com.pms.ocp.model.dto.OneTenanList;
import com.pms.ocp.model.dto.ThreeTenanList;
import com.pms.ocp.model.dto.TwoTenanList;
import com.pms.ocp.model.entity.OcpTenantGroup;
import com.pms.ocp.service.TenantService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup> implements TenantService {
@Autowired
private TenantMapper tenantMapper;
/**
* 应用树分类管理
*
* @return
*/
@Override
public OcpTenantGroupDto getTree() {
List<OcpTenantGroup> ocpTenantGroups = tenantMapper.selectList(null);
//返回参数集合
OcpTenantGroupDto ocpTenantGroupDto = new OcpTenantGroupDto();
//顶级目录
Set<String> stringSet = new HashSet<>();
for (OcpTenantGroup ocpTenantGroup : ocpTenantGroups) {
String tenantGroupCompanyCode = ocpTenantGroup.getTenantGroupCompanyCode();
stringSet.add(tenantGroupCompanyCode);
}
List<TwoTenanList> tenanLists = twoTenanTree(ocpTenantGroups,stringSet);
List<ThreeTenanList> threeTenanLists = ThreeTenanTree(ocpTenantGroups,tenanLists);
ocpTenantGroupDto.setOneList(stringSet);
ocpTenantGroupDto.setTwoList(tenanLists);
ocpTenantGroupDto.setThreeList(threeTenanLists);
return ocpTenantGroupDto;
}
private List<ThreeTenanList> ThreeTenanTree(List<OcpTenantGroup> ocpTenantGroups, List<TwoTenanList> tenanLists) {
//三级应用详情
List<ThreeTenanList> threeTenanLists = new ArrayList<>();
for (TwoTenanList tenanList : tenanLists) {
for (OcpTenantGroup ocpTenantGroup : ocpTenantGroups) {
ThreeTenanList threeTenanList = new ThreeTenanList();
if (tenanList.getTenantGroupCode().equals(ocpTenantGroup.getTenantGroupPcode()) && ocpTenantGroup.getTenantGroupLevel() == 2){
BeanUtils.copyProperties(ocpTenantGroup,threeTenanList);
threeTenanLists.add(threeTenanList);
}
}
}
return threeTenanLists;
}
/**
* 二级 应用管理
* @param ocpTenantGroups
* @param stringSet
* @return
*/
private List<TwoTenanList> twoTenanTree(List<OcpTenantGroup> ocpTenantGroups, Set<String> stringSet) {
//一级数据集合
List<TwoTenanList> twoTenanLists = new ArrayList<>();
for (String code : stringSet) {
for (OcpTenantGroup ocpTenantGroup : ocpTenantGroups) {
TwoTenanList twoTenanList = new TwoTenanList();
if (code.equals(ocpTenantGroup.getTenantGroupCompanyCode()) &&ocpTenantGroup.getTenantGroupLevel() == 1){
BeanUtils.copyProperties(ocpTenantGroup,twoTenanList);
twoTenanLists.add(twoTenanList);
}
}
}
return twoTenanLists;
}
/**
* 应用新增
*
* @param ocpTenantGroup
* @return
*/
@Override
public boolean getTenanInster(OcpTenantGroup ocpTenantGroup) {
boolean falg = true;
OcpTenantGroup group = new OcpTenantGroup();
String tenantGroupCode = ocpTenantGroup.getTenantGroupCode();
List<OcpTenantGroup> ocpTenantGroups = tenantMapper.selectList(null);
for (OcpTenantGroup tenantGroup : ocpTenantGroups) {
if (tenantGroup.getTenantGroupCode().equals(tenantGroupCode)){
falg = false;
break;
}
}
group.setTenantGroupCode(RandomStringUtil.getRandomString(6));
tenantMapper.insert(ocpTenantGroup);
return falg;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment