package cn.autoform.web.service.Enclosure.impl;
|
|
import cn.autoform.web.client.bean.Enclosure;
|
import cn.autoform.web.client.bean.EnclosureExtend;
|
import cn.autoform.web.mapper.Enclosure.EnclosureMapper;
|
import cn.autoform.web.service.Enclosure.EnclosureService;
|
import com.google.common.collect.Lists;
|
import org.apache.commons.lang.StringUtils;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Service
|
public class EnclosureServiceImpl implements EnclosureService {
|
|
String a = "001";
|
@Resource
|
private EnclosureMapper enclosureMapper;
|
|
@Override
|
public List<Enclosure> selectFile(Enclosure enc) {
|
//ThreadData.get("tenantID",String.class);
|
return enclosureMapper.selectFile(enc,a);
|
}
|
@Override
|
public int selectFileStatus(String formId,Integer dataRowNum){
|
if(StringUtils.isNotBlank(formId) && dataRowNum != null){
|
//查询出的附件数量
|
return enclosureMapper.selectFileStatus(formId,dataRowNum,a);
|
}
|
return 0;
|
}
|
|
|
|
@Override
|
public int addFile(EnclosureExtend encs) {
|
int count = 0;
|
for(Enclosure enc : encs.getFileList()){
|
if(enclosureMapper.selectOne(enc.getPhysicsFileName(), encs.getFormId(),a)==null){
|
enc.setFormID(encs.getFormId());
|
enc.setDataRowNum(encs.getRowNum());
|
count += enclosureMapper.insertFile(enc,a);
|
}
|
}
|
return count;
|
}
|
|
@Override
|
public int deleteFile(String path) {
|
return enclosureMapper.deleteFile(path,a);
|
}
|
|
@Override
|
public Enclosure selectOne(String name) {
|
|
return enclosureMapper.selectOnes(name,a);
|
}
|
|
}
|