修改了评论的删除恢复
This commit is contained in:
parent
9ec9847c4b
commit
db5d869f43
@ -5,6 +5,7 @@ import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.User
|
|||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentStatusUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentStatusUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentTopUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentTopUpdateForm;
|
||||||
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateDeleteStatusForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.service.UserCommentClinicalArticleService;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.service.UserCommentClinicalArticleService;
|
||||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
@ -80,4 +81,11 @@ public class UserCommentClinicalArticleController {
|
|||||||
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
||||||
return userCommentClinicalArticleService.delete(commentId);
|
return userCommentClinicalArticleService.delete(commentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新删除状态 @author xing")
|
||||||
|
@PostMapping("/userCommentClinicalArticle/updateDeleteStatus")
|
||||||
|
@SaCheckPermission("userCommentClinicalArticle:delete")
|
||||||
|
public ResponseDTO<String> updateDeleteStatus(@RequestBody @Valid UserCommentClinicalArticleUpdateDeleteStatusForm updateForm) {
|
||||||
|
return userCommentClinicalArticleService.updateDeleteStatus(updateForm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,11 @@ public class UserCommentClinicalArticleEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer isSensitive;
|
private Integer isSensitive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除状态(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer deleteStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否置顶(0:否 1:是)
|
* 是否置顶(0:否 1:是)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -23,6 +23,6 @@ public class UserCommentClinicalArticleQueryForm extends PageParam {
|
|||||||
@Schema(description = "是否置顶(0:否 1:是)")
|
@Schema(description = "是否置顶(0:否 1:是)")
|
||||||
private Integer isTop;
|
private Integer isTop;
|
||||||
|
|
||||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
@Schema(description = "删除状态(0:否 1:是)")
|
||||||
private Integer isSensitive;
|
private Integer deleteStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,9 @@ public class UserCommentClinicalArticleVO {
|
|||||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
||||||
private Integer isSensitive;
|
private Integer isSensitive;
|
||||||
|
|
||||||
|
@Schema(description = "删除状态(0:否 1:是)")
|
||||||
|
private Integer deleteStatus;
|
||||||
|
|
||||||
@Schema(description = "是否置顶(0:否 1:是)")
|
@Schema(description = "是否置顶(0:否 1:是)")
|
||||||
private Integer isTop;
|
private Integer isTop;
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.User
|
|||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentStatusUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentStatusUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentTopUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentTopUpdateForm;
|
||||||
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.form.UserCommentClinicalArticleUpdateDeleteStatusForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO;
|
import net.lab1024.sa.admin.module.business.caseClinicalArticle.domain.vo.UserCommentClinicalArticleVO;
|
||||||
import net.lab1024.sa.base.common.exception.BusinessException;
|
import net.lab1024.sa.base.common.exception.BusinessException;
|
||||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||||
@ -216,4 +217,51 @@ public class UserCommentClinicalArticleService {
|
|||||||
userCommentClinicalArticleDao.deleteById(commentId);
|
userCommentClinicalArticleDao.deleteById(commentId);
|
||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新删除状态
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public ResponseDTO<String> updateDeleteStatus(UserCommentClinicalArticleUpdateDeleteStatusForm updateForm) {
|
||||||
|
if (null == updateForm.getCommentId() || null == updateForm.getDeleteStatus()){
|
||||||
|
return ResponseDTO.userErrorParam("参数不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取评论数据
|
||||||
|
UserCommentClinicalArticleEntity userCommentClinicalArticle = userCommentClinicalArticleDao.selectById(updateForm.getCommentId());
|
||||||
|
if (null == userCommentClinicalArticle) {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新删除状态
|
||||||
|
userCommentClinicalArticle.setDeleteStatus(updateForm.getDeleteStatus());
|
||||||
|
userCommentClinicalArticleDao.updateById(userCommentClinicalArticle);
|
||||||
|
|
||||||
|
// 如果是从删除状态恢复,需要增加统计字段
|
||||||
|
if (updateForm.getDeleteStatus() == 0) {
|
||||||
|
boolean r = caseClinicalArticleService.IncClinicalArticleStats(
|
||||||
|
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||||
|
3,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
if (!r){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果是设置为删除状态,需要减少统计字段
|
||||||
|
boolean r = caseClinicalArticleService.DecClinicalArticleStats(
|
||||||
|
String.valueOf(userCommentClinicalArticle.getArticleId()),
|
||||||
|
3,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
if (!r){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseDTO.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCo
|
|||||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentStatusUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentStatusUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentTopUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentTopUpdateForm;
|
||||||
|
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateDeleteStatusForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.vo.UserCommentClinicalVideoVO;
|
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.vo.UserCommentClinicalVideoVO;
|
||||||
import net.lab1024.sa.admin.module.business.caseClinicalVideo.service.UserCommentClinicalVideoService;
|
import net.lab1024.sa.admin.module.business.caseClinicalVideo.service.UserCommentClinicalVideoService;
|
||||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
@ -80,4 +81,11 @@ public class UserCommentClinicalVideoController {
|
|||||||
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
||||||
return userCommentClinicalVideoService.delete(commentId);
|
return userCommentClinicalVideoService.delete(commentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新删除状态 @author xing")
|
||||||
|
@PostMapping("/userCommentClinicalVideo/updateDeleteStatus")
|
||||||
|
@SaCheckPermission("userCommentClinicalVideo:delete")
|
||||||
|
public ResponseDTO<String> updateDeleteStatus(@RequestBody @Valid UserCommentClinicalVideoUpdateDeleteStatusForm updateForm) {
|
||||||
|
return userCommentClinicalVideoService.updateDeleteStatus(updateForm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,11 @@ public class UserCommentClinicalVideoEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer isSensitive;
|
private Integer isSensitive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除状态(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer deleteStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否置顶(0:否 1:是)
|
* 是否置顶(0:否 1:是)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -23,6 +23,6 @@ public class UserCommentClinicalVideoQueryForm extends PageParam {
|
|||||||
@Schema(description = "是否置顶(0:否 1:是)")
|
@Schema(description = "是否置顶(0:否 1:是)")
|
||||||
private Integer isTop;
|
private Integer isTop;
|
||||||
|
|
||||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
@Schema(description = "删除状态(0:否 1:是)")
|
||||||
private Integer isSensitive;
|
private Integer deleteStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,9 @@ public class UserCommentClinicalVideoVO {
|
|||||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
||||||
private Integer isSensitive;
|
private Integer isSensitive;
|
||||||
|
|
||||||
|
@Schema(description = "删除状态(0:否 1:是)")
|
||||||
|
private Integer deleteStatus;
|
||||||
|
|
||||||
@Schema(description = "是否置顶(0:否 1:是)")
|
@Schema(description = "是否置顶(0:否 1:是)")
|
||||||
private Integer isTop;
|
private Integer isTop;
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import net.lab1024.sa.admin.module.business.caseClinicalVideo.domain.form.UserCommentClinicalVideoUpdateDeleteStatusForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户评论-临床病例-视频 Service
|
* 用户评论-临床病例-视频 Service
|
||||||
@ -197,10 +198,10 @@ public class UserCommentClinicalVideoService {
|
|||||||
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(commentId);
|
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(commentId);
|
||||||
if (null == userCommentClinicalVideo) {
|
if (null == userCommentClinicalVideo) {
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return ResponseDTO.userErrorParam("操作失败1");
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 减少文章的统计字段
|
// 减少视频的统计字段
|
||||||
boolean r = caseClinicalVideoService.DecClinicalVideoStats(
|
boolean r = caseClinicalVideoService.DecClinicalVideoStats(
|
||||||
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||||
3,
|
3,
|
||||||
@ -208,10 +209,57 @@ public class UserCommentClinicalVideoService {
|
|||||||
);
|
);
|
||||||
if (!r){
|
if (!r){
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return ResponseDTO.userErrorParam("操作失败2");
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
userCommentClinicalVideoDao.deleteById(commentId);
|
userCommentClinicalVideoDao.deleteById(commentId);
|
||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新删除状态
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public ResponseDTO<String> updateDeleteStatus(UserCommentClinicalVideoUpdateDeleteStatusForm updateForm) {
|
||||||
|
if (null == updateForm.getCommentId() || null == updateForm.getDeleteStatus()){
|
||||||
|
return ResponseDTO.userErrorParam("参数不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取评论数据
|
||||||
|
UserCommentClinicalVideoEntity userCommentClinicalVideo = userCommentClinicalVideoDao.selectById(updateForm.getCommentId());
|
||||||
|
if (null == userCommentClinicalVideo) {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新删除状态
|
||||||
|
userCommentClinicalVideo.setDeleteStatus(updateForm.getDeleteStatus());
|
||||||
|
userCommentClinicalVideoDao.updateById(userCommentClinicalVideo);
|
||||||
|
|
||||||
|
// 如果是从删除状态恢复,需要增加统计字段
|
||||||
|
if (updateForm.getDeleteStatus() == 0) {
|
||||||
|
boolean r = caseClinicalVideoService.IncClinicalVideoStats(
|
||||||
|
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||||
|
3,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
if (!r){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果是设置为删除状态,需要减少统计字段
|
||||||
|
boolean r = caseClinicalVideoService.DecClinicalVideoStats(
|
||||||
|
String.valueOf(userCommentClinicalVideo.getVideoId()),
|
||||||
|
3,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
if (!r){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseDTO.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserComment
|
|||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentStatusUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentStatusUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentTopUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentTopUpdateForm;
|
||||||
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateDeleteStatusForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.UserCommentExchangeVO;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.UserCommentExchangeVO;
|
||||||
import net.lab1024.sa.admin.module.business.caseExchange.service.UserCommentExchangeService;
|
import net.lab1024.sa.admin.module.business.caseExchange.service.UserCommentExchangeService;
|
||||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||||
@ -80,4 +81,11 @@ public class UserCommentExchangeController {
|
|||||||
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
public ResponseDTO<String> delete(@PathVariable Long commentId) {
|
||||||
return userCommentExchangeService.delete(commentId);
|
return userCommentExchangeService.delete(commentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新删除状态 @author xing")
|
||||||
|
@PostMapping("/userCommentExchange/updateDeleteStatus")
|
||||||
|
@SaCheckPermission("userCommentExchange:delete")
|
||||||
|
public ResponseDTO<String> updateDeleteStatus(@RequestBody @Valid UserCommentExchangeUpdateDeleteStatusForm updateForm) {
|
||||||
|
return userCommentExchangeService.updateDeleteStatus(updateForm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,11 @@ public class UserCommentExchangeEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer isSensitive;
|
private Integer isSensitive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除状态(0:否 1:是)
|
||||||
|
*/
|
||||||
|
private Integer deleteStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否置顶(0:否 1:是)
|
* 是否置顶(0:否 1:是)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -23,6 +23,6 @@ public class UserCommentExchangeQueryForm extends PageParam {
|
|||||||
@Schema(description = "是否置顶(0:否 1:是)")
|
@Schema(description = "是否置顶(0:否 1:是)")
|
||||||
private Integer isTop;
|
private Integer isTop;
|
||||||
|
|
||||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
@Schema(description = "删除状态(0:否 1:是)")
|
||||||
private Integer isSensitive;
|
private Integer deleteStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,9 @@ public class UserCommentExchangeVO {
|
|||||||
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
@Schema(description = "是否存在敏感词(0:否 1:是)")
|
||||||
private Integer isSensitive;
|
private Integer isSensitive;
|
||||||
|
|
||||||
|
@Schema(description = "删除状态(0:否 1:是)")
|
||||||
|
private Integer deleteStatus;
|
||||||
|
|
||||||
@Schema(description = "是否置顶(0:否 1:是)")
|
@Schema(description = "是否置顶(0:否 1:是)")
|
||||||
private Integer isTop;
|
private Integer isTop;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserComment
|
|||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentStatusUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentStatusUpdateForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentTopUpdateForm;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentTopUpdateForm;
|
||||||
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.form.UserCommentExchangeUpdateDeleteStatusForm;
|
||||||
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.UserCommentExchangeVO;
|
import net.lab1024.sa.admin.module.business.caseExchange.domain.vo.UserCommentExchangeVO;
|
||||||
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
import net.lab1024.sa.base.common.util.SmartBeanUtil;
|
||||||
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
import net.lab1024.sa.base.common.util.SmartPageUtil;
|
||||||
@ -212,4 +213,50 @@ public class UserCommentExchangeService {
|
|||||||
userCommentExchangeDao.deleteById(commentId);
|
userCommentExchangeDao.deleteById(commentId);
|
||||||
return ResponseDTO.ok();
|
return ResponseDTO.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新删除状态
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public ResponseDTO<String> updateDeleteStatus(UserCommentExchangeUpdateDeleteStatusForm updateForm) {
|
||||||
|
if (null == updateForm.getCommentId() || null == updateForm.getDeleteStatus()){
|
||||||
|
return ResponseDTO.userErrorParam("参数不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取评论数据
|
||||||
|
UserCommentExchangeEntity userCommentExchange = userCommentExchangeDao.selectById(updateForm.getCommentId());
|
||||||
|
if (null == userCommentExchange) {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新删除状态
|
||||||
|
userCommentExchange.setDeleteStatus(updateForm.getDeleteStatus());
|
||||||
|
userCommentExchangeDao.updateById(userCommentExchange);
|
||||||
|
|
||||||
|
// 如果是从删除状态恢复,需要增加统计字段
|
||||||
|
if (updateForm.getDeleteStatus() == 0) {
|
||||||
|
boolean r = caseExchangeService.IncCaseExchangeStats(
|
||||||
|
String.valueOf(userCommentExchange.getExchangeId()),
|
||||||
|
3
|
||||||
|
);
|
||||||
|
if (!r){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果是设置为删除状态,需要减少统计字段
|
||||||
|
boolean r = caseExchangeService.DecCaseExchangeStats(
|
||||||
|
String.valueOf(userCommentExchange.getExchangeId()),
|
||||||
|
3,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
if (!r){
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ResponseDTO.userErrorParam("操作失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseDTO.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
user_comment_clinical_article.status,
|
user_comment_clinical_article.status,
|
||||||
user_comment_clinical_article.parent_id,
|
user_comment_clinical_article.parent_id,
|
||||||
user_comment_clinical_article.is_sensitive,
|
user_comment_clinical_article.is_sensitive,
|
||||||
|
user_comment_clinical_article.delete_status,
|
||||||
user_comment_clinical_article.is_top,
|
user_comment_clinical_article.is_top,
|
||||||
user_comment_clinical_article.like_num,
|
user_comment_clinical_article.like_num,
|
||||||
user_comment_clinical_article.is_author,
|
user_comment_clinical_article.is_author,
|
||||||
@ -40,9 +41,9 @@
|
|||||||
<if test="queryForm.isTop != null">
|
<if test="queryForm.isTop != null">
|
||||||
AND user_comment_clinical_article.is_top = #{queryForm.isTop}
|
AND user_comment_clinical_article.is_top = #{queryForm.isTop}
|
||||||
</if>
|
</if>
|
||||||
<!--是否存在敏感词-->
|
<!--删除状态-->
|
||||||
<if test="queryForm.isSensitive != null">
|
<if test="queryForm.deleteStatus != null">
|
||||||
AND user_comment_clinical_article.is_sensitive = #{queryForm.isSensitive}
|
AND user_comment_clinical_article.delete_status = #{queryForm.deleteStatus}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY user_comment_clinical_article.created_at DESC
|
ORDER BY user_comment_clinical_article.created_at DESC
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
user_comment_clinical_video.status,
|
user_comment_clinical_video.status,
|
||||||
user_comment_clinical_video.parent_id,
|
user_comment_clinical_video.parent_id,
|
||||||
user_comment_clinical_video.is_sensitive,
|
user_comment_clinical_video.is_sensitive,
|
||||||
|
user_comment_clinical_video.delete_status,
|
||||||
user_comment_clinical_video.is_top,
|
user_comment_clinical_video.is_top,
|
||||||
user_comment_clinical_video.like_num,
|
user_comment_clinical_video.like_num,
|
||||||
user_comment_clinical_video.is_author,
|
user_comment_clinical_video.is_author,
|
||||||
@ -40,9 +41,9 @@
|
|||||||
<if test="queryForm.isTop != null">
|
<if test="queryForm.isTop != null">
|
||||||
AND user_comment_clinical_video.is_top = #{queryForm.isTop}
|
AND user_comment_clinical_video.is_top = #{queryForm.isTop}
|
||||||
</if>
|
</if>
|
||||||
<!--是否存在敏感词-->
|
<!--删除状态-->
|
||||||
<if test="queryForm.isSensitive != null">
|
<if test="queryForm.deleteStatus != null">
|
||||||
AND user_comment_clinical_video.is_sensitive = #{queryForm.isSensitive}
|
AND user_comment_clinical_video.delete_status = #{queryForm.deleteStatus}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY user_comment_clinical_video.created_at DESC
|
ORDER BY user_comment_clinical_video.created_at DESC
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
user_comment_exchange.status,
|
user_comment_exchange.status,
|
||||||
user_comment_exchange.parent_id,
|
user_comment_exchange.parent_id,
|
||||||
user_comment_exchange.is_sensitive,
|
user_comment_exchange.is_sensitive,
|
||||||
|
user_comment_exchange.delete_status,
|
||||||
user_comment_exchange.is_top,
|
user_comment_exchange.is_top,
|
||||||
user_comment_exchange.like_num,
|
user_comment_exchange.like_num,
|
||||||
user_comment_exchange.is_author,
|
user_comment_exchange.is_author,
|
||||||
@ -40,9 +41,9 @@
|
|||||||
<if test="queryForm.isTop != null">
|
<if test="queryForm.isTop != null">
|
||||||
AND user_comment_exchange.is_top = #{queryForm.isTop}
|
AND user_comment_exchange.is_top = #{queryForm.isTop}
|
||||||
</if>
|
</if>
|
||||||
<!--是否存在敏感词-->
|
<!--删除状态-->
|
||||||
<if test="queryForm.isSensitive != null">
|
<if test="queryForm.deleteStatus != null">
|
||||||
AND user_comment_exchange.is_sensitive = #{queryForm.isSensitive}
|
AND user_comment_exchange.delete_status = #{queryForm.deleteStatus}
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY user_comment_exchange.created_at DESC
|
ORDER BY user_comment_exchange.created_at DESC
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
spring:
|
spring:
|
||||||
# 数据库连接信息
|
# 数据库连接信息
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://127.0.0.1:3306/smart_admin_v3?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.27.16.10:3306/case?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
||||||
username: root
|
username: root
|
||||||
password: SmartAdmin666
|
password: sKptsVOiTf6m3lt_
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
initial-size: 10
|
initial-size: 10
|
||||||
min-idle: 10
|
min-idle: 10
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user