package com.ruoyi.generator.service;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.generator.domain.SysProjectTable;
import com.ruoyi.generator.mapper.SysProjectTableMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 项目与表关联Service业务层处理
 *
 * @author ruoyi
 * @date {DATE}
 */
@Service
public class SysProjectTableServiceImpl implements ISysProjectTableService
{
    @Autowired
    private SysProjectTableMapper sysProjectTableMapper;

    /**
     * 查询项目与表关联
     *
     * @param id 项目与表关联主键
     * @return 项目与表关联
     */
    @Override
    public SysProjectTable selectSysProjectTableById(Long id)
    {
        return sysProjectTableMapper.selectSysProjectTableById(id);
    }

    /**
     * 查询项目与表关联列表
     *
     * @param sysProjectTable 项目与表关联
     * @return 项目与表关联
     */
    @Override
    public List<SysProjectTable> selectSysProjectTableList(SysProjectTable sysProjectTable)
    {
        return sysProjectTableMapper.selectSysProjectTableList(sysProjectTable);
    }

    /**
     * 新增项目与表关联
     *
     * @param sysProjectTable 项目与表关联
     * @return 结果
     */
    @Override
    public int insertSysProjectTable(SysProjectTable sysProjectTable)
    {
        sysProjectTable.setCreateTime(DateUtils.getNowDate());
        return sysProjectTableMapper.insertSysProjectTable(sysProjectTable);
    }

    /**
     * 修改项目与表关联
     *
     * @param sysProjectTable 项目与表关联
     * @return 结果
     */
    @Override
    public int updateSysProjectTable(SysProjectTable sysProjectTable)
    {
        sysProjectTable.setUpdateTime(DateUtils.getNowDate());
        return sysProjectTableMapper.updateSysProjectTable(sysProjectTable);
    }

    /**
     * 批量删除项目与表关联
     *
     * @param ids 需要删除的项目与表关联主键
     * @return 结果
     */
    @Override
    public int deleteSysProjectTableByIds(Long[] ids)
    {
        return sysProjectTableMapper.deleteSysProjectTableByIds(ids);
    }

    /**
     * 删除项目与表关联信息
     *
     * @param id 项目与表关联主键
     * @return 结果
     */
    @Override
    public int deleteSysProjectTableById(Long id)
    {
        return sysProjectTableMapper.deleteSysProjectTableById(id);
    }

    /**
     * 根据项目ID删除关联关系
     *
     * @param projectId 项目ID
     * @return 结果
     */
    @Override
    public int deleteSysProjectTableByProjectId(Long projectId)
    {
        return sysProjectTableMapper.deleteSysProjectTableByProjectId(projectId);
    }

    /**
     * 根据表ID删除关联关系
     *
     * @param tableId 表ID
     * @return 结果
     */
    @Override
    public int deleteSysProjectTableByTableId(Long tableId)
    {
        return sysProjectTableMapper.deleteSysProjectTableByTableId(tableId);
    }
} 