diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java index 71ddc72c..cc89ef0b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java @@ -155,6 +155,46 @@ public class SysSupplier extends BaseEntity private String updateInfoTime; + private Long photoAttachId; + + /** 照片 */ + private String photoUrl; + + private String fileIdStr; + + private String removeFileIdStr; + + public Long getPhotoAttachId() { + return photoAttachId; + } + + public void setPhotoAttachId(Long photoAttachId) { + this.photoAttachId = photoAttachId; + } + + public String getPhotoUrl() { + return photoUrl; + } + + public void setPhotoUrl(String photoUrl) { + this.photoUrl = photoUrl; + } + + public String getFileIdStr() { + return fileIdStr; + } + + public void setFileIdStr(String fileIdStr) { + this.fileIdStr = fileIdStr; + } + + public String getRemoveFileIdStr() { + return removeFileIdStr; + } + + public void setRemoveFileIdStr(String removeFileIdStr) { + this.removeFileIdStr = removeFileIdStr; + } public String getAuditStatus() { return auditStatus; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java index 55af200e..6523aaeb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java @@ -2,12 +2,20 @@ package com.ruoyi.system.service.impl; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.service.ICommonService; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysAttach; import com.ruoyi.system.domain.SysSupplier; import com.ruoyi.system.mapper.SysSupplierMapper; +import com.ruoyi.system.service.ISysAttachFileService; +import com.ruoyi.system.service.ISysAttachService; import com.ruoyi.system.service.ISysSupplierService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.Date; import java.util.List; /** @@ -24,6 +32,16 @@ public class SysSupplierServiceImpl implements ISysSupplierService @Autowired private RedisCache redisCache; + + @Autowired + private ISysAttachFileService attachFileService; + + @Autowired + private ISysAttachService attachService; + + @Autowired + private ICommonService commonService; + /** * 查询供应商资料 * @@ -69,6 +87,31 @@ public class SysSupplierServiceImpl implements ISysSupplierService @Override public int updateSysSupplier(SysSupplier sysSupplier) { + String loginName = ShiroUtils.getLoginName(); + Long id = sysSupplier.getSupplierId(); + String fileIdStr = sysSupplier.getFileIdStr(); + Long photoAttachId = sysSupplier.getPhotoAttachId(); + String removeFileIdStr = sysSupplier.getRemoveFileIdStr(); + sysSupplier.setUpdateTime(new Date()); + if(StringUtils.isNotBlank(removeFileIdStr)){ + List removeFileIdList = Arrays.asList(removeFileIdStr.split(";")); + + commonService.deleteByIds(removeFileIdList); + } + if(StringUtils.isNotBlank(fileIdStr)) { + List fileIdList = Arrays.asList(fileIdStr.split(";")); + if (photoAttachId == null) { + SysAttach attach = new SysAttach(); + attach.setCreateBy(loginName); + attach.setCreateTime(new Date()); + attach.setSourceType("erpMaterial"); + attach.setSourceSubType("photo"); + attach.setRelId(id); + attachService.insertSysAttach(attach); + photoAttachId = attach.getId(); + } + attachFileService.updateAttachIdByIdList(photoAttachId, fileIdList); + } return sysSupplierMapper.updateSysSupplier(sysSupplier); } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml index 50ab368a..8dcde90e 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml @@ -43,6 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -59,24 +61,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +
@@ -215,21 +216,27 @@
- -
- - 点击上传 -
只能上传jpg/png文件,第一张图片为主图
-
+ +
+ +
+ + 点击上传 +
只能上传jpg/png文件,第一张图片为主图
+
+
+ + +
-
@@ -245,17 +252,71 @@
- - \ No newline at end of file