Browse Source

1、帖子列表补充(可以查看自己发布的所有帖子)

master
Aug 1 month ago
parent
commit
3c3b4337cf
32 changed files with 1147 additions and 591 deletions
  1. +171
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/controller/CommunityCommentController.java
  2. +13
    -7
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/entity/CommunityComment.java
  3. +5
    -7
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/mapper/CommunityCommentMapper.java
  4. +5
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/mapper/xml/CommunityCommentMapper.xml
  5. +3
    -5
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/service/ICommunityCommentService.java
  6. +19
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/service/impl/CommunityCommentServiceImpl.java
  7. +185
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/CommunityCommentList.vue
  8. +114
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/modules/CommunityCommentForm.vue
  9. +84
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/modules/CommunityCommentModal.Style#Drawer.vue
  10. +60
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/modules/CommunityCommentModal.vue
  11. +61
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/CommunityComment.api.ts
  12. +49
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/CommunityComment.data.ts
  13. +162
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/CommunityCommentList.vue
  14. +58
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/components/CommunityCommentModal.vue
  15. +29
    -119
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/controller/CommunityPostController.java
  16. +11
    -5
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/entity/CommunityPost.java
  17. +1
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/mapper/CommunityPostMapper.java
  18. +0
    -16
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/mapper/xml/CommunityCommentMapper.xml
  19. +1
    -27
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/service/ICommunityPostService.java
  20. +0
    -27
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/service/impl/CommunityCommentServiceImpl.java
  21. +2
    -60
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/service/impl/CommunityPostServiceImpl.java
  22. +0
    -70
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vo/CommunityPostPage.java
  23. +11
    -10
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue/CommunityPostList.vue
  24. +54
    -120
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue/modules/CommunityPostForm.vue
  25. +8
    -12
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue/modules/CommunityPostModal.vue
  26. +0
    -7
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/CommunityPost.api.ts
  27. +0
    -23
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/CommunityPost.data.ts
  28. +15
    -15
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/CommunityPostList.vue
  29. +9
    -54
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/components/CommunityPostModal.vue
  30. +2
    -2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/communityController/CommunityController.java
  31. +1
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/CommunityService.java
  32. +14
    -3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/CommunityServiceImpl.java

+ 171
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/controller/CommunityCommentController.java View File

@ -0,0 +1,171 @@
package org.jeecg.modules.communityComment.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.communityComment.entity.CommunityComment;
import org.jeecg.modules.communityComment.service.ICommunityCommentService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 帖子评论表
* @Author: jeecg-boot
* @Date: 2025-08-06
* @Version: V1.0
*/
@Api(tags="帖子评论表")
@RestController
@RequestMapping("/communityComment/communityComment")
@Slf4j
public class CommunityCommentController extends JeecgController<CommunityComment, ICommunityCommentService> {
@Autowired
private ICommunityCommentService communityCommentService;
/**
* 分页列表查询
*
* @param communityComment
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "帖子评论表-分页列表查询")
@ApiOperation(value="帖子评论表-分页列表查询", notes="帖子评论表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<CommunityComment>> queryPageList(CommunityComment communityComment,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CommunityComment> queryWrapper = QueryGenerator.initQueryWrapper(communityComment, req.getParameterMap());
Page<CommunityComment> page = new Page<CommunityComment>(pageNo, pageSize);
IPage<CommunityComment> pageList = communityCommentService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param communityComment
* @return
*/
@AutoLog(value = "帖子评论表-添加")
@ApiOperation(value="帖子评论表-添加", notes="帖子评论表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody CommunityComment communityComment) {
communityCommentService.save(communityComment);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param communityComment
* @return
*/
@AutoLog(value = "帖子评论表-编辑")
@ApiOperation(value="帖子评论表-编辑", notes="帖子评论表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody CommunityComment communityComment) {
communityCommentService.updateById(communityComment);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "帖子评论表-通过id删除")
@ApiOperation(value="帖子评论表-通过id删除", notes="帖子评论表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
communityCommentService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "帖子评论表-批量删除")
@ApiOperation(value="帖子评论表-批量删除", notes="帖子评论表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.communityCommentService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "帖子评论表-通过id查询")
@ApiOperation(value="帖子评论表-通过id查询", notes="帖子评论表-通过id查询")
@GetMapping(value = "/queryById")
public Result<CommunityComment> queryById(@RequestParam(name="id",required=true) String id) {
CommunityComment communityComment = communityCommentService.getById(id);
if(communityComment==null) {
return Result.error("未找到对应数据");
}
return Result.OK(communityComment);
}
/**
* 导出excel
*
* @param request
* @param communityComment
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, CommunityComment communityComment) {
return super.exportXls(request, communityComment, CommunityComment.class, "帖子评论表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, CommunityComment.class);
}
}

jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/entity/CommunityComment.java → jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/entity/CommunityComment.java View File

@ -1,6 +1,9 @@
package org.jeecg.modules.communityPost.entity;
package org.jeecg.modules.communityComment.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -8,20 +11,23 @@ import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.UnsupportedEncodingException;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 帖子评论表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
@ApiModel(value="community_comment对象", description="帖子评论表")
@Data
@TableName("community_comment")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="community_comment对象", description="帖子评论表")
public class CommunityComment implements Serializable {
private static final long serialVersionUID = 1L;
@ -34,14 +40,12 @@ public class CommunityComment implements Serializable {
private java.lang.String createBy;
/**创建日期*/
@ApiModelProperty(value = "创建日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@ApiModelProperty(value = "更新日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private java.util.Date updateTime;
/**文字描述*/
@Excel(name = "文字描述", width = 15)
@ -52,6 +56,8 @@ public class CommunityComment implements Serializable {
@ApiModelProperty(value = "图片")
private java.lang.String image;
/**关联帖子*/
@Excel(name = "关联帖子", width = 15, dictTable = "community_post", dicText = "content", dicCode = "id")
@Dict(dictTable = "community_post", dicText = "content", dicCode = "id")
@ApiModelProperty(value = "关联帖子")
private java.lang.String postId;
}

jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/mapper/CommunityCommentMapper.java → jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/mapper/CommunityCommentMapper.java View File

@ -1,19 +1,17 @@
package org.jeecg.modules.communityPost.mapper;
package org.jeecg.modules.communityComment.mapper;
import java.util.List;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.communityComment.entity.CommunityComment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 帖子评论表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
public interface CommunityCommentMapper extends BaseMapper<CommunityComment> {
public boolean deleteByMainId(@Param("mainId") String mainId);
public List<CommunityComment> selectByMainId(@Param("mainId") String mainId);
}

+ 5
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/mapper/xml/CommunityCommentMapper.xml View File

@ -0,0 +1,5 @@
<?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.jeecg.modules.communityComment.mapper.CommunityCommentMapper">
</mapper>

jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/service/ICommunityCommentService.java → jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/service/ICommunityCommentService.java View File

@ -1,16 +1,14 @@
package org.jeecg.modules.communityPost.service;
package org.jeecg.modules.communityComment.service;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import org.jeecg.modules.communityComment.entity.CommunityComment;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 帖子评论表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
public interface ICommunityCommentService extends IService<CommunityComment> {
public List<CommunityComment> selectByMainId(String mainId);
}

+ 19
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/service/impl/CommunityCommentServiceImpl.java View File

@ -0,0 +1,19 @@
package org.jeecg.modules.communityComment.service.impl;
import org.jeecg.modules.communityComment.entity.CommunityComment;
import org.jeecg.modules.communityComment.mapper.CommunityCommentMapper;
import org.jeecg.modules.communityComment.service.ICommunityCommentService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 帖子评论表
* @Author: jeecg-boot
* @Date: 2025-08-06
* @Version: V1.0
*/
@Service
public class CommunityCommentServiceImpl extends ServiceImpl<CommunityCommentMapper, CommunityComment> implements ICommunityCommentService {
}

+ 185
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/CommunityCommentList.vue View File

@ -0,0 +1,185 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('帖子评论表')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<community-comment-modal ref="modalForm" @ok="modalFormOk"></community-comment-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CommunityCommentModal from './modules/CommunityCommentModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
export default {
name: 'CommunityCommentList',
mixins:[JeecgListMixin, mixinDevice],
components: {
CommunityCommentModal
},
data () {
return {
description: '帖子评论表管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'文字描述',
align:"center",
dataIndex: 'content'
},
{
title:'图片',
align:"center",
dataIndex: 'image',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'关联帖子',
align:"center",
dataIndex: 'postId_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/communityComment/communityComment/list",
delete: "/communityComment/communityComment/delete",
deleteBatch: "/communityComment/communityComment/deleteBatch",
exportXlsUrl: "/communityComment/communityComment/exportXls",
importExcelUrl: "communityComment/communityComment/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'Text',value:'content',text:'文字描述',dictCode:''})
fieldList.push({type:'Text',value:'image',text:'图片',dictCode:''})
fieldList.push({type:'string',value:'postId',text:'关联帖子',dictCode:"community_post,content,id"})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

+ 114
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/modules/CommunityCommentForm.vue View File

@ -0,0 +1,114 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="文字描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="content">
<a-textarea v-model="model.content" rows="4" placeholder="请输入文字描述" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image">
<j-image-upload isMultiple v-model="model.image" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="关联帖子" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="postId">
<j-dict-select-tag type="list" v-model="model.postId" dictCode="community_post,content,id" placeholder="请选择关联帖子" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'CommunityCommentForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/communityComment/communityComment/add",
edit: "/communityComment/communityComment/edit",
queryById: "/communityComment/communityComment/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>

+ 84
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/modules/CommunityCommentModal.Style#Drawer.vue View File

@ -0,0 +1,84 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<community-comment-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></community-comment-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import CommunityCommentForm from './CommunityCommentForm'
export default {
name: 'CommunityCommentModal',
components: {
CommunityCommentForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

+ 60
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue/modules/CommunityCommentModal.vue View File

@ -0,0 +1,60 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<community-comment-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></community-comment-form>
</j-modal>
</template>
<script>
import CommunityCommentForm from './CommunityCommentForm'
export default {
name: 'CommunityCommentModal',
components: {
CommunityCommentForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

+ 61
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/CommunityComment.api.ts View File

@ -0,0 +1,61 @@
import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';
enum Api {
list = '/communityComment/communityComment/list',
save='/communityComment/communityComment/add',
edit='/communityComment/communityComment/edit',
deleteOne = '/communityComment/communityComment/delete',
deleteBatch = '/communityComment/communityComment/deleteBatch',
importExcel = '/communityComment/communityComment/importExcel',
exportXls = '/communityComment/communityComment/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

+ 49
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/CommunityComment.data.ts View File

@ -0,0 +1,49 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '文字描述',
align:"center",
dataIndex: 'content'
},
{
title: '图片',
align:"center",
dataIndex: 'image',
customRender:render.renderAvatar,
},
{
title: '关联帖子',
align:"center",
dataIndex: 'postId_dictText'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '文字描述',
field: 'content',
component: 'InputTextArea',//TODO 注意string转换问题
},
{
label: '图片',
field: 'image',
component: 'JImageUpload',
componentProps:{
},
},
{
label: '关联帖子',
field: 'postId',
component: 'JDictSelectTag',
componentProps:{
dictCode:"community_post,content,id"
},
},
];

+ 162
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/CommunityCommentList.vue View File

@ -0,0 +1,162 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<CommunityCommentModal @register="registerModal" @success="handleSuccess"></CommunityCommentModal>
</div>
</template>
<script lang="ts" name="communityComment-communityComment" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import CommunityCommentModal from './components/CommunityCommentModal.vue'
import {columns, searchFormSchema} from './communityComment.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './communityComment.api';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '帖子评论表',
api: list,
columns,
canResize:false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
},
},
exportConfig: {
name:"帖子评论表",
url: getExportUrl,
},
importConfig: {
url: getImportUrl
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, reload);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

+ 58
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityComment/vue3/components/CommunityCommentModal.vue View File

@ -0,0 +1,58 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../communityComment.data';
import {saveOrUpdate} from '../communityComment.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
</style>

+ 29
- 119
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/controller/CommunityPostController.java View File

@ -1,42 +1,36 @@
package org.jeecg.modules.communityPost.controller;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.communityPost.entity.CommunityPost;
import org.jeecg.modules.communityPost.service.ICommunityPostService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import org.jeecg.modules.communityPost.entity.CommunityPost;
import org.jeecg.modules.communityPost.vo.CommunityPostPage;
import org.jeecg.modules.communityPost.service.ICommunityPostService;
import org.jeecg.modules.communityPost.service.ICommunityCommentService;
import org.springframework.beans.BeanUtils;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -45,18 +39,16 @@ import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 帖子动态信息表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
@Api(tags="帖子动态信息表")
@RestController
@RequestMapping("/communityPost/communityPost")
@Slf4j
public class CommunityPostController {
public class CommunityPostController extends JeecgController<CommunityPost, ICommunityPostService> {
@Autowired
private ICommunityPostService communityPostService;
@Autowired
private ICommunityCommentService communityCommentService;
/**
* 分页列表查询
@ -83,36 +75,28 @@ public class CommunityPostController {
/**
* 添加
*
* @param communityPostPage
* @param communityPost
* @return
*/
@AutoLog(value = "帖子动态信息表-添加")
@ApiOperation(value="帖子动态信息表-添加", notes="帖子动态信息表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody CommunityPostPage communityPostPage) {
CommunityPost communityPost = new CommunityPost();
BeanUtils.copyProperties(communityPostPage, communityPost);
communityPostService.saveMain(communityPost, communityPostPage.getCommunityCommentList());
public Result<String> add(@RequestBody CommunityPost communityPost) {
communityPostService.save(communityPost);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param communityPostPage
* @param communityPost
* @return
*/
@AutoLog(value = "帖子动态信息表-编辑")
@ApiOperation(value="帖子动态信息表-编辑", notes="帖子动态信息表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody CommunityPostPage communityPostPage) {
CommunityPost communityPost = new CommunityPost();
BeanUtils.copyProperties(communityPostPage, communityPost);
CommunityPost communityPostEntity = communityPostService.getById(communityPost.getId());
if(communityPostEntity==null) {
return Result.error("未找到对应数据");
}
communityPostService.updateMain(communityPost, communityPostPage.getCommunityCommentList());
public Result<String> edit(@RequestBody CommunityPost communityPost) {
communityPostService.updateById(communityPost);
return Result.OK("编辑成功!");
}
@ -126,7 +110,7 @@ public class CommunityPostController {
@ApiOperation(value="帖子动态信息表-通过id删除", notes="帖子动态信息表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
communityPostService.delMain(id);
communityPostService.removeById(id);
return Result.OK("删除成功!");
}
@ -140,8 +124,8 @@ public class CommunityPostController {
@ApiOperation(value="帖子动态信息表-批量删除", notes="帖子动态信息表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.communityPostService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功");
this.communityPostService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
@ -159,21 +143,6 @@ public class CommunityPostController {
return Result.error("未找到对应数据");
}
return Result.OK(communityPost);
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "帖子评论表通过主表ID查询")
@ApiOperation(value="帖子评论表主表ID查询", notes="帖子评论表-通主表ID查询")
@GetMapping(value = "/queryCommunityCommentByMainId")
public Result<List<CommunityComment>> queryCommunityCommentListByMainId(@RequestParam(name="id",required=true) String id) {
List<CommunityComment> communityCommentList = communityCommentService.selectByMainId(id);
return Result.OK(communityCommentList);
}
/**
@ -184,43 +153,11 @@ public class CommunityPostController {
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, CommunityPost communityPost) {
// Step.1 组装查询条件查询数据
QueryWrapper<CommunityPost> queryWrapper = QueryGenerator.initQueryWrapper(communityPost, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//Step.2 获取导出数据
List<CommunityPost> queryList = communityPostService.list(queryWrapper);
// 过滤选中数据
String selections = request.getParameter("selections");
List<CommunityPost> communityPostList = new ArrayList<CommunityPost>();
if(oConvertUtils.isEmpty(selections)) {
communityPostList = queryList;
}else {
List<String> selectionList = Arrays.asList(selections.split(","));
communityPostList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
}
// Step.3 组装pageList
List<CommunityPostPage> pageList = new ArrayList<CommunityPostPage>();
for (CommunityPost main : communityPostList) {
CommunityPostPage vo = new CommunityPostPage();
BeanUtils.copyProperties(main, vo);
List<CommunityComment> communityCommentList = communityCommentService.selectByMainId(main.getId());
vo.setCommunityCommentList(communityCommentList);
pageList.add(vo);
}
// Step.4 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "帖子动态信息表列表");
mv.addObject(NormalExcelConstants.CLASS, CommunityPostPage.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("帖子动态信息表数据", "导出人:"+sysUser.getRealname(), "帖子动态信息表"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
return super.exportXls(request, communityPost, CommunityPost.class, "帖子动态信息表");
}
/**
* 通过excel导入数据
* 通过excel导入数据
*
* @param request
* @param response
@ -228,34 +165,7 @@ public class CommunityPostController {
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<CommunityPostPage> list = ExcelImportUtil.importExcel(file.getInputStream(), CommunityPostPage.class, params);
for (CommunityPostPage page : list) {
CommunityPost po = new CommunityPost();
BeanUtils.copyProperties(page, po);
communityPostService.saveMain(po, page.getCommunityCommentList());
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.OK("文件导入失败!");
return super.importExcel(request, response, CommunityPost.class);
}
}

+ 11
- 5
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/entity/CommunityPost.java View File

@ -3,6 +3,7 @@ package org.jeecg.modules.communityPost.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.IdType;
@ -11,22 +12,27 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.jeecg.modules.communityComment.entity.CommunityComment;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 帖子动态信息表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
@ApiModel(value="community_post对象", description="帖子动态信息表")
@Data
@TableName("community_post")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="community_post对象", description="帖子动态信息表")
public class CommunityPost implements Serializable {
private static final long serialVersionUID = 1L;
@ -56,17 +62,17 @@ public class CommunityPost implements Serializable {
private java.lang.String image;
/**动态类型*/
@Excel(name = "动态类型", width = 15, dicCode = "community_type_post")
@Dict(dicCode = "community_type_post")
@Dict(dicCode = "community_type_post")
@ApiModelProperty(value = "动态类型")
private java.lang.String type;
/**审核状态*/
@Excel(name = "审核状态", width = 15, dicCode = "community_status_post")
@Dict(dicCode = "community_status_post")
@Dict(dicCode = "community_status_post")
@ApiModelProperty(value = "审核状态")
private java.lang.String status;
/**关联用户*/
@Excel(name = "关联用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")
@ApiModelProperty(value = "关联用户")
private java.lang.String userId;


+ 1
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/mapper/CommunityPostMapper.java View File

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 帖子动态信息表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
public interface CommunityPostMapper extends BaseMapper<CommunityPost> {


+ 0
- 16
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/mapper/xml/CommunityCommentMapper.xml View File

@ -1,16 +0,0 @@
<?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.jeecg.modules.communityPost.mapper.CommunityCommentMapper">
<delete id="deleteByMainId" parameterType="java.lang.String">
DELETE
FROM community_comment
WHERE
post_id = #{mainId} </delete>
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.communityPost.entity.CommunityComment">
SELECT *
FROM community_comment
WHERE
post_id = #{mainId} </select>
</mapper>

+ 1
- 27
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/service/ICommunityPostService.java View File

@ -1,40 +1,14 @@
package org.jeecg.modules.communityPost.service;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import org.jeecg.modules.communityPost.entity.CommunityPost;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
/**
* @Description: 帖子动态信息表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
public interface ICommunityPostService extends IService<CommunityPost> {
/**
* 添加一对多
*
*/
public void saveMain(CommunityPost communityPost,List<CommunityComment> communityCommentList) ;
/**
* 修改一对多
*
*/
public void updateMain(CommunityPost communityPost,List<CommunityComment> communityCommentList);
/**
* 删除一对多
*/
public void delMain (String id);
/**
* 批量删除一对多
*/
public void delBatchMain (Collection<? extends Serializable> idList);
}

+ 0
- 27
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/service/impl/CommunityCommentServiceImpl.java View File

@ -1,27 +0,0 @@
package org.jeecg.modules.communityPost.service.impl;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import org.jeecg.modules.communityPost.mapper.CommunityCommentMapper;
import org.jeecg.modules.communityPost.service.ICommunityCommentService;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @Description: 帖子评论表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Version: V1.0
*/
@Service
public class CommunityCommentServiceImpl extends ServiceImpl<CommunityCommentMapper, CommunityComment> implements ICommunityCommentService {
@Autowired
private CommunityCommentMapper communityCommentMapper;
@Override
public List<CommunityComment> selectByMainId(String mainId) {
return communityCommentMapper.selectByMainId(mainId);
}
}

+ 2
- 60
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/service/impl/CommunityPostServiceImpl.java View File

@ -1,77 +1,19 @@
package org.jeecg.modules.communityPost.service.impl;
import org.jeecg.modules.communityPost.entity.CommunityPost;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import org.jeecg.modules.communityPost.mapper.CommunityCommentMapper;
import org.jeecg.modules.communityPost.mapper.CommunityPostMapper;
import org.jeecg.modules.communityPost.service.ICommunityPostService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;
/**
* @Description: 帖子动态信息表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Date: 2025-08-06
* @Version: V1.0
*/
@Service
public class CommunityPostServiceImpl extends ServiceImpl<CommunityPostMapper, CommunityPost> implements ICommunityPostService {
@Autowired
private CommunityPostMapper communityPostMapper;
@Autowired
private CommunityCommentMapper communityCommentMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(CommunityPost communityPost, List<CommunityComment> communityCommentList) {
communityPostMapper.insert(communityPost);
if(communityCommentList!=null && communityCommentList.size()>0) {
for(CommunityComment entity:communityCommentList) {
//外键设置
entity.setPostId(communityPost.getId());
communityCommentMapper.insert(entity);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(CommunityPost communityPost,List<CommunityComment> communityCommentList) {
communityPostMapper.updateById(communityPost);
//1.先删除子表数据
communityCommentMapper.deleteByMainId(communityPost.getId());
//2.子表数据重新插入
if(communityCommentList!=null && communityCommentList.size()>0) {
for(CommunityComment entity:communityCommentList) {
//外键设置
entity.setPostId(communityPost.getId());
communityCommentMapper.insert(entity);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delMain(String id) {
communityCommentMapper.deleteByMainId(id);
communityPostMapper.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) {
for(Serializable id:idList) {
communityCommentMapper.deleteByMainId(id.toString());
communityPostMapper.deleteById(id);
}
}
}

+ 0
- 70
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vo/CommunityPostPage.java View File

@ -1,70 +0,0 @@
package org.jeecg.modules.communityPost.vo;
import java.util.List;
import org.jeecg.modules.communityPost.entity.CommunityPost;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: 帖子动态信息表
* @Author: jeecg-boot
* @Date: 2025-08-04
* @Version: V1.0
*/
@Data
@ApiModel(value="community_postPage对象", description="帖子动态信息表")
public class CommunityPostPage {
/**主键*/
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**动态文本*/
@Excel(name = "动态文本", width = 15)
@ApiModelProperty(value = "动态文本")
private java.lang.String content;
/**动态图片*/
@Excel(name = "动态图片", width = 15)
@ApiModelProperty(value = "动态图片")
private java.lang.String image;
/**动态类型*/
@Excel(name = "动态类型", width = 15, dicCode = "community_type_post")
@Dict(dicCode = "community_type_post")
@ApiModelProperty(value = "动态类型")
private java.lang.String type;
/**审核状态*/
@Excel(name = "审核状态", width = 15, dicCode = "community_status_post")
@Dict(dicCode = "community_status_post")
@ApiModelProperty(value = "审核状态")
private java.lang.String status;
/**关联用户*/
@Excel(name = "关联用户", width = 15, dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")
@Dict(dictTable = "han_hai_member", dicText = "nick_name", dicCode = "id")
@ApiModelProperty(value = "关联用户")
private java.lang.String userId;
@ExcelCollection(name="帖子评论表")
@ApiModelProperty(value = "帖子评论表")
private List<CommunityComment> communityCommentList;
}

+ 11
- 10
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue/CommunityPostList.vue View File

@ -8,7 +8,7 @@
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
@ -36,15 +36,15 @@
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
class="j-table-force-nowrap"
:scroll="{x:true}"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
@ -89,20 +89,21 @@
</a-table>
</div>
<community-post-modal ref="modalForm" @ok="modalFormOk"/>
<community-post-modal ref="modalForm" @ok="modalFormOk"></community-post-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CommunityPostModal from './modules/CommunityPostModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import '@/assets/less/TableExpand.less'
export default {
name: "CommunityPostList",
mixins:[JeecgListMixin],
name: 'CommunityPostList',
mixins:[JeecgListMixin, mixinDevice],
components: {
CommunityPostModal
},
@ -153,7 +154,7 @@
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' },
scopedSlots: { customRender: 'action' }
}
],
url: {
@ -169,12 +170,12 @@
}
},
created() {
this.getSuperFieldList();
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
},
methods: {
initDictConfig(){


+ 54
- 120
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue/modules/CommunityPostForm.vue View File

@ -1,30 +1,29 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<!-- 主表单区域 -->
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24" >
<a-col :span="24">
<a-form-model-item label="动态文本" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="content">
<a-textarea v-model="model.content" rows="4" placeholder="请输入动态文本" />
</a-form-model-item>
</a-col>
<a-col :span="24" >
<a-col :span="24">
<a-form-model-item label="动态图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image">
<j-image-upload isMultiple v-model="model.image" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24" >
<a-col :span="24">
<a-form-model-item label="动态类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
<j-dict-select-tag type="list" v-model="model.type" dictCode="community_type_post" placeholder="请选择动态类型" />
</a-form-model-item>
</a-col>
<a-col :span="24" >
<a-col :span="24">
<a-form-model-item label="审核状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<j-dict-select-tag type="list" v-model="model.status" dictCode="community_status_post" placeholder="请选择审核状态" />
</a-form-model-item>
</a-col>
<a-col :span="24" >
<a-col :span="24">
<a-form-model-item label="关联用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId">
<j-dict-select-tag type="list" v-model="model.userId" dictCode="han_hai_member,nick_name,id" placeholder="请选择关联用户" />
</a-form-model-item>
@ -32,43 +31,30 @@
</a-row>
</a-form-model>
</j-form-container>
<!-- 子表单区域 -->
<a-tabs v-model="activeKey" @change="handleChangeTabs">
<a-tab-pane tab="帖子评论表" :key="refKeys[0]" :forceRender="true">
<j-vxe-table
keep-source
:ref="refKeys[0]"
:loading="communityCommentTable.loading"
:columns="communityCommentTable.columns"
:dataSource="communityCommentTable.dataSource"
:maxHeight="300"
:disabled="formDisabled"
:rowNumber="true"
:rowSelection="true"
:toolbar="true"
/>
</a-tab-pane>
</a-tabs>
</a-spin>
</template>
<script>
import { getAction } from '@/api/manage'
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import { getRefPromise,VALIDATE_FAILED} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
export default {
name: 'CommunityPostForm',
mixins: [JVxeTableModelMixin],
components: {
JFormContainer,
},
data() {
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
@ -77,114 +63,62 @@
xs: { span: 24 },
sm: { span: 16 },
},
model:{
},
//
addDefaultRowNum: 1,
confirmLoading: false,
validatorRules: {
},
refKeys: ['communityComment', ],
tableKeys:['communityComment', ],
activeKey: 'communityComment',
//
communityCommentTable: {
loading: false,
dataSource: [],
columns: [
{
title: '文字描述',
key: 'content',
type: JVXETypes.textarea,
width:"200px",
placeholder: '请输入${title}',
defaultValue:'',
},
{
title: '图片',
key: 'image',
type: JVXETypes.image,
token:true,
responseName:"message",
width:"200px",
placeholder: '请输入${title}',
defaultValue:'',
},
]
},
url: {
add: "/communityPost/communityPost/add",
edit: "/communityPost/communityPost/edit",
queryById: "/communityPost/communityPost/queryById",
communityComment: {
list: '/communityPost/communityPost/queryCommunityCommentByMainId'
},
queryById: "/communityPost/communityPost/queryById"
}
}
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
addBefore(){
this.communityCommentTable.dataSource=[]
add () {
this.edit(this.modelDefault);
},
getAllTable() {
let values = this.tableKeys.map(key => getRefPromise(this, key))
return Promise.all(values)
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
/** 调用完edit()方法之后会自动调用此方法 */
editAfter() {
this.$nextTick(() => {
})
//
if (this.model.id) {
let params = { id: this.model.id }
this.requestSubTableData(this.url.communityComment.list, params, this.communityCommentTable)
}
},
//
validateSubForm(allValues){
return new Promise((resolve,reject)=>{
Promise.all([
]).then(() => {
resolve(allValues)
}).catch(e => {
if (e.error === VALIDATE_FAILED) {
// tab
this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
} else {
console.error(e)
}
})
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
},
/** 整理成formData */
classifyIntoFormData(allValues) {
let main = Object.assign(this.model, allValues.formValue)
return {
...main, //
communityCommentList: allValues.tablesValue[0].tableData,
}
},
validateError(msg){
this.$message.error(msg)
}
})
},
}
}
</script>
<style scoped>
</style>
</script>

+ 8
- 12
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue/modules/CommunityPostModal.vue View File

@ -1,27 +1,26 @@
<template>
<j-modal
:title="title"
:width="1200"
:width="width"
:visible="visible"
:maskClosable="false"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel">
<community-post-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
@cancel="handleCancel"
cancelText="关闭">
<community-post-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></community-post-form>
</j-modal>
</template>
<script>
import CommunityPostForm from './CommunityPostForm'
export default {
name: 'CommunityPostModal',
components: {
CommunityPostForm
},
data() {
data () {
return {
title:'',
width:800,
@ -29,7 +28,7 @@
disableSubmit: false
}
},
methods:{
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
@ -47,7 +46,7 @@
this.visible = false;
},
handleOk () {
this.$refs.realForm.handleOk();
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
@ -58,7 +57,4 @@
}
}
}
</script>
<style scoped>
</style>
</script>

+ 0
- 7
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/CommunityPost.api.ts View File

@ -9,23 +9,16 @@ enum Api {
deleteBatch = '/communityPost/communityPost/deleteBatch',
importExcel = '/communityPost/communityPost/importExcel',
exportXls = '/communityPost/communityPost/exportXls',
communityCommentList = '/communityPost/communityPost/queryCommunityCommentByMainId',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const communityCommentList = Api.communityCommentList;
/**
*
* @param params


+ 0
- 23
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/CommunityPost.data.ts View File

@ -2,7 +2,6 @@ import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
{
@ -74,25 +73,3 @@ export const formSchema: FormSchema[] = [
},
},
];
//子表单数据
//子表表格配置
export const communityCommentColumns: JVxeColumn[] = [
{
title: '文字描述',
key: 'content',
type: JVxeTypes.textarea,
width:"200px",
placeholder: '请输入${title}',
defaultValue:'',
},
{
title: '图片',
key: 'image',
type: JVxeTypes.image,
token:true,
responseName:"message",
width:"200px",
placeholder: '请输入${title}',
defaultValue:'',
},
]

+ 15
- 15
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/CommunityPostList.vue View File

@ -42,15 +42,15 @@
<script lang="ts" name="communityPost-communityPost" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage'
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import CommunityPostModal from './components/CommunityPostModal.vue'
import {columns, searchFormSchema} from './communityPost.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './communityPost.api';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '帖子动态信息表',
@ -58,25 +58,25 @@
columns,
canResize:false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
},
actionColumn: {
actionColumn: {
width: 120,
},
},
exportConfig: {
},
exportConfig: {
name:"帖子动态信息表",
url: getExportUrl,
},
importConfig: {
},
importConfig: {
url: getImportUrl
},
})
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext


+ 9
- 54
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/communityPost/vue3/components/CommunityPostModal.vue View File

@ -1,90 +1,45 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
<BasicForm @register="registerForm" ref="formRef"/>
<!-- 子表单区域 -->
<a-tabs v-model:activeKey="activeKey" @change="handleChangeTabs">
<a-tab-pane tab="帖子评论表" :key="refKeys[0]" :forceRender="true">
<JVxeTable
keep-source
resizable
:ref="refKeys[0]"
:loading="communityCommentTable.loading"
:columns="communityCommentTable.columns"
:dataSource="communityCommentTable.dataSource"
:maxHeight="300"
:rowNumber="true"
:rowSelection="true"
:toolbar="true"
/>
</a-tab-pane>
</a-tabs>
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref,reactive} from 'vue';
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import { JVxeTable } from '/@/components/jeecg/JVxeTable'
import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts'
import {formSchema,communityCommentColumns} from '../communityPost.data';
import {saveOrUpdate,communityCommentList} from '../communityPost.api';
import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
import {formSchema} from '../communityPost.data';
import {saveOrUpdate} from '../communityPost.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
const refKeys = ref(['communityComment', ]);
const activeKey = ref('communityComment');
const communityComment = ref();
const tableRefs = {communityComment, };
const communityCommentTable = reactive({
loading: false,
dataSource: [],
columns:communityCommentColumns
})
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
});
//
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await reset();
setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter});
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
requestSubTableData(communityCommentList, {id:data?.record?.id}, communityCommentTable)
}
//
setProps({ disabled: !data?.showFooter })
});
//
const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys);
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
async function reset(){
await resetFields();
activeKey.value = 'communityComment';
communityCommentTable.dataSource = [];
}
function classifyIntoFormData(allValues) {
let main = Object.assign({}, allValues.formValue)
return {
...main, //
communityCommentList: allValues.tablesValue[0].tableData,
}
}
//
async function requestAddOrEdit(values) {
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);


+ 2
- 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/communityController/CommunityController.java View File

@ -28,8 +28,8 @@ public class CommunityController {
//获取banner图列表
@ApiOperation(value="社区-获取帖子列表", notes="type:0-木邻说 1-木邻见")
@RequestMapping(value = "/queryPostList", method = {RequestMethod.GET})
public Result<?> queryPostList(CommunityPost communityPost, PageBean pageBean){
return communityService.queryPostList(communityPost, pageBean);
public Result<?> queryPostList(String token, CommunityPost communityPost, PageBean pageBean){
return communityService.queryPostList(token, communityPost, pageBean);
}
//上传帖子


+ 1
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/CommunityService.java View File

@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
public interface CommunityService {
//获取帖子列表
public Result<?> queryPostList(CommunityPost communityPost, PageBean pageBean);
public Result<?> queryPostList(String token, CommunityPost communityPost, PageBean pageBean);
//上传帖子
public Result<?> addPost(String token, CommunityPost communityPost);


+ 14
- 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/service/impl/CommunityServiceImpl.java View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xwpf.usermodel.TOC;
import org.jeecg.common.api.vo.Result;
import org.jeecg.config.shiro.ShiroRealm;
import org.jeecg.modules.api.bean.PageBean;
@ -12,9 +13,9 @@ import org.jeecg.modules.communityActivity.entity.CommunityActivity;
import org.jeecg.modules.communityActivityApply.entity.CommunityActivityApply;
import org.jeecg.modules.communityBanner.entity.CommunityBanner;
import org.jeecg.modules.communityBanner.service.ICommunityBannerService;
import org.jeecg.modules.communityPost.entity.CommunityComment;
import org.jeecg.modules.communityComment.entity.CommunityComment;
import org.jeecg.modules.communityComment.service.ICommunityCommentService;
import org.jeecg.modules.communityPost.entity.CommunityPost;
import org.jeecg.modules.communityPost.service.ICommunityCommentService;
import org.jeecg.modules.communityPost.service.ICommunityPostService;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
@ -45,8 +46,14 @@ public class CommunityServiceImpl implements CommunityService {
//获取帖子列表
@Override
public Result<?> queryPostList(CommunityPost communityPost, PageBean pageBean) {
public Result<?> queryPostList(String token, CommunityPost communityPost, PageBean pageBean) {
log.info("开始查询帖子列表");
HanHaiMember hanHaiMember = null;
if(StringUtils.isNotEmpty(token)){
//权限验证
hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);
//hanHaiMember = hanHaiMemberService.getById(token);
}
//返回信息
String massege = "";
//分页信息
@ -71,6 +78,10 @@ public class CommunityServiceImpl implements CommunityService {
//审核状态为已经通过
query.eq(CommunityPost::getStatus, "1");
if(null != hanHaiMember){
query.or().eq(CommunityPost::getUserId, hanHaiMember.getId());
}
//按照创建时间降序排列
query.orderByDesc(CommunityPost::getCreateTime);


Loading…
Cancel
Save