package com.zehong.system.service.impl;

import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDebitCreditMapper;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.service.ITDebitCreditService;

/**
 * 借贷Service业务层处理
 * 
 * @author zehong
 * @date 2023-06-20
 */
@Service
public class TDebitCreditServiceImpl implements ITDebitCreditService 
{
    @Autowired
    private TDebitCreditMapper tDebitCreditMapper;

    /**
     * 查询借贷
     * 
     * @param debitId 借贷ID
     * @return 借贷
     */
    @Override
    public TDebitCredit selectTDebitCreditById(Long debitId)
    {
        return tDebitCreditMapper.selectTDebitCreditById(debitId);
    }

    /**
     * 查询借贷列表
     * 
     * @param tDebitCredit 借贷
     * @return 借贷
     */
    @Override
    public List<TDebitCredit> selectTDebitCreditList(TDebitCredit tDebitCredit)
    {
        return tDebitCreditMapper.selectTDebitCreditList(tDebitCredit);
    }

    /**
     * 新增借贷
     * 
     * @param tDebitCredit 借贷
     * @return 结果
     */
    @Override
    public int insertTDebitCredit(TDebitCredit tDebitCredit)
    {
        tDebitCredit.setCreateTime(DateUtils.getNowDate());
        return tDebitCreditMapper.insertTDebitCredit(tDebitCredit);
    }

    /**
     * 修改借贷
     * 
     * @param tDebitCredit 借贷
     * @return 结果
     */
    @Override
    public int updateTDebitCredit(TDebitCredit tDebitCredit)
    {
        tDebitCredit.setUpdateTime(DateUtils.getNowDate());
        return tDebitCreditMapper.updateTDebitCredit(tDebitCredit);
    }

    /**
     * 批量删除借贷
     * 
     * @param debitIds 需要删除的借贷ID
     * @return 结果
     */
    @Override
    public int deleteTDebitCreditByIds(Long[] debitIds)
    {
        return tDebitCreditMapper.deleteTDebitCreditByIds(debitIds);
    }

    /**
     * 删除借贷信息
     * 
     * @param debitId 借贷ID
     * @return 结果
     */
    @Override
    public int deleteTDebitCreditById(Long debitId)
    {
        return tDebitCreditMapper.deleteTDebitCreditById(debitId);
    }
}
