Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangw 2025-03-19 10:49:27 +08:00
commit b6c4ffdee6
5 changed files with 43 additions and 16 deletions

View File

@ -21,4 +21,6 @@ public interface ShopTableOrderStatisticMapper extends BaseMapper<ShopTableOrder
boolean incrInfo(long shopId, long tableId, long count, BigDecimal amount, String dateStr);
List<TableSummaryInfoVo> findSummaryList(TableSummaryParam param);
List<TableSummaryInfoVo> findSummaryList2(TableSummaryParam param);
}

View File

@ -23,7 +23,7 @@ public class TableSummaryServiceImpl implements TableSummaryService {
@Override
public List<TableSummaryInfoVo> summaryList(TableSummaryParam param) {
return shopTableOrderStatisticMapper.findSummaryList(param);
return shopTableOrderStatisticMapper.findSummaryList2(param);
}
}

View File

@ -64,11 +64,11 @@
WHERE t1.shop_id = #{shopId}
and t1.paid_time is not null
<if test="beginDate != null and beginDate != ''">
and t1.create_time >= str_to_date(concat(#{beginDate},' 00:00:00'), '%Y-%m-%d %H:%i:%s')
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_time <= str_to_date(concat(#{endDate},' 23:59:59'), '%Y-%m-%d %H:%i:%s')
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
]]>
</if>
group by t1.pay_type
@ -79,11 +79,11 @@
from tb_shop_user_flow t1
where t1.shop_id = #{shopId}
<if test="beginDate != null and beginDate != ''">
and t1.create_time >= str_to_date(concat(#{beginDate},' 00:00:00'), '%Y-%m-%d %H:%i:%s')
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_time <= str_to_date(concat(#{endDate},' 23:59:59'), '%Y-%m-%d %H:%i:%s')
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
]]>
</if>
group by t1.biz_code
@ -96,11 +96,11 @@
WHERE t1.shop_id = #{shopId}
and t1.paid_time is not null
<if test="beginDate != null and beginDate != ''">
and t1.create_time >= str_to_date(concat(#{beginDate},' 00:00:00'), '%Y-%m-%d %H:%i:%s')
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_time <= str_to_date(concat(#{endDate},' 23:59:59'), '%Y-%m-%d %H:%i:%s')
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
]]>
</if>
</select>
@ -112,11 +112,11 @@
WHERE t1.shop_id = #{shopId}
and t1.paid_time is not null
<if test="beginDate != null and beginDate != ''">
and t1.create_time >= str_to_date(concat(#{beginDate},' 00:00:00'), '%Y-%m-%d %H:%i:%s')
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_time <= str_to_date(concat(#{endDate},' 23:59:59'), '%Y-%m-%d %H:%i:%s')
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
]]>
</if>
</select>

View File

@ -100,11 +100,11 @@
and t2.category_id like concat('%,', #{prodCategoryId}, ',%')
</if>
<if test="beginDate != null and beginDate != ''">
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d')
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d')
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
]]>
</if>
</select>
@ -129,11 +129,11 @@
and t2.category_id = #{prodCategoryId}
</if>
<if test="beginDate != null and beginDate != ''">
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d')
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d')
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
]]>
</if>
GROUP BY t1.product_id,t1.product_name
@ -148,11 +148,11 @@
from tb_order_detail t1
where t1.shop_id = #{shopId}
<if test="beginDate != null and beginDate != ''">
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d')
and t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
<![CDATA[
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d')
and t1.create_time <= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
]]>
</if>
GROUP BY t1.product_id,t1.product_name

View File

@ -43,9 +43,34 @@
AND t1.create_day >= str_to_date(#{beginDate}, '%Y-%m-%d')
</if>
<if test="endDate != null and endDate != ''">
and t2.create_day &lt;= str_to_date(#{endDate}, '%Y-%m-%d')
and t1.create_day &lt;= str_to_date(#{endDate}, '%Y-%m-%d')
</if>
group by t1.table_id
order by sum(t1.order_count) desc,max(t1.id) desc
</select>
<select id="findSummaryList2" resultType="com.czg.order.vo.TableSummaryInfoVo">
SELECT
t1.table_code,
ifnull(t2.NAME,t1.table_code) AS table_name,
ifnull(t3.NAME,'未知') AS area_name,
count( t1.id ) AS order_count,
sum( t1.pay_amount ) as order_amount,
ifnull(count( case when t1.refund_amount > 0 then 1 end),0) AS refund_count,
ifnull( sum( t1.refund_amount ), 0 ) AS refund_amount
FROM
tb_order_info t1
LEFT JOIN tb_shop_table t2 ON t1.table_code = t2.table_code and t1.shop_id = t2.shop_id
LEFT JOIN tb_shop_table_area t3 ON t2.area_id = t3.id
where t1.shop_id = #{shopId}
and t1.table_code is not null
and t2.name is not null
<if test="beginDate != null and beginDate != ''">
AND t1.create_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
</if>
<if test="endDate != null and endDate != ''">
and t1.create_time &lt;= str_to_date(#{endDate}, '%Y-%m-%d %H:%i:%s')
</if>
GROUP BY t1.table_code
order by count( t1.id ) desc,sum( t1.pay_amount ) desc
</select>
</mapper>