package com.chinacreator.process.dao;

import java.sql.SQLException;
import java.util.List;
import org.springframework.stereotype.Component;
import com.chinacreator.process.bean.DiscntInfo;
import com.chinacreator.process.util.DataSource;
import com.frameworkset.common.poolman.SQLExecutor;

@Component
public class ChangshiDao {

	public List<DiscntInfo> queryDiscntInfo(String userid,String discntValue) throws SQLException {
		String sql = "SELECT *  FROM (  SELECT  SERIALNUMBER userid, DISCNTCODE discntid,"
				+ "DISCNTSTARTDATE ordertime, DISCNTENDDATE endtime,DISCNTORDERSTATE TYPE,"
				+ "row_number() over(partition by DISCNTCODE order by inserttime desc) rn  "
				+ "FROM TD_PRODUCT_ORDERSYN WHERE SERIALNUMBER = ? and dicntvalue=? AND ORIGIN IN ('1','2')) where rn =1";
		return SQLExecutor.queryListWithDBName(DiscntInfo.class, DataSource.SDK, sql, userid,discntValue);
	}

}
