package com.siwei.rsmonitoring.service.impl;

import java.util.List;

import com.siwei.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.siwei.rsmonitoring.mapper.TDkAuditflowFjMapper;
import com.siwei.rsmonitoring.domain.TDkAuditflowFj;
import com.siwei.rsmonitoring.service.ITDkAuditflowFjService;

/**
 * 地块的审核附件Service业务层处理
 *
 * @author siwei
 * @date 2025-02-11
 */
@Service
public class TDkAuditflowFjServiceImpl implements ITDkAuditflowFjService {
    @Autowired
    private TDkAuditflowFjMapper tDkAuditflowFjMapper;
    /**
     * 域名或本机访问地址
     */
    @Value("${file.domain}")
    public String domain;

    /**
     * 资源映射路径 前缀
     */
    @Value("${file.prefix}")
    public String localFilePrefix;

    /**
     * 查询地块的审核附件
     *
     * @param id 地块的审核附件主键
     * @return 地块的审核附件
     */
    @Override
    public TDkAuditflowFj selectTDkAuditflowFjById(String id) {
        return tDkAuditflowFjMapper.selectTDkAuditflowFjById(id);
    }

    /**
     * 查询地块的审核附件列表
     *
     * @param tDkAuditflowFj 地块的审核附件
     * @return 地块的审核附件
     */
    @Override
    public List<TDkAuditflowFj> selectTDkAuditflowFjList(TDkAuditflowFj tDkAuditflowFj) {
        return tDkAuditflowFjMapper.selectTDkAuditflowFjList(tDkAuditflowFj);
    }


    /**
     * 新增地块的审核附件
     *
     * @param tDkAuditflowFj 地块的审核附件
     * @return 结果
     */
    @Override
    public int insertTDkAuditflowFj(TDkAuditflowFj tDkAuditflowFj) {
        tDkAuditflowFj.setCreateTime(DateUtils.getNowDate());
        tDkAuditflowFj.setFjPreview(domain + localFilePrefix + tDkAuditflowFj.getFjPath());
        return tDkAuditflowFjMapper.insertTDkAuditflowFj(tDkAuditflowFj);
    }

    /**
     * 修改地块的审核附件
     *
     * @param tDkAuditflowFj 地块的审核附件
     * @return 结果
     */
    @Override
    public int updateTDkAuditflowFj(TDkAuditflowFj tDkAuditflowFj) {
        return tDkAuditflowFjMapper.updateTDkAuditflowFj(tDkAuditflowFj);
    }

    /**
     * 批量删除地块的审核附件
     *
     * @param ids 需要删除的地块的审核附件主键
     * @return 结果
     */
    @Override
    public int deleteTDkAuditflowFjByIds(String[] ids) {
        return tDkAuditflowFjMapper.deleteTDkAuditflowFjByIds(ids);
    }

    /**
     * 删除地块的审核附件信息
     *
     * @param id 地块的审核附件主键
     * @return 结果
     */
    @Override
    public int deleteTDkAuditflowFjById(String id) {
        return tDkAuditflowFjMapper.deleteTDkAuditflowFjById(id);
    }

    @Override
    public int deleteTDkAuditflowFjByAuditflowId(String auditflowId) {
        return tDkAuditflowFjMapper.deleteTDkAuditflowFjByAuditflowId(auditflowId);
    }

}
