package com.rongwei.bscommon.sys.dao;

import com.rongwei.bsentity.domain.VNcOrderDetailVo;
import com.rongwei.bsentity.domain.VNcOrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SlaveOracleDao {

    /**
     * 获取创新数据库的客户订单
     *
     * @return
     */

    @Select({" <script>",
            "select CSALEORDERID,VBILLCODE as ORDERNO,DBILLDATE as ORDERDATE,VNOTE as REMARK,NAME as BELONGFACTORY from V_BC_SO_SALEORDER where VBILLCODE in",
            " <foreach collection=\"orderNos\" item=\"orderno\" index=\"index\" open=\"(\" close=\")\" separator=\",\"> ",
            "  #{orderno}",
            "</foreach>",
            "</script>"})
    List<VNcOrderVo> getVNcOrderVo(@Param("orderNos") List<String> orderNos);

    /**
     * 获取创新数据库的客户订单明细
     *
     * @return
     */
    @Select({" <script>",
            "select b.CSALEORDERBID as ID,s.VBILLCODE as ORDERNO,b.CMATERIALVID as MATERIALCODE,b.MATERIALNAME,b.MATERIALSPEC as SPECIALFICATION,b.NNUM as TOTALORDERCOUNT,",
            "   b.CUNITID as NUMBERUNIT,b.VROWNOTE as REMARK,b.PAIHAO as ALLOY,b.ZHUANGTAI as ALLOYSTATUS,b.HOUDU as THICKNESS,b.KUANDU as PROWIDTH,b.CHANGDU as PROLENGTH ",
            "from V_BC_SO_SALEORDER_B b",
            "left join V_BC_SO_SALEORDER s on b.CSALEORDERID=s.CSALEORDERID",
            "where b.NNUM>=0 and s.VBILLCODE in",
            " <foreach collection=\"orderNos\" item=\"orderno\" index=\"index\" open=\"(\" close=\")\" separator=\",\"> ",
            "  #{orderno}",
            "</foreach>",
            "</script>"})
    List<VNcOrderDetailVo> getVNcOrderDetailVo(@Param("orderNos") List<String> orderNos);
}
