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.CostBaseProcesscostCEntity;;
public class ComBaseProcesscostC extends DBCommon{

    public CoreReturnObject query(String gang){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseProcesscostC.query");
        if(!gang.equals("")){
            sql += "AND PLINE_NAME like '%" + gang + "%'";
        }
        sql += " order by t.validflag desc,t.pline_code,t.schedule_min";
        return this.getData(sql);
    }
    public CoreReturnObject queryPliao(){
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseProcesscostC.queryPliao");
        return this.getData(sql);
    }
    public CoreReturnObject queryNum(String gang,String min,String max){
        SqlBuilder b = new SqlBuilder("ComBaseProcesscostC.queryNum");
        b.Fill(new String[]{gang,min,max});
        return this.getData(b.toString());
    }
    public CoreReturnObject queryshangxia(String gang,String min,String max){
        SqlBuilder b = new SqlBuilder("ComBaseProcesscostC.queryshangxia");
        b.Fill(new String[]{gang,min,max});
        return this.getData(b.toString());
    }
    public CoreReturnObject isave(String strJSON){
        CostBaseProcesscostCEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseProcesscostCEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseProcesscostC.isave");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }

    public CoreReturnObject usave(String strJSON,String hejin,String min,String max){
        CostBaseProcesscostCEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseProcesscostCEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseProcesscostC.usave");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        sql += " AND PLINE_NAME =  '" + hejin + "'";
        sql += " AND T.SCHEDULE_MIN =  '" + min + "'";
        sql += " AND T.SCHEDULE_MAX =  '" + max + "'";
        return this.setData(sql);
    }
    public CoreReturnObject delete(String strJSON){
        CostBaseProcesscostCEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseProcesscostCEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseProcesscostC.delete");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
    public CoreReturnObject resume(String strJSON){
        CostBaseProcesscostCEntity batching = EntityTool.getEntityByJSONStr(strJSON, CostBaseProcesscostCEntity.class);
        String sql = CoreXmlSqlParsersFactory.getSql("ComBaseProcesscostC.resume");
        sql = EntityTool.fillSqlByEntity(sql, batching);
        return this.setData(sql);
    }
}
