36 changed files with 2117 additions and 17 deletions
@ -0,0 +1,151 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 内容评论表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class NoticeCommentDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 内容ID |
||||
|
*/ |
||||
|
private String noticeId; |
||||
|
|
||||
|
/** |
||||
|
* 评论人ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 评论人昵称 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
|
||||
|
/** |
||||
|
* 评论人头像 |
||||
|
*/ |
||||
|
private String userFace; |
||||
|
|
||||
|
/** |
||||
|
* 评论内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 评论类型 0:评论,1:回复,2:回复的回复 |
||||
|
*/ |
||||
|
private String commentType; |
||||
|
|
||||
|
/** |
||||
|
* 回复的评论ID |
||||
|
*/ |
||||
|
private String commentId; |
||||
|
|
||||
|
/** |
||||
|
* 被回复数 |
||||
|
*/ |
||||
|
private Integer replyCount; |
||||
|
|
||||
|
/** |
||||
|
* 被回复人ID |
||||
|
*/ |
||||
|
private String replyUserId; |
||||
|
|
||||
|
/** |
||||
|
* 被回复人名称 |
||||
|
*/ |
||||
|
private String replyUserName; |
||||
|
|
||||
|
/** |
||||
|
* 被回复人头像 |
||||
|
*/ |
||||
|
private String replyUserFace; |
||||
|
|
||||
|
/** |
||||
|
* 点赞数 |
||||
|
*/ |
||||
|
private Integer likeCount; |
||||
|
|
||||
|
/** |
||||
|
* 点踩数 |
||||
|
*/ |
||||
|
private Integer unLikeCount; |
||||
|
|
||||
|
/** |
||||
|
* 屏蔽标识 0:未屏蔽,1:已屏蔽 |
||||
|
*/ |
||||
|
private String shieldFlag; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0:未删除,1:已删除 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** |
||||
|
* 0 未进行校验;1 微信校验通过;2 微信校验不通过;3 管理员校验通过;4 管理员校验不通过 |
||||
|
*/ |
||||
|
private String sensitiveFlag; |
||||
|
|
||||
|
/** |
||||
|
* 党员标识(0-否,1-是) |
||||
|
*/ |
||||
|
private String partyFlag; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,86 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dto; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 内容评论点赞点踩表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class NoticeCommentUserAttitudeDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* ID |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论ID |
||||
|
*/ |
||||
|
private String noticeCommentId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户点赞点踩标识 0:点赞,1:点踩 |
||||
|
*/ |
||||
|
private String attitudeFlag; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识 0:未删除,1:删除 |
||||
|
*/ |
||||
|
private String delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.Min; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 移动端-内容最新最热列表 |
||||
|
* @Author zy |
||||
|
* @Date 2020/3/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcNoticeCommentListFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -8864248267171206774L; |
||||
|
|
||||
|
/** |
||||
|
* 页码,从1开始 |
||||
|
*/ |
||||
|
@Min(value = 1, message = "页码必须大于0") |
||||
|
private int pageIndex; |
||||
|
/** |
||||
|
* 页容量,默认20页 |
||||
|
*/ |
||||
|
@Min(value = 1, message = "每页条数必须大于必须大于0") |
||||
|
private int pageSize = 10; |
||||
|
|
||||
|
/** |
||||
|
* 第一页查询发起时的时间 |
||||
|
*/ |
||||
|
private String timestamp; |
||||
|
|
||||
|
/** |
||||
|
* 列表类型 0最新;1最热 |
||||
|
*/ |
||||
|
@NotBlank(message = "列表类型不能为空") |
||||
|
private String orderType; |
||||
|
|
||||
|
/** |
||||
|
* 内容ID |
||||
|
*/ |
||||
|
@NotBlank(message = "内容ID不能为空") |
||||
|
private String noticeId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.form; |
||||
|
|
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author: zhangyong |
||||
|
* @Date: 2020/3/25 |
||||
|
* @Description: 表态评论(赞/踩) |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcNoticeCommentStatementFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -2046090814527654468L; |
||||
|
|
||||
|
/** |
||||
|
* 表态 0赞;1踩;2取消点赞;3取消点踩 |
||||
|
*/ |
||||
|
@NotNull(message = "态度不能为空") |
||||
|
private String attitude; |
||||
|
|
||||
|
/** |
||||
|
* 评论ID |
||||
|
*/ |
||||
|
@NotNull(message = "评论ID不能为空") |
||||
|
private String commentId; |
||||
|
|
||||
|
/** |
||||
|
* 新闻ID |
||||
|
*/ |
||||
|
@NotNull(message = "内容ID不能为空") |
||||
|
private String noticeId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import javax.validation.constraints.Size; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 移动端-评论内容、提交评论 |
||||
|
* @Author zy |
||||
|
* @Date 2020/3/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcNoticeCommentSubmitFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -8864248267071206774L; |
||||
|
|
||||
|
/** |
||||
|
* 被评论的内容ID |
||||
|
*/ |
||||
|
@NotBlank(message = "被评论的内容ID不能为空") |
||||
|
private String noticeId; |
||||
|
|
||||
|
/** |
||||
|
* 父评论(被评论)ID |
||||
|
*/ |
||||
|
private String faCommentId; |
||||
|
|
||||
|
/** |
||||
|
* 评论内容 |
||||
|
*/ |
||||
|
@Size(min = 1, max = 500, message = "评论内容不能超过500字") |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 评论人ID |
||||
|
*/ |
||||
|
@NotNull(message = "评论人ID不能为空") |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 评论人昵称 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
|
||||
|
/** |
||||
|
* 评论人头像 |
||||
|
*/ |
||||
|
private String userFace; |
||||
|
|
||||
|
/** |
||||
|
* 党员标识(0-否,1-是) |
||||
|
*/ |
||||
|
private String partyFlag; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
*是否提交为内容待审核状态 |
||||
|
*/ |
||||
|
private Boolean isConReview; |
||||
|
|
||||
|
/** |
||||
|
* 部门id |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 移动端-新闻最新最热列表 |
||||
|
* @Author zy |
||||
|
* @Date 2020/3/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcNoticeCommentListResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 6087794316919494277L; |
||||
|
|
||||
|
/** |
||||
|
* 表态数 |
||||
|
*/ |
||||
|
private long statementNum; |
||||
|
|
||||
|
/** |
||||
|
* 最新最热 评论列表 |
||||
|
*/ |
||||
|
private List<EpdcNoticeCommentsResultDTO> commentsListResultDTO; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 移动端-内容评论用户信息 |
||||
|
* @Author zy |
||||
|
* @Date 2020/3/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcNoticeCommentUserInfoResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 6087794316919494277L; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户名 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
|
||||
|
/** |
||||
|
* 用户头像 |
||||
|
*/ |
||||
|
private String userFace; |
||||
|
|
||||
|
/** |
||||
|
* 党员标识(0-否,1-是) |
||||
|
*/ |
||||
|
private String partyFlag; |
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 移动端-内容最新最热 评论列表 |
||||
|
* @Author zy |
||||
|
* @Date 2020/3/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcNoticeCommentsResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 6087794316919494277L; |
||||
|
|
||||
|
/** |
||||
|
* 评论ID |
||||
|
*/ |
||||
|
private String commentId; |
||||
|
/** |
||||
|
* 评论内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
/** |
||||
|
* 时间 |
||||
|
*/ |
||||
|
private String commentTime; |
||||
|
|
||||
|
/** |
||||
|
* 赞数 |
||||
|
*/ |
||||
|
private Integer approveNum; |
||||
|
|
||||
|
/** |
||||
|
* 踩数 |
||||
|
*/ |
||||
|
private Integer opposeNum; |
||||
|
|
||||
|
/** |
||||
|
* 用户信息 |
||||
|
*/ |
||||
|
private EpdcNoticeCommentUserInfoResultDTO user; |
||||
|
|
||||
|
/** |
||||
|
* 回复评论信息 |
||||
|
*/ |
||||
|
private EpdcNoticeReplyCommentResultDTO replyComment; |
||||
|
|
||||
|
/** |
||||
|
* 用户是否赞过,false未赞 |
||||
|
*/ |
||||
|
private Boolean userLike; |
||||
|
/** |
||||
|
* 用户是否踩过,true踩 |
||||
|
*/ |
||||
|
private Boolean userDislike; |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.elink.esua.epdc.dto.epdc.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 移动端-内容回复评论信息 |
||||
|
* @Author zy |
||||
|
* @Date 2020/3/26 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EpdcNoticeReplyCommentResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 6087794316919494277L; |
||||
|
|
||||
|
/** |
||||
|
* 用户名 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
/** |
||||
|
* 内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.dto.NoticeCommentDTO; |
||||
|
import com.elink.esua.epdc.service.NoticeCommentService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 内容评论表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("noticecomment") |
||||
|
public class NoticeCommentController { |
||||
|
|
||||
|
@Autowired |
||||
|
private NoticeCommentService noticeCommentService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<NoticeCommentDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<NoticeCommentDTO> page = noticeCommentService.page(params); |
||||
|
return new Result<PageData<NoticeCommentDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<NoticeCommentDTO> get(@PathVariable("id") String id){ |
||||
|
NoticeCommentDTO data = noticeCommentService.get(id); |
||||
|
return new Result<NoticeCommentDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody NoticeCommentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
noticeCommentService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody NoticeCommentDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
noticeCommentService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
noticeCommentService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.controller; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO; |
||||
|
import com.elink.esua.epdc.service.NoticeCommentUserAttitudeService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 内容评论点赞点踩表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("noticecommentuserattitude") |
||||
|
public class NoticeCommentUserAttitudeController { |
||||
|
|
||||
|
@Autowired |
||||
|
private NoticeCommentUserAttitudeService noticeCommentUserAttitudeService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<NoticeCommentUserAttitudeDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<NoticeCommentUserAttitudeDTO> page = noticeCommentUserAttitudeService.page(params); |
||||
|
return new Result<PageData<NoticeCommentUserAttitudeDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<NoticeCommentUserAttitudeDTO> get(@PathVariable("id") String id){ |
||||
|
NoticeCommentUserAttitudeDTO data = noticeCommentUserAttitudeService.get(id); |
||||
|
return new Result<NoticeCommentUserAttitudeDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody NoticeCommentUserAttitudeDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
noticeCommentUserAttitudeService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody NoticeCommentUserAttitudeDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
noticeCommentUserAttitudeService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
noticeCommentUserAttitudeService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,107 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO; |
||||
|
import com.elink.esua.epdc.entity.NoticeCommentEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface NoticeCommentDao extends BaseDao<NoticeCommentEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 评论回复数加1 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:19 |
||||
|
*/ |
||||
|
void updateReplyCount(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 更新内容评论支持数 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:52 |
||||
|
*/ |
||||
|
void updateNoticeCommentApproveNum(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 更新内容评论反对数 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:52 |
||||
|
*/ |
||||
|
void updateNoticeCommentOpposeNum(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 评论 赞数-1 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 15:02 |
||||
|
*/ |
||||
|
void updateNoticeCommentApproveNumSubtract(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 评论 踩数-1 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 15:02 |
||||
|
*/ |
||||
|
void updateNoticeCommentOpposeNumSubtract(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 内容评论的表态数 |
||||
|
* |
||||
|
* @param noticeId 内容ID |
||||
|
* @return long |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 15:11 |
||||
|
*/ |
||||
|
long selectCountOfNoticeCommentStatementNum(String noticeId); |
||||
|
|
||||
|
/** |
||||
|
* 内容评论列表 |
||||
|
* |
||||
|
* @param formDto 参数 |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO> |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 15:14 |
||||
|
*/ |
||||
|
List<EpdcNoticeCommentsResultDTO> selectListNoticeComments(EpdcNoticeCommentListFormDTO formDto); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论点赞点踩表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface NoticeCommentUserAttitudeDao extends BaseDao<NoticeCommentUserAttitudeEntity> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,121 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epdc_notice_comment") |
||||
|
public class NoticeCommentEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 内容ID |
||||
|
*/ |
||||
|
private String noticeId; |
||||
|
|
||||
|
/** |
||||
|
* 评论人ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 评论人昵称 |
||||
|
*/ |
||||
|
private String userName; |
||||
|
|
||||
|
/** |
||||
|
* 评论人头像 |
||||
|
*/ |
||||
|
private String userFace; |
||||
|
|
||||
|
/** |
||||
|
* 评论内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 评论类型 0:评论,1:回复,2:回复的回复 |
||||
|
*/ |
||||
|
private String commentType; |
||||
|
|
||||
|
/** |
||||
|
* 回复的评论ID |
||||
|
*/ |
||||
|
private String commentId; |
||||
|
|
||||
|
/** |
||||
|
* 被回复数 |
||||
|
*/ |
||||
|
private Integer replyCount; |
||||
|
|
||||
|
/** |
||||
|
* 被回复人ID |
||||
|
*/ |
||||
|
private String replyUserId; |
||||
|
|
||||
|
/** |
||||
|
* 被回复人名称 |
||||
|
*/ |
||||
|
private String replyUserName; |
||||
|
|
||||
|
/** |
||||
|
* 被回复人头像 |
||||
|
*/ |
||||
|
private String replyUserFace; |
||||
|
|
||||
|
/** |
||||
|
* 点赞数 |
||||
|
*/ |
||||
|
private Integer likeCount; |
||||
|
|
||||
|
/** |
||||
|
* 点踩数 |
||||
|
*/ |
||||
|
private Integer unLikeCount; |
||||
|
|
||||
|
/** |
||||
|
* 屏蔽标识 0:未屏蔽,1:已屏蔽 |
||||
|
*/ |
||||
|
private String shieldFlag; |
||||
|
|
||||
|
/** |
||||
|
* 0 未进行校验;1 微信校验通过;2 微信校验不通过;3 管理员校验通过;4 管理员校验不通过 |
||||
|
*/ |
||||
|
private String sensitiveFlag; |
||||
|
|
||||
|
/** |
||||
|
* 党员标识(0-否,1-是) |
||||
|
*/ |
||||
|
private String partyFlag; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论点赞点踩表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epdc_notice_comment_user_attitude") |
||||
|
public class NoticeCommentUserAttitudeEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论ID |
||||
|
*/ |
||||
|
private String noticeCommentId; |
||||
|
|
||||
|
/** |
||||
|
* 用户ID |
||||
|
*/ |
||||
|
private String userId; |
||||
|
|
||||
|
/** |
||||
|
* 用户点赞点踩标识 0:点赞,1:点踩 |
||||
|
*/ |
||||
|
private String attitudeFlag; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,170 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.NoticeCommentDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO; |
||||
|
import com.elink.esua.epdc.entity.NoticeCommentEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
public interface NoticeCommentService extends BaseService<NoticeCommentEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<NoticeCommentDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
PageData<NoticeCommentDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<NoticeCommentDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
List<NoticeCommentDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return NoticeCommentDTO |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
NoticeCommentDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
void save(NoticeCommentDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
void update(NoticeCommentDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 内容评论、回复提交 |
||||
|
* |
||||
|
* @param formDto |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 11:18 |
||||
|
*/ |
||||
|
Result saveNoticeComment(EpdcNoticeCommentSubmitFormDTO formDto); |
||||
|
|
||||
|
/** |
||||
|
* 内容评论表态 |
||||
|
* |
||||
|
* @param formDto |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 13:33 |
||||
|
*/ |
||||
|
Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto); |
||||
|
|
||||
|
/** |
||||
|
* 内容评论列表 |
||||
|
* |
||||
|
* @param formDto |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO> |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 13:43 |
||||
|
*/ |
||||
|
Result<EpdcNoticeCommentListResultDTO> listNoticeComments(EpdcNoticeCommentListFormDTO formDto); |
||||
|
|
||||
|
/** |
||||
|
* 更新内容评论支持数 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:52 |
||||
|
*/ |
||||
|
void updateNoticeCommentApproveNum(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 更新内容评论反对数 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:52 |
||||
|
*/ |
||||
|
void updateNoticeCommentOpposeNum(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 评论 赞数-1 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:59 |
||||
|
*/ |
||||
|
void updateNoticeCommentApproveNumSubtract(String commentId); |
||||
|
|
||||
|
/** |
||||
|
* 评论 踩数-1 |
||||
|
* |
||||
|
* @param commentId 评论ID |
||||
|
* @return void |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:59 |
||||
|
*/ |
||||
|
void updateNoticeCommentOpposeNumSubtract(String commentId); |
||||
|
} |
||||
@ -0,0 +1,107 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO; |
||||
|
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论点赞点踩表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
public interface NoticeCommentUserAttitudeService extends BaseService<NoticeCommentUserAttitudeEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<NoticeCommentUserAttitudeDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
PageData<NoticeCommentUserAttitudeDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<NoticeCommentUserAttitudeDTO> |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
List<NoticeCommentUserAttitudeDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return NoticeCommentUserAttitudeDTO |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
NoticeCommentUserAttitudeDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
void save(NoticeCommentUserAttitudeDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
void update(NoticeCommentUserAttitudeDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2021-03-16 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 内容评论表态 |
||||
|
* |
||||
|
* @param formDto |
||||
|
* @return com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO |
||||
|
* @author Liuchuang |
||||
|
* @since 2021/3/16 14:45 |
||||
|
*/ |
||||
|
Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto); |
||||
|
} |
||||
@ -0,0 +1,201 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dao.NoticeCommentDao; |
||||
|
import com.elink.esua.epdc.dto.NoticeCommentDTO; |
||||
|
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentListFormDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentSubmitFormDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentListResultDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO; |
||||
|
import com.elink.esua.epdc.entity.NoticeCommentEntity; |
||||
|
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity; |
||||
|
import com.elink.esua.epdc.service.NoticeCommentService; |
||||
|
import com.elink.esua.epdc.service.NoticeCommentUserAttitudeService; |
||||
|
import com.elink.esua.epdc.service.NoticeService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class NoticeCommentServiceImpl extends BaseServiceImpl<NoticeCommentDao, NoticeCommentEntity> implements NoticeCommentService { |
||||
|
|
||||
|
@Autowired |
||||
|
private NoticeService noticeService; |
||||
|
|
||||
|
@Autowired |
||||
|
private NoticeCommentUserAttitudeService noticeCommentUserAttitudeService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<NoticeCommentDTO> page(Map<String, Object> params) { |
||||
|
IPage<NoticeCommentEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, NoticeCommentDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<NoticeCommentDTO> list(Map<String, Object> params) { |
||||
|
List<NoticeCommentEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, NoticeCommentDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<NoticeCommentEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<NoticeCommentEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public NoticeCommentDTO get(String id) { |
||||
|
NoticeCommentEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, NoticeCommentDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(NoticeCommentDTO dto) { |
||||
|
NoticeCommentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(NoticeCommentDTO dto) { |
||||
|
NoticeCommentEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public Result saveNoticeComment(EpdcNoticeCommentSubmitFormDTO formDto) { |
||||
|
NoticeCommentEntity commentEntity = new NoticeCommentEntity(); |
||||
|
commentEntity.setContent(formDto.getContent()); |
||||
|
commentEntity.setUserId(formDto.getUserId()); |
||||
|
commentEntity.setUserName(formDto.getUserName()); |
||||
|
commentEntity.setUserFace(formDto.getUserFace()); |
||||
|
commentEntity.setPartyFlag(formDto.getPartyFlag()); |
||||
|
commentEntity.setNoticeId(formDto.getNoticeId()); |
||||
|
|
||||
|
// 评论类型 0-评论
|
||||
|
String commentType = NumConstant.ZERO_STR; |
||||
|
// 父评论:用户回复的那条评论
|
||||
|
NoticeCommentEntity parentComment = null; |
||||
|
if (!StringUtils.isEmpty(formDto.getFaCommentId())) { |
||||
|
parentComment = baseDao.selectById(formDto.getFaCommentId()); |
||||
|
if (null == parentComment || null == parentComment.getId()) { |
||||
|
return new Result().error("您要回复的评论不存在"); |
||||
|
} |
||||
|
|
||||
|
commentType = NumConstant.ONE_STR; |
||||
|
commentEntity.setCommentId(formDto.getFaCommentId()); |
||||
|
commentEntity.setReplyUserId(parentComment.getUserId()); |
||||
|
commentEntity.setReplyUserName(parentComment.getUserName()); |
||||
|
commentEntity.setReplyUserFace(parentComment.getUserFace()); |
||||
|
} |
||||
|
commentEntity.setCommentType(commentType); |
||||
|
if (NumConstant.ONE != baseDao.insert(commentEntity)) { |
||||
|
return new Result().error("评论失败"); |
||||
|
} |
||||
|
// 回复加1
|
||||
|
if (NumConstant.ONE_STR.equals(commentType)) { |
||||
|
baseDao.updateReplyCount(formDto.getFaCommentId()); |
||||
|
} |
||||
|
// 内容评论数加1
|
||||
|
noticeService.updateNoticeCommentNum(commentEntity.getNoticeId()); |
||||
|
|
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto) { |
||||
|
return noticeCommentUserAttitudeService.noticeCommentStatement(formDto); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<EpdcNoticeCommentListResultDTO> listNoticeComments(EpdcNoticeCommentListFormDTO formDto) { |
||||
|
// 表态数
|
||||
|
long statementNum = baseDao.selectCountOfNoticeCommentStatementNum(formDto.getNoticeId()); |
||||
|
int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize(); |
||||
|
formDto.setPageIndex(pageIndex); |
||||
|
// 评论
|
||||
|
List<EpdcNoticeCommentsResultDTO> list = baseDao.selectListNoticeComments(formDto); |
||||
|
EpdcNoticeCommentListResultDTO data = new EpdcNoticeCommentListResultDTO(); |
||||
|
data.setStatementNum(statementNum); |
||||
|
data.setCommentsListResultDTO(list); |
||||
|
return new Result<EpdcNoticeCommentListResultDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void updateNoticeCommentApproveNum(String commentId) { |
||||
|
baseDao.updateNoticeCommentApproveNum(commentId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void updateNoticeCommentOpposeNum(String commentId) { |
||||
|
baseDao.updateNoticeCommentOpposeNum(commentId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void updateNoticeCommentApproveNumSubtract(String commentId) { |
||||
|
baseDao.updateNoticeCommentApproveNumSubtract(commentId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void updateNoticeCommentOpposeNumSubtract(String commentId) { |
||||
|
baseDao.updateNoticeCommentOpposeNumSubtract(commentId); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,163 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* This program is free software: you can redistribute it and/or modify |
||||
|
* it under the terms of the GNU General Public License as published by |
||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||
|
* (at your option) any later version. |
||||
|
* <p> |
||||
|
* This program is distributed in the hope that it will be useful, |
||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
* GNU General Public License for more details. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dao.NoticeCommentUserAttitudeDao; |
||||
|
import com.elink.esua.epdc.dto.NoticeCommentUserAttitudeDTO; |
||||
|
import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeCommentStatementFormDTO; |
||||
|
import com.elink.esua.epdc.entity.NoticeCommentUserAttitudeEntity; |
||||
|
import com.elink.esua.epdc.service.NoticeCommentService; |
||||
|
import com.elink.esua.epdc.service.NoticeCommentUserAttitudeService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 内容评论点赞点踩表 |
||||
|
* |
||||
|
* @author qu qu@elink-cn.com |
||||
|
* @since v1.0.0 2021-03-16 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class NoticeCommentUserAttitudeServiceImpl extends BaseServiceImpl<NoticeCommentUserAttitudeDao, NoticeCommentUserAttitudeEntity> implements NoticeCommentUserAttitudeService { |
||||
|
|
||||
|
@Autowired |
||||
|
private NoticeCommentService noticeCommentService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<NoticeCommentUserAttitudeDTO> page(Map<String, Object> params) { |
||||
|
IPage<NoticeCommentUserAttitudeEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, NoticeCommentUserAttitudeDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<NoticeCommentUserAttitudeDTO> list(Map<String, Object> params) { |
||||
|
List<NoticeCommentUserAttitudeEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, NoticeCommentUserAttitudeDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<NoticeCommentUserAttitudeEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<NoticeCommentUserAttitudeEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public NoticeCommentUserAttitudeDTO get(String id) { |
||||
|
NoticeCommentUserAttitudeEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, NoticeCommentUserAttitudeDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(NoticeCommentUserAttitudeDTO dto) { |
||||
|
NoticeCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentUserAttitudeEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(NoticeCommentUserAttitudeDTO dto) { |
||||
|
NoticeCommentUserAttitudeEntity entity = ConvertUtils.sourceToTarget(dto, NoticeCommentUserAttitudeEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public Result noticeCommentStatement(EpdcNoticeCommentStatementFormDTO formDto) { |
||||
|
// 获取用户表态记录
|
||||
|
QueryWrapper<NoticeCommentUserAttitudeEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(formDto.getUserId()), "USER_ID", formDto.getUserId()); |
||||
|
wrapper.eq(StringUtils.isNotBlank(formDto.getCommentId()), "NOTICE_COMMENT_ID", formDto.getCommentId()); |
||||
|
NoticeCommentUserAttitudeEntity attitudeEntity = baseDao.selectOne(wrapper); |
||||
|
if (NumConstant.ZERO_STR.equals(formDto.getAttitude()) || NumConstant.ONE_STR.equals(formDto.getAttitude())){ |
||||
|
if (attitudeEntity == null){ |
||||
|
//没有点赞或者点踩,直接插入数据
|
||||
|
NoticeCommentUserAttitudeDTO noticeCommentUserAttitudeDto = new NoticeCommentUserAttitudeDTO(); |
||||
|
noticeCommentUserAttitudeDto.setNoticeCommentId(formDto.getCommentId()); |
||||
|
noticeCommentUserAttitudeDto.setUserId(formDto.getUserId()); |
||||
|
noticeCommentUserAttitudeDto.setAttitudeFlag(formDto.getAttitude()); |
||||
|
this.save(noticeCommentUserAttitudeDto); |
||||
|
|
||||
|
if (NumConstant.ZERO_STR.equals(formDto.getAttitude())){ |
||||
|
noticeCommentService.updateNoticeCommentApproveNum(formDto.getCommentId()); |
||||
|
} |
||||
|
if (NumConstant.ONE_STR.equals(formDto.getAttitude())){ |
||||
|
noticeCommentService.updateNoticeCommentOpposeNum(formDto.getCommentId()); |
||||
|
} |
||||
|
|
||||
|
}else { |
||||
|
if (!formDto.getAttitude().equals(attitudeEntity.getAttitudeFlag())){ |
||||
|
attitudeEntity.setAttitudeFlag(formDto.getAttitude()); |
||||
|
this.updateById(attitudeEntity); |
||||
|
|
||||
|
if (NumConstant.ZERO_STR.equals(formDto.getAttitude())){ |
||||
|
//赞数加1 踩数减一
|
||||
|
noticeCommentService.updateNoticeCommentApproveNum(formDto.getCommentId()); |
||||
|
noticeCommentService.updateNoticeCommentOpposeNumSubtract(formDto.getCommentId()); |
||||
|
}else { |
||||
|
//踩数加一 赞数减一
|
||||
|
noticeCommentService.updateNoticeCommentOpposeNum(formDto.getCommentId()); |
||||
|
noticeCommentService.updateNoticeCommentApproveNumSubtract(formDto.getCommentId()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}else { |
||||
|
//删除点赞或踩的记录,如果重新点赞或踩则重新插入
|
||||
|
this.deleteById(attitudeEntity.getId()); |
||||
|
if (NumConstant.TWO_STR.equals(formDto.getAttitude())){ |
||||
|
//取消赞
|
||||
|
noticeCommentService.updateNoticeCommentApproveNumSubtract(formDto.getCommentId()); |
||||
|
} |
||||
|
if (NumConstant.THREE_STR.equals(formDto.getAttitude())){ |
||||
|
//取消踩
|
||||
|
noticeCommentService.updateNoticeCommentOpposeNumSubtract(formDto.getCommentId()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,124 @@ |
|||||
|
<?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.elink.esua.epdc.dao.NoticeCommentDao"> |
||||
|
|
||||
|
<update id="updateReplyCount"> |
||||
|
UPDATE epdc_notice_comment |
||||
|
SET REPLY_COUNT = REPLY_COUNT + 1 |
||||
|
WHERE ID = #{commentId} |
||||
|
</update> |
||||
|
|
||||
|
<update id="updateNoticeCommentApproveNum"> |
||||
|
UPDATE epdc_notice_comment |
||||
|
SET LIKE_COUNT = LIKE_COUNT + 1 |
||||
|
WHERE ID = #{commentId} |
||||
|
</update> |
||||
|
|
||||
|
|
||||
|
<update id="updateNoticeCommentOpposeNum"> |
||||
|
UPDATE epdc_notice_comment |
||||
|
SET UN_LIKE_COUNT = UN_LIKE_COUNT + 1 |
||||
|
WHERE ID = #{commentId} |
||||
|
</update> |
||||
|
|
||||
|
<update id="updateNoticeCommentApproveNumSubtract" parameterType="java.lang.String"> |
||||
|
UPDATE epdc_notice_comment |
||||
|
SET LIKE_COUNT = LIKE_COUNT - 1 |
||||
|
WHERE ID = #{commentId} |
||||
|
</update> |
||||
|
|
||||
|
|
||||
|
<update id="updateNoticeCommentOpposeNumSubtract" parameterType="java.lang.String"> |
||||
|
UPDATE epdc_notice_comment |
||||
|
SET UN_LIKE_COUNT = UN_LIKE_COUNT - 1 |
||||
|
WHERE ID = #{commentId} |
||||
|
</update> |
||||
|
|
||||
|
<select id="selectCountOfNoticeCommentStatementNum" resultType="long"> |
||||
|
SELECT |
||||
|
COUNT( ID ) + |
||||
|
CASE |
||||
|
WHEN SUM( LIKE_COUNT + UN_LIKE_COUNT ) IS NULL THEN |
||||
|
0 ELSE SUM( LIKE_COUNT + UN_LIKE_COUNT ) |
||||
|
END AS statementNum |
||||
|
FROM |
||||
|
epdc_notice_comment |
||||
|
WHERE |
||||
|
DEL_FLAG = '0' |
||||
|
AND NOTICE_ID = #{noticeId} |
||||
|
</select> |
||||
|
|
||||
|
<resultMap id="listNoticeCommentsMap" type="com.elink.esua.epdc.dto.epdc.result.EpdcNoticeCommentsResultDTO"> |
||||
|
<result property="commentId" column="ID"/> |
||||
|
<result property="content" column="CONTENT"/> |
||||
|
<result property="commentTime" column="CREATED_TIME"/> |
||||
|
<result property="approveNum" column="LIKE_COUNT"/> |
||||
|
<result property="opposeNum" column="UN_LIKE_COUNT"/> |
||||
|
|
||||
|
<result property="user.userId" column="USER_ID"/> |
||||
|
<result property="user.userName" column="USERNAME"/> |
||||
|
<result property="user.userFace" column="USER_FACE"/> |
||||
|
<result property="user.partyFlag" column="PARTY_FLAG"/> |
||||
|
|
||||
|
<result property="userLike" column="userLike"/> |
||||
|
<result property="userDislike" column="userDislike"/> |
||||
|
|
||||
|
<result property="replyComment.userName" column="replyUserName"/> |
||||
|
<result property="replyComment.content" column="replyContent"/> |
||||
|
</resultMap> |
||||
|
<select id="selectListNoticeComments" resultMap="listNoticeCommentsMap"> |
||||
|
SELECT |
||||
|
t2.ID, |
||||
|
t2.CONTENT, |
||||
|
t2.CREATED_TIME, |
||||
|
t2.LIKE_COUNT, |
||||
|
t2.UN_LIKE_COUNT, |
||||
|
t2.USER_ID, |
||||
|
t2.USER_FACE, |
||||
|
t2.USERNAME, |
||||
|
t2.PARTY_FLAG, |
||||
|
t2.userLike, |
||||
|
t2.userDislike, |
||||
|
t3.USER_NAME AS replyUserName, |
||||
|
t3.CONTENT AS replyContent |
||||
|
FROM ( |
||||
|
SELECT |
||||
|
(ua.attitude_flag = 0) userLike, |
||||
|
(ua.attitude_flag = 1) userDislike, |
||||
|
t1.ID, |
||||
|
t1.COMMENT_ID, |
||||
|
t1.CONTENT, |
||||
|
t1.CREATED_TIME, |
||||
|
t1.USER_ID, |
||||
|
t1.USER_FACE, |
||||
|
t1.USER_NAME USERNAME, |
||||
|
t1.PARTY_FLAG, |
||||
|
t1.LIKE_COUNT, |
||||
|
t1.UN_LIKE_COUNT, |
||||
|
(t1.REPLY_COUNT + t1.LIKE_COUNT + t1.UN_LIKE_COUNT) AS attitudeNum |
||||
|
FROM |
||||
|
epdc_notice_comment t1 |
||||
|
LEFT JOIN epdc_notice_comment_user_attitude ua |
||||
|
ON t1.ID = ua.NOTICE_COMMENT_ID |
||||
|
AND ua.DEL_FLAG = '0' |
||||
|
AND ua.USER_ID = #{userId} |
||||
|
AND ua.UPDATED_TIME = ( SELECT MAX( a.updated_time ) FROM epdc_notice_comment_user_attitude a WHERE a.NOTICE_COMMENT_ID = ua.NOTICE_COMMENT_ID AND a.user_id = ua.user_id ) |
||||
|
WHERE t1.DEL_FLAG = '0' AND t1.SHIELD_FLAG = '0' |
||||
|
AND t1.NOTICE_ID = #{noticeId} |
||||
|
ORDER BY |
||||
|
<if test='orderType == "1"'> |
||||
|
attitudeNum DESC, |
||||
|
</if> |
||||
|
t1.CREATED_TIME DESC |
||||
|
LIMIT #{pageIndex},#{pageSize} |
||||
|
) t2 |
||||
|
LEFT JOIN epdc_notice_comment t3 ON t2.COMMENT_ID = t3.ID |
||||
|
ORDER BY |
||||
|
<if test='orderType == "1"'> |
||||
|
attitudeNum DESC, |
||||
|
</if> |
||||
|
t2.CREATED_TIME DESC |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,6 @@ |
|||||
|
<?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.elink.esua.epdc.dao.NoticeCommentUserAttitudeDao"> |
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue