提交 30aa79ae authored 作者: 吴德鹏's avatar 吴德鹏

购物车分页

上级 f271e5a1
......@@ -19,6 +19,8 @@ import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
......@@ -215,8 +217,9 @@ public class CartController extends Controller {
}
@GetMapping
public Result getItemCartList() {
return new Result<>(repository.findAllByUserIdOrderByCreateTimeDesc(user.userId()));
public Result getItemCartList(@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "6") Integer pageSize) {
return new Result<>(repository.findAllByUserIdOrderByCreateTimeDesc(user.userId(), PageRequest.of(pageNo, pageSize)));
}
//Delete by array of cart ids
......
......@@ -81,7 +81,7 @@ public class FlutterWaveController extends Controller {
public ResponseEntity<String> payForOrderByCard(@RequestParam("orderId") String orderId, @RequestBody FlutterWaveCard flutterWaveCard) {
RaveConstant.PUBLIC_KEY = PUBLIC_KEY;
RaveConstant.SECRET_KEY = SECRET_KEY;
RaveConstant.ENVIRONMENT = Environment.STAGING; //or LIVE
RaveConstant.ENVIRONMENT = Environment.STAGING; //or STAGING
// Result result = new Result();
Optional<TbCfOrder> byId = repository.findById(orderId);
......@@ -135,7 +135,7 @@ public class FlutterWaveController extends Controller {
public ResponseEntity<String> payForOrderByPhone(@RequestParam("orderId") String orderId, @RequestBody FlutterWaveCard flutterWaveCard) {
RaveConstant.PUBLIC_KEY = PUBLIC_KEY;
RaveConstant.SECRET_KEY = SECRET_KEY;
RaveConstant.ENVIRONMENT = Environment.STAGING; //or LIVE
RaveConstant.ENVIRONMENT = Environment.STAGING; //or STAGING
// Result result = new Result();
Optional<TbCfOrder> byId = repository.findById(orderId);
......
......@@ -65,7 +65,6 @@ public class TbCfUserInfo {
/**
* 密码
*/
@JsonIgnore
private String password;
/**
* 上一次登录时间
......
package com.example.afrishop_v3.repository;
import com.example.afrishop_v3.models.TbCfCartRecordR;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
......@@ -20,7 +21,7 @@ public interface TbCfCartRecordRRepository extends PagingAndSortingRepository<Tb
Optional<TbCfCartRecordR> findFirstByUserIdAndSourceItemIdAndItemSkuAndEnableFlag(String userId, String sourceItemId, String itemSku, Integer flag);
@Query(value = "select a from #{#entityName} a left join TbCfStationItem x on a.itemId=x.itemId WHERE a.userId=:userId and (x.enableFlag = 1 or x.enableFlag IS NULL) and a.enableFlag=1 order by a.createTime desc")
List<TbCfCartRecordR> findAllByUserIdOrderByCreateTimeDesc(@Param("userId") String userId);
List<TbCfCartRecordR> findAllByUserIdOrderByCreateTimeDesc(@Param("userId") String userId,Pageable pageable);
List<TbCfCartRecordR> findAllByCartRecordIdIn(String[] ids);
......
......@@ -71,7 +71,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
"/goodsType/**", "/home/**", "/spider/**", "/store/**", "/shopify/**", "/community/**", "/version/**",
"/flutterwave/notify/**", "/dpo/notify/**", "/advertisement/**", "/website/**", "/paypal/**", "/discover/bonus/**",
"/problem/**", "/cube/**", "/activity/**", "/attributes/**", "/stripe/**", "/coupon/**", "/logistics/freeShippingThreshold",
"/visit/**", "/search/**", "/country/**", "/term/**", "/api/upload", "/cart/**", "/address/**").permitAll()
"/visit/**", "/search/**", "/country/**", "/term/**", "/api/upload", "/cart/**", "/address/**","/screen/**").permitAll()
.antMatchers("/api/test/**").permitAll()
.anyRequest().authenticated();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论