package com.zehong.system.service.impl;

import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TSafeInspectLedger;
import com.zehong.system.mapper.TSafeInspectLedgerMapper;
import com.zehong.system.service.ITSafeInspectLedgerService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 安全检查台账Service业务层处理
 * 
 * @author zehong
 * @date 2026-03-27
 */
@Service
public class TSafeInspectLedgerServiceImpl implements ITSafeInspectLedgerService 
{
    @Resource
    private TSafeInspectLedgerMapper tSafeInspectLedgerMapper;

    /**
     * 查询安全检查台账
     * 
     * @param inspectId 安全检查台账ID
     * @return 安全检查台账
     */
    @Override
    public TSafeInspectLedger selectTSafeInspectLedgerById(Long inspectId)
    {
        return tSafeInspectLedgerMapper.selectTSafeInspectLedgerById(inspectId);
    }

    /**
     * 查询安全检查台账列表
     * 
     * @param tSafeInspectLedger 安全检查台账
     * @return 安全检查台账
     */
    @Override
    public List<TSafeInspectLedger> selectTSafeInspectLedgerList(TSafeInspectLedger tSafeInspectLedger)
    {
        return tSafeInspectLedgerMapper.selectTSafeInspectLedgerList(tSafeInspectLedger);
    }

    /**
     * 新增安全检查台账
     * 
     * @param tSafeInspectLedger 安全检查台账
     * @return 结果
     */
    @Override
    public int insertTSafeInspectLedger(TSafeInspectLedger tSafeInspectLedger)
    {
        tSafeInspectLedger.setCreateTime(DateUtils.getNowDate());
        tSafeInspectLedger.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
        return tSafeInspectLedgerMapper.insertTSafeInspectLedger(tSafeInspectLedger);
    }

    /**
     * 修改安全检查台账
     * 
     * @param tSafeInspectLedger 安全检查台账
     * @return 结果
     */
    @Override
    public int updateTSafeInspectLedger(TSafeInspectLedger tSafeInspectLedger)
    {
        tSafeInspectLedger.setUpdateTime(DateUtils.getNowDate());
        tSafeInspectLedger.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
        return tSafeInspectLedgerMapper.updateTSafeInspectLedger(tSafeInspectLedger);
    }

    /**
     * 批量删除安全检查台账
     * 
     * @param inspectIds 需要删除的安全检查台账ID
     * @return 结果
     */
    @Override
    public int deleteTSafeInspectLedgerByIds(Long[] inspectIds)
    {
        return tSafeInspectLedgerMapper.deleteTSafeInspectLedgerByIds(inspectIds);
    }

    /**
     * 删除安全检查台账信息
     * 
     * @param inspectId 安全检查台账ID
     * @return 结果
     */
    @Override
    public int deleteTSafeInspectLedgerById(Long inspectId)
    {
        return tSafeInspectLedgerMapper.deleteTSafeInspectLedgerById(inspectId);
    }
}
