客户档案附件上传
This commit is contained in:
@@ -123,6 +123,14 @@ public class CrmFileRest {
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
@ApiOperation("附件保存")
|
||||
@PostMapping("/saveAppendix")
|
||||
ResultBean saveAppendix(@RequestParam(value = "linkSid") String linkSid,@RequestParam(value = "attachType") String attachType, @RequestBody List<PcCommonAppendixDto> list){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
crmFileService.saveAppendix(linkSid,attachType, list);
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
@ApiOperation("PC端保存/修改附件")
|
||||
@PostMapping("/saveOrUpdatePcAppendix")
|
||||
public ResultBean saveOrUpdatePcAppendix(@RequestBody PcCommonAppendixDto dto, @RequestParam("sid") String sid, @RequestParam("staffSid") String staffSid, @RequestParam("attachType") String attachType){
|
||||
@@ -139,9 +147,9 @@ public class CrmFileRest {
|
||||
|
||||
@ApiOperation(value = "批量删除文件")
|
||||
@PostMapping("/deleteFiles")
|
||||
ResultBean deleteFiles(@RequestParam(value = "linkSid") String linkSid){
|
||||
ResultBean deleteFiles(@RequestParam(value = "linkSid") String linkSid,@RequestParam(value = "attachType") String attachType){
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
int i = crmFileService.deleteFiles(linkSid);
|
||||
int i = crmFileService.deleteFiles(linkSid,attachType);
|
||||
return rb.success().setMsg("删除成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel(value = "客户资料表", description = "客户资料表")
|
||||
@TableName("crm_file")
|
||||
@TableName("crm_appendix")
|
||||
public class CrmFile extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -53,8 +53,6 @@ public class CrmFile extends BaseEntity {
|
||||
private String fileName; // 文件名
|
||||
@ApiModelProperty("文件类型")
|
||||
private String fileType; // 文件类型
|
||||
@ApiModelProperty("上传人姓名")
|
||||
private String name; // 上传人姓名
|
||||
@ApiModelProperty("关联业务对象sid")
|
||||
private String linkSid; // 关联业务对象sid
|
||||
@ApiModelProperty("附件类型")
|
||||
@@ -90,19 +88,6 @@ public class CrmFile extends BaseEntity {
|
||||
public void setFileType(String fileType){
|
||||
this.fileType = fileType;
|
||||
}
|
||||
/**
|
||||
* @return 上传人姓名
|
||||
*/
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name 上传人姓名 to set
|
||||
*/
|
||||
public void setName(String name){
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* @return 关联业务对象sid
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -57,15 +58,15 @@ public interface CrmFileMapper extends BaseMapper<CrmFile> {
|
||||
|
||||
List<CrmFileVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<CrmFile> qw);
|
||||
|
||||
@Select("select * from crm_file")
|
||||
@Select("select * from crm_appendix")
|
||||
List<CrmFileVo> selectListVo();
|
||||
|
||||
List<String> selectByLinkSid(@Param("linkSid") String linkSid, @Param("attachType") String attachType);
|
||||
|
||||
@Delete("delete from crm_file where linkSid=#{linkSid} and filePath=#{filePath}")
|
||||
@Delete("delete from crm_appendix where linkSid=#{linkSid} and filePath=#{filePath}")
|
||||
int delByLinkSidAndFilePath(@Param("linkSid") String linkSid, @Param("filePath") String filePath);
|
||||
|
||||
@Select("select * from crm_file where linkSid = #{sid}")
|
||||
@Select("select * from crm_appendix where linkSid = #{sid}")
|
||||
List<CrmFileDetailsVo> fetchByLinkSid(String sid);
|
||||
|
||||
int selectPath(String path);
|
||||
@@ -78,8 +79,8 @@ public interface CrmFileMapper extends BaseMapper<CrmFile> {
|
||||
|
||||
List<CommonAppendixVo> selByLinkSid(String sid);
|
||||
|
||||
@Delete("DELETE FROM crm_file WHERE linkSid = #{linkSid}")
|
||||
int deleteFiles(String linkSid);
|
||||
@Delete("DELETE FROM crm_appendix WHERE linkSid = #{linkSid} and attachType =#{attachType}")
|
||||
int deleteFiles(@Param("linkSid") String linkSid,@Param("attachType") String attachType);
|
||||
|
||||
List<CommonAppendixVo> getPcAppendix(@Param("type") String type, @Param("linkSid") String linkSid, @Param("path") String path);
|
||||
|
||||
|
||||
@@ -10,21 +10,21 @@
|
||||
name,
|
||||
createTime
|
||||
FROM
|
||||
crm_file
|
||||
crm_appendix
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectListAllVo" resultType="com.yxt.customer.biz.crmfile.CrmFileVo">
|
||||
SELECT * FROM crm_file
|
||||
SELECT * FROM crm_appendix
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByLinkSid" resultType="String">
|
||||
SELECT filePath FROM crm_file
|
||||
SELECT filePath FROM crm_appendix
|
||||
WHERE linkSid = #{linkSid}
|
||||
<if test="attachType != null and attachType != ''">
|
||||
AND attachType = #{attachType}
|
||||
@@ -33,30 +33,30 @@
|
||||
|
||||
<select id="selectPath" resultType="int">
|
||||
select count(*)
|
||||
from crm_file
|
||||
from crm_appendix
|
||||
where filePath = #{path}
|
||||
</select>
|
||||
|
||||
<delete id="deletePath">
|
||||
delete
|
||||
from crm_file
|
||||
from crm_appendix
|
||||
where filePath = #{path}
|
||||
</delete>
|
||||
<delete id="deleteByLinkSidAndAttachType">
|
||||
delete
|
||||
from crm_file
|
||||
from crm_appendix
|
||||
where linkSid = #{sid}
|
||||
and attachType = #{key}
|
||||
</delete>
|
||||
|
||||
<select id="fetchByFilePath" resultType="int">
|
||||
select count(*)
|
||||
from crm_file
|
||||
from crm_appendix
|
||||
where filePath = #{str}
|
||||
</select>
|
||||
<select id="selByLinkSid" resultType="com.yxt.customer.biz.crmfile.CommonAppendixVo">
|
||||
select *
|
||||
from crm_file
|
||||
from crm_appendix
|
||||
where linkSid = #{sid}
|
||||
</select>
|
||||
|
||||
@@ -69,9 +69,8 @@
|
||||
cax.fileName,
|
||||
cax.createBySid,
|
||||
DATE_FORMAT(cax.createTime, '%Y-%m-%d') AS createTime,
|
||||
cax.name,
|
||||
cax.linkSid
|
||||
FROM crm_file cax
|
||||
FROM crm_appendix cax
|
||||
WHERE attachType = #{type}
|
||||
AND linkSid = #{linkSid}
|
||||
</select>
|
||||
|
||||
@@ -265,8 +265,8 @@ public class CrmFileService extends MybatisBaseService<CrmFileMapper, CrmFile> {
|
||||
return z;
|
||||
}
|
||||
|
||||
public int deleteFiles(String linkSid) {
|
||||
int i = baseMapper.deleteFiles(linkSid);
|
||||
public int deleteFiles(String linkSid,String attachType) {
|
||||
int i = baseMapper.deleteFiles(linkSid,attachType);
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -307,4 +307,26 @@ public class CrmFileService extends MybatisBaseService<CrmFileMapper, CrmFile> {
|
||||
String urlPrefix = fileUploadComponent.getUrlPrefix();
|
||||
return baseMapper.getPcAppendix(attachType,linkSid, urlPrefix);
|
||||
}
|
||||
|
||||
public void saveAppendix(String linkSid, String attachType, List<PcCommonAppendixDto> list) {
|
||||
for (PcCommonAppendixDto pcCommonAppendixDto : list) {
|
||||
CrmFile commonAppendix = new CrmFile();
|
||||
commonAppendix.setLinkSid(linkSid);
|
||||
if (StringUtils.isNotBlank(pcCommonAppendixDto.getCreateBySid())) {
|
||||
commonAppendix.setCreateBySid(pcCommonAppendixDto.getCreateBySid());
|
||||
}
|
||||
if (StringUtils.isNotBlank(pcCommonAppendixDto.getFileName())) {
|
||||
commonAppendix.setFileName(pcCommonAppendixDto.getFileName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(pcCommonAppendixDto.getFileType())) {
|
||||
commonAppendix.setFileType(pcCommonAppendixDto.getFileType());
|
||||
}
|
||||
if (StringUtils.isNotBlank(pcCommonAppendixDto.getFileSize())) {
|
||||
commonAppendix.setFileSize(pcCommonAppendixDto.getFileSize());
|
||||
}
|
||||
commonAppendix.setAttachType(attachType);
|
||||
commonAppendix.setFilePath(pcCommonAppendixDto.getFilePath().replace(fileUploadComponent.getUrlPrefix(), ""));
|
||||
save(commonAppendix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user