diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppKeywordController.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppKeywordController.java new file mode 100644 index 0000000..21d4f4c --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/controller/AppKeywordController.java @@ -0,0 +1,114 @@ +package com.ruoyi.app.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.domain.R; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.app.domain.AppKeyword; +import com.ruoyi.app.service.IAppKeywordService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * 敏感词Controller + * + * @author wyh + * @date 2024-05-08 + */ +@RestController +@RequestMapping("/keyword") +@Api(tags = "敏感词" , description = "敏感词") +public class AppKeywordController extends BaseController +{ + @Autowired + private IAppKeywordService appKeywordService; + + /** + * 查询敏感词列表 + */ + @RequiresPermissions("app:keyword:list") + @GetMapping("/list") + @ApiOperation(value = "查询敏感词", notes = "查询敏感词", httpMethod = "GET") + public TableDataInfo list(AppKeyword appKeyword) + { + startPage(); + List list = appKeywordService.selectAppKeywordList(appKeyword); + return getDataTable(list); + } + + /** + * 导出敏感词列表 + */ + @RequiresPermissions("app:keyword:export") + @Log(title = "敏感词", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, AppKeyword appKeyword) + { + List list = appKeywordService.selectAppKeywordList(appKeyword); + ExcelUtil util = new ExcelUtil(AppKeyword.class); + util.exportExcel(response, list, "敏感词数据"); + } + + /** + * 获取敏感词详细信息 + */ + @RequiresPermissions("app:keyword:query") + @GetMapping(value = "/{id}") + @ApiOperation(value = "获取敏感词详细信息", notes = "获取敏感词详细信息", httpMethod = "GET") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(appKeywordService.selectAppKeywordById(id)); + } + + /** + * 新增敏感词 + */ + @RequiresPermissions("app:keyword:add") + @ApiOperation(value = "新增敏感词", notes = "新增敏感词", httpMethod = "POST") + @Log(title = "敏感词", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody AppKeyword appKeyword) + { + return toAjax(appKeywordService.insertAppKeyword(appKeyword)); + } + + /** + * 修改敏感词 + */ + @RequiresPermissions("app:keyword:edit") + @ApiOperation(value = "修改敏感词", notes = "修改敏感词", httpMethod = "PUT") + @Log(title = "敏感词", businessType = BusinessType.UPDATE) + @PutMapping("/edit") + public AjaxResult edit(@RequestBody AppKeyword appKeyword) + { + return toAjax(appKeywordService.updateAppKeyword(appKeyword)); + } + + /** + * 删除敏感词 + */ + @RequiresPermissions("app:keyword:remove") + @Log(title = "敏感词", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(appKeywordService.deleteAppKeywordByIds(ids)); + } +} diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/domain/AppKeyword.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/domain/AppKeyword.java new file mode 100644 index 0000000..4ff3dc3 --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/domain/AppKeyword.java @@ -0,0 +1,56 @@ +package com.ruoyi.app.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 敏感词对象 app_keyword + * + * @author wyh + * @date 2024-05-08 + */ +public class AppKeyword extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 敏感词 */ + @Excel(name = "敏感词") + private String content; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("content", getContent()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .append("createBy", getCreateBy()) + .append("updateBy", getUpdateBy()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/mapper/AppKeywordMapper.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/mapper/AppKeywordMapper.java new file mode 100644 index 0000000..d382729 --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/mapper/AppKeywordMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.app.mapper; + +import java.util.List; +import com.ruoyi.app.domain.AppKeyword; + +/** + * 敏感词Mapper接口 + * + * @author wyh + * @date 2024-05-08 + */ +public interface AppKeywordMapper +{ + /** + * 查询敏感词 + * + * @param id 敏感词主键 + * @return 敏感词 + */ + public AppKeyword selectAppKeywordById(Long id); + + /** + * 查询敏感词列表 + * + * @param appKeyword 敏感词 + * @return 敏感词集合 + */ + public List selectAppKeywordList(AppKeyword appKeyword); + + /** + * 新增敏感词 + * + * @param appKeyword 敏感词 + * @return 结果 + */ + public int insertAppKeyword(AppKeyword appKeyword); + + /** + * 修改敏感词 + * + * @param appKeyword 敏感词 + * @return 结果 + */ + public int updateAppKeyword(AppKeyword appKeyword); + + /** + * 删除敏感词 + * + * @param id 敏感词主键 + * @return 结果 + */ + public int deleteAppKeywordById(Long id); + + /** + * 批量删除敏感词 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteAppKeywordByIds(Long[] ids); +} diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppKeywordService.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppKeywordService.java new file mode 100644 index 0000000..b2b8ab3 --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/IAppKeywordService.java @@ -0,0 +1,61 @@ +package com.ruoyi.app.service; + +import java.util.List; +import com.ruoyi.app.domain.AppKeyword; + +/** + * 敏感词Service接口 + * + * @author wyh + * @date 2024-05-08 + */ +public interface IAppKeywordService +{ + /** + * 查询敏感词 + * + * @param id 敏感词主键 + * @return 敏感词 + */ + public AppKeyword selectAppKeywordById(Long id); + + /** + * 查询敏感词列表 + * + * @param appKeyword 敏感词 + * @return 敏感词集合 + */ + public List selectAppKeywordList(AppKeyword appKeyword); + + /** + * 新增敏感词 + * + * @param appKeyword 敏感词 + * @return 结果 + */ + public int insertAppKeyword(AppKeyword appKeyword); + + /** + * 修改敏感词 + * + * @param appKeyword 敏感词 + * @return 结果 + */ + public int updateAppKeyword(AppKeyword appKeyword); + + /** + * 批量删除敏感词 + * + * @param ids 需要删除的敏感词主键集合 + * @return 结果 + */ + public int deleteAppKeywordByIds(Long[] ids); + + /** + * 删除敏感词信息 + * + * @param id 敏感词主键 + * @return 结果 + */ + public int deleteAppKeywordById(Long id); +} diff --git a/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppKeywordServiceImpl.java b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppKeywordServiceImpl.java new file mode 100644 index 0000000..07ba29a --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/java/com/ruoyi/app/service/impl/AppKeywordServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.app.service.impl; + +import java.util.List; +import com.ruoyi.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.app.mapper.AppKeywordMapper; +import com.ruoyi.app.domain.AppKeyword; +import com.ruoyi.app.service.IAppKeywordService; + +/** + * 敏感词Service业务层处理 + * + * @author wyh + * @date 2024-05-08 + */ +@Service +public class AppKeywordServiceImpl implements IAppKeywordService +{ + @Autowired + private AppKeywordMapper appKeywordMapper; + + /** + * 查询敏感词 + * + * @param id 敏感词主键 + * @return 敏感词 + */ + @Override + public AppKeyword selectAppKeywordById(Long id) + { + return appKeywordMapper.selectAppKeywordById(id); + } + + /** + * 查询敏感词列表 + * + * @param appKeyword 敏感词 + * @return 敏感词 + */ + @Override + public List selectAppKeywordList(AppKeyword appKeyword) + { + return appKeywordMapper.selectAppKeywordList(appKeyword); + } + + /** + * 新增敏感词 + * + * @param appKeyword 敏感词 + * @return 结果 + */ + @Override + public int insertAppKeyword(AppKeyword appKeyword) + { + appKeyword.setCreateTime(DateUtils.getNowDate()); + return appKeywordMapper.insertAppKeyword(appKeyword); + } + + /** + * 修改敏感词 + * + * @param appKeyword 敏感词 + * @return 结果 + */ + @Override + public int updateAppKeyword(AppKeyword appKeyword) + { + appKeyword.setUpdateTime(DateUtils.getNowDate()); + return appKeywordMapper.updateAppKeyword(appKeyword); + } + + /** + * 批量删除敏感词 + * + * @param ids 需要删除的敏感词主键 + * @return 结果 + */ + @Override + public int deleteAppKeywordByIds(Long[] ids) + { + return appKeywordMapper.deleteAppKeywordByIds(ids); + } + + /** + * 删除敏感词信息 + * + * @param id 敏感词主键 + * @return 结果 + */ + @Override + public int deleteAppKeywordById(Long id) + { + return appKeywordMapper.deleteAppKeywordById(id); + } +} diff --git a/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppKeywordMapper.xml b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppKeywordMapper.xml new file mode 100644 index 0000000..a531219 --- /dev/null +++ b/gan-modules/ruoyi-gan/src/main/resources/mapper/app/AppKeywordMapper.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + select id, content, create_time, update_time, create_by, updateBy, remark from app_keyword + + + + + + + + insert into app_keyword + + content, + create_time, + update_time, + create_by, + updateBy, + remark, + + + #{content}, + #{createTime}, + #{updateTime}, + #{createBy}, + #{updateBy}, + #{remark}, + + + + + update app_keyword + + content = #{content}, + create_time = #{createTime}, + update_time = #{updateTime}, + create_by = #{createBy}, + updateBy = #{updateBy}, + remark = #{remark}, + + where id = #{id} + + + + delete from app_keyword where id = #{id} + + + + delete from app_keyword where id in + + #{id} + + + \ No newline at end of file