浏览代码

bugfix:提现记录查询,提现账户增加

lyx 4 周之前
父节点
当前提交
28c1718d40

+ 13 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreCashOutRecordMapper.java

@@ -1,14 +1,27 @@
 package shop.alien.mapper;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.StoreCashOutRecord;
 
+import java.util.List;
+
 /**
  * 商户提现记录表 Mapper 接口
  *
  * @author ssk
  * @since 2025-02-25
  */
+@Mapper
 public interface StoreCashOutRecordMapper extends BaseMapper<StoreCashOutRecord> {
 
+    @Select("select scor.*, If(su.alipay_account is not null,su.alipay_account,su.phone) settlementAccount\n" +
+            "from store_cash_out_record scor\n" +
+            "left join store_user su on su.store_id = scor.store_id and su.delete_flag = 0\n" +
+            "${ew.customSqlSegment}")
+    List<StoreCashOutRecord> selectCashoutRecordList(@Param(Constants.WRAPPER) QueryWrapper<StoreCashOutRecord> wrapper);
 }

+ 9 - 7
alien-store/src/main/java/shop/alien/store/service/impl/StoreCashOutRecordServiceImpl.java

@@ -3,6 +3,7 @@ package shop.alien.store.service.impl;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
@@ -44,13 +45,14 @@ public class StoreCashOutRecordServiceImpl extends ServiceImpl<StoreCashOutRecor
 
     @Override
     public StoreCashOutRecordVo getCashOutRecordList(Integer storeId, String cashOutStartTime, String cashOutEndTime, Integer page, Integer size, String paymentStatus) {
-        LambdaQueryWrapper<StoreCashOutRecord> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(StoreCashOutRecord::getStoreId, storeId);
-        wrapper.eq(StringUtils.isNotBlank(paymentStatus), StoreCashOutRecord::getPaymentStatus, paymentStatus);
-        wrapper.le(StringUtils.isNotBlank(cashOutEndTime) , StoreCashOutRecord::getCreatedTime, cashOutEndTime + " 23:59:59");
-        wrapper.ge(StringUtils.isNotBlank(cashOutStartTime), StoreCashOutRecord::getCreatedTime, cashOutStartTime + " 00:00:00" );
-        wrapper.orderByDesc(StoreCashOutRecord::getCreatedTime);
-        List<StoreCashOutRecord> recordList = storeCashOutRecordMapper.selectList(wrapper);
+        QueryWrapper<StoreCashOutRecord> wrapper = new QueryWrapper<>();
+        wrapper.eq("scor.store_id", storeId);
+        wrapper.eq(StringUtils.isNotBlank(paymentStatus), "scor.payment_status", paymentStatus);
+        wrapper.le(StringUtils.isNotBlank(cashOutEndTime) , "scor.created_time", cashOutEndTime + " 23:59:59");
+        wrapper.ge(StringUtils.isNotBlank(cashOutStartTime), "scor.created_time", cashOutStartTime + " 00:00:00" );
+        wrapper.eq("scor.delete_flag", 0);
+        wrapper.orderByDesc("scor.created_time");
+        List<StoreCashOutRecord> recordList = storeCashOutRecordMapper.selectCashoutRecordList(wrapper);
         IPage<StoreCashOutRecord> storeCashOutRecordIPage = ListToPage.setPage(recordList, page, size);
         StoreCashOutRecordVo vo = new StoreCashOutRecordVo();
         vo.setCashOutRecordList( storeCashOutRecordIPage.getRecords());