package com.steering.pss.sale.order.orderchange;

import CoreFS.SA08.CoreXmlSqlParsersFactory;
import com.steering.comm.tools.EntityTool;
import com.steering.pss.sale.order.bomGeneration.model.BaseMaterialEntity;
import com.steering.pss.sale.order.model.CrmSlmOrder;
import com.steering.pss.sale.order.model.SlmBaseMaterialEntity;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class CrmBaseMaterialService {

    public void saveBaseMaterial(Connection con, BaseMaterialEntity baseMaterial) throws SQLException {
        String sql = CoreXmlSqlParsersFactory
                .getSql("CrmBaseMaterial.saveBaseMaterial");
        sql = EntityTool.fillSqlByEntity(sql, baseMaterial);
        PreparedStatement ps = con.prepareStatement(sql);
        ps.executeUpdate();
        ps.close();
    }

    public String updateBaseMaterial(SlmBaseMaterialEntity slmBaseMaterialEntity, String dataStatus) {
        slmBaseMaterialEntity.setDataStatus(dataStatus);
        String sql = CoreXmlSqlParsersFactory
                .getSql("CrmBaseMaterial.updateBaseMaterial");
        sql = EntityTool.fillSqlByEntity(sql, slmBaseMaterialEntity);
        return sql;
    }
}
