|
@@ -20,10 +20,11 @@ import java.util.List;
|
|
|
* @Date: 2023-04-19
|
|
* @Date: 2023-04-19
|
|
|
* @Version: V1.0
|
|
* @Version: V1.0
|
|
|
*/
|
|
*/
|
|
|
-public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
|
|
|
|
+public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 收款汇总统计全部
|
|
* 收款汇总统计全部
|
|
|
|
|
+ *
|
|
|
* @param page
|
|
* @param page
|
|
|
* @param busRoomPayTypes
|
|
* @param busRoomPayTypes
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
@@ -32,35 +33,36 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Select("<script>select max(h.name) as hotel_name,'POS' as department\n" +
|
|
@Select("<script>select max(h.name) as hotel_name,'POS' as department\n" +
|
|
|
- "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
|
|
|
|
|
|
|
+ "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
|
|
|
"SUM(case ogp.payment_method when '${item.id}' then ogp.pay_money else 0 end) as '${item.name}'\n" +
|
|
"SUM(case ogp.payment_method when '${item.id}' then ogp.pay_money else 0 end) as '${item.name}'\n" +
|
|
|
- "</foreach>"+
|
|
|
|
|
|
|
+ "</foreach>" +
|
|
|
"from bus_hotel_info h\n" +
|
|
"from bus_hotel_info h\n" +
|
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
|
"left join pos_order_goods_payment ogp on pty.id=ogp.payment_method\n" +
|
|
"left join pos_order_goods_payment ogp on pty.id=ogp.payment_method\n" +
|
|
|
"where 1=1" +
|
|
"where 1=1" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>" +
|
|
|
"group by h.id\n" +
|
|
"group by h.id\n" +
|
|
|
"UNION ALL\n" +
|
|
"UNION ALL\n" +
|
|
|
"select max(h.name) as hotel_name,'客房' as department\n" +
|
|
"select max(h.name) as hotel_name,'客房' as department\n" +
|
|
|
- "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
|
|
|
|
|
|
|
+ "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
|
|
|
"SUM(case of.pay_type when '${item.id}' then of.money else 0 end) as '${item.name}'\n" +
|
|
"SUM(case of.pay_type when '${item.id}' then of.money else 0 end) as '${item.name}'\n" +
|
|
|
- "</foreach>"+
|
|
|
|
|
|
|
+ "</foreach>" +
|
|
|
"from bus_hotel_info h\n" +
|
|
"from bus_hotel_info h\n" +
|
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
|
"left join bus_order_fee of on pty.id=of.pay_type\n" +
|
|
"left join bus_order_fee of on pty.id=of.pay_type\n" +
|
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and of.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and of.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and of.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and of.create_time <= #{endTime} </if>" +
|
|
|
"group by h.id</script>")
|
|
"group by h.id</script>")
|
|
|
- public List<HashMap<String,Object>> pageList(Page<HashMap<String,Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> pageList(Page<HashMap<String, Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 收款汇总统计POS
|
|
* 收款汇总统计POS
|
|
|
|
|
+ *
|
|
|
* @param page
|
|
* @param page
|
|
|
* @param busRoomPayTypes
|
|
* @param busRoomPayTypes
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
@@ -69,21 +71,22 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Select("<script>select max(h.name) as hotel_name,'POS' as department\n" +
|
|
@Select("<script>select max(h.name) as hotel_name,'POS' as department\n" +
|
|
|
- "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
|
|
|
|
|
|
|
+ "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
|
|
|
"SUM(case ogp.payment_method when '${item.id}' then ogp.pay_money else 0 end) as '${item.name}'\n" +
|
|
"SUM(case ogp.payment_method when '${item.id}' then ogp.pay_money else 0 end) as '${item.name}'\n" +
|
|
|
- "</foreach>"+
|
|
|
|
|
|
|
+ "</foreach>" +
|
|
|
"from bus_hotel_info h\n" +
|
|
"from bus_hotel_info h\n" +
|
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
|
"left join pos_order_goods_payment ogp on pty.id=ogp.payment_method\n" +
|
|
"left join pos_order_goods_payment ogp on pty.id=ogp.payment_method\n" +
|
|
|
"where 1=1" +
|
|
"where 1=1" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>" +
|
|
|
"group by h.id</script>")
|
|
"group by h.id</script>")
|
|
|
- public List<HashMap<String,Object>> posPageList(Page<HashMap<String,Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> posPageList(Page<HashMap<String, Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 收款汇总统计全部
|
|
* 收款汇总统计全部
|
|
|
|
|
+ *
|
|
|
* @param page
|
|
* @param page
|
|
|
* @param busRoomPayTypes
|
|
* @param busRoomPayTypes
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
@@ -92,22 +95,23 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Select("<script>select max(h.name) as hotel_name,'客房' as department\n" +
|
|
@Select("<script>select max(h.name) as hotel_name,'客房' as department\n" +
|
|
|
- "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>"+
|
|
|
|
|
|
|
+ "<foreach item='item' index='index' collection='busRoomPayTypes' open=',' separator=',' close=' '>" +
|
|
|
"SUM(case of.pay_type when '${item.id}' then of.money else 0 end) as '${item.name}'\n" +
|
|
"SUM(case of.pay_type when '${item.id}' then of.money else 0 end) as '${item.name}'\n" +
|
|
|
- "</foreach>"+
|
|
|
|
|
|
|
+ "</foreach>" +
|
|
|
"from bus_hotel_info h\n" +
|
|
"from bus_hotel_info h\n" +
|
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
"inner join bus_room_pay_type_info pty on h.id=pty.hotel_id\n" +
|
|
|
"left join bus_order_fee of on pty.id=of.pay_type\n" +
|
|
"left join bus_order_fee of on pty.id=of.pay_type\n" +
|
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and of.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and of.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and h.id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and of.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and of.create_time <= #{endTime} </if>" +
|
|
|
"group by h.id</script>")
|
|
"group by h.id</script>")
|
|
|
- public List<HashMap<String,Object>> roomPageList(Page<HashMap<String,Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> roomPageList(Page<HashMap<String, Object>> page, @Param("busRoomPayTypes") List<BusRoomPayType> busRoomPayTypes, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 收退款明细列表
|
|
* 收退款明细列表
|
|
|
|
|
+ *
|
|
|
* @param page
|
|
* @param page
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
|
* @param startTime
|
|
* @param startTime
|
|
@@ -119,9 +123,9 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"from pos_order_goods_payment ogp \n" +
|
|
"from pos_order_goods_payment ogp \n" +
|
|
|
"left join bus_room_pay_type_info pty on pty.id=ogp.payment_method\n" +
|
|
"left join bus_room_pay_type_info pty on pty.id=ogp.payment_method\n" +
|
|
|
"where 1=1" +
|
|
"where 1=1" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>" +
|
|
|
"UNION ALL\n" +
|
|
"UNION ALL\n" +
|
|
|
"select '住客' as department,pty.name as payment_method_name,\n" +
|
|
"select '住客' as department,pty.name as payment_method_name,\n" +
|
|
|
"case when of.money>=0 then '收款' else '退款' end as fee_type,\n" +
|
|
"case when of.money>=0 then '收款' else '退款' end as fee_type,\n" +
|
|
@@ -132,15 +136,16 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"left join ces_rooms r on r.id=of.room_id\n" +
|
|
"left join ces_rooms r on r.id=of.room_id\n" +
|
|
|
"left join bus_customer c on c.id=rlo.contact_id\n" +
|
|
"left join bus_customer c on c.id=rlo.contact_id\n" +
|
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and of.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and of.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and of.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and of.create_time <= #{endTime} </if>" +
|
|
|
"</script>")
|
|
"</script>")
|
|
|
- public List<HashMap<String,Object>> financePage(Page<HashMap<String,Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> financePage(Page<HashMap<String, Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* POS收退款明细列表
|
|
* POS收退款明细列表
|
|
|
|
|
+ *
|
|
|
* @param page
|
|
* @param page
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
|
* @param startTime
|
|
* @param startTime
|
|
@@ -152,14 +157,15 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"from pos_order_goods_payment ogp \n" +
|
|
"from pos_order_goods_payment ogp \n" +
|
|
|
"left join bus_room_pay_type_info pty on pty.id=ogp.payment_method\n" +
|
|
"left join bus_room_pay_type_info pty on pty.id=ogp.payment_method\n" +
|
|
|
"where 1=1" +
|
|
"where 1=1" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and ogp.hotel_id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and ogp.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and ogp.create_time <= #{endTime} </if>" +
|
|
|
"</script>")
|
|
"</script>")
|
|
|
- public List<HashMap<String,Object>> postFinancePage(Page<HashMap<String,Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> postFinancePage(Page<HashMap<String, Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 住客收退款明细列表
|
|
* 住客收退款明细列表
|
|
|
|
|
+ *
|
|
|
* @param page
|
|
* @param page
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
|
* @param startTime
|
|
* @param startTime
|
|
@@ -175,14 +181,15 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"left join ces_rooms r on r.id=of.room_id\n" +
|
|
"left join ces_rooms r on r.id=of.room_id\n" +
|
|
|
"left join bus_customer c on c.id=rlo.contact_id\n" +
|
|
"left join bus_customer c on c.id=rlo.contact_id\n" +
|
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
"where of.fee_type=2 and of.preferential_status=2" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>"+
|
|
|
|
|
- "<if test='startTime != null'> and of.create_time >= #{startTime} </if>"+
|
|
|
|
|
- "<if test='endTime != null'> and of.create_time <= #{endTime} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and pty.hotel_id = #{hotelId} </if>" +
|
|
|
|
|
+ "<if test='startTime != null'> and of.create_time >= #{startTime} </if>" +
|
|
|
|
|
+ "<if test='endTime != null'> and of.create_time <= #{endTime} </if>" +
|
|
|
"</script>")
|
|
"</script>")
|
|
|
- public List<HashMap<String,Object>> roomFinancePage(Page<HashMap<String,Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> roomFinancePage(Page<HashMap<String, Object>> page, @Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 按时间每天收入统计列表
|
|
* 按时间每天收入统计列表
|
|
|
|
|
+ *
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
|
* @param startTime
|
|
* @param startTime
|
|
|
* @param endTime
|
|
* @param endTime
|
|
@@ -205,7 +212,7 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"\t) a\n" +
|
|
"\t) a\n" +
|
|
|
"\tLEFT JOIN \n" +
|
|
"\tLEFT JOIN \n" +
|
|
|
"\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1" +
|
|
"\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>" +
|
|
|
") b\n" +
|
|
") b\n" +
|
|
|
"\tON a.time =date(b.create_time)\n" +
|
|
"\tON a.time =date(b.create_time)\n" +
|
|
|
"GROUP BY a.time\t\n" +
|
|
"GROUP BY a.time\t\n" +
|
|
@@ -226,15 +233,16 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"\t) a\n" +
|
|
"\t) a\n" +
|
|
|
"\tLEFT JOIN \n" +
|
|
"\tLEFT JOIN \n" +
|
|
|
"\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2" +
|
|
"\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = #{hotelId} </if>" +
|
|
|
") b\n" +
|
|
") b\n" +
|
|
|
"\tON a.time =date(b.create_time)\n" +
|
|
"\tON a.time =date(b.create_time)\n" +
|
|
|
"GROUP BY a.time)t\n" +
|
|
"GROUP BY a.time)t\n" +
|
|
|
"group by time\t</script>")
|
|
"group by time\t</script>")
|
|
|
- public List<HashMap<String,Object>> dayShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> dayShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 按时间每月收入统计列表
|
|
* 按时间每月收入统计列表
|
|
|
|
|
+ *
|
|
|
* @param hotelId
|
|
* @param hotelId
|
|
|
* @param startTime
|
|
* @param startTime
|
|
|
* @param endTime
|
|
* @param endTime
|
|
@@ -249,15 +257,15 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"\tselect DATE_FORMAT(time, '%Y-%m' ) as time from\n" +
|
|
"\tselect DATE_FORMAT(time, '%Y-%m' ) as time from\n" +
|
|
|
"\t(select adddate('${startTime}',INTERVAL t0.i MONTH ) AS time from\n" +
|
|
"\t(select adddate('${startTime}',INTERVAL t0.i MONTH ) AS time from\n" +
|
|
|
"\t (select 0 i " +
|
|
"\t (select 0 i " +
|
|
|
- "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>"+
|
|
|
|
|
- " select ${item}"+
|
|
|
|
|
- "</foreach>"+
|
|
|
|
|
|
|
+ "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>" +
|
|
|
|
|
+ " select ${item}" +
|
|
|
|
|
+ "</foreach>" +
|
|
|
") t0) v\n" +
|
|
") t0) v\n" +
|
|
|
"\tORDER BY time\n" +
|
|
"\tORDER BY time\n" +
|
|
|
"\t) a\n" +
|
|
"\t) a\n" +
|
|
|
"\tLEFT JOIN \n" +
|
|
"\tLEFT JOIN \n" +
|
|
|
"\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1" +
|
|
"\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
|
|
|
") b\n" +
|
|
") b\n" +
|
|
|
"\tON a.time =DATE_FORMAT(b.create_time, '%Y-%m' )\n" +
|
|
"\tON a.time =DATE_FORMAT(b.create_time, '%Y-%m' )\n" +
|
|
|
"GROUP BY a.time\t\n" +
|
|
"GROUP BY a.time\t\n" +
|
|
@@ -269,18 +277,120 @@ public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
"\tselect DATE_FORMAT(time, '%Y-%m' ) as time from\n" +
|
|
"\tselect DATE_FORMAT(time, '%Y-%m' ) as time from\n" +
|
|
|
"\t(select adddate('${startTime}',INTERVAL t0.i MONTH ) AS time from\n" +
|
|
"\t(select adddate('${startTime}',INTERVAL t0.i MONTH ) AS time from\n" +
|
|
|
"\t (select 0 i " +
|
|
"\t (select 0 i " +
|
|
|
- "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>"+
|
|
|
|
|
- " select ${item}"+
|
|
|
|
|
- "</foreach>"+
|
|
|
|
|
|
|
+ "<foreach item='item' index='index' collection='months' open=' union ' separator=' union ' close=' '>" +
|
|
|
|
|
+ " select ${item}" +
|
|
|
|
|
+ "</foreach>" +
|
|
|
") t0) v\n" +
|
|
") t0) v\n" +
|
|
|
"\tORDER BY time\n" +
|
|
"\tORDER BY time\n" +
|
|
|
"\t) a\n" +
|
|
"\t) a\n" +
|
|
|
"\tLEFT JOIN \n" +
|
|
"\tLEFT JOIN \n" +
|
|
|
"\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2\n" +
|
|
"\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2\n" +
|
|
|
- "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>"+
|
|
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
|
|
|
"\t) b ON a.time =DATE_FORMAT(b.create_time, '%Y-%m' )\n" +
|
|
"\t) b ON a.time =DATE_FORMAT(b.create_time, '%Y-%m' )\n" +
|
|
|
"GROUP BY a.time)t\n" +
|
|
"GROUP BY a.time)t\n" +
|
|
|
"group by time\t</script>")
|
|
"group by time\t</script>")
|
|
|
- public List<HashMap<String,Object>> monthShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("months") List<Integer> months);
|
|
|
|
|
|
|
+ public List<HashMap<String, Object>> monthShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("months") List<Integer> months);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按时间每季度收入统计列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param hotelId
|
|
|
|
|
+ * @param startTime
|
|
|
|
|
+ * @param endTime
|
|
|
|
|
+ * @param quarters
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Select("<script>select time,sum(room_money) as room_money,sum(other_money) as other_money from \n" +
|
|
|
|
|
+ "(SELECT 'pos' as type, a.time\n" +
|
|
|
|
|
+ ",0 AS room_money,\n" +
|
|
|
|
|
+ "sum(ifnull(b.pay_money,0)) as other_money\n" +
|
|
|
|
|
+ "FROM (\n" +
|
|
|
|
|
+ "\tselect concat(DATE_FORMAT(time, '%Y' ),'年-',QUARTER(time),'季度') as time from\n" +
|
|
|
|
|
+ "\t(select adddate('${startTime}',INTERVAL t0.i*3 MONTH ) AS time from\n" +
|
|
|
|
|
+ "\t (select 0 i " +
|
|
|
|
|
+ "<foreach item='item' index='index' collection='quarters' open=' union ' separator=' union ' close=' '>" +
|
|
|
|
|
+ " select ${item}" +
|
|
|
|
|
+ "</foreach>" +
|
|
|
|
|
+ ") t0) v\n" +
|
|
|
|
|
+ "\tORDER BY time\n" +
|
|
|
|
|
+ "\t) a\n" +
|
|
|
|
|
+ "\tLEFT JOIN \n" +
|
|
|
|
|
+ "\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1\n" +
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
|
|
|
|
|
+ " ) b" +
|
|
|
|
|
+ "\tON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年-',QUARTER(b.create_time),'季度')\n" +
|
|
|
|
|
+ "GROUP BY a.time\t\n" +
|
|
|
|
|
+ "UNION ALL\n" +
|
|
|
|
|
+ "SELECT '客房' as type, a.time,\n" +
|
|
|
|
|
+ "sum(ifnull((case b.subject_type when 1 then b.money when 2 then b.money when 3 then b.money else 0 end),0)) AS room_money,\n" +
|
|
|
|
|
+ "sum(ifnull((case b.subject_type when 6 then b.money when 7 then b.money else 0 end),0)) AS other_money\n" +
|
|
|
|
|
+ "FROM (\n" +
|
|
|
|
|
+ "\tselect concat(DATE_FORMAT(time, '%Y' ),'年-',QUARTER(time),'季度') as time from\n" +
|
|
|
|
|
+ "\t(select adddate('${startTime}',INTERVAL t0.i*3 MONTH ) AS time from\n" +
|
|
|
|
|
+ "\t (select 0 i " +
|
|
|
|
|
+ "<foreach item='item' index='index' collection='quarters' open=' union ' separator=' union ' close=' '>" +
|
|
|
|
|
+ " select ${item}" +
|
|
|
|
|
+ "</foreach>" +
|
|
|
|
|
+ ") t0) v\n" +
|
|
|
|
|
+ "\tORDER BY time\n" +
|
|
|
|
|
+ "\t) a\n" +
|
|
|
|
|
+ "\tLEFT JOIN \n" +
|
|
|
|
|
+ "\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2\n" +
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
|
|
|
|
|
+ " ) b ON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年-',QUARTER(b.create_time),'季度')\n" +
|
|
|
|
|
+ "GROUP BY a.time)t\n" +
|
|
|
|
|
+ "group by time</script>")
|
|
|
|
|
+ public List<HashMap<String, Object>> quarterShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("quarters") List<Integer> quarters);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按时间每年收入统计列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param hotelId
|
|
|
|
|
+ * @param startTime
|
|
|
|
|
+ * @param endTime
|
|
|
|
|
+ * @param years
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Select("<script>select time,sum(room_money) as room_money,sum(other_money) as other_money from \n" +
|
|
|
|
|
+ "(SELECT 'pos' as type, a.time\n" +
|
|
|
|
|
+ ",0 AS room_money,\n" +
|
|
|
|
|
+ "sum(ifnull(b.pay_money,0)) as other_money\n" +
|
|
|
|
|
+ "FROM (\n" +
|
|
|
|
|
+ "\tselect concat(DATE_FORMAT(time, '%Y' ),'年') as time from\n" +
|
|
|
|
|
+ "\t(select adddate('${startTime}',INTERVAL t0.i YEAR ) AS time from\n" +
|
|
|
|
|
+ "\t (select 0 i " +
|
|
|
|
|
+ "<foreach item='item' index='index' collection='years' open=' union ' separator=' union ' close=' '>" +
|
|
|
|
|
+ " select ${item}" +
|
|
|
|
|
+ "</foreach>" +
|
|
|
|
|
+ ") t0) v\n" +
|
|
|
|
|
+ "\tORDER BY time\n" +
|
|
|
|
|
+ "\t) a\n" +
|
|
|
|
|
+ "\tLEFT JOIN \n" +
|
|
|
|
|
+ "\t( SELECT id,create_time,pay_money FROM pos_order_goods_payment where 1=1\n" +
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
|
|
|
|
|
+ " ) b" +
|
|
|
|
|
+ "\tON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年')\n" +
|
|
|
|
|
+ "GROUP BY a.time\t\n" +
|
|
|
|
|
+ "UNION ALL\n" +
|
|
|
|
|
+ "SELECT '客房' as type, a.time,\n" +
|
|
|
|
|
+ "sum(ifnull((case b.subject_type when 1 then b.money when 2 then b.money when 3 then b.money else 0 end),0)) AS room_money,\n" +
|
|
|
|
|
+ "sum(ifnull((case b.subject_type when 6 then b.money when 7 then b.money else 0 end),0)) AS other_money\n" +
|
|
|
|
|
+ "FROM (\n" +
|
|
|
|
|
+ "\tselect concat(DATE_FORMAT(time, '%Y' ),'年') as time from\n" +
|
|
|
|
|
+ "\t(select adddate('${startTime}',INTERVAL t0.i YEAR) AS time from\n" +
|
|
|
|
|
+ "\t (select 0 i " +
|
|
|
|
|
+ "<foreach item='item' index='index' collection='years' open=' union ' separator=' union ' close=' '>" +
|
|
|
|
|
+ " select ${item}" +
|
|
|
|
|
+ "</foreach>" +
|
|
|
|
|
+ ") t0) v\n" +
|
|
|
|
|
+ "\tORDER BY time\n" +
|
|
|
|
|
+ "\t) a\n" +
|
|
|
|
|
+ "\tLEFT JOIN \n" +
|
|
|
|
|
+ "\t( SELECT * FROM bus_order_fee where fee_type=1 and preferential_status=2\n" +
|
|
|
|
|
+ "<if test='hotelId != null and hotelId !=\"\"'> and hotel_id = '${hotelId}' </if>" +
|
|
|
|
|
+ " ) b ON a.time =concat(DATE_FORMAT(b.create_time, '%Y' ),'年')\n" +
|
|
|
|
|
+ "GROUP BY a.time)t\n" +
|
|
|
|
|
+ "group by time</script>")
|
|
|
|
|
+ public List<HashMap<String, Object>> yearShouRuStatList(@Param("hotelId") String hotelId, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime, @Param("years") List<Integer> years);
|
|
|
|
|
|
|
|
}
|
|
}
|