附件管理
This commit is contained in:
parent
af7f5bcf33
commit
3e93c9e0a2
@ -0,0 +1,104 @@
|
|||||||
|
package com.ktg.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
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.ktg.common.annotation.Log;
|
||||||
|
import com.ktg.common.core.controller.BaseController;
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
|
import com.ktg.common.enums.BusinessType;
|
||||||
|
import com.ktg.system.domain.SysAttachment;
|
||||||
|
import com.ktg.system.service.ISysAttachmentService;
|
||||||
|
import com.ktg.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件Controller
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-07-26
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/attachment")
|
||||||
|
public class SysAttachmentController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysAttachmentService sysAttachmentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询附件列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:attachment:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysAttachment sysAttachment)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysAttachment> list = sysAttachmentService.selectSysAttachmentList(sysAttachment);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出附件列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:attachment:export')")
|
||||||
|
@Log(title = "附件", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysAttachment sysAttachment)
|
||||||
|
{
|
||||||
|
List<SysAttachment> list = sysAttachmentService.selectSysAttachmentList(sysAttachment);
|
||||||
|
ExcelUtil<SysAttachment> util = new ExcelUtil<SysAttachment>(SysAttachment.class);
|
||||||
|
util.exportExcel(response, list, "附件数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取附件详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:attachment:query')")
|
||||||
|
@GetMapping(value = "/{attachmentId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("attachmentId") Long attachmentId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(sysAttachmentService.selectSysAttachmentByAttachmentId(attachmentId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增附件
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:attachment:add')")
|
||||||
|
@Log(title = "附件", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody SysAttachment sysAttachment)
|
||||||
|
{
|
||||||
|
return toAjax(sysAttachmentService.insertSysAttachment(sysAttachment));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改附件
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:attachment:edit')")
|
||||||
|
@Log(title = "附件", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody SysAttachment sysAttachment)
|
||||||
|
{
|
||||||
|
return toAjax(sysAttachmentService.updateSysAttachment(sysAttachment));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除附件
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:attachment:remove')")
|
||||||
|
@Log(title = "附件", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{attachmentIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] attachmentIds)
|
||||||
|
{
|
||||||
|
return toAjax(sysAttachmentService.deleteSysAttachmentByAttachmentIds(attachmentIds));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,207 @@
|
|||||||
|
package com.ktg.system.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ktg.common.annotation.Excel;
|
||||||
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件对象 sys_attachment
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-07-26
|
||||||
|
*/
|
||||||
|
public class SysAttachment extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 附件ID */
|
||||||
|
private Long attachmentId;
|
||||||
|
|
||||||
|
/** 关联的业务单据ID */
|
||||||
|
@Excel(name = "关联的业务单据ID")
|
||||||
|
private Long sourceDocId;
|
||||||
|
|
||||||
|
/** 业务单据类型 */
|
||||||
|
@Excel(name = "业务单据类型")
|
||||||
|
private String sourceDocType;
|
||||||
|
|
||||||
|
/** 访问URL */
|
||||||
|
@Excel(name = "访问URL")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
/** 域名 */
|
||||||
|
@Excel(name = "域名")
|
||||||
|
private String basePath;
|
||||||
|
|
||||||
|
/** 文件名 */
|
||||||
|
@Excel(name = "文件名")
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/** 原来的文件名 */
|
||||||
|
@Excel(name = "原来的文件名")
|
||||||
|
private String orignalName;
|
||||||
|
|
||||||
|
/** 文件类型 */
|
||||||
|
@Excel(name = "文件类型")
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
/** 文件大小 */
|
||||||
|
@Excel(name = "文件大小")
|
||||||
|
private BigDecimal fileSize;
|
||||||
|
|
||||||
|
/** 预留字段1 */
|
||||||
|
private String attr1;
|
||||||
|
|
||||||
|
/** 预留字段2 */
|
||||||
|
private String attr2;
|
||||||
|
|
||||||
|
/** 预留字段3 */
|
||||||
|
private Long attr3;
|
||||||
|
|
||||||
|
/** 预留字段4 */
|
||||||
|
private Long attr4;
|
||||||
|
|
||||||
|
public void setAttachmentId(Long attachmentId)
|
||||||
|
{
|
||||||
|
this.attachmentId = attachmentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAttachmentId()
|
||||||
|
{
|
||||||
|
return attachmentId;
|
||||||
|
}
|
||||||
|
public void setSourceDocId(Long sourceDocId)
|
||||||
|
{
|
||||||
|
this.sourceDocId = sourceDocId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getSourceDocId()
|
||||||
|
{
|
||||||
|
return sourceDocId;
|
||||||
|
}
|
||||||
|
public void setSourceDocType(String sourceDocType)
|
||||||
|
{
|
||||||
|
this.sourceDocType = sourceDocType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSourceDocType()
|
||||||
|
{
|
||||||
|
return sourceDocType;
|
||||||
|
}
|
||||||
|
public void setFileUrl(String fileUrl)
|
||||||
|
{
|
||||||
|
this.fileUrl = fileUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileUrl()
|
||||||
|
{
|
||||||
|
return fileUrl;
|
||||||
|
}
|
||||||
|
public void setBasePath(String basePath)
|
||||||
|
{
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBasePath()
|
||||||
|
{
|
||||||
|
return basePath;
|
||||||
|
}
|
||||||
|
public void setFileName(String fileName)
|
||||||
|
{
|
||||||
|
this.fileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileName()
|
||||||
|
{
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
public void setOrignalName(String orignalName)
|
||||||
|
{
|
||||||
|
this.orignalName = orignalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrignalName()
|
||||||
|
{
|
||||||
|
return orignalName;
|
||||||
|
}
|
||||||
|
public void setFileType(String fileType)
|
||||||
|
{
|
||||||
|
this.fileType = fileType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFileType()
|
||||||
|
{
|
||||||
|
return fileType;
|
||||||
|
}
|
||||||
|
public void setFileSize(BigDecimal fileSize)
|
||||||
|
{
|
||||||
|
this.fileSize = fileSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getFileSize()
|
||||||
|
{
|
||||||
|
return fileSize;
|
||||||
|
}
|
||||||
|
public void setAttr1(String attr1)
|
||||||
|
{
|
||||||
|
this.attr1 = attr1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttr1()
|
||||||
|
{
|
||||||
|
return attr1;
|
||||||
|
}
|
||||||
|
public void setAttr2(String attr2)
|
||||||
|
{
|
||||||
|
this.attr2 = attr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAttr2()
|
||||||
|
{
|
||||||
|
return attr2;
|
||||||
|
}
|
||||||
|
public void setAttr3(Long attr3)
|
||||||
|
{
|
||||||
|
this.attr3 = attr3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAttr3()
|
||||||
|
{
|
||||||
|
return attr3;
|
||||||
|
}
|
||||||
|
public void setAttr4(Long attr4)
|
||||||
|
{
|
||||||
|
this.attr4 = attr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAttr4()
|
||||||
|
{
|
||||||
|
return attr4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("attachmentId", getAttachmentId())
|
||||||
|
.append("sourceDocId", getSourceDocId())
|
||||||
|
.append("sourceDocType", getSourceDocType())
|
||||||
|
.append("fileUrl", getFileUrl())
|
||||||
|
.append("basePath", getBasePath())
|
||||||
|
.append("fileName", getFileName())
|
||||||
|
.append("orignalName", getOrignalName())
|
||||||
|
.append("fileType", getFileType())
|
||||||
|
.append("fileSize", getFileSize())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.append("attr1", getAttr1())
|
||||||
|
.append("attr2", getAttr2())
|
||||||
|
.append("attr3", getAttr3())
|
||||||
|
.append("attr4", getAttr4())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.ktg.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.system.domain.SysAttachment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件Mapper接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-07-26
|
||||||
|
*/
|
||||||
|
public interface SysAttachmentMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询附件
|
||||||
|
*
|
||||||
|
* @param attachmentId 附件主键
|
||||||
|
* @return 附件
|
||||||
|
*/
|
||||||
|
public SysAttachment selectSysAttachmentByAttachmentId(Long attachmentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询附件列表
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 附件集合
|
||||||
|
*/
|
||||||
|
public List<SysAttachment> selectSysAttachmentList(SysAttachment sysAttachment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增附件
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysAttachment(SysAttachment sysAttachment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改附件
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysAttachment(SysAttachment sysAttachment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除附件
|
||||||
|
*
|
||||||
|
* @param attachmentId 附件主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysAttachmentByAttachmentId(Long attachmentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除附件
|
||||||
|
*
|
||||||
|
* @param attachmentIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysAttachmentByAttachmentIds(Long[] attachmentIds);
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.ktg.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.system.domain.SysAttachment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件Service接口
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-07-26
|
||||||
|
*/
|
||||||
|
public interface ISysAttachmentService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询附件
|
||||||
|
*
|
||||||
|
* @param attachmentId 附件主键
|
||||||
|
* @return 附件
|
||||||
|
*/
|
||||||
|
public SysAttachment selectSysAttachmentByAttachmentId(Long attachmentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询附件列表
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 附件集合
|
||||||
|
*/
|
||||||
|
public List<SysAttachment> selectSysAttachmentList(SysAttachment sysAttachment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增附件
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSysAttachment(SysAttachment sysAttachment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改附件
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSysAttachment(SysAttachment sysAttachment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除附件
|
||||||
|
*
|
||||||
|
* @param attachmentIds 需要删除的附件主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysAttachmentByAttachmentIds(Long[] attachmentIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除附件信息
|
||||||
|
*
|
||||||
|
* @param attachmentId 附件主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSysAttachmentByAttachmentId(Long attachmentId);
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package com.ktg.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ktg.system.mapper.SysAttachmentMapper;
|
||||||
|
import com.ktg.system.domain.SysAttachment;
|
||||||
|
import com.ktg.system.service.ISysAttachmentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件Service业务层处理
|
||||||
|
*
|
||||||
|
* @author yinjinlu
|
||||||
|
* @date 2022-07-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysAttachmentServiceImpl implements ISysAttachmentService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private SysAttachmentMapper sysAttachmentMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询附件
|
||||||
|
*
|
||||||
|
* @param attachmentId 附件主键
|
||||||
|
* @return 附件
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysAttachment selectSysAttachmentByAttachmentId(Long attachmentId)
|
||||||
|
{
|
||||||
|
return sysAttachmentMapper.selectSysAttachmentByAttachmentId(attachmentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询附件列表
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 附件
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysAttachment> selectSysAttachmentList(SysAttachment sysAttachment)
|
||||||
|
{
|
||||||
|
return sysAttachmentMapper.selectSysAttachmentList(sysAttachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增附件
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSysAttachment(SysAttachment sysAttachment)
|
||||||
|
{
|
||||||
|
sysAttachment.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return sysAttachmentMapper.insertSysAttachment(sysAttachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改附件
|
||||||
|
*
|
||||||
|
* @param sysAttachment 附件
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSysAttachment(SysAttachment sysAttachment)
|
||||||
|
{
|
||||||
|
sysAttachment.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return sysAttachmentMapper.updateSysAttachment(sysAttachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除附件
|
||||||
|
*
|
||||||
|
* @param attachmentIds 需要删除的附件主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysAttachmentByAttachmentIds(Long[] attachmentIds)
|
||||||
|
{
|
||||||
|
return sysAttachmentMapper.deleteSysAttachmentByAttachmentIds(attachmentIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除附件信息
|
||||||
|
*
|
||||||
|
* @param attachmentId 附件主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSysAttachmentByAttachmentId(Long attachmentId)
|
||||||
|
{
|
||||||
|
return sysAttachmentMapper.deleteSysAttachmentByAttachmentId(attachmentId);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
<?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.ktg.system.mapper.SysAttachmentMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysAttachment" id="SysAttachmentResult">
|
||||||
|
<result property="attachmentId" column="attachment_id" />
|
||||||
|
<result property="sourceDocId" column="source_doc_id" />
|
||||||
|
<result property="sourceDocType" column="source_doc_type" />
|
||||||
|
<result property="fileUrl" column="file_url" />
|
||||||
|
<result property="basePath" column="base_path" />
|
||||||
|
<result property="fileName" column="file_name" />
|
||||||
|
<result property="orignalName" column="orignal_name" />
|
||||||
|
<result property="fileType" column="file_type" />
|
||||||
|
<result property="fileSize" column="file_size" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
<result property="attr1" column="attr1" />
|
||||||
|
<result property="attr2" column="attr2" />
|
||||||
|
<result property="attr3" column="attr3" />
|
||||||
|
<result property="attr4" column="attr4" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysAttachmentVo">
|
||||||
|
select attachment_id, source_doc_id, source_doc_type, file_url, base_path, file_name, orignal_name, file_type, file_size, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from sys_attachment
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysAttachmentList" parameterType="SysAttachment" resultMap="SysAttachmentResult">
|
||||||
|
<include refid="selectSysAttachmentVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="sourceDocId != null "> and source_doc_id = #{sourceDocId}</if>
|
||||||
|
<if test="sourceDocType != null and sourceDocType != ''"> and source_doc_type = #{sourceDocType}</if>
|
||||||
|
<if test="fileUrl != null and fileUrl != ''"> and file_url = #{fileUrl}</if>
|
||||||
|
<if test="basePath != null and basePath != ''"> and base_path = #{basePath}</if>
|
||||||
|
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
|
||||||
|
<if test="orignalName != null and orignalName != ''"> and orignal_name like concat('%', #{orignalName}, '%')</if>
|
||||||
|
<if test="fileType != null and fileType != ''"> and file_type = #{fileType}</if>
|
||||||
|
<if test="fileSize != null "> and file_size = #{fileSize}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysAttachmentByAttachmentId" parameterType="Long" resultMap="SysAttachmentResult">
|
||||||
|
<include refid="selectSysAttachmentVo"/>
|
||||||
|
where attachment_id = #{attachmentId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysAttachment" parameterType="SysAttachment" useGeneratedKeys="true" keyProperty="attachmentId">
|
||||||
|
insert into sys_attachment
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="sourceDocId != null">source_doc_id,</if>
|
||||||
|
<if test="sourceDocType != null">source_doc_type,</if>
|
||||||
|
<if test="fileUrl != null and fileUrl != ''">file_url,</if>
|
||||||
|
<if test="basePath != null">base_path,</if>
|
||||||
|
<if test="fileName != null">file_name,</if>
|
||||||
|
<if test="orignalName != null">orignal_name,</if>
|
||||||
|
<if test="fileType != null">file_type,</if>
|
||||||
|
<if test="fileSize != null">file_size,</if>
|
||||||
|
<if test="remark != null">remark,</if>
|
||||||
|
<if test="attr1 != null">attr1,</if>
|
||||||
|
<if test="attr2 != null">attr2,</if>
|
||||||
|
<if test="attr3 != null">attr3,</if>
|
||||||
|
<if test="attr4 != null">attr4,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="sourceDocId != null">#{sourceDocId},</if>
|
||||||
|
<if test="sourceDocType != null">#{sourceDocType},</if>
|
||||||
|
<if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if>
|
||||||
|
<if test="basePath != null">#{basePath},</if>
|
||||||
|
<if test="fileName != null">#{fileName},</if>
|
||||||
|
<if test="orignalName != null">#{orignalName},</if>
|
||||||
|
<if test="fileType != null">#{fileType},</if>
|
||||||
|
<if test="fileSize != null">#{fileSize},</if>
|
||||||
|
<if test="remark != null">#{remark},</if>
|
||||||
|
<if test="attr1 != null">#{attr1},</if>
|
||||||
|
<if test="attr2 != null">#{attr2},</if>
|
||||||
|
<if test="attr3 != null">#{attr3},</if>
|
||||||
|
<if test="attr4 != null">#{attr4},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysAttachment" parameterType="SysAttachment">
|
||||||
|
update sys_attachment
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="sourceDocId != null">source_doc_id = #{sourceDocId},</if>
|
||||||
|
<if test="sourceDocType != null">source_doc_type = #{sourceDocType},</if>
|
||||||
|
<if test="fileUrl != null and fileUrl != ''">file_url = #{fileUrl},</if>
|
||||||
|
<if test="basePath != null">base_path = #{basePath},</if>
|
||||||
|
<if test="fileName != null">file_name = #{fileName},</if>
|
||||||
|
<if test="orignalName != null">orignal_name = #{orignalName},</if>
|
||||||
|
<if test="fileType != null">file_type = #{fileType},</if>
|
||||||
|
<if test="fileSize != null">file_size = #{fileSize},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||||
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||||
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||||
|
<if test="attr4 != null">attr4 = #{attr4},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where attachment_id = #{attachmentId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysAttachmentByAttachmentId" parameterType="Long">
|
||||||
|
delete from sys_attachment where attachment_id = #{attachmentId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysAttachmentByAttachmentIds" parameterType="String">
|
||||||
|
delete from sys_attachment where attachment_id in
|
||||||
|
<foreach item="attachmentId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{attachmentId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user