package com.hzya.frame.plugin.lets.dao.impl;

import cn.hutool.core.lang.Assert;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.lets.dao.IBdInvmandocDao;
import com.hzya.frame.plugin.lets.entity.BdInvmandocEntity;

import java.util.List;

/**
 * (BdInvmandoc)表数据库访问层
 *
 * @author makejava
 * @since 2023-08-25 11:21:44
 */
//@Repository("BdInvmandocDaoImpl")
public class BdInvmandocDaoImpl extends MybatisGenericDao<BdInvmandocEntity, String> implements IBdInvmandocDao {
    @DS("lets_u8c")
    @Override
    public BdInvmandocEntity queryBdInvmandocByInvcode(BdInvmandocEntity bdInvmandocEntity) throws Exception {
        Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity must not be null");
//        Assert.notNull(bdInvmandocEntity.getInvcode(), "存货档案编码不能为空");
//        Assert.notNull(bdInvmandocEntity.getPkCorp(), "存货档案所属企业id不能为空");

        List<BdInvmandocEntity> bdInvmandocEntityList = query("com.hzya.frame.plugin.lets.dao.impl.BdInvmandocDaoImpl.queryBdInvmandocByInvcode", bdInvmandocEntity);
        if (bdInvmandocEntityList != null && bdInvmandocEntityList.size() > 0) {
            return bdInvmandocEntityList.get(0);
        }
        return null;
    }

    @DS("lets_u8c")
    @Override
    public List<BdInvmandocEntity> queryBdInvmandocByInvcodeList(BdInvmandocEntity bdInvmandocEntity) throws Exception {
        Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity must not be null!");
        return query("com.hzya.frame.plugin.lets.dao.impl.BdInvmandocDaoImpl.queryBdInvmandocByInvcode", bdInvmandocEntity);
    }
}