feat(shopping): 添加购物初始化接口并优化分页数据结构
- 在PageData类中添加Collections.emptyList()默认值防止空指针异常 - 为PageData类中的getter方法添加标准格式的空格 - 新增ShoppingInitRequest请求实体类用于接收购物初始化参数 - 添加modelId和targetId字段的非空验证注解 - 实现ShoppingController中的init接口方法并返回成功响应 - 导入必要的RequestBody、Valid注解和ShoppingInitRequest类
This commit is contained in:
parent
54c76e64b1
commit
c32bd930fa
|
|
@ -7,6 +7,7 @@ import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
|
@ -38,18 +39,18 @@ public class PageData<T> implements Serializable {
|
||||||
//是否有下一页
|
//是否有下一页
|
||||||
private boolean hasNextPage;
|
private boolean hasNextPage;
|
||||||
|
|
||||||
public boolean isHasNextPage(){
|
public boolean isHasNextPage() {
|
||||||
return page < getTotalPages();
|
return page < getTotalPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
//是否有上一页
|
//是否有上一页
|
||||||
private boolean hasPrevPage;
|
private boolean hasPrevPage;
|
||||||
|
|
||||||
public boolean isHasPrevPage(){
|
public boolean isHasPrevPage() {
|
||||||
return page > 1;
|
return page > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//分页数据
|
//分页数据
|
||||||
@Setter
|
@Setter
|
||||||
private Collection<T> items;
|
private Collection<T> items = Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,16 @@ import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||||
import com.nflg.mobilebroken.common.pojo.vo.SimpleUserVO;
|
import com.nflg.mobilebroken.common.pojo.vo.SimpleUserVO;
|
||||||
import com.nflg.mobilebroken.common.util.AppUserUtil;
|
import com.nflg.mobilebroken.common.util.AppUserUtil;
|
||||||
import com.nflg.mobilebroken.quotation.controller.ControllerBase;
|
import com.nflg.mobilebroken.quotation.controller.ControllerBase;
|
||||||
|
import com.nflg.mobilebroken.quotation.pojo.request.ShoppingInitRequest;
|
||||||
import com.nflg.mobilebroken.repository.entity.TBaseCustomer;
|
import com.nflg.mobilebroken.repository.entity.TBaseCustomer;
|
||||||
import com.nflg.mobilebroken.repository.service.IAppUserService;
|
import com.nflg.mobilebroken.repository.service.IAppUserService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -47,4 +50,9 @@ public class ShoppingController extends ControllerBase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApiResult init(@Valid @RequestBody ShoppingInitRequest request){
|
||||||
|
//TODO
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.nflg.mobilebroken.quotation.pojo.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ShoppingInitRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机型ID
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long modelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报价对象ID
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Integer targetId;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue