@@ -1657,31 +1657,40 @@ public class AsmCourseResourceDao extends GenericHibernateDao<AsmCourseresource,
returnnull;
}
privatevoidupdatePriceField(){
privatevoidupdatePriceField(Datedate,Datenow){
// String sql1 = "delete from asm_courseresource WHERE PriceDate < CURDATE()";
// String sql2 = "update asm_courseresource t SET t.MinPrice = false, t.MinPrice2 = false WHERE t.PriceDate >= CURDATE()";
//modify by caosy for delay 2 day to delete resource
Stringsql1="delete from asm_courseresource WHERE PriceDate < DATE_SUB(CURDATE(),INTERVAL 3 day)";
Stringsql2="update asm_courseresource t SET t.MinPrice = false, t.MinPrice2 = false WHERE t.PriceDate >= DATE_SUB(CURDATE(),INTERVAL 3 day)";
Stringsql2="update asm_courseresource t SET t.MinPrice = false, t.MinPrice2 = false WHERE t.courseid in (SELECT courseid FROM (SELECT DISTINCT courseid from asm_courseresource where Update_LastTime=:Update_LastTime) temp) and t.PriceDate >= DATE_SUB(CURDATE(),INTERVAL 3 day)";
// "select id from (SELECT SUBSTRING_INDEX(GROUP_CONCAT(id ORDER BY salePrice,teeTime ASC),',',1) AS id FROM asm_courseresource t where t.PriceDate >= CURDATE() "
// + " and t.courseStatus!="
...
...
@@ -1712,8 +1721,11 @@ public class AsmCourseResourceDao extends GenericHibernateDao<AsmCourseresource,
+ResourcePriceStatusEnum.getSql(null)+" and publishDate<=PriceDate and PriceDate<=offlineDate AND t.courseid in (SELECT DISTINCT courseid from asm_courseresource where Update_LastTime=:Update_LastTime)"+" GROUP BY t.CourseID,t.PriceDate) as tmp";
Queryquery=this.getSession().createSQLQuery(sql);
query.setParameter("Update_LastTime",now);
List<String>ids=query.list();
StringidStrs="";
if(ids!=null){
intindex=0;
...
...
@@ -1733,7 +1745,7 @@ public class AsmCourseResourceDao extends GenericHibernateDao<AsmCourseresource,
*
* @return
*/
privateStringgetSponsorMinIds(){
privateStringgetSponsorMinIds(Datenow){
Stringsql="SELECT CASE WHEN LOCATE(CONCAT('=540p=', minPrice2),datas) THEN SUBSTRING_INDEX(SUBSTRING(datas from 1 for LOCATE(CONCAT('=540p=', minPrice2),datas)-1),',',-1) ELSE minId END as id"
+" FROM (SELECT SUBSTRING_INDEX(GROUP_CONCAT(sponsorPrice ORDER BY sponsorPrice,teeTime ASC),',',1) minPrice2,GROUP_CONCAT(id,'=',teeTime,'p=',sponsorPrice) datas,SUBSTRING_INDEX(GROUP_CONCAT(id ORDER BY sponsorPrice,teeTime ASC),',',1) minId"
...
...
@@ -1751,9 +1763,12 @@ public class AsmCourseResourceDao extends GenericHibernateDao<AsmCourseresource,
+ResourcePriceStatusEnum.getSql(null)+" and publishDate<=PriceDate and PriceDate<=offlineDate"+" GROUP BY t.CourseID,t.PriceDate) as tmp";
+ResourcePriceStatusEnum.getSql(null)+" and publishDate<=PriceDate and PriceDate<=offlineDate and t.courseid in (SELECT DISTINCT courseid from asm_courseresource where Update_LastTime=:Update_LastTime)"+" GROUP BY t.CourseID,t.PriceDate) as tmp";