package com.goldenwater.slgc.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.goldenwater.slgc.domain.DocFile;
import com.goldenwater.slgc.mapper.DocFileMapper;
import com.goldenwater.slgc.service.DocFileService;

/** 文档文件 业务实现 */
@Service
public class DocFileServiceImpl implements DocFileService {
    @Autowired
    private DocFileMapper docFileMapper;

    @Override
    public List<DocFile> selectDocFileList(DocFile docFile) {
        return docFileMapper.selectDocFileList(docFile);
    }

    @Override
    public DocFile selectDocFileById(String fileId) {
        return docFileMapper.selectDocFileById(fileId);
    }

    @Override
    @Transactional
    public int deleteDocFileByIds(String[] fileIds) {
        return docFileMapper.deleteDocFileByIds(fileIds);
    }

    @Override
    public int insertDocFile(DocFile docFile) {
        return docFileMapper.insertDocFile(docFile);
    }

    @Override
    public int updateDocFile(DocFile docFile) {
        return docFileMapper.updateDocFile(docFile);
    }

    @Override
    @Transactional
    public int moveDocFile(String[] fileIds, String fileCate) {
        DocFile docFile = new DocFile();
        docFile.setFileCate(fileCate);
        java.util.List<String> idList = java.util.Arrays.asList(fileIds);
        docFile.setFileIds(idList);
        return docFileMapper.moveDocFile(docFile);
    }

    @Override
    public int renameDocFile(String fileId, String fileName) {
        DocFile docFile = new DocFile();
        docFile.setFileId(fileId);
        docFile.setFileName(fileName);
        return docFileMapper.renameDocFile(docFile);
    }
}
