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.comm.tools.SqlBuilder;
import com.steering.pss.pncost.entity.CostBaseGradePriceEntity;;
public class ComBaseGradePrice extends DBCommon{
    public CoreReturnObject queryduan(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.queryduan");
        return this.getData(sql);
    }
    public CoreReturnObject querygang(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.querygang");
        return this.getData(sql);
    }
    public CoreReturnObject query(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.query");
        
        return this.getData(sql);
    }
    public CoreReturnObject query2(String year){
        SqlBuilder b = new SqlBuilder("ComBaseGradePrice.query2");
        b.Fill(new String[]{year});
        return this.getData(b.toString());
    }
    public CoreReturnObject isave(String strJSON){
        CostBaseGradePriceEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseGradePriceEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.isave");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject usave(String strJSON){
        CostBaseGradePriceEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseGradePriceEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.usave");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject delete(String strJSON){
        CostBaseGradePriceEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseGradePriceEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.delete");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject resume(String strJSON){
        CostBaseGradePriceEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseGradePriceEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.resume");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject querynum(String gang,String duan){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseGradePrice.querynum");
        if(!gang.equals("")){
            sql += "AND GRADECODE = '" + gang + "'";
        }
        if(!duan.equals("")){
            sql += "AND SPEC_CODE = '" + duan + "'";
        }
        return this.getData(sql);
    }
}
