添加会员流水
This commit is contained in:
@@ -38,7 +38,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@Api(hidden = true)
|
@Api(hidden = true)
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
|
||||||
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
||||||
public class AppRun {
|
public class AppRun {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.ysk.cashier.mybatis.service;
|
package cn.ysk.cashier.mybatis.service;
|
||||||
|
|
||||||
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -15,7 +16,7 @@ public interface TbShopUserFlowService extends IService<TbShopUserFlow> {
|
|||||||
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime);
|
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime);
|
||||||
|
|
||||||
|
|
||||||
Map selectByUserId(Integer userId, Integer page, Integer pageSize);
|
IPage<Map<String, Object>> selectByUserId(Integer userId, Integer page, Integer pageSize);
|
||||||
|
|
||||||
Integer selectCountByUserId(Integer userId);
|
Integer selectCountByUserId(Integer userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,19 @@ package cn.ysk.cashier.mybatis.service.impl;
|
|||||||
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
import cn.ysk.cashier.mybatis.entity.TbShopUserFlow;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbShopUserFlowMapper;
|
import cn.ysk.cashier.mybatis.mapper.TbShopUserFlowMapper;
|
||||||
import cn.ysk.cashier.mybatis.service.TbShopUserFlowService;
|
import cn.ysk.cashier.mybatis.service.TbShopUserFlowService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.*;
|
import org.springframework.data.domain.*;
|
||||||
|
import org.springframework.security.core.parameters.P;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -23,21 +31,19 @@ public class TbShopUserFlowServiceImpl extends ServiceImpl<TbShopUserFlowMapper,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map selectByUserId(Integer userId, Integer page, Integer pageSize) {
|
public IPage<Map<String, Object>> selectByUserId(Integer userId, Integer page, Integer pageSize) {
|
||||||
|
|
||||||
Map map=new HashMap();
|
QueryWrapper<TbShopUserFlow> queryWrapper=new QueryWrapper<>();
|
||||||
int count= baseMapper.selectCountByUserId(userId);
|
queryWrapper.eq("shop_user_id",userId);
|
||||||
if(count>0){
|
|
||||||
Pageable pageable = PageRequest.of(page, pageSize, Sort.by("id").descending());
|
|
||||||
List<TbShopUserFlow> userFlows=baseMapper.selectByUserId(userId,pageable.getPageNumber(),pageable.getPageSize());
|
|
||||||
map.put("totalElements",count);
|
|
||||||
map.put("content",userFlows);
|
|
||||||
}else {
|
|
||||||
|
|
||||||
map.put("totalElements",0);
|
List<OrderItem> orders=new ArrayList<>();
|
||||||
map.put("content",null);
|
OrderItem orderItem=new OrderItem();
|
||||||
}
|
orderItem.setColumn("id");
|
||||||
return map;
|
orderItem.setAsc(false);
|
||||||
|
orders.add(orderItem);
|
||||||
|
Page page1=new Page<>(page,pageSize);
|
||||||
|
page1.setOrders(orders);
|
||||||
|
return baseMapper.selectMapsPage(page1,queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user