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