Browse Source

图谱中删除实体

zxm
zhangxiaomeng 1 year ago
parent
commit
2631ed6b77
  1. BIN
      kcui/src/assets/img/graphDown.png
  2. BIN
      kcui/src/assets/img/graphInput.png
  3. BIN
      kcui/src/assets/img/graphUp.png
  4. BIN
      kcui/src/assets/img/graphbg.png
  5. BIN
      kcui/src/assets/img/juxing.png
  6. 381
      kcui/src/view/Graph.vue
  7. 6
      kcui/src/view/JsInfo.vue
  8. 2
      kcui/src/view/Login.vue
  9. 3
      kcui/src/view/TWInfo.vue
  10. 5
      src/main/java/com/main/woka/Web/Controller/KcInfoController.java
  11. 44
      src/main/java/com/main/woka/Web/Controller/KcTlFileController.java
  12. 61
      src/main/java/com/main/woka/Web/Controller/TwDeleteController.java
  13. 6
      src/main/java/com/main/woka/Web/Mapper/TwDeleteMapper.java
  14. 20
      src/main/java/com/main/woka/Web/Service/TwDeleteService.java

BIN
kcui/src/assets/img/graphDown.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

BIN
kcui/src/assets/img/graphInput.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

BIN
kcui/src/assets/img/graphUp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

BIN
kcui/src/assets/img/graphbg.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

BIN
kcui/src/assets/img/juxing.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

381
kcui/src/view/Graph.vue

@ -17,8 +17,7 @@
<div v-for="item in mulu" :key="item">
<div class="oneMulu" v-if="page!=item.name" @click="goInfo(item.info)">
<div style="width: 80%;text-align: center;">{{ item.name }}</div>
<img src="../assets/img/jiantou.png"
style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 11%;">
<img src="../assets/img/jiantou.png" style="width: 0.9vw;height:0.9vw;object-fit: contain;float: right;margin-top: 11%;">
</div>
<div class="oneMuluXuan" v-else>
<img src="../assets/img/twCircle.png"
@ -36,69 +35,131 @@
</div>
</div>
</div>
<div class="rightContent">
<div style="color: white; margin:3vw 2vw 0vw 2vw;width: 100%;">
<div style="width: 100%;display: flex;flex-direction: row;justify-content: space-around;">
<div style="width: 4vw;">关键字</div>
<input
style="background-color: transparent; border: none; border-bottom: 1px solid white; color: white; outline: none;"
placeholder="请输入关键字" v-model="keywords"/>
<div @click="getInfo1"
style="width: 3vw;height: 1.5vw;background-color: #001c3a;text-align: center;border-radius:1vw;line-height: 1.5vw;">
查询
<div style="color: #ffffff; width: 67%;height:5vw;position: absolute;z-index: 1000;left: 12vw;top: 5vw;display: flex;flex-direction: row;justify-content: space-around;">
<div class="graphcontains1">
<div style="width: 100%;height: 1.4vw;position: relative;display: flex;flex-direction: row;justify-content: space-around;margin-bottom: 0.5vw;">
<div style="width: 43%;display: flex;justify-content: flex-start;">
<img src="../assets/img/juxing.png" style="width: 1vw;object-fit: contain;margin-right: 0.25vw;">
<div style="height:1.4vw;line-height: 1.4vw;color: white;font-size: 0.9vw;font-size: 0.9vw; ">关键词
</div>
</div>
<div style="margin-left: 1vw;" v-if="userType==1">
<el-button type="primary" plain icon="el-icon-upload2" size="mini" @click="openFileInput">导入</el-button>
<div style="width:62%;height: 1.4vw;position: relative;">
<img src="../assets/img/graphInput.png" style="position: absolute;z-index: 99;width:100%;height: 100%;">
<input
ref="fileInput"
type="file"
accept=".doc, .docx"
style="display: none;"
@change="handleFileChange"
type="text"
placeholder="请输入关键词"
v-model="keywords"
@keyup.enter="getInfo1()"
/>
<div style="width: 10%;height: 0.8vw;position: absolute;right: 0.5vw;z-index: 5555;top: 0.2vw;"
@click="getInfo1()">
<img src="../assets/img/look.png" style="width: 100%;height: 100%;">
</div>
</div>
</div>
</div>
<div class="graphcontains2">
<div
style="width: 100%;height: 1.4vw;position: relative;display: flex;flex-direction: row;justify-content: space-around;margin-bottom: 0.5vw;">
<div style="width: 43%;display: flex;justify-content: flex-start;">
<img src="../assets/img/juxing.png" style="width: 1vw;object-fit: contain;margin-right: 0.25vw;">
<div style="height:1.4vw;line-height: 1.4vw;color: white;font-size: 0.9vw;font-size: 0.9vw; ">
飞机类型
</div>
</div>
<div style="margin-left: 1vw;width: 80%;display: flex;flex-direction: row;">
<div style="width: 4vw;margin-left: 1vw;margin-top: 0.5vw;">飞机类型:</div>
<el-select v-model="value1" filterable placeholder="请选择" style="width: 10vw;">
<el-option
<img src="../assets/img/graphDown.png"
style="position: absolute;z-index: 99;width: 5%;height: 100%;object-fit: contain;right: 0.5vw;"
v-if="typePic1==0">
<img src="../assets/img/graphUp.png"
style="position: absolute;z-index: 99;width: 5%;height: 100%;object-fit: contain;right: 0.5vw;"
v-if="typePic1==1">
<div style="width:62%;height: 1.4vw;position: relative;">
<img src="../assets/img/graphInput.png" style="position: absolute;z-index: 99;width:100%;height: 100%;">
<select v-model="value1" @click="changeType1()">
<option
v-for="item in options1"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div style="width: 4vw;margin-left: 1vw;margin-top: 0.5vw;">飞行任务:</div>
<el-select v-model="value2" filterable placeholder="请选择" style="width: 10vw;">
<el-option
</option>
</select>
</div>
</div>
</div>
<div class="graphcontains2">
<div
style="width: 100%;height: 1.4vw;position: relative;display: flex;flex-direction: row;justify-content: space-around;margin-bottom: 0.5vw;">
<div style="width: 43%;display: flex;justify-content: flex-start;">
<img src="../assets/img/juxing.png" style="width: 1vw;object-fit: contain;margin-right: 0.25vw;">
<div style="height:1.4vw;line-height: 1.4vw;color: white;font-size: 0.9vw;font-size: 0.9vw; ">
飞行任务
</div>
</div>
<img src="../assets/img/graphDown.png"
style="position: absolute;z-index: 99;width: 5%;height: 100%;object-fit: contain;right: 0.5vw;"
v-if="typePic2==0">
<img src="../assets/img/graphUp.png"
style="position: absolute;z-index: 99;width: 5%;height: 100%;object-fit: contain;right: 0.5vw;"
v-if="typePic2==1">
<div style="width:62%;height: 1.4vw;position: relative;">
<img src="../assets/img/graphInput.png" style="position: absolute;z-index: 99;width:100%;height: 100%;">
<select v-model="value2" @click="changeType2()">
<option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div style="width: 4vw;margin-left: 1vw;margin-top: 0.5vw;">飞机载荷:</div>
<el-select v-model="value3" filterable placeholder="请选择" style="width: 10vw;">
<el-option
</option>
</select>
</div>
</div>
</div>
<div class="graphcontains2">
<div
style="width: 100%;height: 1.4vw;position: relative;display: flex;flex-direction: row;justify-content: space-around;margin-bottom: 0.5vw;">
<div style="width: 43%;display: flex;justify-content: flex-start;">
<img src="../assets/img/juxing.png" style="width: 1vw;object-fit: contain;margin-right: 0.25vw;">
<div style="height:1.4vw;line-height: 1.4vw;color: white;font-size: 0.9vw;font-size: 0.9vw; ">
飞行载荷
</div>
</div>
<img src="../assets/img/graphDown.png"
style="position: absolute;z-index: 99;width: 5%;height: 100%;object-fit: contain;right: 0.5vw;"
v-if="typePic3==0">
<img src="../assets/img/graphUp.png"
style="position: absolute;z-index: 99;width: 5%;height: 100%;object-fit: contain;right: 0.5vw;"
v-if="typePic3==1">
<div style="width:62%;height: 1.4vw;position: relative;">
<img src="../assets/img/graphInput.png" style="position: absolute;z-index: 99;width:100%;height: 100%;">
<select v-model="value3" @click="changeType3()">
<option
v-for="item in options3"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div @click="getInfo1"
style="width: 3vw;height: 1.5vw;background-color: #001c3a;text-align: center;border-radius:1vw;line-height: 1.5vw;">
生成报告
</div>
</option>
</select>
</div>
</div>
</div>
<div class="rightList">
<div class="tupu">
</div>
<!-- <div style="width: 100%;display: flex;flex-direction: column;justify-content: space-around;">-->
<!-- <div style="margin-left: 1vw;" v-if="userType==1">-->
<!-- <el-button type="primary" plain icon="el-icon-upload2" size="mini" @click="openFileInput">导入</el-button>-->
<!-- <input-->
<!-- ref="fileInput"-->
<!-- type="file"-->
<!-- accept=".doc, .docx"-->
<!-- style="display: none;"-->
<!-- @change="handleFileChange"-->
<!-- />-->
<!-- </div>-->
<!-- </div>-->
<div class="rightContent">
<div class="rightList">
<div class="tupu">
<div style="width: 100%;height: 100%;">
<div class="gContainer">
<div id="graph-panel" style="width: 100%;height: 100%;"></div>
@ -124,7 +185,7 @@
<el-form-item label="操作">
<el-button type="primary" @click="openAdd()">新增下级</el-button>
<el-button type="warning" @click="openEdit()">修改</el-button>
<el-button type="danger">删除</el-button>
<el-button type="danger" @click="deleteTw()">删除</el-button>
</el-form-item>
</el-form>
</el-dialog>
@ -154,9 +215,26 @@
<el-input v-model="newBranchContent"></el-input>
</el-form-item>
<el-form-item style="position: relative ;" label="节点内容" v-if="this.typeValue=='tw'">
<Editor v-model="newBranchValue" style="height: 10vw;"></Editor>
<Editor v-model="newBranchValue" style="height: 10vw;margin-bottom: 5vw;"></Editor>
</el-form-item>
<el-form-item style="position: relative;" label="相关图片" v-if="this.typeValue=='tw'" >
<el-upload
action="http://127.0.0.1:10031/fileUpdate/upload"
list-type="picture-card"
:on-remove="handleRemove"
:file-list="fileList"
:multiple="true"
:limit="9"
:on-exceed="handleExceed"
:before-upload="beforeUpload"
:on-success="handleSuccess"
:on-error="handleError">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="上传视频" prop="spUrl" v-if="this.typeValue=='sp'">
<el-upload
class="avatar-uploader el-upload--text"
@ -314,6 +392,10 @@
</div>
<!-- <div @click="getInfo1"-->
<!-- style="width: 5vw;height: 1.5vw;background-color: #7ffffd;text-align: center;border-radius:1vw;line-height: 1.5vw;bottom: 1vw;position: absolute;right: 1vw;z-index: 3333;">-->
<!-- 生成报告-->
<!-- </div>-->
</div>
</div>
<div style="width: 100%;height: 3%;position: fixed;bottom: 0px;">
@ -333,6 +415,7 @@ import {config} from '@/assets/defaultConfig.js'
import {addFile, addNode, getFileIdByDocId} from "@/api/file";
import Editor from "@/components/Editor.vue";
import {getToken} from "@/utils/auth";
import {twdelete} from "@/api/twdelete";
export default {
// eslint-disable-next-line vue/multi-word-component-names
@ -340,6 +423,10 @@ export default {
components: {Editor, Foot, headInfo},
data() {
return {
typePic1: 0,
typePic2: 0,
typePic3: 0,
userName: "",
userType: 0,
mulu: [
@ -385,58 +472,40 @@ export default {
options1: [{
value: '选项1',
label: '黄金糕'
value: '1',
label: '直9'
}, {
value: '选项2',
label: '双皮奶'
value: '2',
label: '直9-c'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
value: '3',
label: '卡式机'
}],
value1: '',
options2: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
value: '0',
label: '起飞'
}, {
value: '选项4',
label: '龙须面'
value: '1',
label: '降落'
}, {
value: '选项5',
label: '北京烤鸭'
value: '2',
label: '飞行'
}],
value2: '',
options3: [{
value: '选项1',
label: '黄金糕'
value: '0',
label: '鱼雷'
}, {
value: '选项2',
label: '双皮奶'
value: '1',
label: '导弹'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
value: '2',
label: '侦察'
}],
value3: '',
@ -475,6 +544,32 @@ export default {
},
methods: {
changeType1() {
if (this.typePic1 == 0) {
this.typePic1 = 1;
} else {
this.typePic1 = 0
}
},
changeType2() {
if (this.typePic2 == 0) {
this.typePic2 = 1;
} else {
this.typePic2 = 0
}
},
changeType3() {
if (this.typePic3 == 0) {
this.typePic3 = 1;
} else {
this.typePic3 = 0
}
},
//
selectGraph() {
console.log("jksajdklaj-----走这里")
},
openFileInput() {
//
this.$refs.fileInput.click();
@ -563,7 +658,18 @@ export default {
//
deleteTw() {
console.log("这是删除操作")
var id = this.nodeInfo.docId;
twdelete(id).then((res) => {
console.log(res);
if (res.code == 500) {
this.$message.error(res.msg);
}
if (res.code == 200) {
this.$message.success("删除成功");
this.isModalVisible = false;
this.getInfo();
}
})
},
editTw(id) {
//
@ -614,6 +720,7 @@ export default {
this.zhengl(res.data);
})
} else {
this.visGraph.clearAll();
let params = {};
getgraphInfo(params).then((res) => {
@ -889,6 +996,28 @@ export default {
const relation = this.newBranchRelation.trim();
if (this.selectedNode && content && value) {
var urlStr = "";
for (let f = 0; f < this.fileList.length; f++) {
if (f == 0) {
if (this.fileList[f].response != null) {
urlStr = this.fileList[f].response.data.url
} else {
urlStr = this.fileList[f].url
}
} else {
if (this.fileList[f].response != null) {
urlStr = urlStr + "," + this.fileList[f].response.data.url
} else {
urlStr = urlStr + "," + this.fileList[f].url
}
}
}
//
const data = {
fileId: fileId,
@ -897,7 +1026,8 @@ export default {
relation: relation,
parentId: this.newBranchParentId,
level: this.newBranchLevel,
nodeType: 'tw'
nodeType: 'tw',
imgs: urlStr
};
try {
@ -1081,8 +1211,8 @@ export default {
{size: 300, width: 300, height: 300, color: '0,246,255', font: 'normal 50px Arial', fontColor: '0,0,0'},
{size: 250, width: 250, height: 250, color: '0,198,255', font: 'normal 40px Arial', fontColor: '0,0,0'},
{size: 200, width: 200, height: 200, color: '42,152,255', font: 'normal 32px Arial', fontColor: '255,255,255'},
{size: 150, width: 150, height: 150, color: '0,198,255', font: 'normal 30px Arial', fontColor: '0,0,0'},
{size: 130, width: 130, height: 130, color: '198,186,242', font: 'normal 28px Arial', fontColor: '0,0,0',strokeStyle:'198,186,242'}
{size: 150, width: 150, height: 150, color: '0,95,183', font: 'normal 30px Arial', fontColor: '0,0,0'},
{size: 130, width: 130, height: 130, color: '0,62,164', font: 'normal 28px Arial', fontColor: '255,255,255'}
];
return styles[group] || {};
@ -1275,7 +1405,7 @@ export default {
.rightList {
width: 94.6%;
width: 96%;
height: 88%;
position: absolute;
z-index: 2;
@ -1298,11 +1428,10 @@ export default {
.tupu {
width: 100%;
height: 100%;
height: 90%;
position: absolute;
z-index: 3;
top: 1%;
top: 7.5%;
}
.gContainer {
@ -1313,7 +1442,7 @@ export default {
justify-content: center;
overflow: hidden;
width: 100%;
height: 37vw;
height: 39vw;
border-radius: 2vw;
}
@ -1345,4 +1474,74 @@ export default {
.custom-dialog {
margin-top: 0vh !important;
}
.graphcontains1 {
width: 60%;
height: 2vw;
position: relative;
display: flex;
flex-direction: row;
justify-content: flex-start;
margin-left: 5%;
}
.graphcontains2 {
width: 60%;
height: 2vw;
position: relative;
display: flex
;
flex-direction: row;
justify-content: flex-start;
margin-left: 3%;
}
input {
width: 100%;
height: 100%;
border: none;
outline: none;
color: white; /* 文字颜色 */
background-color: transparent;
padding-left: 3%;
position: absolute;
z-index: 2000;
}
input::placeholder {
color: rgba(255, 255, 255, 0.54);
opacity: 1; /* Firefox 默认将 placeholder 的透明度设置为 0.54 */
}
select {
//background-image: url("../assets/img/zcType.png");
width: 100%;
height: 100%;
border: none;
outline: none;
color: white; /* 文字颜色 */
background-color: transparent;
padding-left: 3%;
position: absolute;
z-index: 2000;
appearance: none;
}
option {
color: black;
background: rgb(255, 255, 255);
line-height: 20px;
}
option:hover {
background: #EBCCD1;
}
</style>

6
kcui/src/view/JsInfo.vue

@ -113,7 +113,7 @@
<div
style="width: 9%;text-decoration: underline;font-style: italic;display: flex;justify-content: space-around;margin-left: 1%;">
<div @click="editTw(item.id)">修改</div>
<div @click="deleteTw(item.id)">删除</div>
</div>
</div>
</div>
@ -309,10 +309,6 @@ export default {
},
//
deleteTw() {
console.log("这是删除操作")
},
editTw(id) {
//
var data = {

2
kcui/src/view/Login.vue

@ -215,7 +215,7 @@ export default {
}
},
mounted() {
this.login();
// this.login();
}
}

3
kcui/src/view/TWInfo.vue

@ -555,13 +555,14 @@ export default {
position: absolute;
z-index: 2;
top: 1%;
padding-top: 1vw;
}
.oneRight {
width: 98%;
height: 4.6vw;
line-height: 5vw;
line-height: 1.3vw;
//background-color: #42b983;
margin: 0 1%;
display: flex;

5
src/main/java/com/main/woka/Web/Controller/KcInfoController.java

@ -167,6 +167,9 @@ public class KcInfoController extends BaseController {
KcInfoRelation r = new KcInfoRelation();
r.setSourceId(aa.getParentId());
if(aa.getParentId()==0){
r.setSourceId(Long.valueOf(String.valueOf(aa.getFileId())));
}
r.setTargetId(aa.getId());
String relation = kcInfoRelationMapper.selectKcRelationshipList(r).get(0).getRelation();
aa.setRelation(relation);
@ -678,7 +681,7 @@ public class KcInfoController extends BaseController {
}
//图文
//视频
if (kcInfo.getType() == 2) {
System.out.println("jjjjj====");
System.out.println(kcInfo.getSpUrl());

44
src/main/java/com/main/woka/Web/Controller/KcTlFileController.java

@ -6,8 +6,10 @@ import com.main.woka.Common.util.WebSocket;
import com.main.woka.Web.Dao.KcInfo;
import com.main.woka.Web.Dao.KcInfoRelation;
import com.main.woka.Web.Dao.KcTlFile;
import com.main.woka.Web.Dao.KcTwImg;
import com.main.woka.Web.Mapper.KcFileMapper;
import com.main.woka.Web.Mapper.KcInfoRelationMapper;
import com.main.woka.Web.Mapper.TwImgMapper;
import com.main.woka.Web.Service.impl.KcTlFileServiceImpl;
import com.main.woka.Web.Service.impl.PdfUtil;
import org.neo4j.driver.v1.StatementResult;
@ -49,6 +51,10 @@ public class KcTlFileController extends BaseController {
@Autowired
KcInfoRelationMapper kcInfoRelationMapper;
@Autowired
TwImgMapper twImgMapper;
@PostMapping("/addFile")
public AjaxResult addFile(MultipartFile file) throws IOException {
String url = saveFileWithStructure(file);
@ -125,7 +131,11 @@ public class KcTlFileController extends BaseController {
System.out.println(requestBody);
String nodeType = requestBody.get("nodeType");
if(nodeType.equals("tw")){
Integer fileId = Integer.valueOf(requestBody.get("fileId"));
Integer fileId = Integer.valueOf(String.valueOf(kcFileMapper.getFileList().get(0).getId()));
if(requestBody.get("fileId")!=null && !requestBody.get("fileId").equals("null")){
fileId = Integer.valueOf(requestBody.get("fileId"));
}
String txtName = requestBody.get("txtName");
String TxtValue = requestBody.get("TxtValue");
String relation = requestBody.get("relation");
@ -137,6 +147,12 @@ public class KcTlFileController extends BaseController {
String pathPart = url.substring(0, lastBackslashIndex + 1);
String result = pathPart + "wordSplitter";
String txtUrl = createTxtFile(result, txtName, TxtValue);
String imgs = "";
@ -153,6 +169,32 @@ public class KcTlFileController extends BaseController {
kcFileMapper.insertDoc(kcInfo);
if(requestBody.get("imgs")!=null && !requestBody.get("imgs").equals("null")){
imgs = requestBody.get("imgs");
String[] imgList = imgs.split(",");
List<KcTwImg> list = new ArrayList<>();
if (imgList.length != 0) {
for (int a = 0; a < imgList.length; a++) {
KcTwImg twimg = new KcTwImg();
twimg.setTwId(kcInfo.getId());
twimg.setImgUrl(imgList[a]);
list.add(twimg);
}
} else {
if(!imgs.equals("")){
KcTwImg twimg = new KcTwImg();
twimg.setTwId(kcInfo.getId());
twimg.setImgUrl(imgs);
list.add(twimg);
}
}
twImgMapper.insertTwImg(list);
}
//创建图谱

61
src/main/java/com/main/woka/Web/Controller/TwDeleteController.java

@ -1,29 +1,78 @@
package com.main.woka.Web.Controller;
import com.main.woka.Common.core.AjaxResult;
import com.main.woka.Web.Service.TwDeleteService;
import com.main.woka.Common.util.Neo4jUtil;
import com.main.woka.Web.Dao.KcInfoRelation;
import com.main.woka.Web.Mapper.KcInfoRelationMapper;
import com.main.woka.Web.Mapper.TwDeleteMapper;
import org.neo4j.driver.v1.StatementResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/twdelete")
public class TwDeleteController extends BaseController {
@Autowired
private TwDeleteService twDeleteService;
private TwDeleteMapper twDeleteMapper;
@Autowired
private KcInfoRelationMapper kcInfoRelationMapper;
@Autowired
Neo4jUtil neo4jUtil;
@DeleteMapping("/{id}")
public AjaxResult deleteItem(@PathVariable Long id) {
try {
// 调用服务层方法进行删除操作
twDeleteService.deleteItem(id);
return AjaxResult.success();
KcInfoRelation rr = new KcInfoRelation();
rr.setSourceId(id);
List<KcInfoRelation> list = kcInfoRelationMapper.selectKcRelationshipList(rr);
if(list.size()>0){
return AjaxResult.error("节点拥有子节点不可删除");
}else {
// 调用服务层方法进行删除操作
int a = twDeleteMapper.deleteById(id);
//删除对应关系
KcInfoRelation kr = new KcInfoRelation();
kr.setTargetId(id);
List<KcInfoRelation> rl = kcInfoRelationMapper.selectKcRelationshipList(kr);
for(int i=0;i<rl.size();i++){
int g = kcInfoRelationMapper.deleteKcRelationshipById(rl.get(i).getId());
}
//删除对应的图片信息
int h = twDeleteMapper.deleteImgById(id);
String cql = "MATCH (n:Doc{docId:'" + id + "'}) DETACH delete n";
System.out.println(cql);
StatementResult result1 = neo4jUtil.excuteCypherSql(cql);
return AjaxResult.success();
}
} catch (Exception e) {
// 返回错误信息
e.printStackTrace();
return AjaxResult.error("删除失败");
return AjaxResult.error("删除失败");
}
}
}

6
src/main/java/com/main/woka/Web/Mapper/TwDeleteMapper.java

@ -6,5 +6,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TwDeleteMapper {
@Delete("DELETE FROM kc_info WHERE id = #{id}")
void deleteById(Long id); // 根据ID删除记录
int deleteById(Long id); // 根据ID删除记录
@Delete("DELETE FROM tw_img WHERE tw_id = #{twId}")
int deleteImgById(Long twId); // 根据ID删除记录
}

20
src/main/java/com/main/woka/Web/Service/TwDeleteService.java

@ -1,20 +0,0 @@
package com.main.woka.Web.Service;
import com.main.woka.Web.Mapper.TwDeleteMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class TwDeleteService {
private final TwDeleteMapper twDeleteMapper;
@Autowired
public TwDeleteService(TwDeleteMapper twDeleteMapper) {
this.twDeleteMapper = twDeleteMapper;
}
public void deleteItem(Long id) {
// 调用Mapper执行数据库删除操作
twDeleteMapper.deleteById(id);
}
}
Loading…
Cancel
Save