From bf25c80bccec5692e471bf6ae87f991b7782a5d9 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 25 十二月 2024 14:38:58 +0800
Subject: [PATCH] 验光师端代码
---
manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java b/manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java
index c4e2be2..551cb1b 100644
--- a/manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java
+++ b/manage/src/main/java/com/jilongda/manage/service/impl/TCouponServiceImpl.java
@@ -1,10 +1,26 @@
package com.jilongda.manage.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.jilongda.common.basic.PageInfo;
+import com.jilongda.manage.mapper.TCouponReceiveMapper;
+import com.jilongda.manage.mapper.TStoreMapper;
import com.jilongda.manage.model.TCoupon;
import com.jilongda.manage.mapper.TCouponMapper;
+import com.jilongda.manage.model.TCouponReceive;
+import com.jilongda.manage.model.TOrder;
+import com.jilongda.manage.model.TStore;
+import com.jilongda.manage.query.TCouponQuery;
import com.jilongda.manage.service.TCouponService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jilongda.manage.vo.TAppUserVO;
+import com.jilongda.manage.vo.TCouponVO;
+import org.apache.ibatis.annotations.ResultType;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
/**
* <p>
@@ -17,4 +33,38 @@
@Service
public class TCouponServiceImpl extends ServiceImpl<TCouponMapper, TCoupon> implements TCouponService {
+ @Resource
+ private TStoreMapper storeMapper;
+ @Resource
+ private TCouponReceiveMapper couponReceiveMapper;
+ @Override
+ public PageInfo<TCouponVO> pageList(TCouponQuery query) {
+ PageInfo<TCouponVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+ List<TCouponVO> list = this.baseMapper.pageList(query,pageInfo);
+ StringBuilder stringBuilder = new StringBuilder();
+ for (TCouponVO tAppUserCouponVO : list) {
+ if (StringUtils.hasLength(tAppUserCouponVO.getStoreId())) {
+ List<TStore> tStores = storeMapper.selectList(new LambdaQueryWrapper<TStore>()
+ .in(TStore::getId, Arrays.asList(tAppUserCouponVO.getStoreId().split(","))));
+ for (TStore tStoreVO : tStores) {
+ stringBuilder.append(tStoreVO.getName()).append(",");
+ }
+ tAppUserCouponVO.setStoreName(stringBuilder.substring(0, stringBuilder.length() - 1));
+ } else {
+ tAppUserCouponVO.setStoreName("不限");
+ }
+ // 查询发放数量和使用数量
+ int size = couponReceiveMapper.selectList(new LambdaQueryWrapper<TCouponReceive>()
+ .eq(TCouponReceive::getCouponId, tAppUserCouponVO.getId())).size();
+ tAppUserCouponVO.setGrantCout(size);
+ int size1 = couponReceiveMapper.selectList(new LambdaQueryWrapper<TCouponReceive>()
+ .eq(TCouponReceive::getCouponId, tAppUserCouponVO.getId())
+ .eq(TCouponReceive::getStatus, 2)).size();
+ tAppUserCouponVO.setUseCount(size1);
+ }
+
+ pageInfo.setRecords(list);
+ return pageInfo;
+
+ }
}
--
Gitblit v1.7.1