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.CostBaseMetalGradeEntity;

public class ComBaseMetalGrade extends DBCommon {
    public CoreReturnObject query(String strChan){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.query");
        if(!strChan.equals("")){
            sql += "AND GRADENAME LIKE '%" + strChan + "%'";
        }
        sql += "AND t.validflag='1'";
        return this.getData(sql);
    }
    public CoreReturnObject rightquery(String strChan){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.rightquery");
        if(!strChan.equals("")){
            sql += "AND GRADECODE = '" + strChan + "'";
        }
        return this.getData(sql);
    }
    public CoreReturnObject queryNum(String gang,String hejin){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.queryNum");
        if(!gang.equals("")){
            sql += "AND GRADECODE = '" + gang + "'";
        }
        if(!hejin.equals("")){
            sql += "AND ITEM_CODE = '" + hejin + "'";
        }
        return this.getData(sql);
    }
    public CoreReturnObject insert(String strJSON){
        CostBaseMetalGradeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalGradeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.insert");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject update(String strJSON,String hejin){
        CostBaseMetalGradeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalGradeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.update");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        sql += "AND ITEM_CODE = '" + hejin + "'";
        return this.setData(sql);
    }
    public CoreReturnObject delete(String strJSON){
        CostBaseMetalGradeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalGradeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.delete");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject resume(String strJSON){
        CostBaseMetalGradeEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseMetalGradeEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.resume");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    /*public CoreReturnObject queryPline(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.queryPline");
        return this.getData("PmsDao", sql);
    }2024/5/8注释肖沅累*/
    public CoreReturnObject queryGang(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.queryGang");
        return this.getData(sql);
    }
    /*public CoreReturnObject queryHejin(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.queryHejin");
        return this.getData("PmsDao", sql);
    }2024/5/8注释肖沅累*/
    /*public CoreReturnObject queryPur(String strChan){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.queryPur");
        if(!strChan.equals("")){
            sql += " AND VALIDFLAG='1' AND ARC_CODE = '" + strChan + "'";
        }
        return this.getData("PmsDao", sql);
    }2024/5/8注释肖沅累*/
    /*public CoreReturnObject queryPurNew(String strChan){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseMetalGrade.queryPur");
        if(!strChan.equals("")){
            sql += " AND VALIDFLAG='1' AND ITEM_DESC LIKE '%" + strChan + "%'";
        }
        return this.getData("PmsDao", sql);
    }2024/5/8注释肖沅累*/
}
