45 lines
2.0 KiB
Java
45 lines
2.0 KiB
Java
package com.rj.mapper;
|
||
|
||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||
import com.rj.dto.LbBuyerTradeStats;
|
||
import com.rj.entity.LbOrderRow;
|
||
import org.apache.ibatis.annotations.Mapper;
|
||
import org.apache.ibatis.annotations.Param;
|
||
|
||
import java.math.BigDecimal;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
@Mapper
|
||
public interface LbOrderRowMapper extends BaseMapper<LbOrderRow> {
|
||
|
||
/**
|
||
* 按订单 id(主键)插入或更新;跳过租户行拦截,避免 listByIds 因 tenant_id 过滤漏判导致重复插入。
|
||
*/
|
||
@InterceptorIgnore(tenantLine = "true")
|
||
int upsertBatch(@Param("list") List<LbOrderRow> list);
|
||
|
||
/**
|
||
* 按租户与买家汇总:每位买家取 pay_time 最新(相同时取 id 最大)的已支付订单。
|
||
*/
|
||
List<LbBuyerTradeStats> selectLatestPaidStatsByTenantId(@Param("tenantId") String tenantId,
|
||
@Param("dataType") String dataType);
|
||
|
||
/**
|
||
* 按租户、买家ID列表和时间范围查询订单总金额。
|
||
*/
|
||
BigDecimal selectSumTotalMoneyByBuyerIdsAndTimeRange(@Param("tenantId") String tenantId,
|
||
@Param("buyerIds") List<String> buyerIds,
|
||
@Param("buyStartTime") String buyStartTime,
|
||
@Param("buyEndTime") String buyEndTime);
|
||
|
||
/**
|
||
* 按租户、买家ID列表和时间范围分组查询每个买家的订单总金额。
|
||
*/
|
||
List<Map<String, Object>> selectSumTotalMoneyGroupByBuyerIds(@Param("tenantId") String tenantId,
|
||
@Param("buyerIds") List<String> buyerIds,
|
||
@Param("buyStartTime") String buyStartTime,
|
||
@Param("buyEndTime") String buyEndTime);
|
||
}
|