package com.younike.system.service.impl;

import java.util.List;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.younike.system.mapper.ProfitSharingRecordMapper;
import com.younike.system.domain.ProfitSharingRecord;
import com.younike.system.service.IProfitSharingRecordService;

/**
 * 分账记录Service业务层处理
 * 
 * @author golden
 * @date 2022-03-11
 */
@Service
public class ProfitSharingRecordServiceImpl implements IProfitSharingRecordService {
    @Autowired
    private ProfitSharingRecordMapper profitSharingRecordMapper;

    /**
     * 查询分账记录
     * 
     * @param id 分账记录主键
     * @return 分账记录
     */
    @Override
    public ProfitSharingRecord selectProfitSharingRecordById(Long id) {
        return profitSharingRecordMapper.selectProfitSharingRecordById(id);
    }

    /**
     * 查询分账记录列表
     * 
     * @param profitSharingRecord 分账记录
     * @return 分账记录
     */
    @Override
    public List<ProfitSharingRecord> selectProfitSharingRecordList(ProfitSharingRecord profitSharingRecord) {
        return profitSharingRecordMapper.selectProfitSharingRecordList(profitSharingRecord);
    }

    /**
     * 新增分账记录
     * 
     * @param profitSharingRecord 分账记录
     * @return 结果
     */
    @Override
    public int insertProfitSharingRecord(ProfitSharingRecord profitSharingRecord) {
        profitSharingRecord.setCreateTime(LocalDateTime.now());
        return profitSharingRecordMapper.insertProfitSharingRecord(profitSharingRecord);
    }

    /**
     * 修改分账记录
     * 
     * @param profitSharingRecord 分账记录
     * @return 结果
     */
    @Override
    public int updateProfitSharingRecord(ProfitSharingRecord profitSharingRecord) {
        profitSharingRecord.setUpdateTime(LocalDateTime.now());
        return profitSharingRecordMapper.updateProfitSharingRecord(profitSharingRecord);
    }

    /**
     * 批量删除分账记录
     * 
     * @param ids 需要删除的分账记录主键
     * @return 结果
     */
    @Override
    public int deleteProfitSharingRecordByIds(Long[] ids) {
        return profitSharingRecordMapper.deleteProfitSharingRecordByIds(ids);
    }

    /**
     * 删除分账记录信息
     * 
     * @param id 分账记录主键
     * @return 结果
     */
    @Override
    public int deleteProfitSharingRecordById(Long id)
    {
        return profitSharingRecordMapper.deleteProfitSharingRecordById(id);
    }
}
