|
|
@@ -5,6 +5,7 @@ import com.happy.dao.IDCDao;
|
|
|
import com.happy.dto.IDCBookStatusEto;
|
|
|
import com.happy.dto.IDCHotelEto;
|
|
|
import com.happy.dto.IDCRankEto;
|
|
|
+import com.happy.dto.IDCSum;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
|
@@ -78,4 +79,23 @@ public class IDCImplDao implements IDCDao {
|
|
|
if(list != null && list.size()>0) return list;
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IDCSum getSumData(){
|
|
|
+ String sql = "select *,bookNumDay-bookNumyDay bookNumGrowth,salesAmountDay-salesAmountyDay salesAmountGrowth from (\n" +
|
|
|
+ "\t(select count(1) bookNumDay from booking where order_status = 2 and DATE_FORMAT(pay_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')) a,\n" +
|
|
|
+ "\t(select count(1) bookNumyDay from booking where order_status = 2 and DATE_FORMAT(pay_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d')) b,\n" +
|
|
|
+ "\t(select sum(pay_account) salesAmountDay from booking where order_status = 2 and DATE_FORMAT(pay_time,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')) c,\n" +
|
|
|
+ "\t(select sum(pay_account) salesAmountyDay from booking where order_status = 2 and DATE_FORMAT(pay_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d')) d,\n" +
|
|
|
+ "\t(select count(1) hotelSum from booking where order_status = 2 and DATE_FORMAT(pay_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d')) e\n" +
|
|
|
+ ")";
|
|
|
+ List<IDCSum> list = null;
|
|
|
+ try{
|
|
|
+ list = namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IDCSum.class));
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ if(list != null && list.size()>0) return list.get(0);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|