7 files modified
9 files added
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | import org.springblade.modules.circle.service.ICircleCommentService; |
| | | import org.springblade.modules.circle.vo.CircleCommentVO; |
| | | import org.springblade.modules.circle.wrapper.CircleCommentWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * 圈子评论表 控制器 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("blade-circleComment/circleComment") |
| | | @Api(value = "圈子评论表", tags = "圈子评论表接口") |
| | | public class CircleCommentController extends BladeController { |
| | | |
| | | private final ICircleCommentService circleService; |
| | | |
| | | /** |
| | | * 圈子评论表 详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入circle") |
| | | public R<CircleCommentVO> detail(CircleCommentEntity circle) { |
| | | CircleCommentEntity detail = circleService.getOne(Condition.getQueryWrapper(circle)); |
| | | return R.data(CircleCommentWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | | * 圈子评论表 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入circle") |
| | | public R<IPage<CircleCommentVO>> list(CircleCommentEntity circle, Query query) { |
| | | IPage<CircleCommentEntity> pages = circleService.page(Condition.getPage(query), Condition.getQueryWrapper(circle)); |
| | | return R.data(CircleCommentWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 圈子评论表 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入circle") |
| | | public R<IPage<CircleCommentVO>> page(CircleCommentVO circle, Query query) { |
| | | IPage<CircleCommentVO> pages = circleService.selectCircleCommentPage(Condition.getPage(query), circle); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 圈子评论表 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入circle") |
| | | public R save(@Valid @RequestBody CircleCommentEntity circle) { |
| | | if (circle.getParentId() == null) { |
| | | circle.setDepth(1); |
| | | } |
| | | circle.setUserId(AuthUtil.getUserId()); |
| | | return R.status(circleService.save(circle)); |
| | | } |
| | | |
| | | /** |
| | | * 圈子评论表 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入circle") |
| | | public R update(@Valid @RequestBody CircleCommentEntity circle) { |
| | | return R.status(circleService.updateById(circle)); |
| | | } |
| | | |
| | | /** |
| | | * 圈子评论表 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入circle") |
| | | public R submit(@Valid @RequestBody CircleCommentEntity circle) { |
| | | circle.setUserId(AuthUtil.getUserId()); |
| | | return R.status(circleService.saveOrUpdate(circle)); |
| | | } |
| | | |
| | | /** |
| | | * 圈子评论表 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(circleService.removeBatchByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入circle") |
| | | public R<IPage<CircleVO>> page(CircleVO circle, Query query) { |
| | | circle.setUserIds(AuthUtil.getUserId()); |
| | | IPage<CircleVO> pages = circleService.selectCirclePage(Condition.getPage(query), circle); |
| | | return R.data(pages); |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.circle.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.article.entity.ArticleLikeEntity; |
| | | import org.springblade.modules.circle.entity.CircleLikeEntity; |
| | | import org.springblade.modules.circle.service.ICircleLikeService; |
| | | import org.springblade.modules.circle.vo.CircleLikeVO; |
| | |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入circle") |
| | | public R submit(@Valid @RequestBody CircleLikeEntity circle) { |
| | | UpdateWrapper<CircleLikeEntity> objectUpdateWrapper = new UpdateWrapper<>(); |
| | | objectUpdateWrapper.eq("user_id", circle.getUserId()); |
| | | objectUpdateWrapper.eq("circle_id", circle.getCircleId()); |
| | | return R.status(circleService.saveOrUpdate(circle,objectUpdateWrapper)); |
| | | circle.setUserId(AuthUtil.getUserId()); |
| | | CircleLikeEntity one = circleService.getOne(Wrappers.<CircleLikeEntity>lambdaQuery() |
| | | .eq(CircleLikeEntity::getCircleId, circle.getCircleId()) |
| | | .eq(CircleLikeEntity::getUserId, circle.getUserId())); |
| | | if (one != null) { |
| | | circle.setId(one.getId()); |
| | | } |
| | | return R.status(circleService.saveOrUpdate(circle)); |
| | | } |
| | | |
| | | /** |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 圈子评论表 数据传输对象实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | @Data |
| | | public class CircleCommentDTO extends CircleCommentEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 圈子评论表 实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | @Data |
| | | @TableName("jczz_circle_comment") |
| | | @ApiModel(value = "CircleComment对象", description = "圈子评论表") |
| | | public class CircleCommentEntity { |
| | | |
| | | @ApiModelProperty(value = "主键ID", example = "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** 圈子id */ |
| | | @ApiModelProperty(value = "圈子id", example = "") |
| | | @TableField("circle_id") |
| | | private Long circleId; |
| | | |
| | | /** 评论内容 */ |
| | | @ApiModelProperty(value = "评论内容", example = "") |
| | | @TableField("content") |
| | | private String content; |
| | | |
| | | /** 评论人id */ |
| | | @ApiModelProperty(value = "评论人id", example = "") |
| | | @TableField("user_id") |
| | | private Long userId; |
| | | |
| | | /** 父级id(人) */ |
| | | @ApiModelProperty(value = "父级id(人)", example = "") |
| | | @TableField("parent_id") |
| | | private Long parentId; |
| | | |
| | | /** 回复时间 */ |
| | | @ApiModelProperty(value = "回复时间", example = "") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("reply_time") |
| | | private Date replyTime; |
| | | |
| | | /** 是否置顶(0:否,1:是) */ |
| | | @ApiModelProperty(value = "是否置顶(0:否,1:是)", example = "") |
| | | @TableField("topping") |
| | | private Integer topping; |
| | | |
| | | /** 是否审核(0:否,1:是) */ |
| | | @ApiModelProperty(value = "是否审核(0:否,1:是)", example = "") |
| | | @TableField("isexamine") |
| | | private Integer isexamine; |
| | | |
| | | /** 审核人 */ |
| | | @ApiModelProperty(value = "审核人", example = "") |
| | | @TableField("check_user") |
| | | private Long checkUser; |
| | | |
| | | /** 审核时间 */ |
| | | @ApiModelProperty(value = "审核时间", example = "") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("check_time") |
| | | private Date checkTime; |
| | | |
| | | /** 审核状态 */ |
| | | @ApiModelProperty(value = "审核状态", example = "") |
| | | @TableField("check_status") |
| | | private Integer checkStatus; |
| | | |
| | | /** 审核备注 */ |
| | | @ApiModelProperty(value = "审核备注", example = "") |
| | | @TableField("check_remark") |
| | | private String checkRemark; |
| | | |
| | | /** 创建时间 */ |
| | | @ApiModelProperty(value = "创建时间", example = "") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("create_time") |
| | | private Date createTime; |
| | | |
| | | /** 是否删除 0:否 1:是 */ |
| | | @ApiModelProperty(value = "是否删除 0:否 1:是", example = "") |
| | | @TableField("is_deleted") |
| | | private Integer isDeleted; |
| | | |
| | | /** 评论深度 */ |
| | | @ApiModelProperty(value = "评论深度", example = "") |
| | | @TableField("depth") |
| | | private Integer depth; |
| | | } |
| | |
| | | /** 0:否 1:是 */ |
| | | @ApiModelProperty(value = "0:否 1:是", example = "") |
| | | @TableField("delete_flag") |
| | | @TableLogic |
| | | // @TableLogic |
| | | private Integer deleteFlag; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.mapper; |
| | | |
| | | import io.lettuce.core.dynamic.annotation.Param; |
| | | import org.springblade.modules.circle.dto.CircleCommentDTO; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | import org.springblade.modules.circle.vo.CircleCommentVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 圈子评论表 Mapper 接口 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | public interface CircleCommentMapper extends BaseMapper<CircleCommentEntity> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param circle |
| | | * @return |
| | | */ |
| | | List<CircleCommentVO> selectCircleCommentPage(IPage page, @Param("circle") CircleCommentVO circle); |
| | | |
| | | /** |
| | | * 查询圈子评论表 |
| | | * |
| | | * @param id 圈子评论表ID |
| | | * @return 圈子评论表 |
| | | */ |
| | | public CircleCommentDTO selectCircleCommentById(Integer id); |
| | | |
| | | public CircleCommentDTO selectCircleCommentByParentId(Integer id); |
| | | |
| | | /** |
| | | * 查询圈子评论表列表 |
| | | * |
| | | * @param circleCommentDTO 圈子评论表 |
| | | * @return 圈子评论表集合 |
| | | */ |
| | | public List<CircleCommentDTO> selectCircleCommentList(CircleCommentDTO circleCommentDTO); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.circle.mapper.CircleCommentMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="circleResultMap" type="org.springblade.modules.circle.vo.CircleCommentVO"> |
| | | <result property="id" column="id" /> |
| | | <result property="circleId" column="circle_id" /> |
| | | <result property="content" column="content" /> |
| | | <result property="userId" column="user_id" /> |
| | | <result property="parentId" column="parent_id" /> |
| | | <result property="replyTime" column="reply_time" /> |
| | | <result property="topping" column="topping" /> |
| | | <result property="isexamine" column="isexamine" /> |
| | | <result property="checkUser" column="check_user" /> |
| | | <result property="checkTime" column="check_time" /> |
| | | <result property="checkStatus" column="check_status" /> |
| | | <result property="checkRemark" column="check_remark" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="isDeleted" column="is_deleted" /> |
| | | <result property="depth" column="depth" /> |
| | | |
| | | <collection property="children" column="id" javaType="java.util.List" |
| | | ofType="org.springblade.modules.circle.vo.CircleCommentVO" |
| | | autoMapping="true" |
| | | select="selectCircleCommentByParentId"> |
| | | |
| | | </collection> |
| | | |
| | | </resultMap> |
| | | |
| | | |
| | | <resultMap type="org.springblade.modules.circle.dto.CircleCommentDTO" id="CircleCommentDTOResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="circleId" column="circle_id" /> |
| | | <result property="content" column="content" /> |
| | | <result property="userId" column="user_id" /> |
| | | <result property="parentId" column="parent_id" /> |
| | | <result property="replyTime" column="reply_time" /> |
| | | <result property="topping" column="topping" /> |
| | | <result property="isexamine" column="isexamine" /> |
| | | <result property="checkUser" column="check_user" /> |
| | | <result property="checkTime" column="check_time" /> |
| | | <result property="checkStatus" column="check_status" /> |
| | | <result property="checkRemark" column="check_remark" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="isDeleted" column="is_deleted" /> |
| | | <result property="depth" column="depth" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCircleComment"> |
| | | select |
| | | id, |
| | | circle_id, |
| | | content, |
| | | user_id, |
| | | parent_id, |
| | | reply_time, |
| | | topping, |
| | | isexamine, |
| | | check_user, |
| | | check_time, |
| | | check_status, |
| | | check_remark, |
| | | create_time, |
| | | is_deleted, |
| | | depth |
| | | from |
| | | jczz_circle_comment |
| | | </sql> |
| | | |
| | | <select id="selectCircleCommentById" parameterType="int" resultMap="CircleCommentDTOResult"> |
| | | <include refid="selectCircleComment"/> |
| | | where |
| | | id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectCircleCommentByParentId" parameterType="int" resultMap="CircleCommentDTOResult"> |
| | | <include refid="selectCircleComment"/> |
| | | where |
| | | parent_id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectCircleCommentList" parameterType="org.springblade.modules.circle.dto.CircleCommentDTO" resultMap="CircleCommentDTOResult"> |
| | | <include refid="selectCircleComment"/> |
| | | <where> |
| | | <if test="id != null "> and id = #{id}</if> |
| | | <if test="circleId != null "> and circle_id = #{circleId}</if> |
| | | <if test="content != null and content != ''"> and content = #{content}</if> |
| | | <if test="userId != null "> and user_id = #{userId}</if> |
| | | <if test="parentId != null "> and parent_id = #{parentId}</if> |
| | | <if test="replyTime != null "> and reply_time = #{replyTime}</if> |
| | | <if test="topping != null "> and topping = #{topping}</if> |
| | | <if test="isexamine != null "> and isexamine = #{isexamine}</if> |
| | | <if test="checkUser != null "> and check_user = #{checkUser}</if> |
| | | <if test="checkTime != null "> and check_time = #{checkTime}</if> |
| | | <if test="checkStatus != null "> and check_status = #{checkStatus}</if> |
| | | <if test="checkRemark != null and checkRemark != ''"> and check_remark = #{checkRemark}</if> |
| | | <if test="createTime != null "> and create_time = #{createTime}</if> |
| | | <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if> |
| | | <if test="depth != null "> and depth = #{depth}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectCircleCommentPage" resultMap="circleResultMap"> |
| | | select |
| | | jcc.id, |
| | | jcc.circle_id, |
| | | jcc.content, |
| | | jcc.user_id, |
| | | jcc.parent_id, |
| | | jcc.reply_time, |
| | | jcc.topping, |
| | | jcc.isexamine, |
| | | jcc.check_user, |
| | | jcc.check_time, |
| | | jcc.check_status, |
| | | jcc.check_remark, |
| | | jcc.create_time, |
| | | jcc.is_deleted, |
| | | bu.name, |
| | | bu.avatar, |
| | | jcc.depth |
| | | from |
| | | jczz_circle_comment jcc left join blade_user bu on jcc.user_id = bu.id |
| | | <where> |
| | | <if test="circle.id != null "> and jcc.id = #{circle.id}</if> |
| | | <if test="circle.circleId != null "> and jcc.circle_id = #{circle.circleId}</if> |
| | | <if test="circle.content != null and circle.content != ''"> and content = #{circle.content}</if> |
| | | <if test="circle.userId != null "> and jcc.user_id = #{circle.userId}</if> |
| | | <if test="circle.parentId != null "> and jcc.parent_id = #{circle.parentId}</if> |
| | | <if test="circle.replyTime != null "> and jcc.reply_time = #{circle.replyTime}</if> |
| | | <if test="circle.topping != null "> and jcc.topping = #{circle.topping}</if> |
| | | <if test="circle.isexamine != null "> and jcc.isexamine = #{circle.isexamine}</if> |
| | | <if test="circle.checkUser != null "> and jcc.check_user = #{circle.checkUser}</if> |
| | | <if test="circle.checkTime != null "> and jcc.check_time = #{circle.checkTime}</if> |
| | | <if test="circle.checkStatus != null "> and jcc.check_status = #{circle.checkStatus}</if> |
| | | <if test="circle.checkRemark != null and circle.checkRemark != ''"> and jcc.check_remark = #{circle.checkRemark}</if> |
| | | <if test="circle.createTime != null "> and jcc.create_time = #{circle.createTime}</if> |
| | | <if test="circle.isDeleted != null "> and jcc.is_deleted = #{circle.isDeleted}</if> |
| | | <if test="circle.depth != null "> and jcc.depth = #{circle.depth}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | * @return 圈子表集合 |
| | | */ |
| | | public List<CircleVO> selectCircleList(CircleDTO circleDTO); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | <select id="selectCirclePage" resultMap="CircleVOResult"> |
| | | select jc.id, |
| | | select jc.id, |
| | | jc.user_id, |
| | | jc.create_time, |
| | | jc.circle_text, |
| | |
| | | bu.name, |
| | | bu.avatar, |
| | | jc.circle_type, |
| | | (select count(1) from jczz_circle_like jcl where jcl.circle_id = jc.id and jcl.user_id = #{circle.userId} ) likeFlag |
| | | (select count(1) from jczz_circle_like jcl where jcl.circle_id = jc.id and jcl.user_id = #{circle.userIds} and |
| | | jcl.delete_flag = 0 ) likeFlag |
| | | from jczz_circle jc left join blade_user bu on jc.user_id = bu.id |
| | | <where> |
| | | <if test="circle.id != null "> and id = #{circle.id}</if> |
| | | <if test="circle.userId != null "> and user_id = #{circle.userId}</if> |
| | | <if test="circle.createTime != null "> and create_time = #{circle.createTime}</if> |
| | | <if test="circle.circleText != null and circle.circleText != ''"> and circle_text = #{circle.circleText}</if> |
| | | <if test="circle.circleImages != null and circle.circleImages != ''"> and circle_images = #{circle.circleImages}</if> |
| | | <if test="circle.circleVideo != null and circle.circleVideo != ''"> and circle_video = #{circle.circleVideo}</if> |
| | | <if test="circle.deletedFalg != null "> and deleted_falg = #{circle.deletedFalg}</if> |
| | | <if test="circle.circleType != null "> and circle_type = #{circle.circleType}</if> |
| | | <if test="circle.id != null ">and jc.id = #{circle.id}</if> |
| | | <if test="circle.userId != null ">and jc.user_id = #{circle.userId}</if> |
| | | <if test="circle.createTime != null ">and jc.create_time = #{circle.createTime}</if> |
| | | <if test="circle.circleText != null and circle.circleText != ''">and jc.circle_text like concat |
| | | ('%',#{circle.circleText},'%') |
| | | </if> |
| | | <if test="circle.circleImages != null and circle.circleImages != ''">and jc.circle_images = |
| | | #{circle.circleImages} |
| | | </if> |
| | | <if test="circle.circleVideo != null and circle.circleVideo != ''">and jc.circle_video = |
| | | #{circle.circleVideo} |
| | | </if> |
| | | <if test="circle.deletedFalg != null ">and jc.deleted_falg = #{circle.deletedFalg}</if> |
| | | <if test="circle.circleType != null ">and jc.circle_type = #{circle.circleType}</if> |
| | | </where> |
| | | order by jc.create_time desc |
| | | </select> |
| | | |
| | | |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | import org.springblade.modules.circle.vo.CircleCommentVO; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | /** |
| | | * 圈子评论表 服务类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | public interface ICircleCommentService extends IService<CircleCommentEntity> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param circle |
| | | * @return |
| | | */ |
| | | IPage<CircleCommentVO> selectCircleCommentPage(IPage<CircleCommentVO> page, CircleCommentVO circle); |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | import org.springblade.modules.circle.vo.CircleCommentVO; |
| | | import org.springblade.modules.circle.mapper.CircleCommentMapper; |
| | | import org.springblade.modules.circle.service.ICircleCommentService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | /** |
| | | * 圈子评论表 服务实现类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | @Service |
| | | public class CircleCommentServiceImpl extends ServiceImpl<CircleCommentMapper, CircleCommentEntity> implements ICircleCommentService { |
| | | |
| | | @Override |
| | | public IPage<CircleCommentVO> selectCircleCommentPage(IPage<CircleCommentVO> page, CircleCommentVO circle) { |
| | | return page.setRecords(baseMapper.selectCircleCommentPage(page, circle)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.circle.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.circle.dto.CircleDTO; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | import org.springblade.modules.circle.entity.CircleEntity; |
| | | import org.springblade.modules.circle.entity.CircleLikeEntity; |
| | | import org.springblade.modules.circle.service.ICircleCommentService; |
| | | import org.springblade.modules.circle.service.ICircleLikeService; |
| | | import org.springblade.modules.circle.vo.CircleVO; |
| | | import org.springblade.modules.circle.mapper.CircleMapper; |
| | | import org.springblade.modules.circle.service.ICircleService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | |
| | | @Service |
| | | public class CircleServiceImpl extends ServiceImpl<CircleMapper, CircleEntity> implements ICircleService { |
| | | |
| | | @Autowired |
| | | private ICircleLikeService iCircleLikeService; |
| | | |
| | | @Autowired |
| | | private ICircleCommentService iCircleCommentService; |
| | | @Override |
| | | public IPage<CircleVO> selectCirclePage(IPage<CircleVO> page, CircleVO circle) { |
| | | return page.setRecords(baseMapper.selectCirclePage(page, circle)); |
| | | List<CircleVO> circleVOS = baseMapper.selectCirclePage(page, circle); |
| | | for (CircleVO circleVO : circleVOS) { |
| | | // 获取circleVO中circleId的点赞数 |
| | | long count = iCircleLikeService.count(Wrappers.<CircleLikeEntity>lambdaQuery() |
| | | .eq(CircleLikeEntity::getCircleId, circleVO.getId())); |
| | | circleVO.setLikeCount(count); |
| | | |
| | | // 查询circle_comment表中circle_id等于circleVO.getId()的记录数 |
| | | long count2 = iCircleCommentService.count(Wrappers.<CircleCommentEntity>lambdaQuery() |
| | | .eq(CircleCommentEntity::getCircleId, circleVO.getId()) |
| | | .groupBy(CircleCommentEntity::getCircleId)); |
| | | circleVO.setCommentCount(count2); |
| | | } |
| | | return page.setRecords(circleVOS); |
| | | } |
| | | |
| | | /** |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.vo; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 圈子评论表 视图实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class CircleCommentVO extends CircleCommentEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private List<CircleCommentVO> children; |
| | | |
| | | private String name; |
| | | |
| | | private String avatar; |
| | | |
| | | } |
| | |
| | | |
| | | private Integer likeFlag; |
| | | |
| | | private Long userIds; |
| | | |
| | | private Long commentCount; |
| | | |
| | | private Long likeCount; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.circle.wrapper; |
| | | |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.circle.entity.CircleCommentEntity; |
| | | import org.springblade.modules.circle.vo.CircleCommentVO; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 圈子评论表 包装类,返回视图层所需的字段 |
| | | * |
| | | * @author BladeX |
| | | * @since 2023-12-01 |
| | | */ |
| | | public class CircleCommentWrapper extends BaseEntityWrapper<CircleCommentEntity, CircleCommentVO> { |
| | | |
| | | public static CircleCommentWrapper build() { |
| | | return new CircleCommentWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public CircleCommentVO entityVO(CircleCommentEntity circle) { |
| | | CircleCommentVO circleVO = Objects.requireNonNull(BeanUtil.copy(circle, CircleCommentVO.class)); |
| | | |
| | | //User createUser = UserCache.getUser(circle.getCreateUser()); |
| | | //User updateUser = UserCache.getUser(circle.getUpdateUser()); |
| | | //circleVO.setCreateUserName(createUser.getName()); |
| | | //circleVO.setUpdateUserName(updateUser.getName()); |
| | | |
| | | return circleVO; |
| | | } |
| | | |
| | | |
| | | } |