package com.ruoyi.app.service.impl;

import java.util.List;

import com.ruoyi.app.DTO.HookBindBatchListDTO;
import com.ruoyi.app.DTO.HookBindDetailDTO;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.mapper.HookBindMapper;
import com.ruoyi.app.domain.HookBind;
import com.ruoyi.app.service.IHookBindService;

/**
 * 吊钩绑定Service业务层处理
 * 
 * @author coede
 * @date 2025-03-19
 */
@Service
public class HookBindServiceImpl implements IHookBindService 
{
    @Autowired
    private HookBindMapper hookBindMapper;

    /**
     * 查询吊钩绑定
     * 
     * @param batchNo 批次号
     * @return 吊钩绑定
     */
    @Override
    public HookBindBatchListDTO selectHookBindByBatch(String batchNo)
    {
        return hookBindMapper.selectHookBindByBatch(batchNo);
    }

    /**
     * 查询吊钩绑定详情
     *
     * @param hookNo 吊钩号号
     * @return 吊钩绑定
     */
    @Override
    public HookBindDetailDTO selectHookBindDetail(String hookNo)
    {
        return hookBindMapper.selectHookBindDetail(hookNo);
    }

    /**
     * 查询吊钩绑定列表
     * 
     * @param hookBind 吊钩绑定
     * @return 吊钩绑定
     */
    @Override
    public List<HookBind> selectHookBindList(HookBind hookBind)
    {
        return hookBindMapper.selectHookBindList(hookBind);
    }

    /**
     * 按批次查询吊钩绑定列表
     *
     * @param hookBind 吊钩绑定
     * @return 吊钩绑定
     */
    @Override
    public List<HookBind> selectHookBindListByBatch(HookBind hookBind)
    {
        return hookBindMapper.selectHookBindListByBatch(hookBind);
    }

    /**
     * 校验相同时间吊钩是否已绑定
     *
     * @param hookBind 吊钩绑定
     * @return 结果
     */
    @Override
    public HookBind checkHookNoUnique(HookBind hookBind)
    {
        return hookBindMapper.checkHookNoUnique(hookBind);

    }

    /**
     * 新增吊钩绑定
     * 
     * @param hookBind 吊钩绑定
     * @return 结果
     */
    @Override
    public int insertHookBind(HookBind hookBind)
    {
        hookBind.setCreateTime(DateUtils.getNowDate());
        return hookBindMapper.insertHookBind(hookBind);
    }

    /**
     * 新增吊钩批量绑定
     *
     * @param batch 吊钩绑定
     * @return 结果
     */
    @Override
    public int insertHookBindBatch(List<HookBind> batch)
    {
        return hookBindMapper.insertHookBindBatch(batch);
    }

    /**
     * 修改吊钩绑定
     * 
     * @param hookBind 吊钩绑定
     * @return 结果
     */
    @Override
    public int updateHookBind(HookBind hookBind)
    {
        hookBind.setUpdateTime(DateUtils.getNowDate());
        return hookBindMapper.updateHookBind(hookBind);
    }

    /**
     * 批量删除吊钩绑定
     * 
     * @param ids 需要删除的吊钩绑定主键
     * @return 结果
     */
    @Override
    public int deleteHookBindByIds(String[] ids)
    {
        return hookBindMapper.deleteHookBindByIds(ids);
    }

    /**
     * 删除吊钩绑定信息
     * 
     * @param id 吊钩绑定主键
     * @return 结果
     */
    @Override
    public int deleteHookBindById(String id)
    {
        return hookBindMapper.deleteHookBindById(id);
    }
}
