From 55ed940e2fe4331a3c1b58873ce18a3e1cf395cb Mon Sep 17 00:00:00 2001 From: aikai Date: Thu, 11 Apr 2024 17:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/comment/WorkLogCommentController.java | 44 ++++++++ .../app/comment/dto/CommentDTO.java | 17 +++ .../app/comment/vo/CommentPageListVO.java | 53 +++++++++ .../comment/vo/WorkLogCommentPageReqVO.java | 43 +++++++ .../app/comment/vo/WorkLogCommentRespVO.java | 52 +++++++++ .../comment/vo/WorkLogCommentSaveReqVO.java | 37 ++++++ .../dataobject/comment/WorkLogCommentDO.java | 59 ++++++++++ .../mysql/comment/WorkLogCommentMapper.java | 44 ++++++++ .../comment/WorkLogCommentService.java | 66 +++++++++++ .../comment/WorkLogCommentServiceImpl.java | 105 ++++++++++++++++++ .../mapper/comment/WorkLogCommentMapper.xml | 48 ++++++++ 11 files changed, 568 insertions(+) create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/WorkLogCommentController.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/dto/CommentDTO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/CommentPageListVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentPageReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentRespVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentSaveReqVO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/comment/WorkLogCommentDO.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/comment/WorkLogCommentMapper.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentService.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentServiceImpl.java create mode 100644 yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/comment/WorkLogCommentMapper.xml diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/WorkLogCommentController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/WorkLogCommentController.java new file mode 100644 index 00000000..9b4d7ea9 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/WorkLogCommentController.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.system.controller.app.comment; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.system.controller.app.comment.dto.CommentDTO; +import cn.iocoder.yudao.module.system.controller.app.comment.vo.CommentPageListVO; +import cn.iocoder.yudao.module.system.service.comment.WorkLogCommentService; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - 工作日志评论") +@RestController +@RequestMapping("/system/work-log-comment") +@Validated +public class WorkLogCommentController { + + @Autowired + private WorkLogCommentService workLogCommentService; + + @Operation(summary = "用户工作日志评论-分页查询评论列表") + @GetMapping(value = "/queryCommentPageList") + public CommonResult> queryCommentPageList(CommentDTO dto, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { + Page page = new Page<>(pageNo, pageSize); + IPage pageList = workLogCommentService.queryCommentPageList(page, dto); + return success(pageList); + } + +// @Operation(summary = "用户动态评论-评论/回复评论") +// @PostMapping(value = "/addComment") +// public CommonResult addComment(@RequestBody MemberDynamicCommentAddDTO dto) { +// workLogCommentService.addComment(dto); +// return success("添加成功!"); +// } + + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/dto/CommentDTO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/dto/CommentDTO.java new file mode 100644 index 00000000..4e488434 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/dto/CommentDTO.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.module.system.controller.app.comment.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class CommentDTO { + @Schema(description = "工作日志id", required = true) + @JsonSerialize(using = ToStringSerializer.class) + private Long workLogId; + @Schema(description = "评论类型(0|评论;1|回评") + private Integer type; + @Schema(description = "是否需要显示日志内容 0否 1是 默认否") + private Integer isShowWorkLogContent; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/CommentPageListVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/CommentPageListVO.java new file mode 100644 index 00000000..70812e1c --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/CommentPageListVO.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.system.controller.app.comment.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +@Data +public class CommentPageListVO { + @JsonSerialize(using = ToStringSerializer.class) + @Schema(description = "id") + private Long id; + @Schema(description = "工作日志ID") + @JsonSerialize(using = ToStringSerializer.class) + private Long workLogId; + @Schema(description = "评论用户ID") + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + @Schema(description = "评论用户头像") + private String avatar; + @Schema(description = "评论用户名称") + private String userName; + + @Schema(description = "被评论用户ID") + @JsonSerialize(using = ToStringSerializer.class) + private Long commentUserId; + @Schema(description = "被评论用户头像") + private String commentAvatar; + @Schema(description = "被评论用户名称") + private String commentUserName; + + @Schema(description = "评论内容") + private String comment; + @Schema(description = "评论类型(0|评论;1|回评)") + private Integer type; + + @Schema(description = "被回评内容") + private String replyComment; + + @Schema(description = "工作日志内容(部分)") + private String workLogContent; + @Schema(description = "工作日志名称") + private String workLogName; + @Schema(description = "工作日志模版id") + private Long workFormId; + + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "创建日期") + private String createTime; +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentPageReqVO.java new file mode 100644 index 00000000..960e4e63 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentPageReqVO.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.system.controller.app.comment.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 工作日志评论分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class WorkLogCommentPageReqVO extends PageParam { + + @Schema(description = "动态ID", example = "26393") + private Long workLogId; + + @Schema(description = "评论ID(回复评论的ID)", example = "25541") + private Long commentId; + + @Schema(description = "评论用户ID", example = "17082") + private Long userId; + + @Schema(description = "被评论用户ID", example = "22388") + private Long commentUserId; + + @Schema(description = "评论内容") + private String comment; + + @Schema(description = "评论类型(0|评论;1|回评)", example = "1") + private Boolean type; + + @Schema(description = "楼栋标识") + private String buildingCode; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentRespVO.java new file mode 100644 index 00000000..be061652 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentRespVO.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.system.controller.app.comment.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; + +@Schema(description = "管理后台 - 工作日志评论 Response VO") +@Data +@ExcelIgnoreUnannotated +public class WorkLogCommentRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21304") + @ExcelProperty("id") + private Long id; + + @Schema(description = "动态ID", example = "26393") + @ExcelProperty("动态ID") + private Long workLogId; + + @Schema(description = "评论ID(回复评论的ID)", example = "25541") + @ExcelProperty("评论ID(回复评论的ID)") + private Long commentId; + + @Schema(description = "评论用户ID", example = "17082") + @ExcelProperty("评论用户ID") + private Long userId; + + @Schema(description = "被评论用户ID", example = "22388") + @ExcelProperty("被评论用户ID") + private Long commentUserId; + + @Schema(description = "评论内容") + @ExcelProperty("评论内容") + private String comment; + + @Schema(description = "评论类型(0|评论;1|回评)", example = "1") + @ExcelProperty("评论类型(0|评论;1|回评)") + private Boolean type; + + @Schema(description = "楼栋标识") + @ExcelProperty("楼栋标识") + private String buildingCode; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentSaveReqVO.java new file mode 100644 index 00000000..1dab74c1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/comment/vo/WorkLogCommentSaveReqVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.system.controller.app.comment.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; +import java.util.*; + +@Schema(description = "管理后台 - 工作日志评论新增/修改 Request VO") +@Data +public class WorkLogCommentSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21304") + private Long id; + + @Schema(description = "动态ID", example = "26393") + private Long workLogId; + + @Schema(description = "评论ID(回复评论的ID)", example = "25541") + private Long commentId; + + @Schema(description = "评论用户ID", example = "17082") + private Long userId; + + @Schema(description = "被评论用户ID", example = "22388") + private Long commentUserId; + + @Schema(description = "评论内容") + private String comment; + + @Schema(description = "评论类型(0|评论;1|回评)", example = "1") + private Boolean type; + + @Schema(description = "楼栋标识") + private String buildingCode; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/comment/WorkLogCommentDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/comment/WorkLogCommentDO.java new file mode 100644 index 00000000..7016fa3a --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/comment/WorkLogCommentDO.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.comment; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 工作日志评论 DO + * + * @author 艾楷 + */ +@TableName("work_log_comment") +@KeySequence("work_log_comment_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WorkLogCommentDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 动态ID + */ + private Long workLogId; + /** + * 评论ID(回复评论的ID) + */ + private Long commentId; + /** + * 评论用户ID + */ + private Long userId; + /** + * 被评论用户ID + */ + private Long commentUserId; + /** + * 评论内容 + */ + private String comment; + /** + * 评论类型(0|评论;1|回评) + */ + private Boolean type; + /** + * 楼栋标识 + */ + private String buildingCode; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/comment/WorkLogCommentMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/comment/WorkLogCommentMapper.java new file mode 100644 index 00000000..af112886 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/comment/WorkLogCommentMapper.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.system.dal.mysql.comment; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.system.controller.app.comment.dto.CommentDTO; +import cn.iocoder.yudao.module.system.dal.dataobject.comment.WorkLogCommentDO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.system.controller.app.comment.vo.*; +import org.apache.ibatis.annotations.Param; + +/** + * 工作日志评论 Mapper + * + * @author 艾楷 + */ +@Mapper +public interface WorkLogCommentMapper extends BaseMapperX { + + default PageResult selectPage(WorkLogCommentPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(WorkLogCommentDO::getWorkLogId, reqVO.getWorkLogId()) + .eqIfPresent(WorkLogCommentDO::getCommentId, reqVO.getCommentId()) + .eqIfPresent(WorkLogCommentDO::getUserId, reqVO.getUserId()) + .eqIfPresent(WorkLogCommentDO::getCommentUserId, reqVO.getCommentUserId()) + .eqIfPresent(WorkLogCommentDO::getComment, reqVO.getComment()) + .eqIfPresent(WorkLogCommentDO::getType, reqVO.getType()) + .eqIfPresent(WorkLogCommentDO::getBuildingCode, reqVO.getBuildingCode()) + .betweenIfPresent(WorkLogCommentDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(WorkLogCommentDO::getId)); + } + + /** + * + * @param page + * @param dto + * @return + */ + IPage queryCommentPageList(@Param("page") Page page, @Param("dto") CommentDTO dto); +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentService.java new file mode 100644 index 00000000..ea657381 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentService.java @@ -0,0 +1,66 @@ +package cn.iocoder.yudao.module.system.service.comment; + +import java.util.*; +import javax.validation.*; + +import cn.iocoder.yudao.module.system.controller.app.comment.dto.CommentDTO; +import cn.iocoder.yudao.module.system.controller.app.comment.vo.*; +import cn.iocoder.yudao.module.system.dal.dataobject.comment.WorkLogCommentDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +/** + * 工作日志评论 Service 接口 + * + * @author 艾楷 + */ +public interface WorkLogCommentService { + + /** + * 创建工作日志评论 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createWorkLogComment(@Valid WorkLogCommentSaveReqVO createReqVO); + + /** + * 更新工作日志评论 + * + * @param updateReqVO 更新信息 + */ + void updateWorkLogComment(@Valid WorkLogCommentSaveReqVO updateReqVO); + + /** + * 删除工作日志评论 + * + * @param id 编号 + */ + void deleteWorkLogComment(Long id); + + /** + * 获得工作日志评论 + * + * @param id 编号 + * @return 工作日志评论 + */ + WorkLogCommentDO getWorkLogComment(Long id); + + /** + * 获得工作日志评论分页 + * + * @param pageReqVO 分页查询 + * @return 工作日志评论分页 + */ + PageResult getWorkLogCommentPage(WorkLogCommentPageReqVO pageReqVO); + + /** + * + * @param page + * @param dto + * @return + */ + IPage queryCommentPageList(Page page, CommentDTO dto); +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentServiceImpl.java new file mode 100644 index 00000000..d61ca0c7 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/comment/WorkLogCommentServiceImpl.java @@ -0,0 +1,105 @@ +package cn.iocoder.yudao.module.system.service.comment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.system.controller.app.comment.dto.CommentDTO; +import cn.iocoder.yudao.module.system.controller.app.comment.vo.CommentPageListVO; +import cn.iocoder.yudao.module.system.controller.app.comment.vo.WorkLogCommentPageReqVO; +import cn.iocoder.yudao.module.system.controller.app.comment.vo.WorkLogCommentSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.comment.WorkLogCommentDO; +import cn.iocoder.yudao.module.system.dal.mysql.comment.WorkLogCommentMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 工作日志评论 Service 实现类 + * + * @author 艾楷 + */ +@Service +@Validated +public class WorkLogCommentServiceImpl implements WorkLogCommentService { + + @Resource + private WorkLogCommentMapper workLogCommentMapper; + + @Override + public Long createWorkLogComment(WorkLogCommentSaveReqVO createReqVO) { + // 插入 + WorkLogCommentDO workLogComment = BeanUtils.toBean(createReqVO, WorkLogCommentDO.class); + workLogCommentMapper.insert(workLogComment); + // 返回 + return workLogComment.getId(); + } + + @Override + public void updateWorkLogComment(WorkLogCommentSaveReqVO updateReqVO) { + // 校验存在 +// validateWorkLogCommentExists(updateReqVO.getId()); + // 更新 + WorkLogCommentDO updateObj = BeanUtils.toBean(updateReqVO, WorkLogCommentDO.class); + workLogCommentMapper.updateById(updateObj); + } + + @Override + public void deleteWorkLogComment(Long id) { + // 校验存在 +// validateWorkLogCommentExists(id); + // 删除 + workLogCommentMapper.deleteById(id); + } + +// private void validateWorkLogCommentExists(Long id) { +// if (workLogCommentMapper.selectById(id) == null) { +// throw exception(WORK_LOG_COMMENT_NOT_EXISTS); +// } +// } + + @Override + public WorkLogCommentDO getWorkLogComment(Long id) { + return workLogCommentMapper.selectById(id); + } + + @Override + public PageResult getWorkLogCommentPage(WorkLogCommentPageReqVO pageReqVO) { + return workLogCommentMapper.selectPage(pageReqVO); + } + + @Override + public IPage queryCommentPageList(Page page, CommentDTO dto) { + IPage pageList = workLogCommentMapper.queryCommentPageList(page, dto); + if (dto.getIsShowWorkLogContent() != null && dto.getIsShowWorkLogContent() == 1) { + List records = pageList.getRecords(); + //模版ids过滤 + List workFormIds = records.stream().map(CommentPageListVO::getWorkFormId).collect(Collectors.toList()); + // TODO: 2024/4/11 查询模版列表 + + pageList.getRecords().forEach(item -> { + // TODO: 2024/4/11 - 这里需要通过模版id + item.setWorkLogContent(null); + }); + } + return pageList; + } + + + public static void main(String[] args) { + List records = Arrays.asList( + new CommentPageListVO().setWorkLogId(1L).setWorkFormId("1"), + new CommentPageListVO().setWorkLogId(1L).setWorkFormId("1"), + new CommentPageListVO().setWorkLogId(1L).setWorkFormId("1"), + new CommentPageListVO().setWorkLogId(2L).setWorkFormId("1")); + Map collect = records.stream().collect(Collectors.toMap(CommentPageListVO::getWorkLogId, CommentPageListVO::getWorkFormId)); + System.out.println(collect); + + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/comment/WorkLogCommentMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/comment/WorkLogCommentMapper.xml new file mode 100644 index 00000000..e3538cf0 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/comment/WorkLogCommentMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + \ No newline at end of file