main
parent
551080115a
commit
d5db372eae
|
|
@ -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<AppKeyword> 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<AppKeyword> list = appKeywordService.selectAppKeywordList(appKeyword);
|
||||
ExcelUtil<AppKeyword> util = new ExcelUtil<AppKeyword>(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));
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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<AppKeyword> 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);
|
||||
}
|
||||
|
|
@ -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<AppKeyword> 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);
|
||||
}
|
||||
|
|
@ -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<AppKeyword> 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
<?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="com.ruoyi.app.mapper.AppKeywordMapper">
|
||||
|
||||
<resultMap type="AppKeyword" id="AppKeywordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="content" column="content" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="updateBy" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAppKeywordVo">
|
||||
select id, content, create_time, update_time, create_by, updateBy, remark from app_keyword
|
||||
</sql>
|
||||
|
||||
<select id="selectAppKeywordList" parameterType="AppKeyword" resultMap="AppKeywordResult">
|
||||
<include refid="selectAppKeywordVo"/>
|
||||
<where>
|
||||
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and updateBy = #{updateBy}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAppKeywordById" parameterType="Long" resultMap="AppKeywordResult">
|
||||
<include refid="selectAppKeywordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAppKeyword" parameterType="AppKeyword" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into app_keyword
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="content != null">content,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">updateBy,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAppKeyword" parameterType="AppKeyword">
|
||||
update app_keyword
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">updateBy = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAppKeywordById" parameterType="Long">
|
||||
delete from app_keyword where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAppKeywordByIds" parameterType="String">
|
||||
delete from app_keyword where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue