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