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.ISoSaleDao;
import com.hzya.frame.plugin.lets.entity.SoSaleEntity;
import com.hzya.frame.plugin.lets.u8cdto.QuantityHandDto;
import com.hzya.frame.plugin.lets.u8cdto.QuantityHandResultDto;

import java.util.List;

/**
 * (SoSale)表数据库访问层
 *
 * @author makejava
 * @since 2023-08-16 15:49:53
 */
//@Repository("SoSaleDaoImpl")
public class SoSaleDaoImpl extends MybatisGenericDao<SoSaleEntity, String> implements ISoSaleDao {

    @DS("sowow_sqlserver_test")
    @Override
    public List<SoSaleEntity> querySoSaleEntity(SoSaleEntity soSaleEntity) throws Exception {
        return query("com.hzya.frame.plugin.lets.dao.impl.SoSaleDaoImpl.querySoSaleEntity", soSaleEntity);
    }

    @DS("sowow_sqlserver_test")
    @Override
    public List<QuantityHandResultDto> queryQuantityHand(QuantityHandDto soSaleEntity) throws Exception {
        return (List<QuantityHandResultDto>) selectList("com.hzya.frame.plugin.lets.dao.impl.SoSaleDaoImpl.queryQuantityHand", soSaleEntity);
    }

    @DS("sowow_sqlserver_test")
    @Override
    public List<QuantityHandResultDto> queryQuantityHandV2(QuantityHandDto soSaleEntity) throws Exception {
        return (List<QuantityHandResultDto>) selectList("com.hzya.frame.plugin.lets.dao.impl.SoSaleDaoImpl.queryQuantityHandV2", soSaleEntity);
    }

    @DS("sowow_sqlserver_test")
    @Override
    public void updateSoSale(SoSaleEntity soSaleEntity) throws Exception {
        Assert.notNull(soSaleEntity, "soSaleEntity is null");
        Assert.notNull(soSaleEntity.getVdef20(), "原始订单号不能为空");
        Assert.notNull(soSaleEntity.getCsaleid(), "主键不能为空");
        update("com.hzya.frame.plugin.lets.dao.impl.SoSaleDaoImpl.updateSoSaleByCsaleid", soSaleEntity);
    }
}