parent
f6fc896982
commit
9dc50c1418
@ -0,0 +1,263 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.dto.DataLogDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.system.entity.SysComment;
|
||||
import org.jeecg.modules.system.service.ISysCommentService;
|
||||
import org.jeecg.modules.system.vo.SysCommentFileVo;
|
||||
import org.jeecg.modules.system.vo.SysCommentVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "系统评论回复表")
|
||||
@RestController
|
||||
@RequestMapping("/sys/comment")
|
||||
@Slf4j
|
||||
public class SysCommentController extends JeecgController<SysComment, ISysCommentService> {
|
||||
|
||||
@Autowired
|
||||
private ISysCommentService sysCommentService;
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
|
||||
/**
|
||||
* 在线预览文件地址
|
||||
*/
|
||||
@Value("${jeecg.file-view-domain}/onlinePreview")
|
||||
private String onlinePreviewDomain;
|
||||
|
||||
/**
|
||||
* 查询评论+文件
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统评论回复表-列表查询", notes = "系统评论回复表-列表查询")
|
||||
@GetMapping(value = "/listByForm")
|
||||
public Result<IPage<SysCommentVO>> queryListByForm(SysComment sysComment) {
|
||||
List<SysCommentVO> list = sysCommentService.queryFormCommentInfo(sysComment);
|
||||
IPage<SysCommentVO> pageList = new Page();
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统评论回复表-列表查询", notes = "系统评论回复表-列表查询")
|
||||
@GetMapping(value = "/fileList")
|
||||
public Result<IPage<SysCommentFileVo>> queryFileList(SysComment sysComment) {
|
||||
List<SysCommentFileVo> list = sysCommentService.queryFormFileList(sysComment.getTableName(), sysComment.getTableDataId());
|
||||
IPage<SysCommentFileVo> pageList = new Page();
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "系统评论表-添加文本", notes = "系统评论表-添加文本")
|
||||
@PostMapping(value = "/addText")
|
||||
public Result<String> addText(@RequestBody SysComment sysComment) {
|
||||
String commentId = sysCommentService.saveOne(sysComment);
|
||||
return Result.OK(commentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "系统评论表-添加文件", notes = "系统评论表-添加文件")
|
||||
@PostMapping(value = "/addFile")
|
||||
public Result<String> addFile(HttpServletRequest request) {
|
||||
try {
|
||||
sysCommentService.saveOneFileComment(request);
|
||||
return Result.OK("success");
|
||||
} catch (Exception e) {
|
||||
log.error("评论文件上传失败", e.getMessage());
|
||||
return Result.error("操作失败," + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "系统评论回复表-通过id删除", notes = "系统评论回复表-通过id删除")
|
||||
@DeleteMapping(value = "/deleteOne")
|
||||
public Result<String> deleteOne(@RequestParam(name = "id", required = true) String id) {
|
||||
SysComment comment = sysCommentService.getById(id);
|
||||
if(comment==null){
|
||||
return Result.error("该评论已被删除!");
|
||||
}
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String username = sysUser.getUsername();
|
||||
String admin = "admin";
|
||||
//除了admin外 其他人只能删除自己的评论
|
||||
if((!admin.equals(username)) && !username.equals(comment.getCreateBy())){
|
||||
return Result.error("只能删除自己的评论!");
|
||||
}
|
||||
sysCommentService.deleteOne(id);
|
||||
//删除评论添加日志
|
||||
String logContent = "删除了评论, "+ comment.getCommentContent();
|
||||
DataLogDTO dataLog = new DataLogDTO(comment.getTableName(), comment.getTableDataId(), logContent, CommonConstant.DATA_LOG_TYPE_COMMENT);
|
||||
sysBaseAPI.saveDataLog(dataLog);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件预览的地址
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getFileViewDomain")
|
||||
public Result<String> getFileViewDomain() {
|
||||
return Result.OK(onlinePreviewDomain);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysComment
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
////@AutoLog(value = "系统评论回复表-分页列表查询")
|
||||
@ApiOperation(value = "系统评论回复表-分页列表查询", notes = "系统评论回复表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysComment>> queryPageList(SysComment sysComment,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysComment> queryWrapper = QueryGenerator.initQueryWrapper(sysComment, req.getParameterMap());
|
||||
Page<SysComment> page = new Page<SysComment>(pageNo, pageSize);
|
||||
IPage<SysComment> pageList = sysCommentService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统评论回复表-添加", notes = "系统评论回复表-添加")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody SysComment sysComment) {
|
||||
sysCommentService.save(sysComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统评论回复表-编辑")
|
||||
@ApiOperation(value = "系统评论回复表-编辑", notes = "系统评论回复表-编辑")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody SysComment sysComment) {
|
||||
sysCommentService.updateById(sysComment);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统评论回复表-通过id删除")
|
||||
@ApiOperation(value = "系统评论回复表-通过id删除", notes = "系统评论回复表-通过id删除")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysCommentService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统评论回复表-批量删除")
|
||||
@ApiOperation(value = "系统评论回复表-批量删除", notes = "系统评论回复表-批量删除")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysCommentService.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<SysComment> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysComment sysComment = sysCommentService.getById(id);
|
||||
if (sysComment == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sysComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysComment
|
||||
*/
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysComment sysComment) {
|
||||
return super.exportXls(request, sysComment, SysComment.class, "系统评论回复表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("sys_comment:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysComment.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
import org.jeecg.modules.system.service.ISysFilesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "知识库-文档管理")
|
||||
@RestController
|
||||
@RequestMapping("/sys/files")
|
||||
public class SysFilesController extends JeecgController<SysFiles, ISysFilesService> {
|
||||
@Autowired
|
||||
private ISysFilesService sysFilesService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysFiles
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-分页列表查询")
|
||||
@ApiOperation(value = "知识库-文档管理-分页列表查询", notes = "知识库-文档管理-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(SysFiles sysFiles,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysFiles> queryWrapper = QueryGenerator.initQueryWrapper(sysFiles, req.getParameterMap());
|
||||
Page<SysFiles> page = new Page<SysFiles>(pageNo, pageSize);
|
||||
IPage<SysFiles> pageList = sysFilesService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysFiles
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-添加")
|
||||
@ApiOperation(value = "知识库-文档管理-添加", notes = "知识库-文档管理-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysFiles sysFiles) {
|
||||
sysFilesService.save(sysFiles);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysFiles
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-编辑")
|
||||
@ApiOperation(value = "知识库-文档管理-编辑", notes = "知识库-文档管理-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysFiles sysFiles) {
|
||||
sysFilesService.updateById(sysFiles);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-通过id删除")
|
||||
@ApiOperation(value = "知识库-文档管理-通过id删除", notes = "知识库-文档管理-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysFilesService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-批量删除")
|
||||
@ApiOperation(value = "知识库-文档管理-批量删除", notes = "知识库-文档管理-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysFilesService.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<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysFiles sysFiles = sysFilesService.getById(id);
|
||||
return Result.OK(sysFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysFiles
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysFiles sysFiles) {
|
||||
return super.exportXls(request, sysFiles, SysFiles.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, SysFiles.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
import org.jeecg.modules.system.service.ISysFormFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "表单评论文件")
|
||||
@RestController
|
||||
@RequestMapping("/sys/formFile")
|
||||
public class SysFormFileController extends JeecgController<SysFormFile, ISysFormFileService> {
|
||||
@Autowired
|
||||
private ISysFormFileService sysFormFileService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysFormFile
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-分页列表查询")
|
||||
@ApiOperation(value = "表单评论文件-分页列表查询", notes = "表单评论文件-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(SysFormFile sysFormFile,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysFormFile> queryWrapper = QueryGenerator.initQueryWrapper(sysFormFile, req.getParameterMap());
|
||||
Page<SysFormFile> page = new Page<SysFormFile>(pageNo, pageSize);
|
||||
IPage<SysFormFile> pageList = sysFormFileService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysFormFile
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-添加")
|
||||
@ApiOperation(value = "表单评论文件-添加", notes = "表单评论文件-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysFormFile sysFormFile) {
|
||||
sysFormFileService.save(sysFormFile);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysFormFile
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-编辑")
|
||||
@ApiOperation(value = "表单评论文件-编辑", notes = "表单评论文件-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysFormFile sysFormFile) {
|
||||
sysFormFileService.updateById(sysFormFile);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-通过id删除")
|
||||
@ApiOperation(value = "表单评论文件-通过id删除", notes = "表单评论文件-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysFormFileService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-批量删除")
|
||||
@ApiOperation(value = "表单评论文件-批量删除", notes = "表单评论文件-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysFormFileService.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<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysFormFile sysFormFile = sysFormFileService.getById(id);
|
||||
return Result.OK(sysFormFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysFormFile
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysFormFile sysFormFile) {
|
||||
return super.exportXls(request, sysFormFile, SysFormFile.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, SysFormFile.class);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_comment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sys_comment对象", description="系统评论回复表")
|
||||
public class SysComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
/**表名*/
|
||||
@Excel(name = "表名", width = 15)
|
||||
@ApiModelProperty(value = "表名")
|
||||
private String tableName;
|
||||
/**数据id*/
|
||||
@Excel(name = "数据id", width = 15)
|
||||
@ApiModelProperty(value = "数据id")
|
||||
private String tableDataId;
|
||||
/**来源用户id*/
|
||||
@Excel(name = "来源用户id", width = 15)
|
||||
@ApiModelProperty(value = "来源用户id")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String fromUserId;
|
||||
/**发送给用户id(允许为空)*/
|
||||
@Excel(name = "发送给用户id(允许为空)", width = 15)
|
||||
@ApiModelProperty(value = "发送给用户id(允许为空)")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String toUserId;
|
||||
/**评论id(允许为空,不为空时,则为回复)*/
|
||||
@Excel(name = "评论id(允许为空,不为空时,则为回复)", width = 15)
|
||||
@ApiModelProperty(value = "评论id(允许为空,不为空时,则为回复)")
|
||||
@Dict(dictTable = "sys_comment", dicCode = "id", dicText = "comment_content")
|
||||
private String commentId;
|
||||
/**回复内容*/
|
||||
@Excel(name = "回复内容", width = 15)
|
||||
@ApiModelProperty(value = "回复内容")
|
||||
private String commentContent;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.system.entity.SysComment;
|
||||
import org.jeecg.modules.system.vo.SysCommentFileVo;
|
||||
import org.jeecg.modules.system.vo.SysCommentVO;
|
||||
import org.jeecg.modules.system.vo.UserAvatar;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysCommentMapper extends BaseMapper<SysComment> {
|
||||
|
||||
List<SysCommentVO> queryCommentList(@Param("tableName") String tableName, @Param("formDataId") String formDataId);
|
||||
|
||||
/**
|
||||
* 根据表名和数据id查询表单文件
|
||||
*
|
||||
* @param tableName
|
||||
* @param formDataId
|
||||
* @return
|
||||
*/
|
||||
List<SysCommentFileVo> queryFormFileList(@Param("tableName") String tableName, @Param("formDataId") String formDataId);
|
||||
|
||||
/**
|
||||
* 根据用户名获取用户信息
|
||||
* @param idSet
|
||||
* @return
|
||||
*/
|
||||
List<UserAvatar> queryUserAvatarList(@Param("idSet") Set<String> idSet);
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysFilesMapper extends BaseMapper<SysFiles> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysFormFileMapper extends BaseMapper<SysFormFile> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
<?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.system.mapper.SysCommentMapper">
|
||||
|
||||
<resultMap id="commentResult" type="org.jeecg.modules.system.vo.SysCommentVO">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
|
||||
<result property="tableDataId" column="table_data_id" jdbcType="VARCHAR"/>
|
||||
<result property="fromUserId" column="from_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="commentContent" column="comment_content" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="toUserId" column="to_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="commentId" column="comment_id" jdbcType="VARCHAR"/>
|
||||
<!-- 8+6 -->
|
||||
<collection property="fileList" ofType="org.jeecg.modules.system.vo.SysCommentFileVo" javaType="java.util.List">
|
||||
<result property="sysFormFileId" column="sys_form_file_id" jdbcType="VARCHAR"/>
|
||||
<result property="fileId" column="file_id" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="file_name" jdbcType="VARCHAR"/>
|
||||
<result property="fileSize" column="file_size" jdbcType="VARCHAR"/>
|
||||
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="file_type" jdbcType="VARCHAR"/>
|
||||
<result property="storeType" column="store_type" jdbcType="VARCHAR"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据表名和数据id查询表单评论信息及文件 -->
|
||||
<select id="queryCommentList" resultMap="commentResult">
|
||||
select
|
||||
a.id,
|
||||
a.table_name,
|
||||
a.table_data_id,
|
||||
a.from_user_id,
|
||||
a.comment_content,
|
||||
a.create_time,
|
||||
a.to_user_id,
|
||||
a.comment_id,
|
||||
b.id as sys_form_file_id,
|
||||
c.id as file_id,
|
||||
c.file_name,
|
||||
c.file_size,
|
||||
c.url,
|
||||
c.file_type,
|
||||
c.store_type
|
||||
from sys_comment a
|
||||
left join sys_form_file b on b.table_name = 'sys_comment' and b.table_data_id = a.id
|
||||
left join sys_files c on b.file_id = c.id and c.del_flag = '0'
|
||||
where a.table_name = #{tableName, jdbcType=VARCHAR}
|
||||
and a.table_data_id = #{formDataId, jdbcType=VARCHAR}
|
||||
order by a.create_time asc
|
||||
</select>
|
||||
|
||||
<!-- 根据表名和数据id查询表单文件 -->
|
||||
<select id="queryFormFileList" resultType="org.jeecg.modules.system.vo.SysCommentFileVo">
|
||||
select
|
||||
b.id as sys_form_file_id,
|
||||
c.id as file_id,
|
||||
c.file_name as name,
|
||||
c.file_size,
|
||||
c.url,
|
||||
c.file_type as type,
|
||||
c.store_type
|
||||
from sys_comment a
|
||||
join sys_form_file b on b.table_name = 'sys_comment' and b.table_data_id = a.id
|
||||
join sys_files c on b.file_id = c.id
|
||||
where c.del_flag = '0'
|
||||
and a.table_name = #{tableName, jdbcType=VARCHAR}
|
||||
and a.table_data_id = #{formDataId, jdbcType=VARCHAR}
|
||||
order by a.create_time asc
|
||||
</select>
|
||||
|
||||
<!-- 根据用户名获取用户信息 -->
|
||||
<select id="queryUserAvatarList" resultType="org.jeecg.modules.system.vo.UserAvatar">
|
||||
select id, avatar, realname from sys_user
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="idSet" open="(" separator="or" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,60 @@
|
||||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysComment;
|
||||
import org.jeecg.modules.system.vo.SysCommentFileVo;
|
||||
import org.jeecg.modules.system.vo.SysCommentVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysCommentService extends IService<SysComment> {
|
||||
|
||||
|
||||
/**
|
||||
* 保存评论 返回评论ID
|
||||
*
|
||||
* @param sysComment
|
||||
*/
|
||||
String saveOne(SysComment sysComment);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteOne(String id);
|
||||
|
||||
/**
|
||||
* 根据表名和数据id查询表单评论及文件信息
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
List<SysCommentVO> queryFormCommentInfo(SysComment sysComment);
|
||||
|
||||
|
||||
/**
|
||||
* 保存文件+评论
|
||||
*
|
||||
* @param req
|
||||
*/
|
||||
void saveOneFileComment(HttpServletRequest req);
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前表单的文件列表
|
||||
*
|
||||
* @param tableName
|
||||
* @param formDataId
|
||||
* @return
|
||||
*/
|
||||
List<SysCommentFileVo> queryFormFileList(String tableName, String formDataId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysFilesService extends IService<SysFiles> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysFormFileService extends IService<SysFormFile> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
import org.jeecg.modules.system.mapper.SysFilesMapper;
|
||||
import org.jeecg.modules.system.service.ISysFilesService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysFilesServiceImpl extends ServiceImpl<SysFilesMapper, SysFiles> implements ISysFilesService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
import org.jeecg.modules.system.mapper.SysFormFileMapper;
|
||||
import org.jeecg.modules.system.service.ISysFormFileService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysFormFileServiceImpl extends ServiceImpl<SysFormFileMapper, SysFormFile> implements ISysFormFileService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package org.jeecg.modules.system.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户名和头像信息
|
||||
* @Author taoYan
|
||||
* @Date 2022/8/8 17:06
|
||||
**/
|
||||
@Data
|
||||
public class UserAvatar {
|
||||
|
||||
private String id;
|
||||
|
||||
private String realname;
|
||||
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue