From 268427bb59ad00cad67bf6f5cda2bfef4fc2b172 Mon Sep 17 00:00:00 2001
From: lau572 <1010031226@qq.com>
Date: Sun, 18 Feb 2024 10:57:27 +0800
Subject: [PATCH] =?UTF-8?q?=E6=83=85=E6=8A=A5=E6=9D=BF=E6=95=8F=E6=84=9F?=
=?UTF-8?q?=E8=AF=8D=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DcInfoBoardVocabularyController.java | 4 ++--
.../mapper/DcInfoBoardVocabularyMapper.java | 2 ++
.../service/IDcInfoBoardVocabularyService.java | 4 ++--
.../impl/DcInfoBoardVocabularyServiceImpl.java | 18 ++++++++++++++----
.../business/DcInfoBoardVocabularyMapper.xml | 13 +++++++++++--
5 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java b/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java
index ea360148..64cfc39f 100644
--- a/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java
+++ b/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java
@@ -86,7 +86,7 @@ public class DcInfoBoardVocabularyController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody DcInfoBoardVocabulary dcInfoBoardVocabulary)
{
- return toAjax(dcInfoBoardVocabularyService.insertDcInfoBoardVocabulary(dcInfoBoardVocabulary));
+ return dcInfoBoardVocabularyService.insertDcInfoBoardVocabulary(dcInfoBoardVocabulary);
}
/**
@@ -98,7 +98,7 @@ public class DcInfoBoardVocabularyController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody DcInfoBoardVocabulary dcInfoBoardVocabulary)
{
- return toAjax(dcInfoBoardVocabularyService.updateDcInfoBoardVocabulary(dcInfoBoardVocabulary));
+ return dcInfoBoardVocabularyService.updateDcInfoBoardVocabulary(dcInfoBoardVocabulary);
}
/**
diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcInfoBoardVocabularyMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcInfoBoardVocabularyMapper.java
index 7223ec20..b9d4adc7 100644
--- a/zc-business/src/main/java/com/zc/business/mapper/DcInfoBoardVocabularyMapper.java
+++ b/zc-business/src/main/java/com/zc/business/mapper/DcInfoBoardVocabularyMapper.java
@@ -2,6 +2,7 @@ package com.zc.business.mapper;
import java.util.List;
import com.zc.business.domain.DcInfoBoardVocabulary;
+import org.apache.ibatis.annotations.Param;
/**
* 情报板敏感字管理Mapper接口
@@ -19,6 +20,7 @@ public interface DcInfoBoardVocabularyMapper
*/
public DcInfoBoardVocabulary selectDcInfoBoardVocabularyById(Long id);
+ int selectWordNum(DcInfoBoardVocabulary dcInfoBoardVocabulary);
/**
* 查询情报板敏感字管理列表
*
diff --git a/zc-business/src/main/java/com/zc/business/service/IDcInfoBoardVocabularyService.java b/zc-business/src/main/java/com/zc/business/service/IDcInfoBoardVocabularyService.java
index 60b7ae86..128130d4 100644
--- a/zc-business/src/main/java/com/zc/business/service/IDcInfoBoardVocabularyService.java
+++ b/zc-business/src/main/java/com/zc/business/service/IDcInfoBoardVocabularyService.java
@@ -35,7 +35,7 @@ public interface IDcInfoBoardVocabularyService
* @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 结果
*/
- int insertDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary);
+ AjaxResult insertDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary);
/**
* 修改情报板敏感字管理
@@ -43,7 +43,7 @@ public interface IDcInfoBoardVocabularyService
* @param dcInfoBoardVocabulary 情报板敏感字管理
* @return 结果
*/
- int updateDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary);
+ AjaxResult updateDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary);
/**
* 批量删除情报板敏感字管理
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcInfoBoardVocabularyServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcInfoBoardVocabularyServiceImpl.java
index cf25d1af..d93b412e 100644
--- a/zc-business/src/main/java/com/zc/business/service/impl/DcInfoBoardVocabularyServiceImpl.java
+++ b/zc-business/src/main/java/com/zc/business/service/impl/DcInfoBoardVocabularyServiceImpl.java
@@ -54,10 +54,15 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 结果
*/
@Override
- public int insertDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary)
+ public AjaxResult insertDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary)
{
dcInfoBoardVocabulary.setCreateTime(DateUtils.getNowDate());
- return dcInfoBoardVocabularyMapper.insertDcInfoBoardVocabulary(dcInfoBoardVocabulary);
+ int oldNum = dcInfoBoardVocabularyMapper.selectWordNum(dcInfoBoardVocabulary);
+ if (oldNum > 0){
+ return AjaxResult.error("该关键词已存在!");
+ }
+ dcInfoBoardVocabularyMapper.insertDcInfoBoardVocabulary(dcInfoBoardVocabulary);
+ return AjaxResult.success("新增成功");
}
/**
@@ -67,9 +72,14 @@ public class DcInfoBoardVocabularyServiceImpl implements IDcInfoBoardVocabularyS
* @return 结果
*/
@Override
- public int updateDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary)
+ public AjaxResult updateDcInfoBoardVocabulary(DcInfoBoardVocabulary dcInfoBoardVocabulary)
{
- return dcInfoBoardVocabularyMapper.updateDcInfoBoardVocabulary(dcInfoBoardVocabulary);
+ int oldNum = dcInfoBoardVocabularyMapper.selectWordNum(dcInfoBoardVocabulary);
+ if (oldNum > 0){
+ return AjaxResult.error("该关键词已存在!");
+ }
+ dcInfoBoardVocabularyMapper.updateDcInfoBoardVocabulary(dcInfoBoardVocabulary);
+ return AjaxResult.success("修改成功");
}
/**
diff --git a/zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml b/zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml
index d841c80f..b1df6aaf 100644
--- a/zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml
+++ b/zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml
@@ -20,12 +20,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and word like concat('%', #{word}, '%')
-
+
-
+
+
insert into dc_info_board_vocabulary