Pre Merge pull request !274 from 飞扬/server
commit
70b30a56b8
@ -0,0 +1,104 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>server-moules-xm</artifactId>
|
||||||
|
<description>
|
||||||
|
server-modules-xm脑图模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger UI -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>${swagger.fox.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RuoYi Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RuoYi Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RuoYi Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RuoYi Common Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.server.xm;
|
||||||
|
|
||||||
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
|
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableRyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.server.xm.mapper")
|
||||||
|
public class ServerXmApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ServerXmApplication.class, args);
|
||||||
|
System.out.println("Server-XM模块启动成功");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.server.xm.controller;
|
||||||
|
|
||||||
|
import com.server.xm.entity.XmNode;
|
||||||
|
import com.server.xm.service.XmNodeService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Xmind列表(XmNode)表控制层
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-24 22:16:42
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("xmNode")
|
||||||
|
public class XmNodeController {
|
||||||
|
/**
|
||||||
|
* 服务对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private XmNodeService xmNodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 单条数据
|
||||||
|
*/
|
||||||
|
@GetMapping("selectOne")
|
||||||
|
public XmNode selectOne(String id) {
|
||||||
|
return this.xmNodeService.queryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.server.xm.controller;
|
||||||
|
|
||||||
|
import com.server.xm.entity.XmNodeStyle;
|
||||||
|
import com.server.xm.service.XmNodeStyleService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样式表(XmNodeStyle)表控制层
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-24 22:33:28
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("xmNodeStyle")
|
||||||
|
public class XmNodeStyleController {
|
||||||
|
/**
|
||||||
|
* 服务对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private XmNodeStyleService xmNodeStyleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 单条数据
|
||||||
|
*/
|
||||||
|
@GetMapping("selectOne")
|
||||||
|
public XmNodeStyle selectOne(String id) {
|
||||||
|
return this.xmNodeStyleService.queryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.server.xm.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
import com.server.xm.entity.XmTop;
|
||||||
|
import com.server.xm.entity.vo.XmTopVo;
|
||||||
|
import com.server.xm.service.XmTopService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Xmind列表(XmTop)表控制层
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-23 12:50:31
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/xmTop")
|
||||||
|
public class XmTopController extends BaseController {
|
||||||
|
/**
|
||||||
|
* 服务对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private XmTopService xmTopService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 单条数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/findOne/{id}")
|
||||||
|
public XmTopVo selectOne(@PathVariable("id") String id) {
|
||||||
|
return this.xmTopService.queryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
public TableDataInfo page(XmTop xmTop){
|
||||||
|
startPage();
|
||||||
|
List<XmTop> list = this.xmTopService.queryAll(xmTop);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
@PostMapping("/create")
|
||||||
|
public AjaxResult create(@RequestBody XmTopVo xmTopVo){
|
||||||
|
this.xmTopService.insert(xmTopVo);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,124 @@
|
|||||||
|
package com.server.xm.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.ruoyi.common.core.utils.uuid.UUID;
|
||||||
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
|
import com.server.xm.entity.vo.XmTopVo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样式表(XmNodeStyle)实体类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-24 22:33:26
|
||||||
|
*/
|
||||||
|
public class XmNodeStyle extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = -43953448497497403L;
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String direction;
|
||||||
|
/**
|
||||||
|
* 所属节点ID
|
||||||
|
*/
|
||||||
|
private String hyperLink;
|
||||||
|
/**
|
||||||
|
* 图标
|
||||||
|
*/
|
||||||
|
private String icons;
|
||||||
|
|
||||||
|
private String memo;
|
||||||
|
/**
|
||||||
|
* 样式
|
||||||
|
*/
|
||||||
|
private String style;
|
||||||
|
/**
|
||||||
|
* 标签
|
||||||
|
*/
|
||||||
|
private String tags;
|
||||||
|
/**
|
||||||
|
* 节点ID
|
||||||
|
*/
|
||||||
|
private String nodeId;
|
||||||
|
|
||||||
|
public XmNodeStyle(){}
|
||||||
|
public XmNodeStyle(XmTopVo xmTopVo){
|
||||||
|
this.setId(UUID.randomUUID().toString());
|
||||||
|
this.setDirection(xmTopVo.getDirection().toString());
|
||||||
|
this.setIcons(JSON.toJSONString(xmTopVo.getIcons()));
|
||||||
|
this.setTags(JSON.toJSONString(xmTopVo.getTags()));
|
||||||
|
this.setMemo(xmTopVo.getMemo());
|
||||||
|
this.setHyperLink(xmTopVo.getHyperLink());
|
||||||
|
this.setStyle(JSON.toJSONString(xmTopVo.getStyle()));
|
||||||
|
this.setNodeId(xmTopVo.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDirection() {
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirection(String direction) {
|
||||||
|
this.direction = direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHyperLink() {
|
||||||
|
return hyperLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHyperLink(String hyperLink) {
|
||||||
|
this.hyperLink = hyperLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIcons() {
|
||||||
|
return icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcons(String icons) {
|
||||||
|
this.icons = icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMemo() {
|
||||||
|
return memo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMemo(String memo) {
|
||||||
|
this.memo = memo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStyle() {
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStyle(String style) {
|
||||||
|
this.style = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTags(String tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNodeId() {
|
||||||
|
return nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeId(String nodeId) {
|
||||||
|
this.nodeId = nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
package com.server.xm.entity.vo;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.nacos.shaded.com.google.gson.JsonArray;
|
||||||
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
||||||
|
import com.ruoyi.common.core.utils.bean.BeanUtils;
|
||||||
|
import com.server.xm.entity.XmNodeStyle;
|
||||||
|
import com.server.xm.entity.XmTop;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class XmTopVo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 814901162125497459L;
|
||||||
|
private String id;
|
||||||
|
private String topic;
|
||||||
|
private Integer direction;
|
||||||
|
private String hyperLink;
|
||||||
|
private String memo;
|
||||||
|
private String nodeLevel;
|
||||||
|
private List<String> icons;
|
||||||
|
private Map<String,Object> style;
|
||||||
|
private List<String> tags;
|
||||||
|
private List<XmTopVo> children;
|
||||||
|
|
||||||
|
public XmTopVo() {
|
||||||
|
if(null == this.id){
|
||||||
|
this.setId(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public XmTopVo(XmTop top, XmNodeStyle style){
|
||||||
|
//基本信息同步
|
||||||
|
BeanUtils.copyProperties(top,this);
|
||||||
|
this.setTopic(top.getName());
|
||||||
|
this.setIcons(JSON.parseObject(style.getIcons(), ArrayList.class));
|
||||||
|
this.setStyle(JSON.parseObject(style.getStyle(),Map.class));
|
||||||
|
this.setTags(JSON.parseObject(style.getTags(),ArrayList.class));
|
||||||
|
this.setDirection(Integer.parseInt(style.getDirection()));
|
||||||
|
this.setHyperLink(style.getHyperLink());
|
||||||
|
this.setMemo(style.getMemo());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTopic() {
|
||||||
|
return topic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTopic(String topic) {
|
||||||
|
this.topic = topic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDirection() {
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirection(Integer direction) {
|
||||||
|
this.direction = direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHyperLink() {
|
||||||
|
return hyperLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHyperLink(String hyperLink) {
|
||||||
|
this.hyperLink = hyperLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getIcons() {
|
||||||
|
return icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcons(List<String> icons) {
|
||||||
|
this.icons = icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMemo() {
|
||||||
|
return memo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMemo(String memo) {
|
||||||
|
this.memo = memo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getStyle() {
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStyle(Map<String, Object> style) {
|
||||||
|
this.style = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTags(List<String> tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<XmTopVo> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<XmTopVo> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNodeLevel() {
|
||||||
|
return nodeLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeLevel(String nodeLevel) {
|
||||||
|
this.nodeLevel = nodeLevel;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.server.xm.service;
|
||||||
|
|
||||||
|
import com.server.xm.entity.XmNode;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Xmind列表(XmNode)表服务接口
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-24 22:16:42
|
||||||
|
*/
|
||||||
|
public interface XmNodeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
XmNode queryById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多条数据
|
||||||
|
*
|
||||||
|
* @param offset 查询起始位置
|
||||||
|
* @param limit 查询条数
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
List<XmNode> queryAllByLimit(int offset, int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param xmNode 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
XmNode insert(XmNode xmNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param xmNode 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
XmNode update(XmNode xmNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteById(String id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.server.xm.service;
|
||||||
|
|
||||||
|
import com.server.xm.entity.XmNodeStyle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样式表(XmNodeStyle)表服务接口
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-24 22:33:28
|
||||||
|
*/
|
||||||
|
public interface XmNodeStyleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
XmNodeStyle queryById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多条数据
|
||||||
|
*
|
||||||
|
* @param offset 查询起始位置
|
||||||
|
* @param limit 查询条数
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
List<XmNodeStyle> queryAllByLimit(int offset, int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param xmNodeStyle 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
XmNodeStyle insert(XmNodeStyle xmNodeStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param xmNodeStyle 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
XmNodeStyle update(XmNodeStyle xmNodeStyle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteById(String id);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.server.xm.service.impl;
|
||||||
|
|
||||||
|
import com.server.xm.entity.XmNode;
|
||||||
|
import com.server.xm.mapper.XmNodeMapper;
|
||||||
|
import com.server.xm.service.XmNodeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Xmind列表(XmNode)表服务实现类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-24 22:16:42
|
||||||
|
*/
|
||||||
|
@Service("xmNodeService")
|
||||||
|
public class XmNodeServiceImpl implements XmNodeService {
|
||||||
|
@Resource
|
||||||
|
private XmNodeMapper xmNodeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmNode queryById(String id) {
|
||||||
|
return this.xmNodeMapper.queryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多条数据
|
||||||
|
*
|
||||||
|
* @param offset 查询起始位置
|
||||||
|
* @param limit 查询条数
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<XmNode> queryAllByLimit(int offset, int limit) {
|
||||||
|
return this.xmNodeMapper.queryAllByLimit(offset, limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param xmNode 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmNode insert(XmNode xmNode) {
|
||||||
|
this.xmNodeMapper.insert(xmNode);
|
||||||
|
return xmNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param xmNode 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmNode update(XmNode xmNode) {
|
||||||
|
this.xmNodeMapper.update(xmNode);
|
||||||
|
return this.queryById(xmNode.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(String id) {
|
||||||
|
return this.xmNodeMapper.deleteById(id) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.server.xm.service.impl;
|
||||||
|
|
||||||
|
import com.server.xm.entity.XmNodeStyle;
|
||||||
|
import com.server.xm.mapper.XmNodeStyleMapper;
|
||||||
|
import com.server.xm.service.XmNodeStyleService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 样式表(XmNodeStyle)表服务实现类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-24 22:33:28
|
||||||
|
*/
|
||||||
|
@Service("xmNodeStyleService")
|
||||||
|
public class XmNodeStyleServiceImpl implements XmNodeStyleService {
|
||||||
|
@Resource
|
||||||
|
private XmNodeStyleMapper xmNodeStyleMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmNodeStyle queryById(String id) {
|
||||||
|
return this.xmNodeStyleMapper.queryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多条数据
|
||||||
|
*
|
||||||
|
* @param offset 查询起始位置
|
||||||
|
* @param limit 查询条数
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<XmNodeStyle> queryAllByLimit(int offset, int limit) {
|
||||||
|
return this.xmNodeStyleMapper.queryAllByLimit(offset, limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param xmNodeStyle 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmNodeStyle insert(XmNodeStyle xmNodeStyle) {
|
||||||
|
this.xmNodeStyleMapper.insert(xmNodeStyle);
|
||||||
|
return xmNodeStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param xmNodeStyle 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmNodeStyle update(XmNodeStyle xmNodeStyle) {
|
||||||
|
this.xmNodeStyleMapper.update(xmNodeStyle);
|
||||||
|
return this.queryById(xmNodeStyle.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(String id) {
|
||||||
|
return this.xmNodeStyleMapper.deleteById(id) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,154 @@
|
|||||||
|
package com.server.xm.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.server.xm.entity.XmNode;
|
||||||
|
import com.server.xm.entity.XmNodeStyle;
|
||||||
|
import com.server.xm.entity.XmTop;
|
||||||
|
import com.server.xm.entity.vo.XmTopVo;
|
||||||
|
import com.server.xm.mapper.XmNodeMapper;
|
||||||
|
import com.server.xm.mapper.XmNodeStyleMapper;
|
||||||
|
import com.server.xm.mapper.XmTopMapper;
|
||||||
|
import com.server.xm.service.XmTopService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Xmind列表(XmTop)表服务实现类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-10-23 12:50:29
|
||||||
|
*/
|
||||||
|
@Service("xmTopService")
|
||||||
|
public class XmTopServiceImpl implements XmTopService {
|
||||||
|
@Resource
|
||||||
|
private XmTopMapper xmTopMapper;
|
||||||
|
@Resource
|
||||||
|
private XmNodeStyleMapper styleMapper;
|
||||||
|
@Resource
|
||||||
|
private XmNodeMapper nodeMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过ID查询单条数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmTopVo queryById(String id) {
|
||||||
|
//查询出节点与父节点数据
|
||||||
|
XmTop top = this.xmTopMapper.queryById(id);
|
||||||
|
//查询出二级ID
|
||||||
|
List<XmTop> secList = this.xmTopMapper.queryByPid(id);
|
||||||
|
List<String> nids = secList.stream().map(e -> e.getId()).collect(Collectors.toList());
|
||||||
|
nids.add(top.getId());
|
||||||
|
List<XmNodeStyle> styleList = styleMapper.queryByNid(nids);
|
||||||
|
Map<String,List<XmNodeStyle>> styleMap = styleList.stream().collect(Collectors.groupingBy(e -> e.getNodeId()));
|
||||||
|
//组装父节点
|
||||||
|
XmTopVo data = new XmTopVo(top,styleMap.get(top.getId()).get(0));
|
||||||
|
//子节点
|
||||||
|
List<XmTopVo> children = secList.stream().map(e -> new XmTopVo(e,styleMap.get(e.getId()).get(0))).collect(Collectors.toList());
|
||||||
|
data.setChildren(children);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多条数据
|
||||||
|
*
|
||||||
|
* @param offset 查询起始位置
|
||||||
|
* @param limit 查询条数
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<XmTop> queryAllByLimit(int offset, int limit) {
|
||||||
|
return this.xmTopMapper.queryAllByLimit(offset, limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<XmTop> queryAll(XmTop xmTop) {
|
||||||
|
return this.xmTopMapper.queryAll(xmTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*
|
||||||
|
* @param xmTopVo 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void insert(XmTopVo xmTopVo) {
|
||||||
|
//查询头两个节点,存入top
|
||||||
|
List<XmTop> topList = new ArrayList<>();
|
||||||
|
XmTop topEntity = new XmTop(xmTopVo,"1","-1");
|
||||||
|
topList.add(topEntity);
|
||||||
|
List<XmTopVo> secList = xmTopVo.getChildren();
|
||||||
|
//保存前两节点style
|
||||||
|
List<XmNodeStyle> styleList = new ArrayList<>();
|
||||||
|
styleList.add(new XmNodeStyle(xmTopVo));
|
||||||
|
if(!CollectionUtils.isEmpty(secList)){
|
||||||
|
List<XmTop> secTopList = secList.stream().map(e -> new XmTop(e,"2",topEntity.getId())).collect(Collectors.toList());
|
||||||
|
topList.addAll(secTopList);
|
||||||
|
//保存节点
|
||||||
|
xmTopMapper.insertBatch(topList);
|
||||||
|
List<XmNodeStyle> secStyleList = secList.stream().map(e -> new XmNodeStyle(e)).collect(Collectors.toList());
|
||||||
|
styleList.addAll(secStyleList);
|
||||||
|
//保存syle
|
||||||
|
styleMapper.insertBatch(styleList);
|
||||||
|
//递归下属节点
|
||||||
|
List<XmNode> nodes = new ArrayList<>();
|
||||||
|
List<XmNodeStyle> styles = new ArrayList<>();
|
||||||
|
secList.stream().forEach(e -> {
|
||||||
|
if(!CollectionUtils.isEmpty(e.getChildren())){
|
||||||
|
dealInsertNode(e.getChildren(),nodes,styles,3,e.getId(),topEntity.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//保存
|
||||||
|
nodeMapper.insertBatch(nodes);
|
||||||
|
styleMapper.insertBatch(styles);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private void dealInsertNode(List<XmTopVo> xmTopVoList, List<XmNode> nodeList,List<XmNodeStyle> styleList,Integer level,String parentId,String topId){
|
||||||
|
final Integer oldLevel = level;
|
||||||
|
List<XmNode> nodes = xmTopVoList.stream().map(e -> new XmNode(e,oldLevel.toString(),parentId,topId)).collect(Collectors.toList());
|
||||||
|
nodeList.addAll(nodes);
|
||||||
|
List<XmNodeStyle> styles = xmTopVoList.stream().map(e -> new XmNodeStyle(e)).collect(Collectors.toList());
|
||||||
|
styleList.addAll(styles);
|
||||||
|
Map<String,List<XmTopVo>> map = xmTopVoList.stream().filter(e -> null != e.getChildren()).collect(Collectors.toMap(e ->e.getId(),e->e.getChildren(),(k1,k2) ->k1));
|
||||||
|
final Integer newLevel = ++level;
|
||||||
|
map.forEach((k,v) -> {
|
||||||
|
if(!CollectionUtils.isEmpty(v)){
|
||||||
|
dealInsertNode(v,nodeList,styleList,newLevel,k,topId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*
|
||||||
|
* @param xmTop 实例对象
|
||||||
|
* @return 实例对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public XmTop update(XmTop xmTop) {
|
||||||
|
this.xmTopMapper.update(xmTop);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean deleteById(String id) {
|
||||||
|
return this.xmTopMapper.deleteById(id) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9204
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: server-xm
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/server-xm" />
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.server" level="info" />
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info" />
|
||||||
|
<appender-ref ref="file_error" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
@ -0,0 +1,174 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.server.xm.mapper.XmNodeMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.server.xm.entity.XmNode" id="XmNodeMap">
|
||||||
|
<result property="id" column="ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="name" column="NAME" jdbcType="VARCHAR"/>
|
||||||
|
<result property="typeId" column="TYPE_ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="nodeLevel" column="NODE_LEVEL" jdbcType="VARCHAR"/>
|
||||||
|
<result property="parentId" column="PARENT_ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="topId" column="TOP_ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
|
||||||
|
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
|
||||||
|
<result property="delFlag" column="DEL_FLAG" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<select id="queryById" resultMap="XmNodeMap">
|
||||||
|
select ID,
|
||||||
|
NAME,
|
||||||
|
TYPE_ID,
|
||||||
|
NODE_LEVEL,
|
||||||
|
PARENT_ID,
|
||||||
|
TOP_ID,
|
||||||
|
CREATE_TIME,
|
||||||
|
UPDATE_TIME,
|
||||||
|
CREATE_BY,
|
||||||
|
UPDATE_BY,
|
||||||
|
DEL_FLAG
|
||||||
|
from xm_node
|
||||||
|
where ID = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询指定行数据-->
|
||||||
|
<select id="queryAllByLimit" resultMap="XmNodeMap">
|
||||||
|
select ID,
|
||||||
|
NAME,
|
||||||
|
TYPE_ID,
|
||||||
|
NODE_LEVEL,
|
||||||
|
PARENT_ID,
|
||||||
|
TOP_ID,
|
||||||
|
CREATE_TIME,
|
||||||
|
UPDATE_TIME,
|
||||||
|
CREATE_BY,
|
||||||
|
UPDATE_BY,
|
||||||
|
DEL_FLAG
|
||||||
|
from xm_node
|
||||||
|
limit #{offset}
|
||||||
|
, #{limit}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--通过实体作为筛选条件查询-->
|
||||||
|
<select id="queryAll" resultMap="XmNodeMap">
|
||||||
|
select
|
||||||
|
ID, NAME, TYPE_ID, NODE_LEVEL, PARENT_ID, TOP_ID, CREATE_TIME, UPDATE_TIME, CREATE_BY, UPDATE_BY, DEL_FLAG
|
||||||
|
from xm_node
|
||||||
|
<where>
|
||||||
|
<if test="id != null and id != ''">
|
||||||
|
and ID = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and NAME = #{name}
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
and TYPE_ID = #{typeId}
|
||||||
|
</if>
|
||||||
|
<if test="nodeLevel != null and nodeLevel != ''">
|
||||||
|
and NODE_LEVEL = #{nodeLevel}
|
||||||
|
</if>
|
||||||
|
<if test="parentId != null and parentId != ''">
|
||||||
|
and PARENT_ID = #{parentId}
|
||||||
|
</if>
|
||||||
|
<if test="topId != null and topId != ''">
|
||||||
|
and TOP_ID = #{topId}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and CREATE_TIME = #{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
and UPDATE_TIME = #{updateTime}
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
and CREATE_BY = #{createBy}
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
and UPDATE_BY = #{updateBy}
|
||||||
|
</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">
|
||||||
|
and DEL_FLAG = #{delFlag}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_node(ID,NAME, TYPE_ID, NODE_LEVEL, PARENT_ID, TOP_ID, CREATE_TIME, UPDATE_TIME, CREATE_BY,
|
||||||
|
UPDATE_BY, DEL_FLAG)
|
||||||
|
values (#{id},#{name}, #{typeId}, #{nodeLevel}, #{parentId}, #{topId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{delFlag})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_node(ID,NAME, TYPE_ID, NODE_LEVEL, PARENT_ID, TOP_ID, CREATE_TIME, UPDATE_TIME, CREATE_BY,
|
||||||
|
UPDATE_BY, DEL_FLAG)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.id},#{entity.name}, #{entity.typeId}, #{entity.nodeLevel}, #{entity.parentId}, #{entity.topId},
|
||||||
|
#{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}, #{entity.delFlag})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_node(NAME, TYPE_ID, NODE_LEVEL, PARENT_ID, TOP_ID, CREATE_TIME, UPDATE_TIME, CREATE_BY,
|
||||||
|
UPDATE_BY, DEL_FLAG)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.name}, #{entity.typeId}, #{entity.nodeLevel}, #{entity.parentId}, #{entity.topId},
|
||||||
|
#{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}, #{entity.delFlag})
|
||||||
|
</foreach>
|
||||||
|
on duplicate key update
|
||||||
|
NAME = values(NAME) , TYPE_ID = values(TYPE_ID) , NODE_LEVEL = values(NODE_LEVEL) , PARENT_ID =
|
||||||
|
values(PARENT_ID) , TOP_ID = values(TOP_ID) , CREATE_TIME = values(CREATE_TIME) , UPDATE_TIME =
|
||||||
|
values(UPDATE_TIME) , CREATE_BY = values(CREATE_BY) , UPDATE_BY = values(UPDATE_BY) , DEL_FLAG =
|
||||||
|
values(DEL_FLAG)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
update xm_node
|
||||||
|
<set>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
NAME = #{name},
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
TYPE_ID = #{typeId},
|
||||||
|
</if>
|
||||||
|
<if test="nodeLevel != null and nodeLevel != ''">
|
||||||
|
NODE_LEVEL = #{nodeLevel},
|
||||||
|
</if>
|
||||||
|
<if test="parentId != null and parentId != ''">
|
||||||
|
PARENT_ID = #{parentId},
|
||||||
|
</if>
|
||||||
|
<if test="topId != null and topId != ''">
|
||||||
|
TOP_ID = #{topId},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
CREATE_TIME = #{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
UPDATE_TIME = #{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
CREATE_BY = #{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
UPDATE_BY = #{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">
|
||||||
|
DEL_FLAG = #{delFlag},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where ID = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from xm_node
|
||||||
|
where ID = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,157 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.server.xm.mapper.XmNodeStyleMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.server.xm.entity.XmNodeStyle" id="XmNodeStyleMap">
|
||||||
|
<result property="id" column="ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="direction" column="DIRECTION" jdbcType="VARCHAR"/>
|
||||||
|
<result property="hyperLink" column="HYPER_LINK" jdbcType="VARCHAR"/>
|
||||||
|
<result property="icons" column="ICONS" jdbcType="VARCHAR"/>
|
||||||
|
<result property="memo" column="MEMO" jdbcType="VARCHAR"/>
|
||||||
|
<result property="style" column="STYLE" jdbcType="VARCHAR"/>
|
||||||
|
<result property="tags" column="TAGS" jdbcType="VARCHAR"/>
|
||||||
|
<result property="nodeId" column="NODE_ID" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<select id="queryById" resultMap="XmNodeStyleMap">
|
||||||
|
select ID,
|
||||||
|
DIRECTION,
|
||||||
|
HYPER_LINK,
|
||||||
|
ICONS,
|
||||||
|
MEMO,
|
||||||
|
STYLE,
|
||||||
|
TAGS,
|
||||||
|
NODE_ID
|
||||||
|
from xm_node_style
|
||||||
|
where ID = #{id}
|
||||||
|
</select>
|
||||||
|
<select id="queryByNid" resultMap="XmNodeStyleMap" parameterType="arraylist">
|
||||||
|
select ID,
|
||||||
|
DIRECTION,
|
||||||
|
HYPER_LINK,
|
||||||
|
ICONS,
|
||||||
|
MEMO,
|
||||||
|
STYLE,
|
||||||
|
TAGS,
|
||||||
|
NODE_ID
|
||||||
|
from xm_node_style
|
||||||
|
where NODE_ID IN
|
||||||
|
<foreach collection="nids" index="index" item="nid" separator="," open="(" close=")">
|
||||||
|
#{nid}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询指定行数据-->
|
||||||
|
<select id="queryAllByLimit" resultMap="XmNodeStyleMap">
|
||||||
|
select ID,
|
||||||
|
DIRECTION,
|
||||||
|
HYPER_LINK,
|
||||||
|
ICONS,
|
||||||
|
MEMO,
|
||||||
|
STYLE,
|
||||||
|
TAGS,
|
||||||
|
NODE_ID
|
||||||
|
from xm_node_style
|
||||||
|
limit #{offset}
|
||||||
|
, #{limit}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--通过实体作为筛选条件查询-->
|
||||||
|
<select id="queryAll" resultMap="XmNodeStyleMap">
|
||||||
|
select
|
||||||
|
ID, DIRECTION, HYPER_LINK, ICONS, MEMO, STYLE, TAGS, NODE_ID
|
||||||
|
from xm_node_style
|
||||||
|
<where>
|
||||||
|
<if test="id != null and id != ''">
|
||||||
|
and ID = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="direction != null and direction != ''">
|
||||||
|
and DIRECTION = #{direction}
|
||||||
|
</if>
|
||||||
|
<if test="hyperLink != null and hyperLink != ''">
|
||||||
|
and HYPER_LINK = #{hyperLink}
|
||||||
|
</if>
|
||||||
|
<if test="icons != null and icons != ''">
|
||||||
|
and ICONS = #{icons}
|
||||||
|
</if>
|
||||||
|
<if test="memo != null and memo != ''">
|
||||||
|
and MEMO = #{memo}
|
||||||
|
</if>
|
||||||
|
<if test="style != null and style != ''">
|
||||||
|
and STYLE = #{style}
|
||||||
|
</if>
|
||||||
|
<if test="tags != null and tags != ''">
|
||||||
|
and TAGS = #{tags}
|
||||||
|
</if>
|
||||||
|
<if test="nodeId != null and nodeId != ''">
|
||||||
|
and NODE_ID = #{nodeId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_node_style(ID,DIRECTION, HYPER_LINK, ICONS, MEMO, STYLE, TAGS, NODE_ID)
|
||||||
|
values (#{id},#{direction}, #{hyperLink}, #{icons}, #{memo}, #{style}, #{tags}, #{nodeId})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_node_style(ID,DIRECTION, HYPER_LINK, ICONS, MEMO, STYLE, TAGS, NODE_ID)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.id},#{entity.direction}, #{entity.hyperLink}, #{entity.icons}, #{entity.memo}, #{entity.style}, #{entity.tags},
|
||||||
|
#{entity.nodeId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_node_style(DIRECTION, HYPER_LINK, ICONS, MEMO, STYLE, TAGS, NODE_ID)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.direction}, #{entity.hyperLink}, #{entity.icons}, #{entity.memo}, #{entity.style}, #{entity.tags},
|
||||||
|
#{entity.nodeId})
|
||||||
|
</foreach>
|
||||||
|
on duplicate key update
|
||||||
|
DIRECTION = values(DIRECTION) , HYPER_LINK = values(HYPER_LINK) , ICONS = values(ICONS) , MEMO = values(MEMO) ,
|
||||||
|
STYLE = values(STYLE) , TAGS = values(TAGS) , NODE_ID = values(NODE_ID)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
update xm_node_style
|
||||||
|
<set>
|
||||||
|
<if test="direction != null and direction != ''">
|
||||||
|
DIRECTION = #{direction},
|
||||||
|
</if>
|
||||||
|
<if test="hyperLink != null and hyperLink != ''">
|
||||||
|
HYPER_LINK = #{hyperLink},
|
||||||
|
</if>
|
||||||
|
<if test="icons != null and icons != ''">
|
||||||
|
ICONS = #{icons},
|
||||||
|
</if>
|
||||||
|
<if test="memo != null and memo != ''">
|
||||||
|
MEMO = #{memo},
|
||||||
|
</if>
|
||||||
|
<if test="style != null and style != ''">
|
||||||
|
STYLE = #{style},
|
||||||
|
</if>
|
||||||
|
<if test="tags != null and tags != ''">
|
||||||
|
TAGS = #{tags},
|
||||||
|
</if>
|
||||||
|
<if test="nodeId != null and nodeId != ''">
|
||||||
|
NODE_ID = #{nodeId},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where ID = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from xm_node_style
|
||||||
|
where ID = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -0,0 +1,169 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.server.xm.mapper.XmTopMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.server.xm.entity.XmTop" id="XmTopMap">
|
||||||
|
<result property="id" column="ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="name" column="NAME" jdbcType="VARCHAR"/>
|
||||||
|
<result property="typeId" column="TYPE_ID" jdbcType="VARCHAR"/>
|
||||||
|
<result property="nodeLevel" column="NODE_LEVEL" jdbcType="VARCHAR"/>
|
||||||
|
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
|
||||||
|
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
|
||||||
|
<result property="delFlag" column="DEL_FLAG" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!--查询单个-->
|
||||||
|
<select id="queryById" resultMap="XmTopMap">
|
||||||
|
select ID,
|
||||||
|
NAME,
|
||||||
|
TYPE_ID,
|
||||||
|
NODE_LEVEL,
|
||||||
|
CREATE_TIME,
|
||||||
|
UPDATE_TIME,
|
||||||
|
CREATE_BY,
|
||||||
|
UPDATE_BY,
|
||||||
|
DEL_FLAG
|
||||||
|
from xm_top
|
||||||
|
where ID = #{id}
|
||||||
|
</select>
|
||||||
|
<!--根据父节点查询二级节点-->
|
||||||
|
<select id="queryByPid" resultMap="XmTopMap">
|
||||||
|
select ID,
|
||||||
|
NAME,
|
||||||
|
TYPE_ID,
|
||||||
|
NODE_LEVEL,
|
||||||
|
CREATE_TIME,
|
||||||
|
UPDATE_TIME,
|
||||||
|
CREATE_BY,
|
||||||
|
UPDATE_BY,
|
||||||
|
DEL_FLAG
|
||||||
|
from xm_top where PARENT_ID = #{pid}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--查询指定行数据-->
|
||||||
|
<select id="queryAllByLimit" resultMap="XmTopMap">
|
||||||
|
select ID,
|
||||||
|
NAME,
|
||||||
|
TYPE_ID,
|
||||||
|
NODE_LEVEL,
|
||||||
|
CREATE_TIME,
|
||||||
|
UPDATE_TIME,
|
||||||
|
CREATE_BY,
|
||||||
|
UPDATE_BY,
|
||||||
|
DEL_FLAG
|
||||||
|
from xm_top
|
||||||
|
limit #{offset}
|
||||||
|
, #{limit}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--通过实体作为筛选条件查询-->
|
||||||
|
<select id="queryAll" resultMap="XmTopMap">
|
||||||
|
select
|
||||||
|
ID, NAME, TYPE_ID, NODE_LEVEL, CREATE_TIME, UPDATE_TIME, CREATE_BY, UPDATE_BY, DEL_FLAG
|
||||||
|
from xm_top
|
||||||
|
<where>
|
||||||
|
<if test="id != null and id != ''">
|
||||||
|
and ID = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and NAME like concat('%',#{name},'%')
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
and TYPE_ID like concat('%',#{type},'%')
|
||||||
|
</if>
|
||||||
|
<if test="nodeLevel != null and nodeLevel != ''">
|
||||||
|
and NODE_LEVEL = #{nodeLevel}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and CREATE_TIME = #{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
and UPDATE_TIME = #{updateTime}
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
and CREATE_BY = #{createBy}
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
and UPDATE_BY = #{updateBy}
|
||||||
|
</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">
|
||||||
|
and DEL_FLAG = #{delFlag}
|
||||||
|
</if>
|
||||||
|
and NODE_LEVEL = '1'
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_top(ID,NAME, TYPE_ID, NODE_LEVEL, PARENT_ID,CREATE_TIME, UPDATE_TIME, CREATE_BY, UPDATE_BY,
|
||||||
|
DEL_FLAG)
|
||||||
|
values (#{entity.id},#{name}, #{typeId}, #{nodeLevel},#{entity.parentId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{delFlag})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_top(ID,NAME, TYPE_ID, NODE_LEVEL, PARENT_ID,CREATE_TIME, UPDATE_TIME, CREATE_BY, UPDATE_BY,
|
||||||
|
DEL_FLAG)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.id},#{entity.name}, #{entity.typeId}, #{entity.nodeLevel},#{entity.parentId}, #{entity.createTime}, #{entity.updateTime},
|
||||||
|
#{entity.createBy}, #{entity.updateBy}, #{entity.delFlag})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
insert into xm_top(NAME, TYPE_ID, NODE_LEVEL, CREATE_TIME, UPDATE_TIME, CREATE_BY, UPDATE_BY,
|
||||||
|
DEL_FLAG)
|
||||||
|
values
|
||||||
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
|
(#{entity.name}, #{entity.typeId}, #{entity.nodeLevel}, #{entity.createTime}, #{entity.updateTime},
|
||||||
|
#{entity.createBy}, #{entity.updateBy}, #{entity.delFlag})
|
||||||
|
</foreach>
|
||||||
|
on duplicate key update
|
||||||
|
NAME = values(NAME) , TYPE_ID = values(TYPE_ID) , NODE_LEVEL = values(NODE_LEVEL) , CREATE_TIME =
|
||||||
|
values(CREATE_TIME) , UPDATE_TIME = values(UPDATE_TIME) , CREATE_BY = values(CREATE_BY) , UPDATE_BY =
|
||||||
|
values(UPDATE_BY) , DEL_FLAG = values(DEL_FLAG)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
update xm_top
|
||||||
|
<set>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
NAME = #{name},
|
||||||
|
</if>
|
||||||
|
<if test="typeId != null and typeId != ''">
|
||||||
|
TYPE_ID = #{typeId},
|
||||||
|
</if>
|
||||||
|
<if test="nodeLevel != null and nodeLevel != ''">
|
||||||
|
NODE_LEVEL = #{nodeLevel},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
CREATE_TIME = #{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
UPDATE_TIME = #{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
CREATE_BY = #{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
UPDATE_BY = #{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">
|
||||||
|
DEL_FLAG = #{delFlag},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where ID = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
delete
|
||||||
|
from xm_top
|
||||||
|
where ID = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
Loading…
Reference in new issue