|
|
@@ -0,0 +1,108 @@
|
|
|
+package org.jeecg.modules.finance.mapper;
|
|
|
+
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
+import org.apache.ibatis.annotations.Select;
|
|
|
+import org.jeecg.modules.business.entity.BusRoomPayType;
|
|
|
+import org.jeecg.modules.kc.entity.KcDepositoryInGoods;
|
|
|
+import org.jeecg.modules.pos.entity.PosOrderGoodsPayment;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 收款汇总统计
|
|
|
+ * @Author: jeecg-boot
|
|
|
+ * @Date: 2023-04-19
|
|
|
+ * @Version: V1.0
|
|
|
+ */
|
|
|
+public interface SummaryMapper extends BaseMapper<PosOrderGoodsPayment> {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收款汇总统计全部
|
|
|
+ * @param page
|
|
|
+ * @param busRoomPayTypes
|
|
|
+ * @param hotelId
|
|
|
+ * @param startTime
|
|
|
+ * @param endTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Select("<script>select max(h.name) as hotel_name,'POS' as department\n" +
|
|
|
+ "<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" +
|
|
|
+ "</foreach>"+
|
|
|
+ "from bus_hotel_info h\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" +
|
|
|
+ "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>"+
|
|
|
+ "group by h.id\n" +
|
|
|
+ "UNION ALL\n" +
|
|
|
+ "select max(h.name) as hotel_name,'客房' as department\n" +
|
|
|
+ "<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" +
|
|
|
+ "</foreach>"+
|
|
|
+ "from bus_hotel_info h\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" +
|
|
|
+ "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>"+
|
|
|
+ "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);
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收款汇总统计POS
|
|
|
+ * @param page
|
|
|
+ * @param busRoomPayTypes
|
|
|
+ * @param hotelId
|
|
|
+ * @param startTime
|
|
|
+ * @param endTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Select("<script>select max(h.name) as hotel_name,'POS' as department,\n" +
|
|
|
+ "<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" +
|
|
|
+ "</foreach>"+
|
|
|
+ "from bus_hotel_info h\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" +
|
|
|
+ "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>"+
|
|
|
+ "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);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收款汇总统计全部
|
|
|
+ * @param page
|
|
|
+ * @param busRoomPayTypes
|
|
|
+ * @param hotelId
|
|
|
+ * @param startTime
|
|
|
+ * @param endTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Select("<script>select max(h.name) as hotel_name,'客房' as department,\n" +
|
|
|
+ "<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" +
|
|
|
+ "</foreach>"+
|
|
|
+ "from bus_hotel_info h\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" +
|
|
|
+ "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>"+
|
|
|
+ "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);
|
|
|
+
|
|
|
+}
|