package com.steering.pss.pncost.base;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.EntityTool;
import com.steering.pss.pncost.entity.CostBaseMetalTypeEntity;

public class ComBaseMetalType extends DBCommon{
    public CoreReturnObject query(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalType.query");
        return this.getData(sql);
    }
    public CoreReturnObject queryPliao(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalType.queryPliao");
        return this.getData(sql);
    }
    public CoreReturnObject queryNum(String gang){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalType.queryNum");
        if(!gang.equals("")){
            sql += "AND ITEM_CODE = '" + gang + "'";
        }
        return this.getData(sql);
    }
    
    public CoreReturnObject isave(String strJSON){
        CostBaseMetalTypeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalTypeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalType.isave");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject usave(String strJSON,String hejin){
        CostBaseMetalTypeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalTypeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalType.usave");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        sql += "AND ITEM_CODE = '" + hejin + "'";
        return this.setData(sql);
    }
    public CoreReturnObject delete(String strJSON){
        CostBaseMetalTypeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalTypeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalType.delete");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject resume(String strJSON){
        CostBaseMetalTypeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalTypeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalType.resume");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
}
