package com.lz.modules.flow.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.ISelect;
import com.lz.common.utils.PageUtils;
import com.lz.modules.flow.dao.RecordFileMapper;
import com.lz.modules.flow.entity.RecordFile;
import com.lz.modules.flow.req.ResultDetailReq;
import com.lz.modules.flow.service.RecordFileService;
import com.lz.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* <p>
* 文件上传表 服务类
* </p>
*
* @author quyixiao
* @since 2020-08-25
*/

@Service
public class RecordFileServiceImpl extends ServiceImpl<RecordFileMapper, RecordFile> implements RecordFileService {


    @Autowired
	private RecordFileMapper recordFileMapper;



	@Override
	public RecordFile selectRecordFileById(Long id){
		return recordFileMapper.selectRecordFileById(id);
	}



	@Override
	public Long insertRecordFile(RecordFile recordFile){
		return recordFileMapper.insertRecordFile(recordFile);
	}



	@Override
	public int updateRecordFileById(RecordFile recordFile){
		return recordFileMapper.updateRecordFileById(recordFile);
	}



	@Override
	public int updateCoverRecordFileById(RecordFile recordFile){
		return recordFileMapper.updateCoverRecordFileById(recordFile);
	}



	@Override
	public int deleteRecordFileById(Long id){
		return recordFileMapper.deleteRecordFileById(id);
	}

    @Override
    public PageUtils queryPage(ResultDetailReq req, SysUserEntity user) {
        return PageUtils.startPage(req.getPage(),req.getLimit()).doSelect(new ISelect() {
			@Override
			public List doSelect(IPage page) {
				return recordFileMapper.selectByCondition(page,req);
			}
		});
    }

    @Override
    public int selectRecordFileCountByRecordId(Long recordId) {
        return recordFileMapper.selectRecordFileCountByRecordId(recordId);
    }


}
