From 62bce0f1102690a7254c7f805182d6f052d6480c Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 05 Jan 2022 08:42:01 +0800
Subject: [PATCH] 1.敏感词
---
src/main/java/org/springblade/common/config/BladeConfiguration.java | 1
src/main/java/org/springblade/modules/sensitiveword/controller/SensitivewordController.java | 124 +++++++++++++++++
src/main/java/org/springblade/modules/sensitiveword/entity/Sensitiveword.java | 45 ++++++
src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.java | 43 ++++++
src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.xml | 16 ++
src/main/java/org/springblade/modules/sensitiveword/service/ISensitivewordService.java | 41 +++++
src/main/java/org/springblade/modules/sensitiveword/dto/SensitivewordDTO.java | 34 ++++
src/main/java/org/springblade/modules/sensitiveword/service/impl/SensitivewordServiceImpl.java | 41 +++++
src/main/java/org/springblade/modules/sensitiveword/vo/SensitivewordVO.java | 36 +++++
9 files changed, 381 insertions(+), 0 deletions(-)
diff --git a/src/main/java/org/springblade/common/config/BladeConfiguration.java b/src/main/java/org/springblade/common/config/BladeConfiguration.java
index ad35e61..5abce8d 100644
--- a/src/main/java/org/springblade/common/config/BladeConfiguration.java
+++ b/src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -103,6 +103,7 @@
secureRegistry.excludePathPatterns("/investigate/**");
secureRegistry.excludePathPatterns("/taskqd/**");
secureRegistry.excludePathPatterns("/taskfk/**");
+ secureRegistry.excludePathPatterns("/sensitiveword/**");
return secureRegistry;
}
diff --git a/src/main/java/org/springblade/modules/sensitiveword/controller/SensitivewordController.java b/src/main/java/org/springblade/modules/sensitiveword/controller/SensitivewordController.java
new file mode 100644
index 0000000..54098f2
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/controller/SensitivewordController.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.sensitiveword.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.sensitiveword.entity.Sensitiveword;
+import org.springblade.modules.sensitiveword.service.ISensitivewordService;
+import org.springblade.modules.sensitiveword.vo.SensitivewordVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 控制器
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/sensitiveword")
+@Api(value = "", tags = "接口")
+public class SensitivewordController extends BladeController {
+
+ private final ISensitivewordService sensitivewordService;
+
+ /**
+ * 详情
+ */
+ @GetMapping("/detail")
+ @ApiOperationSupport(order = 1)
+ @ApiOperation(value = "详情", notes = "传入sensitiveword")
+ public R<Sensitiveword> detail(Sensitiveword sensitiveword) {
+ Sensitiveword detail = sensitivewordService.getOne(Condition.getQueryWrapper(sensitiveword));
+ return R.data(detail);
+ }
+
+ /**
+ * 分页
+ */
+ @GetMapping("/list")
+ @ApiOperationSupport(order = 2)
+ @ApiOperation(value = "分页", notes = "传入sensitiveword")
+ public R<IPage<Sensitiveword>> list(Sensitiveword sensitiveword, Query query) {
+ IPage<Sensitiveword> pages = sensitivewordService.page(Condition.getPage(query), Condition.getQueryWrapper(sensitiveword));
+ return R.data(pages);
+ }
+
+ /**
+ * 自定义分页
+ */
+ @GetMapping("/page")
+ @ApiOperationSupport(order = 3)
+ @ApiOperation(value = "分页", notes = "传入sensitiveword")
+ public R<IPage<SensitivewordVO>> page(SensitivewordVO sensitiveword, Query query) {
+ IPage<SensitivewordVO> pages = sensitivewordService.selectSensitivewordPage(Condition.getPage(query), sensitiveword);
+ return R.data(pages);
+ }
+
+ /**
+ * 新增
+ */
+ @PostMapping("/save")
+ @ApiOperationSupport(order = 4)
+ @ApiOperation(value = "新增", notes = "传入sensitiveword")
+ public R save(@Valid @RequestBody Sensitiveword sensitiveword) {
+ return R.status(sensitivewordService.save(sensitiveword));
+ }
+
+ /**
+ * 修改
+ */
+ @PostMapping("/update")
+ @ApiOperationSupport(order = 5)
+ @ApiOperation(value = "修改", notes = "传入sensitiveword")
+ public R update(@Valid @RequestBody Sensitiveword sensitiveword) {
+ return R.status(sensitivewordService.updateById(sensitiveword));
+ }
+
+ /**
+ * 新增或修改
+ */
+ @PostMapping("/submit")
+ @ApiOperationSupport(order = 6)
+ @ApiOperation(value = "新增或修改", notes = "传入sensitiveword")
+ public R submit(@Valid @RequestBody Sensitiveword sensitiveword) {
+ return R.status(sensitivewordService.saveOrUpdate(sensitiveword));
+ }
+
+
+ /**
+ * 删除
+ */
+ @PostMapping("/remove")
+ @ApiOperationSupport(order = 8)
+ @ApiOperation(value = "删除", notes = "传入ids")
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+ return R.status(sensitivewordService.removeByIds(Func.toLongList(ids)));
+ }
+}
diff --git a/src/main/java/org/springblade/modules/sensitiveword/dto/SensitivewordDTO.java b/src/main/java/org/springblade/modules/sensitiveword/dto/SensitivewordDTO.java
new file mode 100644
index 0000000..70cac12
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/dto/SensitivewordDTO.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.sensitiveword.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.sensitiveword.entity.Sensitiveword;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SensitivewordDTO extends Sensitiveword {
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/sensitiveword/entity/Sensitiveword.java b/src/main/java/org/springblade/modules/sensitiveword/entity/Sensitiveword.java
new file mode 100644
index 0000000..aeed13a
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/entity/Sensitiveword.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.sensitiveword.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+@Data
+@TableName("sys_sensitiveword")
+@ApiModel(value = "Sensitiveword对象", description = "Sensitiveword对象")
+public class Sensitiveword implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+ private String badword;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.java b/src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.java
new file mode 100644
index 0000000..e019cdf
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.sensitiveword.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.sensitiveword.entity.Sensitiveword;
+import org.springblade.modules.sensitiveword.vo.SensitivewordVO;
+
+import java.util.List;
+
+/**
+ * Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+public interface SensitivewordMapper extends BaseMapper<Sensitiveword> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param sensitiveword
+ * @return
+ */
+ List<SensitivewordVO> selectSensitivewordPage(IPage page, SensitivewordVO sensitiveword);
+
+}
diff --git a/src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.xml b/src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.xml
new file mode 100644
index 0000000..7acf8eb
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/mapper/SensitivewordMapper.xml
@@ -0,0 +1,16 @@
+<?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="org.springblade.modules.sensitiveword.mapper.SensitivewordMapper">
+
+ <!-- 通用查询映射结果 -->
+ <resultMap id="sensitivewordResultMap" type="org.springblade.modules.sensitiveword.entity.Sensitiveword">
+ <id column="id" property="id"/>
+ <result column="badword" property="badword"/>
+ </resultMap>
+
+
+ <select id="selectSensitivewordPage" resultMap="sensitivewordResultMap">
+ select * from sys_sensitiveword where is_deleted = 0
+ </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/sensitiveword/service/ISensitivewordService.java b/src/main/java/org/springblade/modules/sensitiveword/service/ISensitivewordService.java
new file mode 100644
index 0000000..d9daa97
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/service/ISensitivewordService.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.sensitiveword.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.sensitiveword.entity.Sensitiveword;
+import org.springblade.modules.sensitiveword.vo.SensitivewordVO;
+
+/**
+ * 服务类
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+public interface ISensitivewordService extends IService<Sensitiveword> {
+
+ /**
+ * 自定义分页
+ *
+ * @param page
+ * @param sensitiveword
+ * @return
+ */
+ IPage<SensitivewordVO> selectSensitivewordPage(IPage<SensitivewordVO> page, SensitivewordVO sensitiveword);
+
+}
diff --git a/src/main/java/org/springblade/modules/sensitiveword/service/impl/SensitivewordServiceImpl.java b/src/main/java/org/springblade/modules/sensitiveword/service/impl/SensitivewordServiceImpl.java
new file mode 100644
index 0000000..989cdee
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/service/impl/SensitivewordServiceImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.sensitiveword.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.sensitiveword.entity.Sensitiveword;
+import org.springblade.modules.sensitiveword.mapper.SensitivewordMapper;
+import org.springblade.modules.sensitiveword.service.ISensitivewordService;
+import org.springblade.modules.sensitiveword.vo.SensitivewordVO;
+import org.springframework.stereotype.Service;
+
+/**
+ * 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+@Service
+public class SensitivewordServiceImpl extends ServiceImpl<SensitivewordMapper, Sensitiveword> implements ISensitivewordService {
+
+ @Override
+ public IPage<SensitivewordVO> selectSensitivewordPage(IPage<SensitivewordVO> page, SensitivewordVO sensitiveword) {
+ return page.setRecords(baseMapper.selectSensitivewordPage(page, sensitiveword));
+ }
+
+}
diff --git a/src/main/java/org/springblade/modules/sensitiveword/vo/SensitivewordVO.java b/src/main/java/org/springblade/modules/sensitiveword/vo/SensitivewordVO.java
new file mode 100644
index 0000000..124ab54
--- /dev/null
+++ b/src/main/java/org/springblade/modules/sensitiveword/vo/SensitivewordVO.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * Neither the name of the dreamlu.net developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.sensitiveword.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.sensitiveword.entity.Sensitiveword;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2022-01-04
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "SensitivewordVO对象", description = "SensitivewordVO对象")
+public class SensitivewordVO extends Sensitiveword {
+ private static final long serialVersionUID = 1L;
+
+}
--
Gitblit v1.9.3