From 3503011df6f093da6f6ac319f76ea1d75e16cbb2 Mon Sep 17 00:00:00 2001 From: wangyinsheng <2310589501@qq.com> Date: Sat, 21 Sep 2024 13:53:52 +0800 Subject: [PATCH 1/6] =?UTF-8?q?add:=E6=9F=A5=E8=AF=A2=E6=89=80=E6=9C=89?= =?UTF-8?q?=E7=94=B5=E7=AB=99=E8=A7=86=E9=A2=91=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/StationVideoTypeController.java | 7 +++++ .../station/mapper/StationVideoTypeMapper.java | 2 ++ .../station/mapper/StationVideoTypeMapper.xml | 33 ++++++++++++++++++++++ .../station/service/IStationVideoTypeService.java | 3 ++ .../service/impl/StationVideoTypeServiceImpl.java | 5 ++++ 5 files changed, 50 insertions(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java index a5f89ec..252e1c4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java @@ -386,4 +386,11 @@ public class StationVideoTypeController extends BladeController { public R> getVideoByPointCodes(@RequestParam @ApiParam("视频设备编号") String pointCodes) { return R.data(stationVideoTypeService.getVideoByPointCodes(pointCodes)); } + + @GetMapping ("/listAll") + @ApiOperationSupport(order = 200) + @ApiOperation(value = "获取所有站点视频") + public R> listAll() { + return R.data(stationVideoTypeService.listAll()); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java index 38672d7..f37a9a6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.java @@ -44,4 +44,6 @@ public interface StationVideoTypeMapper extends UserDataScopeBaseMapper getAgencyStationsByVideo(@Param("type") String type); + + List listAll(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.xml index 23ec9ce..ca41715 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationVideoTypeMapper.xml @@ -71,4 +71,37 @@ order by hs.sort + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java index cb79a30..de5618c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java @@ -79,4 +79,7 @@ public interface IStationVideoTypeService extends IService getHikVideoAreaTree(Long platformId); List getVideoByPointCodes(String pointCodes); + + List listAll(); + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java index c2227e9..443da4a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java @@ -366,4 +366,9 @@ public class StationVideoTypeServiceImpl extends ServiceImpl qw = Wrappers.lambdaQuery().in(StationVideoTypeEntity::getPointCode, pointCodeList); return this.list(qw); } + + @Override + public List listAll() { + return baseMapper.listAll(); + } } From b53534898ae258e0561c14056d3c107f8900ee03 Mon Sep 17 00:00:00 2001 From: luyie Date: Sat, 21 Sep 2024 14:20:30 +0800 Subject: [PATCH 2/6] =?UTF-8?q?add:=E9=97=AE=E9=A2=98=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E5=92=8C=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuestionAnswerCommentController.java | 63 +++++++++++++++++ .../entity/QuestionAnswerCommentEntity.java | 47 +++++++++++++ .../mapper/QuestionAnswerCommentMapper.java | 11 +++ .../service/QuestionAnswerCommentService.java | 26 +++++++ .../impl/QuestionAnswerCommentServiceImpl.java | 82 ++++++++++++++++++++++ .../maintenance/vo/AnswerCommentRequest.java | 33 +++++++++ .../maintenance/vo/AnswerPraiseRequest.java | 20 ++++++ 7 files changed, 282 insertions(+) create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/QuestionAnswerCommentMapper.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerCommentRequest.java create mode 100644 hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerPraiseRequest.java diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java new file mode 100644 index 0000000..705bd96 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java @@ -0,0 +1,63 @@ +package com.hnac.gglm.bigmodel.maintenance.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity; +import com.hnac.gglm.bigmodel.maintenance.service.QuestionAnswerCommentService; +import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest; +import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @Author: ypj + * @Date: 2024/9/21 13:27 + */ +@RestController +@Slf4j +@RequestMapping("/question/") +@AllArgsConstructor +@Api(value = "问题评论管理", tags = "问题评论管理") +public class QuestionAnswerCommentController { + private final QuestionAnswerCommentService questionAnswerCommentService; + + @PostMapping("/comment") + @ApiOperation(value = "评论") + @ApiOperationSupport(order = 1) + public R comment(@RequestBody AnswerCommentRequest req) { + return R.status(questionAnswerCommentService.comment(req)); + } + + @PostMapping("/praise") + @ApiOperation(value = "点赞") + @ApiOperationSupport(order = 2) + public R praise(@RequestBody AnswerPraiseRequest req) { + return R.status(questionAnswerCommentService.praise(req)); + } + + @PostMapping("/resetPraise") + @ApiOperation(value = "取消点赞") + @ApiOperationSupport(order = 3) + public R resetPraise(@RequestBody AnswerPraiseRequest req) { + return R.status(questionAnswerCommentService.resetPraise(req)); + } + + @GetMapping("/listByQuestionId") + @ApiOperation(value = "根据问题id获取评论列表") + @ApiOperationSupport(order = 4) + public R> listByQuestionId(String questionId) { + return R.data(questionAnswerCommentService.listByQuestionId(questionId)); + } + + @GetMapping("/praiseCount") + @ApiOperation(value = "点赞数") + @ApiOperationSupport(order = 5) + public R praiseCount(String questionId) { + return R.data(questionAnswerCommentService.praiseCount(questionId)); + } +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java new file mode 100644 index 0000000..4669655 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java @@ -0,0 +1,47 @@ +package com.hnac.gglm.bigmodel.maintenance.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +/** + * @Author: ypj + * @Date: 2024/9/21 11:07 + */ +@Data +@TableName("question_answer_comment") +@ApiModel +public class QuestionAnswerCommentEntity extends TenantEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("对话id") + @TableField("chat_id") + private String chatId; + + @ApiModelProperty("问题id") + @TableField("question_id") + private String questionId; + + @ApiModelProperty("用户id") + @TableField("user_id") + private String userId; + + @ApiModelProperty("用户名") + @TableLogic + private String userName; + + @ApiModelProperty("点赞") + @TableField("praise") + private Integer praise; + + @ApiModelProperty("评论内容") + @TableField("content") + private String content; +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/QuestionAnswerCommentMapper.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/QuestionAnswerCommentMapper.java new file mode 100644 index 0000000..014aefb --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/mapper/QuestionAnswerCommentMapper.java @@ -0,0 +1,11 @@ +package com.hnac.gglm.bigmodel.maintenance.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity; + +/** + * @Author: ypj + * @Date: 2024/9/21 13:31 + */ +public interface QuestionAnswerCommentMapper extends BaseMapper { +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java new file mode 100644 index 0000000..dd23e6e --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java @@ -0,0 +1,26 @@ +package com.hnac.gglm.bigmodel.maintenance.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity; +import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest; +import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; + +import java.util.List; + +/** + * @Author: ypj + * @Date: 2024/9/21 13:29 + */ +public interface QuestionAnswerCommentService extends IService { + QuestionAnswerCommentEntity getComment(String userAccount, String questionId); + + Boolean comment(AnswerCommentRequest req); + + Boolean praise(AnswerPraiseRequest req); + + List listByQuestionId(String questionId); + + Long praiseCount(String questionId); + + Boolean resetPraise(AnswerPraiseRequest req); +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java new file mode 100644 index 0000000..82e5afd --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java @@ -0,0 +1,82 @@ +package com.hnac.gglm.bigmodel.maintenance.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity; +import com.hnac.gglm.bigmodel.maintenance.mapper.QuestionAnswerCommentMapper; +import com.hnac.gglm.bigmodel.maintenance.service.QuestionAnswerCommentService; +import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest; +import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @Author: ypj + * @Date: 2024/9/21 13:32 + */ +@Service +@Slf4j +@AllArgsConstructor +@DS("hznlm") +public class QuestionAnswerCommentServiceImpl extends ServiceImpl implements QuestionAnswerCommentService { + @Override + public QuestionAnswerCommentEntity getComment(String userAccount, String questionId) { + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() + .eq(QuestionAnswerCommentEntity::getQuestionId, questionId) + .eq(QuestionAnswerCommentEntity::getUserId, userAccount).last("limit 1"); + return this.getOne(queryWrapper); + } + + @Override + public Boolean comment(AnswerCommentRequest req) { + QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserAccount(), + req.getQuestionId()); + if (ObjectUtil.isEmpty(entity)) { + entity = req.toEntity(); + } + return this.saveOrUpdate(entity); + } + + @Override + public Boolean praise(AnswerPraiseRequest req) { + QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserAccount(), + req.getQuestionId()); + if (ObjectUtil.isNotEmpty(entity)) { + entity.setPraise(1); + return this.updateById(entity); + } + return Boolean.FALSE; + } + + @Override + public List listByQuestionId(String questionId) { + return this.list(Wrappers.lambdaQuery() + .eq(QuestionAnswerCommentEntity::getQuestionId, questionId) + .orderByAsc(QuestionAnswerCommentEntity::getCreateTime)); + } + + @Override + public Long praiseCount(String questionId) { + return this.count(Wrappers.lambdaQuery() + .eq(QuestionAnswerCommentEntity::getQuestionId, questionId) + .eq(QuestionAnswerCommentEntity::getPraise, 1)); + } + + @Override + public Boolean resetPraise(AnswerPraiseRequest req) { + QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserAccount(), + req.getQuestionId()); + if (ObjectUtil.isNotEmpty(entity)) { + entity.setPraise(0); + return this.updateById(entity); + } + return Boolean.FALSE; + } +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerCommentRequest.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerCommentRequest.java new file mode 100644 index 0000000..73892b4 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerCommentRequest.java @@ -0,0 +1,33 @@ +package com.hnac.gglm.bigmodel.maintenance.vo; + +import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springblade.core.secure.utils.AuthUtil; + +/** + * @Author: ypj + * @Date: 2024/9/21 13:38 + */ +@Data +@ApiModel(value = "评论请求") +public class AnswerCommentRequest { + @ApiModelProperty(value = "对话id") + private String chartId; + + @ApiModelProperty(value = "问题id") + private String questionId; + + @ApiModelProperty(value = "评论内容") + private String content; + + public QuestionAnswerCommentEntity toEntity() { + QuestionAnswerCommentEntity entity = new QuestionAnswerCommentEntity(); + entity.setChatId(chartId); + entity.setQuestionId(questionId); + entity.setContent(content); + entity.setUserId(AuthUtil.getUserAccount()); + return entity; + } +} diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerPraiseRequest.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerPraiseRequest.java new file mode 100644 index 0000000..a848807 --- /dev/null +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/vo/AnswerPraiseRequest.java @@ -0,0 +1,20 @@ +package com.hnac.gglm.bigmodel.maintenance.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: ypj + * @Date: 2024/9/21 13:49 + */ +@Data +@ApiModel(value = "点赞请求") +public class AnswerPraiseRequest { + + @ApiModelProperty(value = "对话id") + private String chartId; + + @ApiModelProperty(value = "问题id") + private String questionId; +} From b0089779932aecb3f88a57289b76802d871ed771 Mon Sep 17 00:00:00 2001 From: luyie Date: Sat, 21 Sep 2024 14:27:59 +0800 Subject: [PATCH 3/6] =?UTF-8?q?add:=E9=97=AE=E9=A2=98=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E5=92=8C=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/controller/QuestionAnswerCommentController.java | 2 +- .../maintenance/service/impl/QuestionAnswerCommentServiceImpl.java | 2 +- .../com/hnac/gglm/bigmodel/maintenance/vo/AnswerPraiseRequest.java | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java index 705bd96..6126100 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java @@ -57,7 +57,7 @@ public class QuestionAnswerCommentController { @GetMapping("/praiseCount") @ApiOperation(value = "点赞数") @ApiOperationSupport(order = 5) - public R praiseCount(String questionId) { + public R praiseCount(String questionId) { return R.data(questionAnswerCommentService.praiseCount(questionId)); } } diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java index 82e5afd..c661ff3 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java @@ -49,7 +49,7 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl Date: Sat, 21 Sep 2024 15:01:28 +0800 Subject: [PATCH 4/6] =?UTF-8?q?add:=E9=97=AE=E9=A2=98=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E5=92=8C=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/entity/QuestionAnswerCommentEntity.java | 7 +++++-- .../maintenance/service/QuestionAnswerCommentService.java | 2 +- .../service/impl/QuestionAnswerCommentServiceImpl.java | 11 ++++++----- .../gglm/bigmodel/maintenance/vo/AnswerCommentRequest.java | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java index 4669655..27a672d 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Builder; import lombok.Data; import org.springblade.core.tenant.mp.TenantEntity; +import org.springframework.data.annotation.Transient; import java.io.Serializable; @@ -31,10 +32,12 @@ public class QuestionAnswerCommentEntity extends TenantEntity implements Seriali @ApiModelProperty("用户id") @TableField("user_id") - private String userId; + private Long userId; + + @ApiModelProperty("用户账号") + private String userAccount; @ApiModelProperty("用户名") - @TableLogic private String userName; @ApiModelProperty("点赞") diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java index dd23e6e..6510c53 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/QuestionAnswerCommentService.java @@ -12,7 +12,7 @@ import java.util.List; * @Date: 2024/9/21 13:29 */ public interface QuestionAnswerCommentService extends IService { - QuestionAnswerCommentEntity getComment(String userAccount, String questionId); + QuestionAnswerCommentEntity getComment(Long userId, String questionId); Boolean comment(AnswerCommentRequest req); diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java index c661ff3..6456cdc 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java @@ -27,16 +27,16 @@ import java.util.List; @DS("hznlm") public class QuestionAnswerCommentServiceImpl extends ServiceImpl implements QuestionAnswerCommentService { @Override - public QuestionAnswerCommentEntity getComment(String userAccount, String questionId) { + public QuestionAnswerCommentEntity getComment(Long userId, String questionId) { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() .eq(QuestionAnswerCommentEntity::getQuestionId, questionId) - .eq(QuestionAnswerCommentEntity::getUserId, userAccount).last("limit 1"); + .eq(QuestionAnswerCommentEntity::getUserId, userId).last("limit 1"); return this.getOne(queryWrapper); } @Override public Boolean comment(AnswerCommentRequest req) { - QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserAccount(), + QuestionAnswerCommentEntity entity = getComment(AuthUtil.getUserId(), req.getQuestionId()); if (ObjectUtil.isEmpty(entity)) { entity = req.toEntity(); @@ -46,7 +46,7 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl listByQuestionId(String questionId) { + return this.list(Wrappers.lambdaQuery() .eq(QuestionAnswerCommentEntity::getQuestionId, questionId) .orderByAsc(QuestionAnswerCommentEntity::getCreateTime)); @@ -71,7 +72,7 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl Date: Sat, 21 Sep 2024 15:18:37 +0800 Subject: [PATCH 5/6] =?UTF-8?q?add:=E9=97=AE=E9=A2=98=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E5=92=8C=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/entity/QuestionAnswerCommentEntity.java | 2 ++ .../service/impl/QuestionAnswerCommentServiceImpl.java | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java index 27a672d..e8ee50c 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java @@ -35,9 +35,11 @@ public class QuestionAnswerCommentEntity extends TenantEntity implements Seriali private Long userId; @ApiModelProperty("用户账号") + @TableField(exist = false) private String userAccount; @ApiModelProperty("用户名") + @TableField(exist = false) private String userName; @ApiModelProperty("点赞") diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java index 6456cdc..4898537 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java @@ -12,7 +12,10 @@ import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import java.util.List; @@ -26,6 +29,8 @@ import java.util.List; @AllArgsConstructor @DS("hznlm") public class QuestionAnswerCommentServiceImpl extends ServiceImpl implements QuestionAnswerCommentService { + private final IUserClient userClient; + @Override public QuestionAnswerCommentEntity getComment(Long userId, String questionId) { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() @@ -57,10 +62,17 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl listByQuestionId(String questionId) { - - return this.list(Wrappers.lambdaQuery() + List list = this.list(Wrappers.lambdaQuery() .eq(QuestionAnswerCommentEntity::getQuestionId, questionId) .orderByAsc(QuestionAnswerCommentEntity::getCreateTime)); + list.forEach(item -> { + R user = userClient.userInfoById(item.getUserId()); + if (user.isSuccess() && user.getData() != null) { + item.setUserName(user.getData().getName()); + item.setUserAccount(user.getData().getAccount()); + } + }); + return list; } @Override From e598966e6f247bf70ecd2a7d14a2b43439eb23f1 Mon Sep 17 00:00:00 2001 From: luyie Date: Sat, 21 Sep 2024 15:50:08 +0800 Subject: [PATCH 6/6] =?UTF-8?q?add:=E9=97=AE=E9=A2=98=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E5=92=8C=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/controller/QuestionAnswerCommentController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java index 6126100..2c9c23f 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/QuestionAnswerCommentController.java @@ -7,6 +7,7 @@ import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest; import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; @@ -50,7 +51,7 @@ public class QuestionAnswerCommentController { @GetMapping("/listByQuestionId") @ApiOperation(value = "根据问题id获取评论列表") @ApiOperationSupport(order = 4) - public R> listByQuestionId(String questionId) { + public R> listByQuestionId(@RequestParam @ApiParam("问题id") String questionId) { return R.data(questionAnswerCommentService.listByQuestionId(questionId)); }