Browse Source

情报板敏感词接口修改

develop
lau572 9 months ago
parent
commit
268427bb59
  1. 4
      zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java
  2. 2
      zc-business/src/main/java/com/zc/business/mapper/DcInfoBoardVocabularyMapper.java
  3. 4
      zc-business/src/main/java/com/zc/business/service/IDcInfoBoardVocabularyService.java
  4. 18
      zc-business/src/main/java/com/zc/business/service/impl/DcInfoBoardVocabularyServiceImpl.java
  5. 13
      zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml

4
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);
}
/**

2
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);
/**
* 查询情报板敏感字管理列表
*

4
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);
/**
* 批量删除情报板敏感字管理

18
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("修改成功");
}
/**

13
zc-business/src/main/resources/mapper/business/DcInfoBoardVocabularyMapper.xml

@ -20,12 +20,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="word != null and word != ''"> and word like concat('%', #{word}, '%')</if>
</where>
</select>
<select id="selectDcInfoBoardVocabularyById" parameterType="Long" resultMap="DcInfoBoardVocabularyResult">
<include refid="selectDcInfoBoardVocabularyVo"/>
where id = #{id}
</select>
<select id="selectWordNum" resultType="java.lang.Integer">
select count(*) num from dc_info_board_vocabulary
<where>
word = #{word}
<if test="id != null">
and id != #{id}
</if>
</where>
</select>
<insert id="insertDcInfoBoardVocabulary" parameterType="DcInfoBoardVocabulary" useGeneratedKeys="true" keyProperty="id">
insert into dc_info_board_vocabulary
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save