Commit 0df3ddba authored by xiaosl's avatar xiaosl

举报

parent c1d6cd03
package com.github.wxiaoqi.security.admin.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* 评论举报记录
* @author xiaoshaolin
* @email 18178966185@163.com
* @date 2020-12-13 21:20:35
*/
@Data
@Table(name = "report_comment")
public class ReportComment implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("")
private Long id;
/**
*
*/
@Column(name = "comment_id")
@ApiModelProperty(value = "")
private Long commentId;
/**
*
*/
@Column(name = "remarks")
@ApiModelProperty(value = "")
private String remarks;
/**
*
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "", hidden = true )
private Long crtTime;
/**
*
*/
@Column(name = "user_id")
@ApiModelProperty(value = "")
private Integer userId;
/**
*
*/
@Column(name = "pic_url")
@ApiModelProperty(value = "")
private String picUrl;
/**
* 状态,1未处理,2已处理
*/
@Column(name = "status")
@ApiModelProperty(value = "状态,1未处理,2已处理")
private Integer status;
}
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.stereotype.Service;
import com.github.wxiaoqi.security.admin.entity.ReportComment;
import com.github.wxiaoqi.security.admin.mapper.ReportCommentMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
/**
*
*
* @author xiaoshaolin
* @email 18178966185@163.com
* @date 2020-12-13 21:20:35
*/
@Service
public class ReportCommentBiz extends BaseBiz<ReportCommentMapper, ReportComment> {
public ObjectRestResponse saveReport(ReportComment reportComment) {
if (reportComment.getUserId() != null && reportComment.getUserId() != 0) {
ReportComment query = new ReportComment();
query.setCommentId(reportComment.getCommentId());
query.setUserId(reportComment.getUserId());
List<ReportComment> reportCommentList = selectList(query);
if (reportCommentList != null && reportCommentList.size() > 0) {
return ObjectRestResponse.succ("已举报过,我们会及时处理,无需重复提交");
}
}
reportComment.setCrtTime(System.currentTimeMillis());
reportComment.setStatus(1);
mapper.insertSelective(reportComment);
return ObjectRestResponse.succ("感谢你的反馈,我们会进行核实,并对违规进行下架处理");
}
}
\ No newline at end of file
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.ReportComment;
import tk.mybatis.mapper.common.Mapper;
/**
*
*
* @author xiaoshaolin
* @email 18178966185@163.com
* @date 2020-12-13 21:20:35
*/
public interface ReportCommentMapper extends Mapper<ReportComment> {
}
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.entity.UserComment;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.admin.biz.ReportCommentBiz;
import com.github.wxiaoqi.security.admin.entity.ReportComment;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("app/reportComment")
@Api(tags = {"评论举报"})
public class AppReportCommentController extends BaseController<ReportCommentBiz, ReportComment> {
@PostMapping("saveReport")
@ApiModelProperty("评论举报")
@IgnoreUserToken
public ObjectRestResponse saveReport(@RequestBody ReportComment reportComment) {
reportComment.setUserId(getCurrentUserIdInt());
baseBiz.saveReport(reportComment);
return ObjectRestResponse.succ();
}
}
\ 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.github.wxiaoqi.security.admin.mapper.ReportCommentMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.github.wxiaoqi.security.admin.entity.ReportComment" id="reportCommentMap">
<result property="id" column="id"/>
<result property="commentId" column="comment_id"/>
<result property="remarks" column="remarks"/>
<result property="crtTime" column="crt_time"/>
<result property="userId" column="user_id"/>
<result property="picUrl" column="pic_url"/>
<result property="status" column="status"/>
</resultMap>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment