3 files modified
3 files added
| New file |
| | |
| | | package com.xzx.gc.shop.controller; |
| | | |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.xzx.gc.common.request.BaseController; |
| | | import com.xzx.gc.model.JsonResult; |
| | | import com.xzx.gc.shop.dto.XcxOrderListDto; |
| | | import com.xzx.gc.shop.service.OrderService; |
| | | import com.xzx.gc.shop.vo.XcxOrderListVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @RestController |
| | | @Api(tags = {"积分商城--API订单管理"}) |
| | | @Slf4j |
| | | public class ApiOrderController extends BaseController { |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @ApiOperation("我的订单列表") |
| | | @ApiResponses( |
| | | @ApiResponse(code = 200, message = "success", response = XcxOrderListVo.class) |
| | | ) |
| | | @PostMapping(value = "/order/list") |
| | | public JsonResult<PageInfo<XcxOrderListVo>> orderList(@RequestBody XcxOrderListDto xcxOrderListDto, HttpServletRequest request) { |
| | | String userId = getUserId(request); |
| | | xcxOrderListDto.setUserId(userId); |
| | | return JsonResult.success(orderService.orderList(xcxOrderListDto)); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.xzx.gc.shop.dto; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "XcxOrderListDto", description = "小程序订单列表参数接收类") |
| | | public class XcxOrderListDto { |
| | | |
| | | @ApiModelProperty(value="页码") |
| | | private int pageNo=1; |
| | | |
| | | @ApiModelProperty(value="每页显示记录数") |
| | | private int pageSize=10; |
| | | |
| | | @ApiModelProperty(value = "状态 1-未完成 2-已完成 3-已取消") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String userId; |
| | | } |
| | |
| | | |
| | | import com.xzx.gc.entity.ScoreOrder; |
| | | import com.xzx.gc.shop.dto.QueryOrderListDto; |
| | | import com.xzx.gc.shop.dto.XcxOrderListDto; |
| | | import com.xzx.gc.shop.vo.QueryOrderListVo; |
| | | import com.xzx.gc.shop.vo.XcxOrderListVo; |
| | | import com.xzx.gc.util.GcMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | @Param("status")Integer status, |
| | | @Param("createdTimeStart")Date createdTimeStart, |
| | | @Param("createdTimeEnd")Date createdTimeEnd); |
| | | |
| | | List<XcxOrderListVo> selectXcxOrderList(@Param("record") XcxOrderListDto xcxOrderListDto); |
| | | } |
| | |
| | | import com.xzx.gc.shop.vo.ExpressInfoVo; |
| | | import com.xzx.gc.shop.vo.QueryOrderListVo; |
| | | import com.xzx.gc.shop.vo.ViewOrderVo; |
| | | import com.xzx.gc.shop.vo.XcxOrderListVo; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | scoreOrderMapper.updateByPrimaryKeySelective(scoreOrder); |
| | | return scoreOrder.getId(); |
| | | } |
| | | |
| | | public PageInfo<XcxOrderListVo> orderList(XcxOrderListDto xcxOrderListDto) { |
| | | PageHelper.startPage(xcxOrderListDto.getPageNo(), xcxOrderListDto.getPageSize()); |
| | | List<XcxOrderListVo> data = scoreOrderMapper.selectXcxOrderList(xcxOrderListDto); |
| | | return new PageInfo<>(data); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.xzx.gc.shop.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel(value = "XcxOrderListVo", description = "小程序订单列表接口参数返回类") |
| | | public class XcxOrderListVo { |
| | | |
| | | @ApiModelProperty(value = "订单ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNo; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @ApiModelProperty(value = "下单时间") |
| | | private Date createdTime; |
| | | |
| | | @ApiModelProperty(value = "缩略图") |
| | | private String thumb; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "样式名称") |
| | | private String style; |
| | | |
| | | @ApiModelProperty(value = "sku名称") |
| | | private String sku; |
| | | |
| | | @ApiModelProperty(value = "数量") |
| | | private Integer cnt; |
| | | |
| | | @ApiModelProperty(value = "状态 1-待发货 2-待收货 3-已收货 4-已完成 6-已取消") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "总价") |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty(value = "单价") |
| | | private BigDecimal unitPrice; |
| | | |
| | | } |
| | |
| | | order by a.CREATED_TIME desc |
| | | </select> |
| | | |
| | | <select id="selectXcxOrderList" resultType="com.xzx.gc.shop.vo.XcxOrderListVo"> |
| | | select |
| | | a.*, |
| | | b.unit_price, |
| | | b.sku, |
| | | b.style, |
| | | b.thumb |
| | | from xzx_score_order a |
| | | inner join xzx_score_order_details b on a.id=b.order_id |
| | | <where> |
| | | a.user_id=#{record.userId} |
| | | <if test="record.status == 1"> |
| | | and a.status in (1, 2, 3) |
| | | </if> |
| | | <if test="record.status == 2"> |
| | | and a.status = 4 |
| | | </if> |
| | | <if test="record.status == 3"> |
| | | and a.status = 6 |
| | | </if> |
| | | </where> |
| | | order by a.created_time desc |
| | | </select> |
| | | |
| | | </mapper> |