package com.steering.pss.judge.DAL;

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.SqlBuilder;
import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;

/**
 * 数据库表QCM_ZG_PHYRESULT所对应的Java类（生成工具：代码生成工具4.0   访问地址：http://172.16.2.128/tool/）
 * @author tgcx-test   date 2016-09-29
 */
public class QcmZgPhyresultDAL extends DBCommon{

 /**
     * 通用查询
     */
    public CoreReturnObject Query(String stoveNo, Integer judgeType){
    	String processCode = "";
    	if(judgeType.toString().startsWith("1")){
    		processCode = "A";
    	}else if(judgeType.toString().startsWith("2")){
    		processCode = "B";
    	}else if(judgeType.toString().startsWith("3")){
    		processCode = "D";
    	}else if(judgeType.toString().startsWith("4")){
    		processCode = "E";
    	}
    	String strJudgeType = judgeType.toString();
    	SqlBuilder b = new SqlBuilder("QcmZgPhyresultDAL.Query");
    	b.AppendLn("AND A.STOVE_NO = {1}", strJudgeType.startsWith("1") || strJudgeType.startsWith("2"));
    	b.AppendLn("AND A.JUDGE_STOVE_NO = {1}", !strJudgeType.startsWith("1") && !strJudgeType.startsWith("2"));
    	b.AppendLn(" ORDER BY T.PHY_RESULT_ID DESC, PHY_RESULT_SEQ ASC");
    	b.Fill(new String[]{processCode, stoveNo});
        return this.getData(b.toString());
    }

    /**
     * 通过主键查询
     */
    public CoreReturnObject QueryByPk(String phyResultId, String phyResultSeq){
        String sqlQuery = CoreXmlSqlParsersFactory.getSql("QcmZgPhyresultDAL.QueryByPk");
        return this.getData(sqlQuery);
    }
}
