package com.chushang.inspection.project.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chushang.common.mybatis.enums.Operator;
import com.chushang.common.mybatis.utils.PageResult;
import com.chushang.inspection.project.po.Template;
import com.chushang.oss.entity.vo.FileSourceVo;
import org.springframework.web.multipart.MultipartFile;

/**
 * @auther: zhao
 * @date: 2024/7/2 11:04
 */
public interface TbTemplateService extends IService<Template> {
    PageResult pageList(Template template);

    Long saveTemplate(Template template);

    Long updateTemplate(Template template);

    default Template getByAlias(String alias, Long taskId){
        return getOne(new LambdaQueryWrapper<Template>()
                .eq(Template::getTemplateAlias, alias)
                .eq(null != taskId, Template::getTaskId, taskId)
                .last(Operator.LIMIT_ONE.getCharacter())
        );
    }

    FileSourceVo uploadFile(MultipartFile file);
}
