1、发布工具流程-关联工具细节调整
2、文档资源管理调整
This commit is contained in:
parent
f1b84cb823
commit
f0a14bcd3c
@ -1,18 +1,12 @@
|
||||
package com.rzdata.web.controller.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.rzdata.common.config.JaConfig;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.core.domain.AjaxResult;
|
||||
import com.rzdata.common.utils.StringUtils;
|
||||
import com.rzdata.common.utils.file.FileUploadUtils;
|
||||
import com.rzdata.common.utils.file.FileUtils;
|
||||
import com.rzdata.framework.config.ServerConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -21,13 +15,14 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.rzdata.common.config.JaConfig;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.core.domain.AjaxResult;
|
||||
import com.rzdata.common.utils.StringUtils;
|
||||
import com.rzdata.common.utils.file.FileUploadUtils;
|
||||
import com.rzdata.common.utils.file.FileUtils;
|
||||
import com.rzdata.framework.config.ServerConfig;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
@ -92,7 +87,8 @@ public class CommonController
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("filePath", fileName);
|
||||
ajax.put("suffixType", FileUploadUtils.extractSuffix(fileName));
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
@ -220,8 +216,10 @@ public class CommonController
|
||||
Map<String, String> response = new HashMap<>();
|
||||
String url = serverConfig.getUrl() + fileNamePath;
|
||||
response.put("url", url);
|
||||
response.put("fileUrl", finalFilePath);
|
||||
response.put("fileNamePath", fileNamePath);
|
||||
response.put("filePath", fileNamePath);
|
||||
response.put("suffixType", FileUploadUtils.extractSuffix(fileNamePath));
|
||||
response.put("newFileName", FileUtils.getName(fileNamePath));
|
||||
response.put("originalFilename", fileName);
|
||||
return ResponseEntity.ok(response);
|
||||
} catch (IOException e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
|
||||
|
@ -10,7 +10,6 @@ import com.rzdata.common.utils.poi.ExcelUtil;
|
||||
import com.rzdata.web.domain.Document;
|
||||
import com.rzdata.web.service.IDocumentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -88,10 +87,20 @@ public class DocumentController extends BaseController
|
||||
/**
|
||||
* 删除【文档资源信息】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@Log(title = "【逻辑删除-文档资源信息】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(documentService.deleteDocumentByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布文档
|
||||
*/
|
||||
@Log(title = "【发布逻辑】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/pushDoc/{ids}")
|
||||
public AjaxResult pushDoc(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(documentService.pushDoc(ids));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,105 @@
|
||||
package com.rzdata.web.controller.tool;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.rzdata.web.domain.Attachment;
|
||||
import com.rzdata.web.service.IAttachmentService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.rzdata.common.annotation.Log;
|
||||
import com.rzdata.common.core.controller.BaseController;
|
||||
import com.rzdata.common.core.domain.AjaxResult;
|
||||
import com.rzdata.common.enums.BusinessType;
|
||||
import com.rzdata.common.utils.poi.ExcelUtil;
|
||||
import com.rzdata.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 附件Controller
|
||||
*
|
||||
* @author panchichun
|
||||
* @date 2024-08-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/attachment")
|
||||
public class AttachmentController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAttachmentService attachmentService;
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Attachment attachment)
|
||||
{
|
||||
startPage();
|
||||
List<Attachment> list = attachmentService.selectAttachmentList(attachment);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出附件列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:export')")
|
||||
@Log(title = "附件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Attachment attachment)
|
||||
{
|
||||
List<Attachment> list = attachmentService.selectAttachmentList(attachment);
|
||||
ExcelUtil<Attachment> util = new ExcelUtil<Attachment>(Attachment.class);
|
||||
util.exportExcel(response, list, "附件数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取附件详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(attachmentService.selectAttachmentById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:add')")
|
||||
@Log(title = "附件", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Attachment attachment)
|
||||
{
|
||||
return toAjax(attachmentService.insertAttachment(attachment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:edit')")
|
||||
@Log(title = "附件", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Attachment attachment)
|
||||
{
|
||||
return toAjax(attachmentService.updateAttachment(attachment));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:attachment:remove')")
|
||||
@Log(title = "附件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(attachmentService.deleteAttachmentByIds(ids));
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.rzdata.web.controller.tool;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.blueland.bpmclient.model.ProcessInstanceModel;
|
||||
@ -14,7 +15,9 @@ import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.common.utils.StringUtils;
|
||||
import com.rzdata.common.utils.poi.ExcelUtil;
|
||||
import com.rzdata.system.service.ISysDeptService;
|
||||
import com.rzdata.web.domain.Document;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.service.IDocumentService;
|
||||
import com.rzdata.web.service.IToolService;
|
||||
import com.rzdata.web.service.IUseApplyService;
|
||||
import com.rzdata.web.service.WorkflowService;
|
||||
@ -25,6 +28,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工具信息Controller
|
||||
@ -48,6 +52,10 @@ public class ToolController extends BaseController
|
||||
@Autowired
|
||||
private ISysDeptService iSysDeptService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IDocumentService iDocumentService;
|
||||
|
||||
/**
|
||||
* 查询工具信息列表
|
||||
*/
|
||||
@ -136,14 +144,26 @@ public class ToolController extends BaseController
|
||||
if (add) {
|
||||
tTool.setProcInstId(processInstanceModel.getProcInstId());
|
||||
toolService.insertTool(tTool);
|
||||
//保存文档和附件
|
||||
toolService.addDocAndAtt(tTool);
|
||||
}else if (BooleanUtil.isTrue(tTool.getEditStatus())){
|
||||
toolService.updateTool(tTool);
|
||||
//删除文档和附件
|
||||
toolService.deleteDocAndAtt(tTool);
|
||||
//保存文档和附件
|
||||
toolService.addDocAndAtt(tTool);
|
||||
}else {
|
||||
Tool tool = new Tool();
|
||||
tool.setToolId(tTool.getToolId());
|
||||
tool.setRecordStatus(tTool.getRecordStatus());
|
||||
toolService.updateTool(tool);
|
||||
}
|
||||
|
||||
//办结
|
||||
if(RecordStatusEnum.DONE.getCode().equals(tTool.getRecordStatus())){
|
||||
//更新文档状态
|
||||
toolService.updateDocPushStatus(tTool);
|
||||
}
|
||||
return AjaxResult.success("操作成功",processInstanceModel);
|
||||
}else {
|
||||
return AjaxResult.error();
|
||||
|
@ -0,0 +1,83 @@
|
||||
package com.rzdata.web.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.rzdata.common.annotation.Excel;
|
||||
import com.rzdata.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件对象 t_attachment
|
||||
*
|
||||
* @author panchichun
|
||||
* @date 2024-08-28
|
||||
*/
|
||||
@Data
|
||||
public class Attachment extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private String id;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String fileType;
|
||||
|
||||
/** 业务类型 */
|
||||
@Excel(name = "业务类型")
|
||||
private String bizType;
|
||||
|
||||
/** 文件URL */
|
||||
@Excel(name = "文件URL")
|
||||
private String fileUrl;
|
||||
|
||||
/** 文件源名称 */
|
||||
@Excel(name = "文件源名称")
|
||||
private String fileOldName;
|
||||
|
||||
/** 文件新名称 */
|
||||
@Excel(name = "文件新名称")
|
||||
private String fileNewName;
|
||||
|
||||
/** 文件后缀 */
|
||||
@Excel(name = "文件后缀")
|
||||
private String suffixType;
|
||||
|
||||
/** 文件大小 */
|
||||
@Excel(name = "文件大小")
|
||||
private Long fileSize;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String businessId;
|
||||
|
||||
/** 序号 */
|
||||
@Excel(name = "序号")
|
||||
private Long sorts;
|
||||
|
||||
/** 删除;1是, 0:否 */
|
||||
@Excel(name = "删除;1是, 0:否")
|
||||
private String del;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createDate;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date updateDate;
|
||||
|
||||
/** 失效时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "失效时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date failureTime;
|
||||
|
||||
private List<String> businessIds;
|
||||
}
|
@ -6,6 +6,8 @@ import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 t_document
|
||||
*
|
||||
@ -58,4 +60,29 @@ public class Document extends BaseEntity {
|
||||
/** 文档分类id */
|
||||
@Excel(name = "文档分类id")
|
||||
private String docCategoryId;
|
||||
|
||||
/** 创建人id */
|
||||
private String createById;
|
||||
/** 更新人id */
|
||||
private String updateById;
|
||||
/** 逻辑删除(1:删除,0:未删除) */
|
||||
private String isDeleted;
|
||||
|
||||
/** 主键 **/
|
||||
private List<String> ids;
|
||||
|
||||
/** 附件名称 **/
|
||||
private Attachment attachment;
|
||||
|
||||
/** 关联工具id对象 */
|
||||
private String toolId;
|
||||
/**
|
||||
* 工具名称
|
||||
*/
|
||||
private String toolName;
|
||||
/** 工具信息 **/
|
||||
private Tool tool;
|
||||
|
||||
/** 文档部门名称 **/
|
||||
private String docRespDeptName;
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ public class Tool extends BaseEntity
|
||||
|
||||
private BpmClientInputModelBo bpmClientInputModel;
|
||||
|
||||
/** done:办结,doing:进行中**/
|
||||
private String recordStatus;
|
||||
|
||||
private Boolean editStatus;
|
||||
@ -101,4 +102,6 @@ public class Tool extends BaseEntity
|
||||
private Boolean downloadStatus;
|
||||
|
||||
private List<String> excludeFields;
|
||||
|
||||
private List<Document> documentList;
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
package com.rzdata.web.mapper;
|
||||
|
||||
import com.rzdata.web.domain.Attachment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件Mapper接口
|
||||
*
|
||||
* @author panchichun
|
||||
* @date 2024-08-28
|
||||
*/
|
||||
public interface AttachmentMapper
|
||||
{
|
||||
/**
|
||||
* 查询附件
|
||||
*
|
||||
* @param id 附件主键
|
||||
* @return 附件
|
||||
*/
|
||||
public Attachment selectAttachmentById(String id);
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 附件集合
|
||||
*/
|
||||
public List<Attachment> selectAttachmentList(Attachment attachment);
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAttachment(Attachment attachment);
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAttachment(Attachment attachment);
|
||||
|
||||
/**
|
||||
* 根据业务id更新附件
|
||||
* @param attachment
|
||||
* @return
|
||||
*/
|
||||
public int updateAttachmentByBusinessId(Attachment attachment);
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
*
|
||||
* @param id 附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAttachmentById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAttachmentByIds(String[] ids);
|
||||
|
||||
public int deleteAttachmentByBusinessId(List<String> list);
|
||||
}
|
@ -53,10 +53,14 @@ public interface DocumentMapper
|
||||
public int deleteDocumentById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @param Document 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDocumentByIds(String[] ids);
|
||||
public int isDeleteDocumentByIds(Document Document);
|
||||
|
||||
public int updatePushDoc(Document doc);
|
||||
|
||||
public int batchDeleteById(List<String> list);
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package com.rzdata.web.service;
|
||||
|
||||
import com.rzdata.web.domain.Attachment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 附件Service接口
|
||||
*
|
||||
* @author panchichun
|
||||
* @date 2024-08-28
|
||||
*/
|
||||
public interface IAttachmentService
|
||||
{
|
||||
/**
|
||||
* 查询附件
|
||||
*
|
||||
* @param id 附件主键
|
||||
* @return 附件
|
||||
*/
|
||||
public Attachment selectAttachmentById(String id);
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 附件集合
|
||||
*/
|
||||
public List<Attachment> selectAttachmentList(Attachment attachment);
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAttachment(Attachment attachment);
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAttachment(Attachment attachment);
|
||||
public int updateAttachmentByBusinessId(Attachment attachment);
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param ids 需要删除的附件主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAttachmentByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 根据业务id批量删除
|
||||
* @param businessIds
|
||||
* @return
|
||||
*/
|
||||
public int deleteAttachmentByBusinessId(List<String> businessIds);
|
||||
|
||||
/**
|
||||
* 删除附件信息
|
||||
*
|
||||
* @param id 附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAttachmentById(String id);
|
||||
}
|
@ -28,6 +28,9 @@ public interface IDocumentService
|
||||
*/
|
||||
public List<Document> selectDocumentList(Document document);
|
||||
|
||||
|
||||
public List<Document> selectDocumentListAll(Document document);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
@ -62,4 +65,13 @@ public interface IDocumentService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDocumentById(String id);
|
||||
|
||||
/**
|
||||
* 发布文档
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int pushDoc(String[] ids);
|
||||
|
||||
public int batchDeleteById(List<String> docIds);
|
||||
}
|
||||
|
@ -63,4 +63,18 @@ public interface IToolService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteToolByToolId(String toolId);
|
||||
|
||||
/**
|
||||
* 删除文档和附件
|
||||
* @param tool
|
||||
*/
|
||||
public void deleteDocAndAtt(Tool tool);
|
||||
|
||||
/**
|
||||
* 新增文档和附件
|
||||
* @param tool
|
||||
*/
|
||||
public void addDocAndAtt(Tool tool);
|
||||
|
||||
void updateDocPushStatus(Tool tTool);
|
||||
}
|
||||
|
@ -0,0 +1,117 @@
|
||||
package com.rzdata.web.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rzdata.web.domain.Attachment;
|
||||
import com.rzdata.web.mapper.AttachmentMapper;
|
||||
import com.rzdata.web.service.IAttachmentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 附件Service业务层处理
|
||||
*
|
||||
* @author panchichun
|
||||
* @date 2024-08-28
|
||||
*/
|
||||
@Service
|
||||
public class AttachmentServiceImpl implements IAttachmentService
|
||||
{
|
||||
@Autowired
|
||||
private AttachmentMapper attachmentMapper;
|
||||
|
||||
/**
|
||||
* 查询附件
|
||||
*
|
||||
* @param id 附件主键
|
||||
* @return 附件
|
||||
*/
|
||||
@Override
|
||||
public Attachment selectAttachmentById(String id)
|
||||
{
|
||||
return attachmentMapper.selectAttachmentById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询附件列表
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 附件
|
||||
*/
|
||||
@Override
|
||||
public List<Attachment> selectAttachmentList(Attachment attachment)
|
||||
{
|
||||
return attachmentMapper.selectAttachmentList(attachment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增附件
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAttachment(Attachment attachment)
|
||||
{
|
||||
return attachmentMapper.insertAttachment(attachment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAttachment(Attachment attachment)
|
||||
{
|
||||
return attachmentMapper.updateAttachment(attachment);
|
||||
}
|
||||
/**
|
||||
* 修改附件
|
||||
*
|
||||
* @param attachment 附件
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAttachmentByBusinessId(Attachment attachment)
|
||||
{
|
||||
return attachmentMapper.updateAttachmentByBusinessId(attachment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param ids 需要删除的附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAttachmentByIds(String[] ids)
|
||||
{
|
||||
return attachmentMapper.deleteAttachmentByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除附件
|
||||
*
|
||||
* @param ids 需要删除的附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAttachmentByBusinessId(List<String> businessIds)
|
||||
{
|
||||
return attachmentMapper.deleteAttachmentByBusinessId(businessIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件信息
|
||||
*
|
||||
* @param id 附件主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAttachmentById(String id)
|
||||
{
|
||||
return attachmentMapper.deleteAttachmentById(id);
|
||||
}
|
||||
}
|
@ -1,14 +1,25 @@
|
||||
package com.rzdata.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.web.domain.Attachment;
|
||||
import com.rzdata.web.domain.Document;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.mapper.DocumentMapper;
|
||||
import com.rzdata.web.service.IDocumentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
@ -21,6 +32,10 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
{
|
||||
@Autowired
|
||||
private DocumentMapper documentMapper;
|
||||
@Autowired
|
||||
private AttachmentServiceImpl attachmentService;
|
||||
@Autowired
|
||||
private ToolServiceImpl toolService;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
@ -31,19 +46,65 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
@Override
|
||||
public Document selectDocumentById(String docId)
|
||||
{
|
||||
return documentMapper.selectDocumentById(docId);
|
||||
Document document = documentMapper.selectDocumentById(docId);
|
||||
if(StrUtil.isNotBlank(document.getToolId())){
|
||||
Tool tool = toolService.selectToolByToolId(document.getToolId());
|
||||
document.setToolName(tool.getToolName());
|
||||
}
|
||||
Attachment attachment = new Attachment();
|
||||
attachment.setBusinessId(document.getDocId());
|
||||
attachment.setDel(Constants.STR_ZERO);
|
||||
List<Attachment> attachments = attachmentService.selectAttachmentList(attachment);
|
||||
if(CollUtil.isNotEmpty(attachments)){
|
||||
document.setAttachment(attachments.get(0));
|
||||
}
|
||||
return document;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param Document 【请填写功能名称】
|
||||
* @param document 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<Document> selectDocumentList(Document Document)
|
||||
public List<Document> selectDocumentList(Document document)
|
||||
{
|
||||
return documentMapper.selectDocumentList(Document);
|
||||
List<Document> documents = documentMapper.selectDocumentList(document);
|
||||
if(CollUtil.isEmpty(documents)){
|
||||
return documents;
|
||||
}
|
||||
List<String> docIds = documents.stream().map(Document::getDocId).collect(Collectors.toList());
|
||||
Attachment attachment = new Attachment();
|
||||
attachment.setBusinessIds(docIds);
|
||||
attachment.setDel(Constants.STR_ZERO);
|
||||
List<Attachment> attachments = attachmentService.selectAttachmentList(attachment);
|
||||
if(CollUtil.isEmpty(attachments)){
|
||||
return documents;
|
||||
}
|
||||
for (Document doc : documents) {
|
||||
for (Attachment att : attachments) {
|
||||
if(doc.getDocId().equals(att.getBusinessId())){
|
||||
doc.setAttachment(att);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return documents;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param document 【请填写功能名称】
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public List<Document> selectDocumentListAll(Document document)
|
||||
{
|
||||
List<Document> documents = documentMapper.selectDocumentList(document);
|
||||
return documents;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,11 +121,26 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
return documentMapper.insertDocument(document);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String saveDocument(Document document){
|
||||
document.setCreateTime(DateUtils.getNowDate());
|
||||
String docId = IdUtil.simpleUUID();
|
||||
document.setDocId(docId);
|
||||
document.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
document.setCreateById(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
|
||||
document.setIsDeleted(Constants.STR_ZERO);
|
||||
document.setCreateTime(new Date());
|
||||
int result = documentMapper.insertDocument(document);
|
||||
if(ObjectUtil.isNotEmpty(document.getAttachment())){
|
||||
Attachment attachment = document.getAttachment();
|
||||
attachment.setId(IdUtil.simpleUUID());
|
||||
attachment.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
attachment.setBusinessId(docId);
|
||||
attachment.setBizType(Constants.DOC_TYPE_DOC);
|
||||
attachment.setDel(Constants.STR_ZERO);
|
||||
attachment.setCreateDate(new Date());
|
||||
attachmentService.insertAttachment(attachment);
|
||||
}
|
||||
if(result > 0){
|
||||
return docId;
|
||||
}
|
||||
@ -74,14 +150,36 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param Document 【请填写功能名称】
|
||||
* @param document 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDocument(Document Document)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateDocument(Document document)
|
||||
{
|
||||
Document.setUpdateTime(DateUtils.getNowDate());
|
||||
return documentMapper.updateDocument(Document);
|
||||
document.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
document.setUpdateById(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
|
||||
document.setUpdateTime(new Date());
|
||||
int result = documentMapper.updateDocument(document);
|
||||
|
||||
Attachment attParam = document.getAttachment();
|
||||
if(ObjectUtil.isNotEmpty(attParam) && StrUtil.isBlank(attParam.getId())){
|
||||
Attachment att = new Attachment();
|
||||
att.setBusinessId(document.getDocId());
|
||||
att.setDel(Constants.STR_ONE);
|
||||
attachmentService.updateAttachmentByBusinessId(att);
|
||||
|
||||
Attachment attachment = document.getAttachment();
|
||||
attachment.setId(IdUtil.simpleUUID());
|
||||
attachment.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
attachment.setBusinessId(document.getDocId());
|
||||
attachment.setBizType(Constants.DOC_TYPE_DOC);
|
||||
attachment.setDel(Constants.STR_ZERO);
|
||||
attachment.setCreateDate(new Date());
|
||||
attachmentService.insertAttachment(attachment);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,7 +191,12 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
@Override
|
||||
public int deleteDocumentByIds(String[] ids)
|
||||
{
|
||||
return documentMapper.deleteDocumentByIds(ids);
|
||||
Document doc = new Document();
|
||||
doc.setIds(Arrays.asList(ids));
|
||||
doc.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
doc.setUpdateById(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
|
||||
doc.setUpdateTime(new Date());
|
||||
return documentMapper.isDeleteDocumentByIds(doc);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,5 +210,31 @@ public class DocumentServiceImpl implements IDocumentService
|
||||
{
|
||||
return documentMapper.deleteDocumentById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布文档
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int pushDoc(String[] ids) {
|
||||
Document doc = new Document();
|
||||
doc.setIds(Arrays.asList(ids));
|
||||
doc.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
doc.setUpdateById(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
|
||||
doc.setDocStatus(Constants.DOC_STATUS_YFB);
|
||||
doc.setUpdateTime(new Date());
|
||||
return documentMapper.updatePushDoc(doc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
* @param docIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int batchDeleteById(List<String> docIds){
|
||||
return documentMapper.batchDeleteById(docIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,23 @@
|
||||
package com.rzdata.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.BooleanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.rzdata.common.constant.Constants;
|
||||
import com.rzdata.common.utils.DateUtils;
|
||||
import com.rzdata.common.utils.SecurityUtils;
|
||||
import com.rzdata.web.domain.Document;
|
||||
import com.rzdata.web.domain.Tool;
|
||||
import com.rzdata.web.mapper.ToolMapper;
|
||||
import com.rzdata.web.service.IAttachmentService;
|
||||
import com.rzdata.web.service.IDocumentService;
|
||||
import com.rzdata.web.service.IToolService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工具信息Service业务层处理
|
||||
@ -25,6 +31,12 @@ public class ToolServiceImpl implements IToolService
|
||||
@Autowired
|
||||
private ToolMapper toolMapper;
|
||||
|
||||
@Autowired
|
||||
private IAttachmentService iAttachmentService;
|
||||
|
||||
@Autowired
|
||||
private IDocumentService documentService;
|
||||
|
||||
/**
|
||||
* 查询工具信息
|
||||
*
|
||||
@ -84,11 +96,43 @@ public class ToolServiceImpl implements IToolService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateTool(Tool tool)
|
||||
{
|
||||
tool.setUpdateBy(SecurityUtils.getUserId().toString());
|
||||
tool.setUpdateTime(DateUtils.getNowDate());
|
||||
return toolMapper.updateTool(tool);
|
||||
int result = toolMapper.updateTool(tool);
|
||||
deleteDocAndAtt(tool);
|
||||
addDocAndAtt(tool);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDocAndAtt(Tool tool) {
|
||||
List<Document> documentList = tool.getDocumentList();
|
||||
if(CollUtil.isEmpty(documentList)){
|
||||
return;
|
||||
}
|
||||
//先删除,后新增
|
||||
List<String> docIds = documentList.stream().map(Document::getDocId).collect(Collectors.toList());
|
||||
iAttachmentService.deleteAttachmentByBusinessId(docIds);
|
||||
documentService.batchDeleteById(docIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addDocAndAtt(Tool tool) {
|
||||
List<Document> documentList = tool.getDocumentList();
|
||||
if(CollUtil.isEmpty(documentList)){
|
||||
return;
|
||||
}
|
||||
//新增
|
||||
for (Document document : documentList) {
|
||||
document.setToolId(tool.getToolId());
|
||||
document.setDocStatus(Constants.DOC_STATUS_SHZ);
|
||||
documentService.saveDocument(document);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,4 +158,17 @@ public class ToolServiceImpl implements IToolService
|
||||
{
|
||||
return toolMapper.deleteToolByToolId(toolId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDocPushStatus(Tool tTool) {
|
||||
Document document = new Document();
|
||||
document.setToolId(tTool.getToolId());
|
||||
List<Document> documents = documentService.selectDocumentListAll(document);
|
||||
if(CollUtil.isEmpty(documents)){
|
||||
return;
|
||||
}
|
||||
List<String> ids = documents.stream().map(Document::getDocId).collect(Collectors.toList());
|
||||
String[] idsArray = ids.stream().toArray(String[]::new);
|
||||
documentService.pushDoc(idsArray);
|
||||
}
|
||||
}
|
||||
|
161
tool-tech-admin/src/main/resources/mapper/AttachmentMapper.xml
Normal file
161
tool-tech-admin/src/main/resources/mapper/AttachmentMapper.xml
Normal file
@ -0,0 +1,161 @@
|
||||
<?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="com.rzdata.web.mapper.AttachmentMapper">
|
||||
|
||||
<resultMap type="Attachment" id="AttachmentResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="bizType" column="biz_type" />
|
||||
<result property="fileUrl" column="file_url" />
|
||||
<result property="fileOldName" column="file_old_name" />
|
||||
<result property="fileNewName" column="file_new_name" />
|
||||
<result property="suffixType" column="suffix_type" />
|
||||
<result property="fileSize" column="file_size" />
|
||||
<result property="businessId" column="business_id" />
|
||||
<result property="sorts" column="sorts" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="del" column="del" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
<result property="failureTime" column="failure_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAttachmentVo">
|
||||
select id, biz_type, file_url, file_old_name, file_new_name, suffix_type, file_size, business_id, sorts, remark, del, create_by, create_date, update_by, update_date, failure_time from t_attachment
|
||||
</sql>
|
||||
|
||||
<select id="selectAttachmentList" parameterType="Attachment" resultMap="AttachmentResult">
|
||||
<include refid="selectAttachmentVo"/>
|
||||
<where>
|
||||
<if test="bizType != null and bizType != ''"> and biz_type = #{bizType}</if>
|
||||
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
|
||||
<if test="fileOldName != null and fileOldName != ''"> and file_old_name like concat('%', #{fileOldName}, '%')</if>
|
||||
<if test="fileNewName != null and fileNewName != ''"> and file_new_name like concat('%', #{fileNewName}, '%')</if>
|
||||
<if test="suffixType != null and suffixType != ''"> and suffix_type = #{suffixType}</if>
|
||||
<if test="fileSize != null "> and file_size = #{fileSize}</if>
|
||||
<if test="businessId != null and businessId != ''"> and business_id = #{businessId}</if>
|
||||
<if test="sorts != null "> and sorts = #{sorts}</if>
|
||||
<if test="del != null "> and del = #{del}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="failureTime != null "> and failure_time = #{failureTime}</if>
|
||||
<if test="businessIds != null and businessIds.size() > 0">
|
||||
and business_id in
|
||||
<foreach item="id" index="index" collection="businessIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAttachmentById" parameterType="String" resultMap="AttachmentResult">
|
||||
<include refid="selectAttachmentVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAttachment" parameterType="Attachment">
|
||||
insert into t_attachment
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="bizType != null">biz_type,</if>
|
||||
<if test="fileUrl != null">file_url,</if>
|
||||
<if test="fileOldName != null">file_old_name,</if>
|
||||
<if test="fileNewName != null">file_new_name,</if>
|
||||
<if test="suffixType != null">suffix_type,</if>
|
||||
<if test="fileSize != null">file_size,</if>
|
||||
<if test="businessId != null">business_id,</if>
|
||||
<if test="sorts != null">sorts,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="del != null">del,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createDate != null">create_date,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateDate != null">update_date,</if>
|
||||
<if test="failureTime != null">failure_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="bizType != null">#{bizType},</if>
|
||||
<if test="fileUrl != null">#{fileUrl},</if>
|
||||
<if test="fileOldName != null">#{fileOldName},</if>
|
||||
<if test="fileNewName != null">#{fileNewName},</if>
|
||||
<if test="suffixType != null">#{suffixType},</if>
|
||||
<if test="fileSize != null">#{fileSize},</if>
|
||||
<if test="businessId != null">#{businessId},</if>
|
||||
<if test="sorts != null">#{sorts},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="del != null">#{del},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateDate != null">#{updateDate},</if>
|
||||
<if test="failureTime != null">#{failureTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAttachment" parameterType="Attachment">
|
||||
update t_attachment
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="bizType != null">biz_type = #{bizType},</if>
|
||||
<if test="fileUrl != null">file_url = #{fileUrl},</if>
|
||||
<if test="fileOldName != null">file_old_name = #{fileOldName},</if>
|
||||
<if test="fileNewName != null">file_new_name = #{fileNewName},</if>
|
||||
<if test="suffixType != null">suffix_type = #{suffixType},</if>
|
||||
<if test="fileSize != null">file_size = #{fileSize},</if>
|
||||
<if test="businessId != null">business_id = #{businessId},</if>
|
||||
<if test="sorts != null">sorts = #{sorts},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="del != null">del = #{del},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createDate != null">create_date = #{createDate},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateDate != null">update_date = #{updateDate},</if>
|
||||
<if test="failureTime != null">failure_time = #{failureTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateAttachmentByBusinessId" parameterType="Attachment">
|
||||
update t_attachment
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="bizType != null">biz_type = #{bizType},</if>
|
||||
<if test="fileUrl != null">file_url = #{fileUrl},</if>
|
||||
<if test="fileOldName != null">file_old_name = #{fileOldName},</if>
|
||||
<if test="fileNewName != null">file_new_name = #{fileNewName},</if>
|
||||
<if test="suffixType != null">suffix_type = #{suffixType},</if>
|
||||
<if test="fileSize != null">file_size = #{fileSize},</if>
|
||||
<if test="sorts != null">sorts = #{sorts},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="del != null">del = #{del},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createDate != null">create_date = #{createDate},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateDate != null">update_date = #{updateDate},</if>
|
||||
<if test="failureTime != null">failure_time = #{failureTime},</if>
|
||||
</trim>
|
||||
where business_id = #{businessId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAttachmentById" parameterType="String">
|
||||
delete from t_attachment where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAttachmentByIds" parameterType="String">
|
||||
delete from t_attachment where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAttachmentByBusinessId" parameterType="java.util.List">
|
||||
delete from t_attachment where business_id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -20,26 +20,36 @@
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="docCategoryId" column="doc_category_id" />
|
||||
<result property="isDeleted" column="is_deleted" />
|
||||
<result property="toolId" column="tool_id" />
|
||||
<result property="toolName" column="tool_name" />
|
||||
<result property="docRespDeptName" column="doc_resp_dept_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDocumentVo">
|
||||
select doc_id, doc_code, doc_name, doc_type, doc_principals, doc_resp_dept,
|
||||
doc_source, doc_status, doc_url, create_by, create_time,
|
||||
update_by, update_time, remark, doc_category_id from t_document
|
||||
update_by, update_time, remark, doc_category_id,is_deleted,tool_id from t_document
|
||||
</sql>
|
||||
|
||||
<select id="selectDocumentList" parameterType="Document" resultMap="DocumentResult">
|
||||
<include refid="selectDocumentVo"/>
|
||||
select td.*, t_tool.tool_name as tool_name,sys_dept.dept_name as doc_resp_dept_name
|
||||
from t_document td
|
||||
left join t_tool on t_tool.tool_id = td.tool_id
|
||||
left join sys_dept on sys_dept.dept_id = td.doc_resp_dept
|
||||
<where>
|
||||
<if test="docCode != null and docCode != ''"> and doc_code = #{docCode}</if>
|
||||
<if test="docName != null and docName != ''"> and doc_name like concat('%', #{docName}, '%')</if>
|
||||
<if test="docType != null and docType != ''"> and doc_type = #{docType}</if>
|
||||
<if test="docPrincipals != null and docPrincipals != ''"> and doc_principals = #{docPrincipals}</if>
|
||||
<if test="docRespDept != null and docRespDept != ''"> and doc_resp_dept = #{docRespDept}</if>
|
||||
<if test="docSource != null and docSource != ''"> and doc_source = #{docSource}</if>
|
||||
<if test="docStatus != null and docStatus != ''"> and doc_status = #{docStatus}</if>
|
||||
<if test="docCategoryId != null and docCategoryId != ''"> and doc_category_id = #{docCategoryId}</if>
|
||||
<if test="docCode != null and docCode != ''"> and td.doc_code = #{docCode}</if>
|
||||
<if test="docName != null and docName != ''"> and td.doc_name like concat('%', #{docName}, '%')</if>
|
||||
<if test="docType != null and docType != ''"> and td.doc_type = #{docType}</if>
|
||||
<if test="docPrincipals != null and docPrincipals != ''"> and td.doc_principals = #{docPrincipals}</if>
|
||||
<if test="docRespDept != null and docRespDept != ''"> and td.doc_resp_dept = #{docRespDept}</if>
|
||||
<if test="docSource != null and docSource != ''"> and td.doc_source = #{docSource}</if>
|
||||
<if test="docStatus != null and docStatus != ''"> and td.doc_status = #{docStatus}</if>
|
||||
<if test="toolId != null and toolId != ''"> and td.tool_id = #{toolId}</if>
|
||||
<if test="docCategoryId != null and docCategoryId != ''"> and td.doc_category_id = #{docCategoryId}</if>
|
||||
and td.is_deleted = '0'
|
||||
</where>
|
||||
order by td.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDocumentById" parameterType="String" resultMap="DocumentResult">
|
||||
@ -65,6 +75,10 @@
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="docCategoryId != null">doc_category_id,</if>
|
||||
<if test="createById != null and createById != ''">create_by_id,</if>
|
||||
<if test="updateById != null">update_by_id,</if>
|
||||
<if test="isDeleted != null">is_deleted,</if>
|
||||
<if test="toolId != null">tool_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="docId != null">#{docId},</if>
|
||||
@ -81,7 +95,11 @@
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="docCategoryId != null">#{doc_category_id},</if>
|
||||
<if test="docCategoryId != null">#{docCategoryId},</if>
|
||||
<if test="createById != null and createById != ''">#{createById},</if>
|
||||
<if test="updateById != null">#{updateById},</if>
|
||||
<if test="isDeleted != null">#{isDeleted},</if>
|
||||
<if test="toolId != null">#{toolId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -101,7 +119,11 @@
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="docCategoryId != null">docCategoryId = #{doc_category_id},</if>
|
||||
<if test="docCategoryId != null">doc_category_id = #{docCategoryId},</if>
|
||||
<if test="isDeleted != null">is_deleted = #{isDeleted},</if>
|
||||
<if test="updateById != null">update_by_id = #{updateById},</if>
|
||||
<if test="createById != null">create_by_id = #{createById},</if>
|
||||
<if test="toolId != null">tool_id = #{toolId},</if>
|
||||
</trim>
|
||||
where doc_id = #{docId}
|
||||
</update>
|
||||
@ -110,10 +132,29 @@
|
||||
delete from t_document where doc_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDocumentByIds" parameterType="String">
|
||||
<delete id="isDeleteDocumentByIds" parameterType="Document">
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
update t_document set is_deleted = '1' ,update_by_id = #{updateById},update_by = #{updateBy},update_time = #{updateTime} where doc_id in
|
||||
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<update id="updatePushDoc" parameterType="Document">
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
update t_document set doc_status = #{docStatus} ,update_by_id = #{updateById},update_by = #{updateBy},update_time = #{updateTime} where doc_id in
|
||||
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<delete id="batchDeleteById" parameterType="java.util.List">
|
||||
delete from t_document where doc_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -182,4 +182,17 @@ public class Constants
|
||||
public static final String DOWNLOAD_TOOL_PERMISSION = "download:done:tool";
|
||||
|
||||
|
||||
/** 文档-状态-已发布 **/
|
||||
public static final String DOC_STATUS_YFB = "yfb";
|
||||
/** 文档-状态-已上传 **/
|
||||
public static final String DOC_STATUS_YSC = "ysc";
|
||||
/** 文档-状态-审核中 **/
|
||||
public static final String DOC_STATUS_SHZ = "shz";
|
||||
|
||||
/** 文档-doc **/
|
||||
public static final String DOC_TYPE_DOC = "doc";
|
||||
|
||||
|
||||
public static final String STR_ZERO = "0";
|
||||
public static final String STR_ONE = "1";
|
||||
}
|
||||
|
@ -328,4 +328,12 @@ public class FileUploadUtils
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String extractSuffix(String filePath) {
|
||||
int lastDotIndex = filePath.lastIndexOf('.');
|
||||
if (lastDotIndex == -1) {
|
||||
return ""; // 没有后缀
|
||||
}
|
||||
return filePath.substring(lastDotIndex + 1); // 去掉点(.)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user