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

完成举报管理

上级 465775ae
package com.platform.controller;
import com.platform.entity.CommentEntity;
import com.platform.service.CommentService;
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-23 11:46:51
*/
@Controller
@RequestMapping("comment")
public class CommentController {
@Autowired
private CommentService commentService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("comment:list")
@ResponseBody
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<CommentEntity> commentList = commentService.queryList(query);
int total = commentService.queryTotal(query);
PageUtils pageUtil = new PageUtils(commentList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("comment:info")
@ResponseBody
public R info(@PathVariable("id") String id) {
CommentEntity comment = commentService.queryObject(id);
return R.ok().put("comment", comment);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("comment:save")
@ResponseBody
public R save(@RequestBody CommentEntity comment) {
commentService.save(comment);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("comment:update")
@ResponseBody
public R update(@RequestBody CommentEntity comment) {
commentService.update(comment);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("comment:delete")
@ResponseBody
public R delete(@RequestBody String[] ids) {
commentService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<CommentEntity> list = commentService.queryList(params);
return R.ok().put("list", list);
}
}
......@@ -56,7 +56,7 @@ public class ComplainController {
@RequiresPermissions("complain:info")
@ResponseBody
public R info(@PathVariable("id") String id) {
ComplainEntity complain = complainService.queryObject(id);
ComplainVo complain = complainService.queryObject(id);
return R.ok().put("complain", complain);
}
......@@ -120,13 +120,10 @@ public class ComplainController {
@RequestMapping("/changeStatus")
@ResponseBody
public R changeStatus(@RequestParam("id") String id,
@RequestParam("type") Integer type,
@RequestParam("archived") Integer archived) {
int res = complainService.changeStatus(id, type, archived);
if (res > 0) {
return R.ok();
} else {
return R.error("操作失败");
}
complainService.changeStatus(id, archived);
return R.ok();
}
}
package com.platform.controller;
import com.platform.entity.ReplyEntity;
import com.platform.service.ReplyService;
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-23 11:55:01
*/
@Controller
@RequestMapping("reply")
public class ReplyController {
@Autowired
private ReplyService replyService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("reply:list")
@ResponseBody
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<ReplyEntity> replyList = replyService.queryList(query);
int total = replyService.queryTotal(query);
PageUtils pageUtil = new PageUtils(replyList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("reply:info")
@ResponseBody
public R info(@PathVariable("id") Long id) {
ReplyEntity reply = replyService.queryObject(id);
return R.ok().put("reply", reply);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("reply:save")
@ResponseBody
public R save(@RequestBody ReplyEntity reply) {
replyService.save(reply);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("reply:update")
@ResponseBody
public R update(@RequestBody ReplyEntity reply) {
replyService.update(reply);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("reply:delete")
@ResponseBody
public R delete(@RequestBody Long[] ids) {
replyService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<ReplyEntity> list = replyService.queryList(params);
return R.ok().put("list", list);
}
}
package com.platform.dao;
import com.platform.entity.CommentEntity;
/**
* Dao
*
* @author lipengjun
* @date 2020-06-23 11:46:51
*/
public interface CommentDao extends BaseDao<CommentEntity> {
}
......@@ -18,4 +18,7 @@ public interface ComplainDao extends BaseDao<ComplainEntity> {
List<ComplainVo> queryComplainList(Map<String, Object> map);
int changeStatus(@Param("id") String id, @Param("archived") Integer archived);
ComplainVo queryObject(String id);
}
package com.platform.dao;
import com.platform.entity.ReplyEntity;
/**
* Dao
*
* @author lipengjun
* @date 2020-06-23 11:55:01
*/
public interface ReplyDao extends BaseDao<ReplyEntity> {
}
......@@ -16,11 +16,11 @@ public class PostEntity implements Serializable {
/**
*
*/
private Long id;
private String id;
/**
*
*/
private String archived;
private Integer archived;
/**
*
*/
......@@ -70,27 +70,22 @@ public class PostEntity implements Serializable {
this.userId = userId;
}
public Long getId() {
public String getId() {
return id;
}
public void setId(Long id) {
public void setId(String id) {
this.id = id;
}
/**
* 设置:
*/
public void setArchived(String archived) {
this.archived = archived;
public Integer getArchived() {
return archived;
}
/**
* 获取:
*/
public String getArchived() {
return archived;
public void setArchived(Integer archived) {
this.archived = archived;
}
/**
* 设置:
*/
......
package com.platform.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 实体
* 表名 reply
*
* @author lipengjun
* @date 2020-06-23 11:55:01
*/
public class ReplyEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String id;
/**
*
*/
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 content;
/**
*
*/
private String commentId;
/**
*
*/
private String userId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getArchived() {
return archived;
}
public void setArchived(Integer archived) {
this.archived = 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 setContent(String content) {
this.content = content;
}
/**
* 获取:
*/
public String getContent() {
return content;
}
public String getCommentId() {
return commentId;
}
public void setCommentId(String commentId) {
this.commentId = commentId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
}
package com.platform.service;
import com.platform.entity.CommentEntity;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author lipengjun
* @date 2020-06-23 11:46:51
*/
public interface CommentService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
CommentEntity queryObject(String id);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<CommentEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param comment 实体
* @return 保存条数
*/
int save(CommentEntity comment);
/**
* 根据主键更新实体
*
* @param comment 实体
* @return 更新条数
*/
int update(CommentEntity comment);
/**
* 根据主键删除
*
* @param id
* @return 删除条数
*/
int delete(String id);
/**
* 根据主键批量删除
*
* @param ids
* @return 删除条数
*/
int deleteBatch(String[] ids);
}
......@@ -22,7 +22,7 @@ public interface ComplainService {
* @param id 主键
* @return 实体
*/
ComplainEntity queryObject(String id);
ComplainVo queryObject(String id);
/**
* 分页查询
......@@ -76,9 +76,8 @@ public interface ComplainService {
* 根据ID修改状态
*
* @param id
* @param type
* @param archived
* @return
*/
int changeStatus(String id, Integer type, Integer archived);
void changeStatus(String id, Integer archived);
}
package com.platform.service;
import com.platform.entity.ReplyEntity;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author lipengjun
* @date 2020-06-23 11:55:01
*/
public interface ReplyService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
ReplyEntity queryObject(Long id);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<ReplyEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param reply 实体
* @return 保存条数
*/
int save(ReplyEntity reply);
/**
* 根据主键更新实体
*
* @param reply 实体
* @return 更新条数
*/
int update(ReplyEntity reply);
/**
* 根据主键删除
*
* @param id
* @return 删除条数
*/
int delete(Long id);
/**
* 根据主键批量删除
*
* @param ids
* @return 删除条数
*/
int deleteBatch(Long[] ids);
}
package com.platform.service.impl;
import com.platform.dao.CommentDao;
import com.platform.entity.CommentEntity;
import com.platform.service.CommentService;
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-23 11:46:51
*/
@Service("commentService")
public class CommentServiceImpl implements CommentService {
@Autowired
private CommentDao commentDao;
@Override
public CommentEntity queryObject(String id) {
return commentDao.queryObject(id);
}
@Override
public List<CommentEntity> queryList(Map<String, Object> map) {
return commentDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return commentDao.queryTotal(map);
}
@Override
public int save(CommentEntity comment) {
comment.setId(IdUtil.createIdbyUUID());
return commentDao.save(comment);
}
@Override
public int update(CommentEntity comment) {
return commentDao.update(comment);
}
@Override
public int delete(String id) {
return commentDao.delete(id);
}
@Override
public int deleteBatch(String[] ids) {
return commentDao.deleteBatch(ids);
}
}
package com.platform.service.impl;
import com.platform.dao.ComplainDao;
import com.platform.dao.PostDao;
import com.platform.dao.TbCfUserInfoDao;
import com.platform.entity.ComplainEntity;
import com.platform.entity.ComplainVo;
import com.platform.dao.*;
import com.platform.entity.*;
import com.platform.service.ComplainService;
import com.platform.utils.IdUtil;
import com.platform.utils.R;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -33,18 +31,29 @@ public class ComplainServiceImpl implements ComplainService {
@Autowired
private TbCfUserInfoDao tbCfUserInfoDao;
@Autowired
private CommentDao commentDao;
@Autowired
private ReplyDao replyDao;
@Override
public ComplainEntity queryObject(String id) {
ComplainEntity complainEntity = complainDao.queryObject(id);
ComplainVo complain = new ComplainVo();
BeanUtils.copyProperties(complainEntity, complain);
if ("1".equals(complain.getType())) {
public ComplainVo queryObject(String id) {
ComplainVo complain = complainDao.queryObject(id);
ComplainVo complainVo = new ComplainVo();
BeanUtils.copyProperties(complain, complainVo);
if ("1".equals(complain.getType().toString())) {
//查询被举报的评论
} else if ("2".equals(complain.getType())) {
//查询被举报的回复信息
CommentEntity comment = commentDao.queryObject(complain.getCommentId());
if (comment != null)
complainVo.setCaption(comment.getContent());
} else if ("2".equals(complain.getType().toString())) {
//查询被举报的回复信息
ReplyEntity reply = replyDao.queryObject(complain.getReplyId());
if (reply != null)
complainVo.setCaption(reply.getContent());
}
return complainEntity;
return complainVo;
}
@Override
......@@ -103,24 +112,35 @@ public class ComplainServiceImpl implements ComplainService {
* ============================
*
* @param id
* @param type
* @param archived
* @return 修改记录数
*/
@Override
public int changeStatus(String id, Integer type, Integer archived) {
int res = 0;
public void changeStatus(String id, Integer archived) {
ComplainEntity complain = complainDao.queryObject(id);
Integer type = complain.getType();
//帖子
if ("0".equals(type.toString())) {
res = complainDao.changeStatus(id, archived);
complainDao.changeStatus(id, archived);
PostEntity post = postDao.queryObject(complain.getPostId());
post.setArchived(archived);
postDao.update(post);
} else if ("1".equals(type.toString())) {
//评论
res = complainDao.changeStatus(id, archived);
complainDao.changeStatus(id, archived);
CommentEntity comment = commentDao.queryObject(complain.getCommentId());
comment.setArchived(archived);
commentDao.update(comment);
} else if ("2".equals(type.toString())) {
//回复
res = complainDao.changeStatus(id, archived);
complainDao.changeStatus(id, archived);
ReplyEntity reply = replyDao.queryObject(complain.getReplyId());
reply.setArchived(archived);
replyDao.update(reply);
}
return res;
}
}
......@@ -38,7 +38,7 @@ public class PostServiceImpl implements PostService {
@Override
public int save(PostEntity post) {
post.setId(Long.parseLong(IdUtil.createIdbyUUID()));
post.setId(IdUtil.createIdbyUUID());
return postDao.save(post);
}
......
package com.platform.service.impl;
import com.platform.dao.ReplyDao;
import com.platform.entity.ReplyEntity;
import com.platform.service.ReplyService;
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-23 11:55:01
*/
@Service("replyService")
public class ReplyServiceImpl implements ReplyService {
@Autowired
private ReplyDao replyDao;
@Override
public ReplyEntity queryObject(Long id) {
return replyDao.queryObject(id);
}
@Override
public List<ReplyEntity> queryList(Map<String, Object> map) {
return replyDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return replyDao.queryTotal(map);
}
@Override
public int save(ReplyEntity reply) {
reply.setId(IdUtil.createIdbyUUID());
return replyDao.save(reply);
}
@Override
public int update(ReplyEntity reply) {
return replyDao.update(reply);
}
@Override
public int delete(Long id) {
return replyDao.delete(id);
}
@Override
public int deleteBatch(Long[] ids) {
return replyDao.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.CommentDao">
<resultMap type="com.platform.entity.CommentEntity" id="commentMap">
<result property="id" column="id"/>
<result property="archived" column="archived"/>
<result property="archivedBy" column="archived_by"/>
<result property="archivedDate" column="archived_date"/>
<result property="createDate" column="create_date"/>
<result property="createdBy" column="created_by"/>
<result property="updateDate" column="update_date"/>
<result property="updatedBy" column="updated_by"/>
<result property="version" column="version"/>
<result property="content" column="content"/>
<result property="postId" column="post_id"/>
<result property="userId" column="user_id"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.CommentEntity">
select
`id`,
`archived`,
`archived_by`,
`archived_date`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`content`,
`post_id`,
`user_id`
from comment
where id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.CommentEntity">
select
`id`,
`archived`,
`archived_by`,
`archived_date`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`content`,
`post_id`,
`user_id`
from comment
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 comment
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.CommentEntity">
insert into comment(
`id`,
`archived`,
`archived_by`,
`archived_date`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`content`,
`post_id`,
`user_id`)
values(
#{id},
#{archived},
#{archivedBy},
#{archivedDate},
#{createDate},
#{createdBy},
#{updateDate},
#{updatedBy},
#{version},
#{content},
#{postId},
#{userId})
</insert>
<update id="update" parameterType="com.platform.entity.CommentEntity">
update comment
<set>
<if test="archived != null">`archived` = #{archived}, </if>
<if test="archivedBy != null">`archived_by` = #{archivedBy}, </if>
<if test="archivedDate != null">`archived_date` = #{archivedDate}, </if>
<if test="createDate != null">`create_date` = #{createDate}, </if>
<if test="createdBy != null">`created_by` = #{createdBy}, </if>
<if test="updateDate != null">`update_date` = #{updateDate}, </if>
<if test="updatedBy != null">`updated_by` = #{updatedBy}, </if>
<if test="version != null">`version` = #{version}, </if>
<if test="content != null">`content` = #{content}, </if>
<if test="postId != null">`post_id` = #{postId}, </if>
<if test="userId != null">`user_id` = #{userId}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete from comment where id = #{value}
</delete>
<delete id="deleteBatch">
delete from comment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.ReplyDao">
<resultMap type="com.platform.entity.ReplyEntity" id="replyMap">
<result property="id" column="id"/>
<result property="archived" column="archived"/>
<result property="archivedBy" column="archived_by"/>
<result property="archivedDate" column="archived_date"/>
<result property="createDate" column="create_date"/>
<result property="createdBy" column="created_by"/>
<result property="updateDate" column="update_date"/>
<result property="updatedBy" column="updated_by"/>
<result property="version" column="version"/>
<result property="content" column="content"/>
<result property="commentId" column="comment_id"/>
<result property="userId" column="user_id"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.ReplyEntity">
select
`id`,
`archived`,
`archived_by`,
`archived_date`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`content`,
`comment_id`,
`user_id`
from reply
where id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.ReplyEntity">
select
`id`,
`archived`,
`archived_by`,
`archived_date`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`content`,
`comment_id`,
`user_id`
from reply
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 reply
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.ReplyEntity" useGeneratedKeys="true" keyProperty="id">
insert into reply(
`archived`,
`archived_by`,
`archived_date`,
`create_date`,
`created_by`,
`update_date`,
`updated_by`,
`version`,
`content`,
`comment_id`,
`user_id`)
values(
#{archived},
#{archivedBy},
#{archivedDate},
#{createDate},
#{createdBy},
#{updateDate},
#{updatedBy},
#{version},
#{content},
#{commentId},
#{userId})
</insert>
<update id="update" parameterType="com.platform.entity.ReplyEntity">
update reply
<set>
<if test="archived != null">`archived` = #{archived}, </if>
<if test="archivedBy != null">`archived_by` = #{archivedBy}, </if>
<if test="archivedDate != null">`archived_date` = #{archivedDate}, </if>
<if test="createDate != null">`create_date` = #{createDate}, </if>
<if test="createdBy != null">`created_by` = #{createdBy}, </if>
<if test="updateDate != null">`update_date` = #{updateDate}, </if>
<if test="updatedBy != null">`updated_by` = #{updatedBy}, </if>
<if test="version != null">`version` = #{version}, </if>
<if test="content != null">`content` = #{content}, </if>
<if test="commentId != null">`comment_id` = #{commentId}, </if>
<if test="userId != null">`user_id` = #{userId}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete from reply where id = #{value}
</delete>
<delete id="deleteBatch">
delete from reply where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<!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("comment:save"))
<i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
#end
#if($shiro.hasPermission("comment:update"))
<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
#end
#if($shiro.hasPermission("comment: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="comment" :rules="ruleValidate" :label-width="80">
<Form-item label="" prop="archived">
<i-input v-model="comment.archived" placeholder=""/>
</Form-item>
<Form-item label="" prop="archivedBy">
<i-input v-model="comment.archivedBy" placeholder=""/>
</Form-item>
<Form-item label="" prop="archivedDate">
<i-input v-model="comment.archivedDate" placeholder=""/>
</Form-item>
<Form-item label="" prop="createDate">
<i-input v-model="comment.createDate" placeholder=""/>
</Form-item>
<Form-item label="" prop="createdBy">
<i-input v-model="comment.createdBy" placeholder=""/>
</Form-item>
<Form-item label="" prop="updateDate">
<i-input v-model="comment.updateDate" placeholder=""/>
</Form-item>
<Form-item label="" prop="updatedBy">
<i-input v-model="comment.updatedBy" placeholder=""/>
</Form-item>
<Form-item label="" prop="version">
<i-input v-model="comment.version" placeholder=""/>
</Form-item>
<Form-item label="" prop="content">
<i-input v-model="comment.content" placeholder=""/>
</Form-item>
<Form-item label="" prop="postId">
<i-input v-model="comment.postId" placeholder=""/>
</Form-item>
<Form-item label="" prop="userId">
<i-input v-model="comment.userId" placeholder=""/>
</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/comment.js?_${date.systemTime}"></script>
</body>
</html>
\ No newline at end of file
<!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("reply:save"))
<i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
#end
#if($shiro.hasPermission("reply:update"))
<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
#end
#if($shiro.hasPermission("reply: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="reply" :rules="ruleValidate" :label-width="80">
<Form-item label="" prop="archived">
<i-input v-model="reply.archived" placeholder=""/>
</Form-item>
<Form-item label="" prop="archivedBy">
<i-input v-model="reply.archivedBy" placeholder=""/>
</Form-item>
<Form-item label="" prop="archivedDate">
<i-input v-model="reply.archivedDate" placeholder=""/>
</Form-item>
<Form-item label="" prop="createDate">
<i-input v-model="reply.createDate" placeholder=""/>
</Form-item>
<Form-item label="" prop="createdBy">
<i-input v-model="reply.createdBy" placeholder=""/>
</Form-item>
<Form-item label="" prop="updateDate">
<i-input v-model="reply.updateDate" placeholder=""/>
</Form-item>
<Form-item label="" prop="updatedBy">
<i-input v-model="reply.updatedBy" placeholder=""/>
</Form-item>
<Form-item label="" prop="version">
<i-input v-model="reply.version" placeholder=""/>
</Form-item>
<Form-item label="" prop="content">
<i-input v-model="reply.content" placeholder=""/>
</Form-item>
<Form-item label="" prop="commentId">
<i-input v-model="reply.commentId" placeholder=""/>
</Form-item>
<Form-item label="" prop="userId">
<i-input v-model="reply.userId" placeholder=""/>
</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/reply.js?_${date.systemTime}"></script>
</body>
</html>
\ No newline at end of file
$(function () {
$("#jqGrid").Grid({
url: '../comment/list',
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '', name: 'archived', index: 'archived', width: 80},
{label: '', name: 'archivedBy', index: 'archived_by', width: 80},
{label: '', name: 'archivedDate', index: 'archived_date', width: 80},
{label: '', name: 'createDate', index: 'create_date', width: 80},
{label: '', name: 'createdBy', index: 'created_by', width: 80},
{label: '', name: 'updateDate', index: 'update_date', width: 80},
{label: '', name: 'updatedBy', index: 'updated_by', width: 80},
{label: '', name: 'version', index: 'version', width: 80},
{label: '', name: 'content', index: 'content', width: 80},
{label: '', name: 'postId', index: 'post_id', width: 80},
{label: '', name: 'userId', index: 'user_id', width: 80}]
});
});
let vm = new Vue({
el: '#rrapp',
data: {
showList: true,
title: null,
comment: {},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
},
q: {
name: ''
}
},
methods: {
query: function () {
vm.reload();
},
add: function () {
vm.showList = false;
vm.title = "新增";
vm.comment = {};
},
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.comment.id == null ? "../comment/save" : "../comment/update";
Ajax.request({
url: url,
params: JSON.stringify(vm.comment),
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: "../comment/delete",
params: JSON.stringify(ids),
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.reload();
});
}
});
});
},
getInfo: function(id){
Ajax.request({
url: "../comment/info/"+id,
async: true,
successCallback: function (r) {
vm.comment = r.comment;
}
});
},
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
......@@ -72,7 +72,7 @@ let vm = new Vue({
methods: {
off: function (id) {
let url = '../complain/changeStatus?id=' + id + '&type=0&archived=2';
let url = '../complain/changeStatus?id=' + id + '&archived=2';
Ajax.request({
url: url,
type: "POST",
......@@ -83,7 +83,7 @@ let vm = new Vue({
});
},
activate: function (id) {
let url = '../complain/changeStatus?id=' + id + '&type=0&archived=1';
let url = '../complain/changeStatus?id=' + id + '&archived=1';
Ajax.request({
url: url,
type: "POST",
......
$(function () {
$("#jqGrid").Grid({
url: '../reply/list',
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '', name: 'archived', index: 'archived', width: 80},
{label: '', name: 'archivedBy', index: 'archived_by', width: 80},
{label: '', name: 'archivedDate', index: 'archived_date', width: 80},
{label: '', name: 'createDate', index: 'create_date', width: 80},
{label: '', name: 'createdBy', index: 'created_by', width: 80},
{label: '', name: 'updateDate', index: 'update_date', width: 80},
{label: '', name: 'updatedBy', index: 'updated_by', width: 80},
{label: '', name: 'version', index: 'version', width: 80},
{label: '', name: 'content', index: 'content', width: 80},
{label: '', name: 'commentId', index: 'comment_id', width: 80},
{label: '', name: 'userId', index: 'user_id', width: 80}]
});
});
let vm = new Vue({
el: '#rrapp',
data: {
showList: true,
title: null,
reply: {},
ruleValidate: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'}
]
},
q: {
name: ''
}
},
methods: {
query: function () {
vm.reload();
},
add: function () {
vm.showList = false;
vm.title = "新增";
vm.reply = {};
},
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.reply.id == null ? "../reply/save" : "../reply/update";
Ajax.request({
url: url,
params: JSON.stringify(vm.reply),
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: "../reply/delete",
params: JSON.stringify(ids),
type: "POST",
contentType: "application/json",
successCallback: function () {
alert('操作成功', function (index) {
vm.reload();
});
}
});
});
},
getInfo: function(id){
Ajax.request({
url: "../reply/info/"+id,
async: true,
successCallback: function (r) {
vm.reply = r.reply;
}
});
},
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
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论