mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 12:56:28 +08:00
5.0
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -91,6 +91,12 @@
|
||||
<version>${fastmybatis.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.oschina.durcframework</groupId>
|
||||
<artifactId>http-helper</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
|
@@ -99,7 +99,10 @@
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>net.oschina.durcframework</groupId>
|
||||
<artifactId>http-helper</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- test-->
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.common.enums;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.config.Configs;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -11,11 +12,21 @@ import lombok.Getter;
|
||||
public enum ConfigKeyEnum {
|
||||
PASSWORD_SALT("admin.password-salt", ""),
|
||||
JWT_TIMEOUT_DAYS("admin.jwt-timeout-days", "365"),
|
||||
JWT_SECRET("admin.jwt.secret", "");
|
||||
JWT_SECRET("admin.jwt.secret", ""),
|
||||
TORNA_URL("admin.torna-url", ""),
|
||||
OPEN_PROD_URL("admin.open-prod-url", ""),
|
||||
OPEN_SANDBOX_URL("admin.open-sandbox-url", "");
|
||||
|
||||
private final String key;
|
||||
|
||||
private final String defaultValue;
|
||||
|
||||
public String getValue() {
|
||||
return getValue(this.defaultValue);
|
||||
}
|
||||
|
||||
public String getValue(String defaultValue) {
|
||||
return Configs.getValue(this, defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,13 +5,11 @@ import com.gitee.sop.adminbackend.common.util.SystemUtil;
|
||||
import com.gitee.sop.adminbackend.interceptor.LoginInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
|
@@ -0,0 +1,41 @@
|
||||
package com.gitee.sop.adminbackend.controller.doc;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.controller.doc.resp.DocSettingVO;
|
||||
import com.gitee.sop.adminbackend.service.doc.DocService;
|
||||
import com.gitee.sop.adminbackend.service.doc.dto.DocSettingDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 文档设置
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/doc/setting")
|
||||
public class DocSettingController {
|
||||
|
||||
@Autowired
|
||||
private DocService docService;
|
||||
|
||||
@GetMapping("get")
|
||||
public Result<DocSettingVO> get() {
|
||||
DocSettingDTO docSetting = docService.getDocSetting();
|
||||
DocSettingVO docSettingVO = CopyUtil.copyBean(docSetting, DocSettingVO::new);
|
||||
return Result.ok(docSettingVO);
|
||||
}
|
||||
|
||||
@PostMapping("save")
|
||||
public Result<Integer> save(@Validated @RequestBody DocSettingDTO docSettingVO) {
|
||||
docService.save(docSettingVO);
|
||||
return Result.ok(1);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.gitee.sop.adminbackend.controller.doc.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class DocSettingVO {
|
||||
|
||||
private String tornaServerAddr;
|
||||
|
||||
private String openProdUrl;
|
||||
|
||||
private String openSandboxUrl;
|
||||
|
||||
|
||||
|
||||
}
|
@@ -1,22 +1,15 @@
|
||||
package com.gitee.sop.adminbackend.controller.sys;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.controller.sys.req.ConfigSettingParam;
|
||||
import com.gitee.sop.adminbackend.dao.entity.SysConfig;
|
||||
import com.gitee.sop.adminbackend.service.sys.SysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@@ -24,7 +17,7 @@ import javax.annotation.Resource;
|
||||
@RequestMapping("sys/config")
|
||||
public class SysConfigController {
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private SysConfigService sysConfigService;
|
||||
|
||||
/**
|
||||
@@ -34,10 +27,9 @@ public class SysConfigController {
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public Result<Integer> add(@Validated @RequestBody ConfigSettingParam param) {
|
||||
// 返回添加后的主键值
|
||||
sysConfigService.save(param.getItems());
|
||||
return Result.ok(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.gitee.sop.adminbackend.controller.sys.req;
|
||||
|
||||
import com.gitee.sop.adminbackend.service.sys.dto.SystemConfigDTO;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
@@ -12,15 +13,7 @@ import java.util.List;
|
||||
public class ConfigSettingParam {
|
||||
|
||||
@NotEmpty
|
||||
private List<Config> items;
|
||||
private List<SystemConfigDTO> items;
|
||||
|
||||
@Data
|
||||
public static class Config {
|
||||
private String configKey;
|
||||
|
||||
private String configValue;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,54 @@
|
||||
package com.gitee.sop.adminbackend.controller.website;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.annotation.NoToken;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.controller.website.resp.DocAppVO;
|
||||
import com.gitee.sop.adminbackend.controller.website.resp.DocInfoTreeVO;
|
||||
import com.gitee.sop.adminbackend.service.website.WebsiteService;
|
||||
import com.gitee.sop.adminbackend.service.website.dto.DocAppDTO;
|
||||
import com.gitee.sop.adminbackend.service.website.dto.DocInfoTreeDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 提供给网站的接口,不需要校验token
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("website")
|
||||
@NoToken
|
||||
public class WebsiteController {
|
||||
|
||||
@Autowired
|
||||
private WebsiteService websiteService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取文档应用列表
|
||||
*/
|
||||
@GetMapping("listDocApp")
|
||||
public Result<List<DocAppVO>> listDocApp() {
|
||||
List<DocAppDTO> docAppDTOS = websiteService.listDocApp();
|
||||
List<DocAppVO> docAppVOS = CopyUtil.deepCopyList(docAppDTOS, DocAppVO.class);
|
||||
return Result.ok(docAppVOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档菜单树
|
||||
*
|
||||
* @param docAppId 应用id
|
||||
*/
|
||||
@GetMapping("listDocMenuTree")
|
||||
public Result<List<DocInfoTreeVO>> listDocMenuTree(Long docAppId) {
|
||||
List<DocInfoTreeDTO> docInfoTreeDTOS = websiteService.listDocMenuTree(docAppId);
|
||||
List<DocInfoTreeVO> docAppVOS = CopyUtil.deepCopyList(docInfoTreeDTOS, DocInfoTreeVO.class);
|
||||
return Result.ok(docAppVOS);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.gitee.sop.adminbackend.controller.website.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 备注:文档应用
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class DocAppVO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
package com.gitee.sop.adminbackend.controller.website.resp;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.TreeNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 备注:文档信息
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class DocInfoTreeVO implements TreeNode<DocInfoTreeVO, Long> {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* doc_app.id
|
||||
*/
|
||||
private Long docAppId;
|
||||
|
||||
/**
|
||||
* 文档id
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 文档code
|
||||
*/
|
||||
private String docCode;
|
||||
|
||||
/**
|
||||
* 文档类型,1-dubbo,2-富文本,3-Markdown
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 来源类型,1-torna,2-自建
|
||||
*/
|
||||
private Integer sourceType;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否分类
|
||||
*/
|
||||
private Integer isFolder;
|
||||
|
||||
/**
|
||||
* 状态, 0-未发布,1-已发布
|
||||
*/
|
||||
private Integer isPublish;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
private List<DocInfoTreeVO> children;
|
||||
|
||||
|
||||
@Override
|
||||
public Long takeId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long takeParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,58 @@
|
||||
package com.gitee.sop.adminbackend.dao.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.annotation.Pk;
|
||||
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||
import com.gitee.fastmybatis.annotation.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:doc_app
|
||||
* 备注:文档应用
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Table(name = "doc_app", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Data
|
||||
public class DocApp {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* Torna应用token
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,98 @@
|
||||
package com.gitee.sop.adminbackend.dao.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.annotation.Pk;
|
||||
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||
import com.gitee.fastmybatis.annotation.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:doc_info
|
||||
* 备注:文档信息
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Table(name = "doc_info", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Data
|
||||
public class DocInfo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* doc_app.id
|
||||
*/
|
||||
private Long docAppId;
|
||||
|
||||
/**
|
||||
* 文档id
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 文档code
|
||||
*/
|
||||
private String docCode;
|
||||
|
||||
/**
|
||||
* 文档类型,1-dubbo,2-富文本,3-Markdown
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 来源类型,1-torna,2-自建
|
||||
*/
|
||||
private Integer sourceType;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否分类
|
||||
*/
|
||||
private Integer isFolder;
|
||||
|
||||
/**
|
||||
* 状态, 0-未发布,1-已发布
|
||||
*/
|
||||
private Integer isPublish;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.gitee.sop.adminbackend.dao.mapper;
|
||||
|
||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocApp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Mapper
|
||||
public interface DocAppMapper extends BaseMapper<DocApp> {
|
||||
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.gitee.sop.adminbackend.dao.mapper;
|
||||
|
||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Mapper
|
||||
public interface DocInfoMapper extends BaseMapper<DocInfo> {
|
||||
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package com.gitee.sop.adminbackend.service.doc;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||
import com.gitee.sop.adminbackend.service.doc.dto.DocSettingDTO;
|
||||
import com.gitee.sop.adminbackend.service.sys.SysConfigService;
|
||||
import com.gitee.sop.adminbackend.service.sys.dto.SystemConfigDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class DocService {
|
||||
|
||||
@Autowired
|
||||
private SysConfigService sysConfigService;
|
||||
|
||||
public DocSettingDTO getDocSetting() {
|
||||
DocSettingDTO docSettingDTO = new DocSettingDTO();
|
||||
docSettingDTO.setTornaServerAddr(ConfigKeyEnum.TORNA_URL.getValue());
|
||||
docSettingDTO.setOpenProdUrl(ConfigKeyEnum.OPEN_PROD_URL.getValue());
|
||||
docSettingDTO.setOpenSandboxUrl(ConfigKeyEnum.OPEN_SANDBOX_URL.getValue());
|
||||
return docSettingDTO;
|
||||
}
|
||||
|
||||
public void save(DocSettingDTO docSettingDTO) {
|
||||
Collection<SystemConfigDTO> systemConfigDTOS = new ArrayList<>();
|
||||
systemConfigDTOS.add(new SystemConfigDTO(ConfigKeyEnum.TORNA_URL.getKey(), docSettingDTO.getTornaServerAddr(), "Torna服务器地址"));
|
||||
systemConfigDTOS.add(new SystemConfigDTO(ConfigKeyEnum.OPEN_PROD_URL.getKey(), docSettingDTO.getOpenProdUrl(), "开放平台线上地址"));
|
||||
systemConfigDTOS.add(new SystemConfigDTO(ConfigKeyEnum.OPEN_SANDBOX_URL.getKey(), docSettingDTO.getOpenSandboxUrl(), "开放平台沙箱地址"));
|
||||
sysConfigService.save(systemConfigDTOS);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package com.gitee.sop.adminbackend.service.doc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class DocSettingDTO {
|
||||
|
||||
@Length(max = 256)
|
||||
private String tornaServerAddr;
|
||||
@Length(max = 256)
|
||||
private String openProdUrl;
|
||||
@Length(max = 256)
|
||||
private String openSandboxUrl;
|
||||
|
||||
|
||||
}
|
@@ -1,11 +1,15 @@
|
||||
package com.gitee.sop.adminbackend.service.sys.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author tanghc
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SystemConfigDTO {
|
||||
private String configKey;
|
||||
|
||||
|
@@ -0,0 +1,38 @@
|
||||
package com.gitee.sop.adminbackend.service.website;
|
||||
|
||||
import com.gitee.fastmybatis.core.util.TreeUtil;
|
||||
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocApp;
|
||||
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.DocInfoMapper;
|
||||
import com.gitee.sop.adminbackend.service.website.dto.DocAppDTO;
|
||||
import com.gitee.sop.adminbackend.service.website.dto.DocInfoTreeDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class WebsiteService {
|
||||
|
||||
@Autowired
|
||||
private DocAppMapper docAppMapper;
|
||||
@Autowired
|
||||
private DocInfoMapper docInfoMapper;
|
||||
|
||||
public List<DocAppDTO> listDocApp() {
|
||||
List<DocApp> docApps = docAppMapper.listAll();
|
||||
return CopyUtil.copyList(docApps, DocAppDTO::new);
|
||||
}
|
||||
|
||||
public List<DocInfoTreeDTO> listDocMenuTree(Long docAppId) {
|
||||
List<DocInfo> list = docInfoMapper.list(DocInfo::getDocAppId, docAppId);
|
||||
List<DocInfoTreeDTO> treeList = CopyUtil.copyList(list, DocInfoTreeDTO::new);
|
||||
return TreeUtil.convertTree(treeList, 0L);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
package com.gitee.sop.adminbackend.service.website.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.annotation.Pk;
|
||||
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||
import com.gitee.fastmybatis.annotation.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 备注:文档应用
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class DocAppDTO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* Torna应用token
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,106 @@
|
||||
package com.gitee.sop.adminbackend.service.website.dto;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.TreeNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 备注:文档信息
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class DocInfoTreeDTO implements TreeNode<DocInfoTreeDTO, Long> {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* doc_app.id
|
||||
*/
|
||||
private Long docAppId;
|
||||
|
||||
/**
|
||||
* 文档id
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 文档code
|
||||
*/
|
||||
private String docCode;
|
||||
|
||||
/**
|
||||
* 文档类型,1-dubbo,2-富文本,3-Markdown
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 来源类型,1-torna,2-自建
|
||||
*/
|
||||
private Integer sourceType;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String docName;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否分类
|
||||
*/
|
||||
private Integer isFolder;
|
||||
|
||||
/**
|
||||
* 状态, 0-未发布,1-已发布
|
||||
*/
|
||||
private Integer isPublish;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long addBy;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
private List<DocInfoTreeDTO> children;
|
||||
|
||||
|
||||
@Override
|
||||
public Long takeId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long takeParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
}
|
27
sop-admin/sop-admin-frontend/src/api/docSetting.ts
Normal file
27
sop-admin/sop-admin-frontend/src/api/docSetting.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { createUrl, http } from "@/utils/http";
|
||||
import type { PageResult, Result } from "@/model";
|
||||
|
||||
// 后端请求接口
|
||||
const apiUrl: any = createUrl({
|
||||
get: "/doc/setting/get",
|
||||
save: "/doc/setting/save"
|
||||
});
|
||||
|
||||
/**
|
||||
* 接口管理
|
||||
*/
|
||||
export const api: any = {
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
get(): Promise<PageResult> {
|
||||
return http.get<PageResult, any>(apiUrl.get, {});
|
||||
},
|
||||
/**
|
||||
* 新增
|
||||
* @param data 表单内容
|
||||
*/
|
||||
save(data: object) {
|
||||
return http.post<Result<any>, any>(apiUrl.save, { data });
|
||||
}
|
||||
};
|
@@ -1,11 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
const a = 1;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<el-card>1</el-card>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
|
@@ -1,31 +1,15 @@
|
||||
import { ref } from "vue";
|
||||
import type { PlusColumn, FieldValues } from "plus-pro-components";
|
||||
import { api } from "@/api/docSetting";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
export const state = ref<FieldValues>({
|
||||
status: "0",
|
||||
name: "",
|
||||
rate: 4,
|
||||
progress: 100,
|
||||
switch: true,
|
||||
time: new Date().toString(),
|
||||
endTime: [],
|
||||
img: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
|
||||
tornaServerAddr: "",
|
||||
openProdUrl: "",
|
||||
openSandboxUrl: ""
|
||||
});
|
||||
|
||||
export const rules = {
|
||||
tornaServerAddr: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入名称"
|
||||
}
|
||||
],
|
||||
openProdUrl: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入标签"
|
||||
}
|
||||
]
|
||||
};
|
||||
export const rules = {};
|
||||
|
||||
export const columns: PlusColumn[] = [
|
||||
{
|
||||
@@ -55,5 +39,15 @@ export const columns: PlusColumn[] = [
|
||||
];
|
||||
|
||||
export const handleSubmit = (values: FieldValues) => {
|
||||
console.log(values, "Submit");
|
||||
api.save(values).then(() => {
|
||||
ElMessage.success("保存成功");
|
||||
});
|
||||
};
|
||||
|
||||
const loadSetting = () => {
|
||||
api.get().then(resp => {
|
||||
state.value = resp.data;
|
||||
});
|
||||
};
|
||||
|
||||
loadSetting();
|
||||
|
Reference in New Issue
Block a user