package com.jjt.inventory.service.impl;

import com.jjt.inventory.domain.TwinCalcDayPt;
import com.jjt.inventory.mapper.TwinCalcDayPtMapper;
import com.jjt.inventory.service.ITwinCalcDayPtService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 盘头库日统计数据Service业务层处理
 *
 * @author wukai
 * @date 2025-06-13
 */
@Service
public class TwinCalcDayPtServiceImpl implements ITwinCalcDayPtService {
    @Resource
    private TwinCalcDayPtMapper twinCalcDayPtMapper;

    /**
     * 查询盘头库日统计数据
     *
     * @param id 盘头库日统计数据主键
     * @return 盘头库日统计数据
     */
    @Override
    public TwinCalcDayPt selectTwinCalcDayPtById(Long id) {
        return twinCalcDayPtMapper.selectTwinCalcDayPtById(id);
    }

    /**
     * 查询盘头库日统计数据列表
     *
     * @param twinCalcDayPt 盘头库日统计数据
     * @return 盘头库日统计数据
     */
    @Override
    public List<TwinCalcDayPt> selectTwinCalcDayPtList(TwinCalcDayPt twinCalcDayPt) {
        return twinCalcDayPtMapper.selectTwinCalcDayPtList(twinCalcDayPt);
    }

    /**
     * 新增盘头库日统计数据
     *
     * @param twinCalcDayPt 盘头库日统计数据
     * @return 结果
     */
    @Override
    public int insertTwinCalcDayPt(TwinCalcDayPt twinCalcDayPt) {
        return twinCalcDayPtMapper.insertTwinCalcDayPt(twinCalcDayPt);
    }

    /**
     * 修改盘头库日统计数据
     *
     * @param twinCalcDayPt 盘头库日统计数据
     * @return 结果
     */
    @Override
    public int updateTwinCalcDayPt(TwinCalcDayPt twinCalcDayPt) {
        return twinCalcDayPtMapper.updateTwinCalcDayPt(twinCalcDayPt);
    }

    /**
     * 批量删除盘头库日统计数据
     *
     * @param ids 需要删除的盘头库日统计数据主键
     * @return 结果
     */
    @Override
    public int deleteTwinCalcDayPtByIds(Long[] ids) {
        return twinCalcDayPtMapper.deleteTwinCalcDayPtByIds(ids);
    }

    /**
     * 删除盘头库日统计数据信息
     *
     * @param id 盘头库日统计数据主键
     * @return 结果
     */
    @Override
    public int deleteTwinCalcDayPtById(Long id) {
        return twinCalcDayPtMapper.deleteTwinCalcDayPtById(id);
    }

    /**
     * 删除白坯库日统计数据信息
     *
     * @param date 白坯库日统计数据主键
     */
    @Override
    public void delete4date(String date) {
        twinCalcDayPtMapper.delete4date(date);
    }


    /**
     * 查询白坯库日统计数据
     *
     * @param date 白坯库日统计数据主键
     * @return 白坯库日统计数据
     */
    @Override
    public List<TwinCalcDayPt> selectStartDate(LocalDate date) {
        TwinCalcDayPt query = new TwinCalcDayPt();
        Map<String, Object> params = new HashMap<>(16);
        params.put("time", date);
        query.setParams(params);
        return selectTwinCalcDayPtList(query);
    }
}
