package com.steering.pss.crm.server;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.Util.StringUtils;
import com.steering.comm.db.DBCommon;

public class CrmBaseMaterialServer extends DBCommon {

    public CoreReturnObject Query(String material, String startDate, String endDate) {
        String sql = CoreXmlSqlParsersFactory.getSql("CrmBaseMaterial.Query");
        if (!StringUtils.isEmpty(material)) {
            sql += " AND T.MATERIAL_DESC like '%" + material + "%'";
        }
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            sql += " AND T.CREATE_TIME BETWEEN to_date('" + startDate + "','yyyy-MM-dd HH24:MI:SS') AND to_date('" + endDate + "','yyyy-MM-dd HH24:MI:SS')";
        }
        sql += " ORDER BY T.CREATE_TIME";
        return this.getData(sql);
    }
}
