案例管理
This commit is contained in:
@ -23,13 +23,21 @@ public class SysCustomerCase extends BaseEntity
|
||||
private String name;
|
||||
|
||||
/** 案例关键词 */
|
||||
@Excel(name = "案例关键词")
|
||||
@Excel(name = "关键词")
|
||||
private String keyword;
|
||||
|
||||
/** 案例所属客户ID */
|
||||
@Excel(name = "案例所属客户ID")
|
||||
private Long customerId;
|
||||
|
||||
@Excel(name = "所属客户")
|
||||
private String customerName;
|
||||
|
||||
/** 删除标识 0未删除 1已删除,默认0 */
|
||||
private Long delFlag;
|
||||
|
||||
//案例文件名称数组
|
||||
private String[] caseFileName;
|
||||
|
||||
//案例文件URL数组
|
||||
private String[] caseFileUrl;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.stdiet.custom.dto.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileRequest {
|
||||
|
||||
private String fileUrl;
|
||||
|
||||
private String fileName;
|
||||
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysCustomerCaseFile;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 客户案例对应文件管理Mapper接口
|
||||
@ -58,4 +59,29 @@ public interface SysCustomerCaseFileMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysCustomerCaseFileByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据案例ID删除该案例下的所有文件记录
|
||||
* @param caseId
|
||||
*/
|
||||
int deleteSysCustomerCaseFileByCaseId(@Param("caseId")Long caseId);
|
||||
|
||||
/**
|
||||
* 根据案例ID批量删除该案例下的所有文件记录
|
||||
* @param caseIds
|
||||
*/
|
||||
int deleteSysCustomerCaseFileByCaseIds(Long[] caseIds);
|
||||
|
||||
/**
|
||||
* 批量插入案例文件记录
|
||||
* @param list
|
||||
*/
|
||||
int insertBatch(List<SysCustomerCaseFile> list);
|
||||
|
||||
/**
|
||||
* 根据案例Id查询案例文件列表
|
||||
* @param caseId
|
||||
* @return
|
||||
*/
|
||||
List<SysCustomerCaseFile> selectSysCustomerCaseFileListByCaseId(@Param("caseId") Long caseId);
|
||||
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysCustomerCase;
|
||||
import com.stdiet.custom.domain.SysCustomerCaseFile;
|
||||
|
||||
/**
|
||||
* 客户案例管理Service接口
|
||||
@ -58,4 +59,11 @@ public interface ISysCustomerCaseService {
|
||||
*/
|
||||
public int deleteSysCustomerCaseById(Long id);
|
||||
|
||||
/**
|
||||
* 根据案例ID获取对应文件列表
|
||||
* @param caseId
|
||||
* @return
|
||||
*/
|
||||
List<SysCustomerCaseFile> getFileListByCaseId(Long caseId);
|
||||
|
||||
}
|
@ -1,12 +1,16 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.domain.SysCustomerCaseFile;
|
||||
import com.stdiet.custom.mapper.SysCustomerCaseFileMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysCustomerCaseMapper;
|
||||
import com.stdiet.custom.domain.SysCustomerCase;
|
||||
import com.stdiet.custom.service.ISysCustomerCaseService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 客户案例管理Service业务层处理
|
||||
@ -15,11 +19,15 @@ import com.stdiet.custom.service.ISysCustomerCaseService;
|
||||
* @date 2021-03-04
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
||||
{
|
||||
@Autowired
|
||||
private SysCustomerCaseMapper sysCustomerCaseMapper;
|
||||
|
||||
@Autowired
|
||||
private SysCustomerCaseFileMapper sysCustomerCaseFileMapper;
|
||||
|
||||
/**
|
||||
* 查询客户案例管理
|
||||
*
|
||||
@ -54,7 +62,23 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
||||
public int insertSysCustomerCase(SysCustomerCase sysCustomerCase)
|
||||
{
|
||||
sysCustomerCase.setCreateTime(DateUtils.getNowDate());
|
||||
return sysCustomerCaseMapper.insertSysCustomerCase(sysCustomerCase);
|
||||
int rows = sysCustomerCaseMapper.insertSysCustomerCase(sysCustomerCase);
|
||||
if(rows > 0){
|
||||
//批量添加文件对应列表
|
||||
SysCustomerCaseFile caseFile = null;
|
||||
if(sysCustomerCase.getCaseFileUrl() != null && sysCustomerCase.getCaseFileUrl().length > 0){
|
||||
List<SysCustomerCaseFile> caseFileList = new ArrayList<>();
|
||||
for (String url : sysCustomerCase.getCaseFileUrl()) {
|
||||
caseFile = new SysCustomerCaseFile();
|
||||
caseFile.setCaseId(sysCustomerCase.getId());
|
||||
caseFile.setFileName(sysCustomerCase.getCaseFileName()[caseFileList.size()]);
|
||||
caseFile.setFileUrl(url);
|
||||
caseFileList.add(caseFile);
|
||||
}
|
||||
rows = sysCustomerCaseFileMapper.insertBatch(caseFileList);
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +103,11 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
||||
@Override
|
||||
public int deleteSysCustomerCaseByIds(Long[] ids)
|
||||
{
|
||||
return sysCustomerCaseMapper.deleteSysCustomerCaseByIds(ids);
|
||||
int rows = sysCustomerCaseMapper.deleteSysCustomerCaseByIds(ids);
|
||||
if(rows > 0){
|
||||
rows = sysCustomerCaseFileMapper.deleteSysCustomerCaseFileByCaseIds(ids);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,6 +119,19 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
||||
@Override
|
||||
public int deleteSysCustomerCaseById(Long id)
|
||||
{
|
||||
return sysCustomerCaseMapper.deleteSysCustomerCaseById(id);
|
||||
int rows = sysCustomerCaseMapper.deleteSysCustomerCaseById(id);
|
||||
if(rows > 0){
|
||||
rows = sysCustomerCaseFileMapper.deleteSysCustomerCaseFileByCaseId(id);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据案例ID获取对应文件列表
|
||||
* @param caseId
|
||||
* @return
|
||||
*/
|
||||
public List<SysCustomerCaseFile> getFileListByCaseId(Long caseId){
|
||||
return sysCustomerCaseFileMapper.selectSysCustomerCaseFileListByCaseId(caseId);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user