提交 af7c8a85 authored 作者: 吴德鹏's avatar 吴德鹏

敏感词汇

上级 37467713
package com.platform.controller;
import com.platform.entity.TbCfSensitiveEntity;
import com.platform.service.TbCfSensitiveService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* Controller
*
* @author lipengjun
* @date 2020-06-18 17:29:01
*/
@Controller
@RequestMapping("tbcfsensitive")
public class TbCfSensitiveController {
@Autowired
private TbCfSensitiveService tbCfSensitiveService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("tbcfsensitive:list")
@ResponseBody
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<TbCfSensitiveEntity> tbCfSensitiveList = tbCfSensitiveService.queryList(query);
int total = tbCfSensitiveService.queryTotal(query);
PageUtils pageUtil = new PageUtils(tbCfSensitiveList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("tbcfsensitive:info")
@ResponseBody
public R info(@PathVariable("id") String id) {
TbCfSensitiveEntity tbCfSensitive = tbCfSensitiveService.queryObject(id);
return R.ok().put("tbCfSensitive", tbCfSensitive);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("tbcfsensitive:save")
@ResponseBody
public R save(@RequestBody TbCfSensitiveEntity tbCfSensitive) {
tbCfSensitiveService.save(tbCfSensitive);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("tbcfsensitive:update")
@ResponseBody
public R update(@RequestBody TbCfSensitiveEntity tbCfSensitive) {
tbCfSensitiveService.update(tbCfSensitive);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("tbcfsensitive:delete")
@ResponseBody
public R delete(@RequestBody String[] ids) {
tbCfSensitiveService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<TbCfSensitiveEntity> list = tbCfSensitiveService.queryList(params);
return R.ok().put("list", list);
}
}
package com.platform.dao;
import com.platform.entity.TbCfSensitiveEntity;
/**
* Dao
*
* @author lipengjun
* @date 2020-06-18 17:29:01
*/
public interface TbCfSensitiveDao extends BaseDao<TbCfSensitiveEntity> {
}
package com.platform.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 实体
* 表名 tb_cf_sensitive
*
* @author lipengjun
* @date 2020-06-18 17:29:01
*/
public class TbCfSensitiveEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 敏感词ID
*/
private String id;
/**
* 敏感词
*/
private String sensitiveWords;
/**
* 设置:敏感词ID
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取:敏感词ID
*/
public String getId() {
return id;
}
/**
* 设置:敏感词
*/
public void setSensitiveWords(String sensitiveWords) {
this.sensitiveWords = sensitiveWords;
}
/**
* 获取:敏感词
*/
public String getSensitiveWords() {
return sensitiveWords;
}
}
package com.platform.service;
import com.platform.entity.TbCfSensitiveEntity;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author lipengjun
* @date 2020-06-18 17:29:01
*/
public interface TbCfSensitiveService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfSensitiveEntity queryObject(String id);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfSensitiveEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfSensitive 实体
* @return 保存条数
*/
int save(TbCfSensitiveEntity tbCfSensitive);
/**
* 根据主键更新实体
*
* @param tbCfSensitive 实体
* @return 更新条数
*/
int update(TbCfSensitiveEntity tbCfSensitive);
/**
* 根据主键删除
*
* @param id
* @return 删除条数
*/
int delete(String id);
/**
* 根据主键批量删除
*
* @param ids
* @return 删除条数
*/
int deleteBatch(String[] ids);
}
package com.platform.service.impl;
import com.platform.dao.TbCfSensitiveDao;
import com.platform.entity.TbCfSensitiveEntity;
import com.platform.service.TbCfSensitiveService;
import com.platform.utils.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service实现类
*
* @author lipengjun
* @date 2020-06-18 17:29:01
*/
@Service("tbCfSensitiveService")
public class TbCfSensitiveServiceImpl implements TbCfSensitiveService {
@Autowired
private TbCfSensitiveDao tbCfSensitiveDao;
@Override
public TbCfSensitiveEntity queryObject(String id) {
return tbCfSensitiveDao.queryObject(id);
}
@Override
public List<TbCfSensitiveEntity> queryList(Map<String, Object> map) {
return tbCfSensitiveDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfSensitiveDao.queryTotal(map);
}
@Override
public int save(TbCfSensitiveEntity tbCfSensitive) {
tbCfSensitive.setId(IdUtil.createIdbyUUID());
return tbCfSensitiveDao.save(tbCfSensitive);
}
@Override
public int update(TbCfSensitiveEntity tbCfSensitive) {
return tbCfSensitiveDao.update(tbCfSensitive);
}
@Override
public int delete(String id) {
return tbCfSensitiveDao.delete(id);
}
@Override
public int deleteBatch(String[] ids) {
return tbCfSensitiveDao.deleteBatch(ids);
}
}
<?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.platform.dao.TbCfSensitiveDao">
<resultMap type="com.platform.entity.TbCfSensitiveEntity" id="tbCfSensitiveMap">
<result property="id" column="id"/>
<result property="sensitiveWords" column="sensitive_words"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfSensitiveEntity">
select
`id`,
`sensitive_words`
from tb_cf_sensitive
where id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.TbCfSensitiveEntity">
select
`id`,
`sensitive_words`
from tb_cf_sensitive
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_sensitive
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfSensitiveEntity">
insert into tb_cf_sensitive(
`id`,
`sensitive_words`)
values(
#{id},
#{sensitiveWords})
</insert>
<update id="update" parameterType="com.platform.entity.TbCfSensitiveEntity">
update tb_cf_sensitive
<set>
<if test="sensitiveWords != null">`sensitive_words` = #{sensitiveWords}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete from tb_cf_sensitive where id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_sensitive where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -82,7 +82,7 @@ redis.maxTotal=100
redis.maxIdle=10
redis.maxWaitMillis=5000
redis.minEvictableIdleTimeMillis=60000
redis.minIdle=1
redis.minIdle=500
redis.numTestsPerEvictionRun=10
redis.lifo=false
redis.softMinEvictableIdleTimeMillis=10
......
<!DOCTYPE html>
<html>
<head>
<title></title>
#parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak style="height: calc(100% - 15px);">
<div v-show="showList" style="height: 100%;">
<Row :gutter="16">
<div class="search-group">
<i-col span="4">
<i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
</i-col>
<i-button @click="query">查询</i-button>
<i-button @click="reloadSearch">重置</i-button>
</div>
<div class="buttons-group">
#if($shiro.hasPermission("tbcfsensitive:save"))
<i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
#end
<!-- #if($shiro.hasPermission("tbcfsensitive:update"))-->
<!-- <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>-->
<!-- #end-->
#if($shiro.hasPermission("tbcfsensitive:delete"))
<i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
#end
</div>
</Row>
<table id="jqGrid"></table>
</div>
<Card v-show="!showList">
<p slot="title">{{title}}</p>
<i-form ref="formValidate" :model="tbCfSensitive" :rules="ruleValidate" :label-width="80">
<Form-item label="敏感词汇" prop="sensitiveWords">
<!-- <i-input v-model="tbCfSensitive.sensitiveWords" placeholder="敏感词"/>-->
<textarea v-model="tbCfSensitive.sensitiveWords" style="width: 800px;height: 600px;"></textarea>
</Form-item>
<Form-item>
<i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
<i-button type="warning" @click="reload" style="margin-left: 8px"/>
返回</i-button>
<i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
</Form-item>
</i-form>
</Card>
</div>
<script src="${rc.contextPath}/js/sys/tbcfsensitive.js?_${date.systemTime}"></script>
</body>
</html>
\ No newline at end of file
......@@ -810,7 +810,11 @@ itemStatusFormat = function (cellvalue) {
}
return returnStr;
}
shows = function (cellvalue, options, rowObject) {
let returnStr;
returnStr = "<i-button class=\"ivu-btn ivu-btn-info\" onclick=showWord('" + rowObject.id + "') type=\"info\">查看</i-button>";
return returnStr;
}
/**
* 跳转页面
* @param cellvalue
......@@ -847,6 +851,8 @@ contentFormat = function (cellvalue, options, rowObject) {
var returnStr = "<span class='btn btn-primary' onclick=showContent('" + rowObject.problemId + "')>查看</span>";
return returnStr;
};
/**
* 优惠券类型
* @param cellvalue
......
$(function () {
$("#jqGrid").Grid({
url: '../tbcfsensitive/list',
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '敏感词', name: 'sensitiveWords', index: 'sensitive_words', width: 80},
{
label: '操作', index: 'operate', width: 80, formatter: function (value, grid, rows) {
return "<i-button class=\"ivu-btn ivu-btn-info\" onclick=showWord('" + rows.id + "') type=\"info\">查看</i-button>";
}
}
]
});
});
function showWord(e) {
vm.showList = false;
vm.title = "修改";
vm.getInfo(e);
}
let vm = new Vue({
el: '#rrapp',
data: {
showList: true,
title: null,
tbCfSensitive: {},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
},
q: {
name: ''
}
},
methods: {
query: function () {
vm.reload();
},
add: function () {
vm.showList = false;
vm.title = "新增";
vm.tbCfSensitive = {};
},
update: function (event) {
let id = getSelectedRow("#jqGrid");
if (id == null) {
return;
}
vm.showList = false;
vm.title = "修改";
vm.getInfo(id);
},
saveOrUpdate: function (event) {
let url = vm.tbCfSensitive.id == null ? "../tbcfsensitive/save" : "../tbcfsensitive/update";
Ajax.request({
url: url,
params: JSON.stringify(vm.tbCfSensitive),
type: "POST",
contentType: "application/json",
successCallback: function (r) {
alert('操作成功', function (index) {
vm.reload();
});
}
});
},
del: function (event) {
let ids = getSelectedRows("#jqGrid");
if (ids == null) {
return;
}
confirm('确定要删除选中的记录?', function () {
Ajax.request({
url: "../tbcfsensitive/delete",
params: JSON.stringify(ids),
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.reload();
});
}
});
});
},
getInfo: function (id) {
Ajax.request({
url: "../tbcfsensitive/info/" + id,
async: true,
successCallback: function (r) {
vm.tbCfSensitive = r.tbCfSensitive;
}
});
},
reload: function (event) {
vm.showList = true;
let page = $("#jqGrid").jqGrid('getGridParam', 'page');
$("#jqGrid").jqGrid('setGridParam', {
postData: {'name': vm.q.name},
page: page
}).trigger("reloadGrid");
vm.handleReset('formValidate');
},
reloadSearch: function () {
vm.q = {
name: ''
};
vm.reload();
},
handleSubmit: function (name) {
handleSubmitValidate(this, name, function () {
vm.saveOrUpdate()
});
},
handleReset: function (name) {
handleResetForm(this, name);
}
}
});
\ No newline at end of file
package com.platform.dao;
import com.platform.entity.ComplainEntity;
/**
* Dao
*
* @author lipengjun
* @date 2020-06-19 16:57:10
*/
public interface ComplainDao extends BaseDao<ComplainEntity> {
}
package com.platform.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 实体
* 表名 complain
*
* @author lipengjun
* @date 2020-06-19 16:57:10
*/
public class ComplainEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 举报ID
*/
private String id;
/**
* 举报类型 0:帖子 1:评论 2:回复
*/
private Integer type;
/**
* 0:已删除 1:正常
*/
private Integer archived;
/**
* 删除人
*/
private String archivedBy;
/**
* 删除时间
*/
private Date archivedDate;
/**
* 创建时间
*/
private Date createDate;
/**
* 创建人
*/
private String createdBy;
/**
* 更新时间
*/
private Date updateDate;
/**
* 更新人
*/
private String updatedBy;
/**
* 版本
*/
private Integer version;
/**
* 举报信息
*/
private String description;
/**
* 帖子ID
*/
private String postId;
/**
* 评论ID
*/
private String commentId;
/**
* 回复ID
*/
private String replyId;
/**
* 举报人
*/
private String userId;
/**
* 设置:举报ID
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取:举报ID
*/
public String getId() {
return id;
}
/**
* 设置:举报类型 0:帖子 1:评论 2:回复
*/
public void setType(Integer type) {
this.type = type;
}
/**
* 获取:举报类型 0:帖子 1:评论 2:回复
*/
public Integer getType() {
return type;
}
/**
* 设置:0:已删除 1:正常
*/
public void setArchived(Integer archived) {
this.archived = archived;
}
/**
* 获取:0:已删除 1:正常
*/
public Integer getArchived() {
return archived;
}
/**
* 设置:删除人
*/
public void setArchivedBy(String archivedBy) {
this.archivedBy = archivedBy;
}
/**
* 获取:删除人
*/
public String getArchivedBy() {
return archivedBy;
}
/**
* 设置:删除时间
*/
public void setArchivedDate(Date archivedDate) {
this.archivedDate = archivedDate;
}
/**
* 获取:删除时间
*/
public Date getArchivedDate() {
return archivedDate;
}
/**
* 设置:创建时间
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* 获取:创建时间
*/
public Date getCreateDate() {
return createDate;
}
/**
* 设置:创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* 获取:创建人
*/
public String getCreatedBy() {
return createdBy;
}
/**
* 设置:更新时间
*/
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
/**
* 获取:更新时间
*/
public Date getUpdateDate() {
return updateDate;
}
/**
* 设置:更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* 获取:更新人
*/
public String getUpdatedBy() {
return updatedBy;
}
/**
* 设置:版本
*/
public void setVersion(Integer version) {
this.version = version;
}
/**
* 获取:版本
*/
public Integer getVersion() {
return version;
}
/**
* 设置:举报信息
*/
public void setDescription(String description) {
this.description = description;
}
/**
* 获取:举报信息
*/
public String getDescription() {
return description;
}
/**
* 设置:帖子ID
*/
public void setPostId(String postId) {
this.postId = postId;
}
/**
* 获取:帖子ID
*/
public String getPostId() {
return postId;
}
/**
* 设置:评论ID
*/
public void setCommentId(String commentId) {
this.commentId = commentId;
}
/**
* 获取:评论ID
*/
public String getCommentId() {
return commentId;
}
/**
* 设置:回复ID
*/
public void setReplyId(String replyId) {
this.replyId = replyId;
}
/**
* 获取:回复ID
*/
public String getReplyId() {
return replyId;
}
/**
* 设置:举报人
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:举报人
*/
public String getUserId() {
return userId;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论