Browse Source

金币bug修改5.19退款商品homilyChart金币数统计

ljl^2
jianlin 1 month ago
parent
commit
b826f289d9
  1. 2
      src/main/java/com/example/demo/domain/vo/RefundA.java
  2. 6
      src/main/java/com/example/demo/serviceImpl/RefundServiceImpl.java
  3. 16
      src/main/resources/mapper/RefundMapper.xml

2
src/main/java/com/example/demo/domain/vo/RefundA.java

@ -41,5 +41,5 @@ public class RefundA implements Serializable {
private String category; private String category;
private BigDecimal amount; private BigDecimal amount;
private List<String> areas; private List<String> areas;
private Boolean hasIndexMatch;
} }

6
src/main/java/com/example/demo/serviceImpl/RefundServiceImpl.java

@ -146,6 +146,12 @@ public class RefundServiceImpl implements RefundService {
@Override @Override
public List<RefundA> getRefundA(RefundA refundA) { public List<RefundA> getRefundA(RefundA refundA) {
// 如果 refundGoods 存在则判断是否匹配 index 表中的 remark
if (refundA.getRefundGoods() != null && !refundA.getRefundGoods().trim().isEmpty()) {
boolean matchExists = refundMapper.isIndexTypeExist(refundA.getRefundGoods());
refundA.setHasIndexMatch(matchExists); // 设置标志位
}
// 执行原始查询获取实际存在的分类及其汇总值 // 执行原始查询获取实际存在的分类及其汇总值
List<RefundA> result = refundMapper.getRefundA(refundA); List<RefundA> result = refundMapper.getRefundA(refundA);

16
src/main/resources/mapper/RefundMapper.xml

@ -34,7 +34,21 @@
<if test='startDate != null and endDate != null'>AND d.create_time BETWEEN #{startDate} AND #{endDate}</if> <if test='startDate != null and endDate != null'>AND d.create_time BETWEEN #{startDate} AND #{endDate}</if>
<if test='area!=null and area.length>0'>and user.area=#{area}</if> <if test='area!=null and area.length>0'>and user.area=#{area}</if>
<if test='refundType != null and refundType.length>0'>AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')</if> <if test='refundType != null and refundType.length>0'>AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')</if>
<if test='refundGoods != null and refundGoods.length>0'>AND d.refund_goods LIKE CONCAT('%', #{refundGoods}, '%')</if>
<if test='refundGoods != null and refundGoods.length() > 0'>
<choose>
<!-- 是否走精确匹配 -->
<when test="hasIndexMatch">
AND d.refund_goods IN (
SELECT name FROM `index`
WHERE type = 1 AND remark = #{refundGoods}
)
</when>
<!-- 否则模糊匹配 -->
<otherwise>
AND d.refund_goods LIKE CONCAT('%', #{refundGoods}, '%')
</otherwise>
</choose>
</if>
<if test="areas != null"> <if test="areas != null">
AND area IN AND area IN
<foreach collection="areas" item="areas" open="(" separator="," close=")"> <foreach collection="areas" item="areas" open="(" separator="," close=")">

Loading…
Cancel
Save