Compare commits
65
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c18d0e8a9f | ||
|
|
1b221b13d1 | ||
|
|
135996ce19 | ||
|
|
6b85cddede | ||
|
|
e486f850f2 | ||
|
|
76c2f3a5fd | ||
|
|
bb542e7510 | ||
|
|
eba4461381 | ||
|
|
f5ad238015 | ||
|
|
4bdb24e9ac | ||
|
|
425922fd04 | ||
|
|
d65424e5bf | ||
|
|
2a35793baf | ||
|
|
d22df698b6 | ||
|
|
1771bf9909 | ||
|
|
15d69f9361 | ||
|
|
2b4089ef59 | ||
|
|
20c3e1f422 | ||
|
|
3b19d9e930 | ||
|
|
5fd11e9caf | ||
|
|
0b98dcdfe9 | ||
|
|
b373cbbe46 | ||
|
|
acd97c7b9b | ||
|
|
118bdb1666 | ||
|
|
944de228f7 | ||
|
|
25c9cd4dfc | ||
|
|
882cd226ec | ||
|
|
feb4d7af66 | ||
|
|
d75ab1ed5f | ||
|
|
a501eb7443 | ||
|
|
19941d9480 | ||
|
|
cd3d522d4f | ||
|
|
181c5078e9 | ||
|
|
e97f46e6b4 | ||
|
|
c0f89deb83 | ||
|
|
ce695463d3 | ||
|
|
83c683d473 | ||
|
|
9555474b0b | ||
|
|
a150f9e017 | ||
|
|
ecd2fa1c33 | ||
|
|
e3236d262d | ||
|
|
c8e2e16ba5 | ||
|
|
99b44faf09 | ||
|
|
b3e3cbf84b | ||
|
|
0aee11d824 | ||
|
|
fcf358a768 | ||
|
|
619369104c | ||
|
|
4f1408b9d0 | ||
|
|
029eea70cc | ||
|
|
22b1e65385 | ||
|
|
2170c48763 | ||
|
|
c2d1c48aae | ||
|
|
e14958c643 | ||
|
|
da288338cd | ||
|
|
ea430f2468 | ||
|
|
f76f79744a | ||
|
|
19daaff907 | ||
|
|
db94d8f932 | ||
|
|
53618fe362 | ||
|
|
523edffc4e | ||
|
|
c7ddb1a8b0 | ||
|
|
45c9fc814a | ||
|
|
407dc13ac4 | ||
|
|
0c06bf16c2 | ||
|
|
1db39e77d3 |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.timiserverapi</groupId>
|
<groupId>com.imyeyu.timiserverapi</groupId>
|
||||||
<artifactId>TimiServerAPI</artifactId>
|
<artifactId>TimiServerAPI</artifactId>
|
||||||
<version>1.0.56</version>
|
<version>1.0.54</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>TimiServerAPI</name>
|
<name>TimiServerAPI</name>
|
||||||
<description>imyeyu.com API</description>
|
<description>imyeyu.com API</description>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,13 +3,8 @@ package com.imyeyu.api.modules.gao.controller;
|
|||||||
import com.imyeyu.api.annotation.RequireCorePermission;
|
import com.imyeyu.api.annotation.RequireCorePermission;
|
||||||
import com.imyeyu.api.bean.CorePermissionCode;
|
import com.imyeyu.api.bean.CorePermissionCode;
|
||||||
import com.imyeyu.api.bean.ModuleCode;
|
import com.imyeyu.api.bean.ModuleCode;
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoStore;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreService;
|
|
||||||
import com.imyeyu.api.modules.user.bean.AuthOwnerType;
|
|
||||||
import com.imyeyu.api.modules.user.entity.Role;
|
import com.imyeyu.api.modules.user.entity.Role;
|
||||||
import com.imyeyu.api.modules.user.service.AuthorizationScopeService;
|
import com.imyeyu.api.modules.user.service.AuthorizationScopeService;
|
||||||
import com.imyeyu.api.modules.user.service.PermissionService;
|
|
||||||
import com.imyeyu.api.modules.user.service.RoleService;
|
|
||||||
import com.imyeyu.api.modules.user.service.UserLoginService;
|
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||||
import com.imyeyu.spring.annotation.AOPLog;
|
import com.imyeyu.spring.annotation.AOPLog;
|
||||||
import com.imyeyu.spring.annotation.RequestRateLimit;
|
import com.imyeyu.spring.annotation.RequestRateLimit;
|
||||||
@@ -31,9 +26,6 @@ public class GaoRoleController {
|
|||||||
|
|
||||||
private final UserLoginService userLoginService;
|
private final UserLoginService userLoginService;
|
||||||
private final AuthorizationScopeService authorizationScopeService;
|
private final AuthorizationScopeService authorizationScopeService;
|
||||||
private final GaoStoreService gaoStoreService;
|
|
||||||
private final PermissionService permissionService;
|
|
||||||
private final RoleService roleService;
|
|
||||||
|
|
||||||
@AOPLog
|
@AOPLog
|
||||||
@RequestRateLimit
|
@RequestRateLimit
|
||||||
@@ -42,40 +34,4 @@ public class GaoRoleController {
|
|||||||
public List<Role> availableList() {
|
public List<Role> availableList() {
|
||||||
return authorizationScopeService.listGrantableRole(userLoginService.getRequireLoginUserId(), ModuleCode.GAO);
|
return authorizationScopeService.listGrantableRole(userLoginService.getRequireLoginUserId(), ModuleCode.GAO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 查询登录用户所属门店内可管理的角色
|
|
||||||
///
|
|
||||||
/// @return 门店角色列表
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireCorePermission(CorePermissionCode.ROLE_READ)
|
|
||||||
@PostMapping("/management/list")
|
|
||||||
public List<Role> managementList() {
|
|
||||||
String loginUserId = userLoginService.getRequireLoginUserId();
|
|
||||||
GaoStore store = gaoStoreService.getByUserId(loginUserId);
|
|
||||||
if (store == null) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Role> roleList = authorizationScopeService.listManageableRole(loginUserId, ModuleCode.GAO)
|
|
||||||
.stream()
|
|
||||||
.filter(role -> role.getOwnerType() == AuthOwnerType.STORE)
|
|
||||||
.filter(role -> store.getId().equals(role.getOwnerId()))
|
|
||||||
.toList();
|
|
||||||
roleList.forEach(this::fillRoleDetail);
|
|
||||||
return roleList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 填充角色详情
|
|
||||||
///
|
|
||||||
/// @param role 角色
|
|
||||||
private void fillRoleDetail(Role role) {
|
|
||||||
role.setPermissionList(permissionService.listByRoleId(role.getId()));
|
|
||||||
role.setAllPermissionList(roleService.listPermissionByRoleId(role.getId()));
|
|
||||||
role.setChildRoleList(roleService.listChildByParentRoleId(role.getId()));
|
|
||||||
if (role.getParentRoleId() != null) {
|
|
||||||
role.setParentRole(roleService.get(role.getParentRoleId()));
|
|
||||||
}
|
|
||||||
role.setDelegationPermissionList(roleService.listDelegationPermissionByRoleId(role.getId()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.imyeyu.api.modules.gao.controller;
|
|||||||
|
|
||||||
import com.imyeyu.api.modules.gao.annotation.RequireGaoPermission;
|
import com.imyeyu.api.modules.gao.annotation.RequireGaoPermission;
|
||||||
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
import com.imyeyu.api.modules.gao.bean.GaoPermissionCode;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoPointChartService;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreChartService;
|
import com.imyeyu.api.modules.gao.service.GaoStoreChartService;
|
||||||
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
|
import com.imyeyu.api.modules.gao.service.GaoStoreScopeService;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoCustomerAgeStatView;
|
||||||
@@ -11,8 +10,6 @@ import com.imyeyu.api.modules.gao.vo.GaoCustomerGenderStatView;
|
|||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoEventRecordNumberValueDailyStatView;
|
import com.imyeyu.api.modules.gao.vo.GaoEventRecordNumberValueDailyStatView;
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointDailyStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointRedemptionProductRankView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
|
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.annotation.AOPLog;
|
import com.imyeyu.spring.annotation.AOPLog;
|
||||||
@@ -36,7 +33,6 @@ import java.util.List;
|
|||||||
public class GaoStoreChartController {
|
public class GaoStoreChartController {
|
||||||
|
|
||||||
private final GaoStoreChartService service;
|
private final GaoStoreChartService service;
|
||||||
private final GaoPointChartService pointChartService;
|
|
||||||
private final GaoStoreScopeService storeScopeService;
|
private final GaoStoreScopeService storeScopeService;
|
||||||
|
|
||||||
/// 查询客户增长趋势
|
/// 查询客户增长趋势
|
||||||
@@ -100,26 +96,4 @@ public class GaoStoreChartController {
|
|||||||
req.setStoreId(storeScopeService.resolveStoreId(req.getStoreId()));
|
req.setStoreId(storeScopeService.resolveStoreId(req.getStoreId()));
|
||||||
return service.eventRecordCalendar(req);
|
return service.eventRecordCalendar(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 查询每日积分获得、消耗和差值
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireGaoPermission(GaoPermissionCode.STAT_READ)
|
|
||||||
@PostMapping("/point/ledger/daily")
|
|
||||||
public List<GaoPointDailyStatView> pointDaily(@RequestBody GaoStoreChartReq req) {
|
|
||||||
TimiException.required(req, "积分图表请求不能为空");
|
|
||||||
req.setStoreId(storeScopeService.resolveStoreId(req.getStoreId()));
|
|
||||||
return pointChartService.dailyTrend(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 查询积分兑换产品排行
|
|
||||||
@AOPLog
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequireGaoPermission(GaoPermissionCode.STAT_READ)
|
|
||||||
@PostMapping("/point/redemption/product/rank")
|
|
||||||
public List<GaoPointRedemptionProductRankView> pointRedemptionProductRank(@RequestBody GaoStoreChartReq req) {
|
|
||||||
TimiException.required(req, "积分兑换排行请求不能为空");
|
|
||||||
req.setStoreId(storeScopeService.resolveStoreId(req.getStoreId()));
|
|
||||||
return pointChartService.redemptionProductRank(req);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.mapper;
|
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointDailyStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointRedemptionProductRankView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/// 门店积分图表统计 Mapper
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-23
|
|
||||||
public interface GaoPointChartMapper {
|
|
||||||
|
|
||||||
/// 按天汇总积分获得和消耗
|
|
||||||
List<GaoPointDailyStatView> selectDailyTrend(GaoStoreChartReq req);
|
|
||||||
|
|
||||||
/// 按产品汇总兑换积分并取前 10
|
|
||||||
List<GaoPointRedemptionProductRankView> selectRedemptionProductRank(GaoStoreChartReq req);
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.service;
|
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointDailyStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointRedemptionProductRankView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/// 门店积分图表统计服务
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-23
|
|
||||||
public interface GaoPointChartService {
|
|
||||||
|
|
||||||
/// 查询每日积分获得、消耗和差值
|
|
||||||
List<GaoPointDailyStatView> dailyTrend(GaoStoreChartReq req);
|
|
||||||
|
|
||||||
/// 查询积分兑换产品排行,按实际扣除积分取前 10
|
|
||||||
List<GaoPointRedemptionProductRankView> redemptionProductRank(GaoStoreChartReq req);
|
|
||||||
}
|
|
||||||
-43
@@ -1,43 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.service.implement;
|
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.mapper.GaoPointChartMapper;
|
|
||||||
import com.imyeyu.api.modules.gao.service.GaoPointChartService;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointDailyStatView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoPointRedemptionProductRankView;
|
|
||||||
import com.imyeyu.api.modules.gao.vo.GaoStoreChartReq;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/// 门店积分图表统计服务实现
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-23
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class GaoPointChartServiceImplement implements GaoPointChartService {
|
|
||||||
|
|
||||||
private final GaoPointChartMapper mapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GaoPointDailyStatView> dailyTrend(GaoStoreChartReq req) {
|
|
||||||
checkRangeReq(req);
|
|
||||||
return mapper.selectDailyTrend(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<GaoPointRedemptionProductRankView> redemptionProductRank(GaoStoreChartReq req) {
|
|
||||||
checkRangeReq(req);
|
|
||||||
return mapper.selectRedemptionProductRank(req);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkRangeReq(GaoStoreChartReq req) {
|
|
||||||
TimiException.required(req, "积分图表请求不能为空");
|
|
||||||
TimiException.required(req.getStoreId(), "积分图表门店不能为空");
|
|
||||||
TimiException.required(req.getBeginAt(), "积分图表开始时间不能为空");
|
|
||||||
TimiException.required(req.getEndAt(), "积分图表结束时间不能为空");
|
|
||||||
TimiException.requiredTrue(req.getBeginAt() <= req.getEndAt(), "积分图表结束时间早于开始时间");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,6 @@ import com.imyeyu.java.bean.BasePage;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/// GAO 统一履约分页查询请求
|
/// GAO 统一履约分页查询请求
|
||||||
///
|
///
|
||||||
/// @author Codex
|
/// @author Codex
|
||||||
@@ -24,9 +22,6 @@ public class GaoOrderFulfillmentPage extends BasePage {
|
|||||||
/// 客户 ID
|
/// 客户 ID
|
||||||
private String customerId;
|
private String customerId;
|
||||||
|
|
||||||
/// SKU ID 列表,任一 SKU 命中即匹配
|
|
||||||
private List<String> skuIdList;
|
|
||||||
|
|
||||||
/// 履约状态
|
/// 履约状态
|
||||||
private GaoOrderFulfillment.Status status;
|
private GaoOrderFulfillment.Status status;
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/// 每日积分获得与消耗统计
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-23
|
|
||||||
@Data
|
|
||||||
public class GaoPointDailyStatView {
|
|
||||||
|
|
||||||
/// 日期值,格式为 yyyyMMdd
|
|
||||||
private Integer dateValue;
|
|
||||||
|
|
||||||
/// 每日获得积分
|
|
||||||
private Long earnedPoints;
|
|
||||||
|
|
||||||
/// 每日消耗积分,以正数返回
|
|
||||||
private Long consumedPoints;
|
|
||||||
|
|
||||||
/// 获得积分减消耗积分
|
|
||||||
private Long netChangePoints;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/// 积分兑换产品排行统计
|
|
||||||
///
|
|
||||||
/// @author Codex
|
|
||||||
/// @since 2026-09-23
|
|
||||||
@Data
|
|
||||||
public class GaoPointRedemptionProductRankView {
|
|
||||||
|
|
||||||
/// 产品 ID
|
|
||||||
private String productId;
|
|
||||||
|
|
||||||
/// 产品名称
|
|
||||||
private String productName;
|
|
||||||
|
|
||||||
/// 兑换单数
|
|
||||||
private Long redemptionCount;
|
|
||||||
|
|
||||||
/// 实际扣除积分合计,不扣除退回积分
|
|
||||||
private Long pointCost;
|
|
||||||
}
|
|
||||||
@@ -39,14 +39,6 @@
|
|||||||
<if test="storeId != null and storeId != ''">AND `store_id` = #{storeId}</if>
|
<if test="storeId != null and storeId != ''">AND `store_id` = #{storeId}</if>
|
||||||
<if test="salesOrderId != null and salesOrderId != ''">AND `sales_order_id` = #{salesOrderId}</if>
|
<if test="salesOrderId != null and salesOrderId != ''">AND `sales_order_id` = #{salesOrderId}</if>
|
||||||
<if test="customerId != null and customerId != ''">AND `customer_id` = #{customerId}</if>
|
<if test="customerId != null and customerId != ''">AND `customer_id` = #{customerId}</if>
|
||||||
<if test="skuIdList != null and skuIdList.size() > 0">
|
|
||||||
AND EXISTS (
|
|
||||||
SELECT 1 FROM `gao_order_fulfillment_item` fulfillment_item
|
|
||||||
WHERE fulfillment_item.`fulfillment_id` = `gao_order_fulfillment`.`id`
|
|
||||||
AND fulfillment_item.`sku_id` IN
|
|
||||||
<foreach collection="skuIdList" item="skuId" open="(" separator="," close=")">#{skuId}</foreach>
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
<if test="status != null">AND `status` = #{status}</if>
|
<if test="status != null">AND `status` = #{status}</if>
|
||||||
<if test="beginAt != null">AND `delivered_at` >= #{beginAt}</if>
|
<if test="beginAt != null">AND `delivered_at` >= #{beginAt}</if>
|
||||||
<if test="endAt != null">AND `delivered_at` <= #{endAt}</if>
|
<if test="endAt != null">AND `delivered_at` <= #{endAt}</if>
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
||||||
<mapper namespace="com.imyeyu.api.modules.gao.mapper.GaoPointChartMapper">
|
|
||||||
<select id="selectDailyTrend" resultType="com.imyeyu.api.modules.gao.vo.GaoPointDailyStatView">
|
|
||||||
SELECT
|
|
||||||
CAST(DATE_FORMAT(FROM_UNIXTIME(l.`occurred_at` / 1000), '%Y%m%d') AS UNSIGNED) AS `dateValue`,
|
|
||||||
COALESCE(SUM(CASE WHEN l.`change_type` = 'EARN' THEN l.`point_delta` ELSE 0 END), 0) AS `earnedPoints`,
|
|
||||||
COALESCE(SUM(CASE WHEN l.`change_type` = 'CONSUME' THEN -l.`point_delta` ELSE 0 END), 0) AS `consumedPoints`,
|
|
||||||
COALESCE(SUM(l.`point_delta`), 0) AS `netChangePoints`
|
|
||||||
FROM `gao_point_ledger` l
|
|
||||||
WHERE l.`deleted_at` IS NULL
|
|
||||||
AND l.`store_id` = #{storeId}
|
|
||||||
AND l.`occurred_at` >= #{beginAt}
|
|
||||||
AND l.`occurred_at` <= #{endAt}
|
|
||||||
AND l.`change_type` IN ('EARN', 'CONSUME')
|
|
||||||
GROUP BY DATE_FORMAT(FROM_UNIXTIME(l.`occurred_at` / 1000), '%Y%m%d')
|
|
||||||
ORDER BY `dateValue` ASC
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectRedemptionProductRank" resultType="com.imyeyu.api.modules.gao.vo.GaoPointRedemptionProductRankView">
|
|
||||||
SELECT
|
|
||||||
r.`product_id_snapshot` AS `productId`,
|
|
||||||
COALESCE(MAX(NULLIF(r.`product_name_snapshot`, '')), '未命名产品') AS `productName`,
|
|
||||||
COUNT(1) AS `redemptionCount`,
|
|
||||||
COALESCE(SUM(r.`actual_point_cost`), 0) AS `pointCost`
|
|
||||||
FROM `gao_point_redemption` r
|
|
||||||
WHERE r.`deleted_at` IS NULL
|
|
||||||
AND r.`store_id` = #{storeId}
|
|
||||||
AND r.`product_id_snapshot` IS NOT NULL
|
|
||||||
AND r.`redeemed_at` >= #{beginAt}
|
|
||||||
AND r.`redeemed_at` <= #{endAt}
|
|
||||||
GROUP BY r.`product_id_snapshot`
|
|
||||||
ORDER BY `pointCost` DESC, `redemptionCount` DESC, `productName` ASC, `productId` ASC
|
|
||||||
LIMIT 10
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
Reference in New Issue
Block a user