Helius
2021-06-28 3c1b5a586e8ecabf903a549500f2a48bfd3fad95
add orderList
6 files modified
76 ■■■■■ changed files
gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java 11 ●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/dto/AddJhyOrderDto.java 3 ●●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java 7 ●●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java 8 ●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderListVo.java 24 ●●●● patch | view | raw | blame | history
gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml 23 ●●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java
@@ -1,5 +1,6 @@
package com.xzx.gc.order.controller;
import com.github.pagehelper.PageInfo;
import com.xzx.gc.common.Result;
import com.xzx.gc.common.request.BaseController;
import com.xzx.gc.model.JsonResult;
@@ -9,6 +10,8 @@
import com.xzx.gc.order.vo.JhyOrderListVo;
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;
@@ -34,9 +37,13 @@
    }
    @ApiOperation("集物员订单列表")
    @ApiResponses(
            @ApiResponse(code = 200, message = "success", response = JhyOrderListVo.class)
    )
    @PostMapping(value = "/jhy/order/list")
    public JsonResult<JhyOrderListVo> orderList(@RequestBody JhyOrderListDto jhyOrderListDto) {
        return null;
    public JsonResult<PageInfo<JhyOrderListVo>> orderList(@RequestBody JhyOrderListDto jhyOrderListDto) {
        PageInfo<JhyOrderListVo> result = jhyOrderService.orderList(jhyOrderListDto);
        return JsonResult.success(result);
    }
gc-order/src/main/java/com/xzx/gc/order/dto/AddJhyOrderDto.java
@@ -11,6 +11,9 @@
@ApiModel(value = "AddJhyOrderDto", description = "小程序下单参数接收类")
public class AddJhyOrderDto {
    @ApiModelProperty(value = "地址类型")
    private String addressType;
    @ApiModelProperty(value = "地址ID")
    private Long addressId;
gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java
@@ -1,9 +1,16 @@
package com.xzx.gc.order.mapper;
import com.xzx.gc.entity.JhyOrder;
import com.xzx.gc.order.dto.JhyOrderListDto;
import com.xzx.gc.order.vo.JhyOrderListVo;
import com.xzx.gc.util.GcMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface JhyOrderMapper extends GcMapper<JhyOrder> {
    List<JhyOrderListVo> selectJhyOrderList(@Param("record") JhyOrderListDto jhyOrderListDto);
}
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
@@ -1,6 +1,8 @@
package com.xzx.gc.order.service;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.common.utils.IdUtils;
import com.xzx.gc.entity.AddressInfo;
@@ -91,7 +93,9 @@
        }
    }
    public List<JhyOrderListVo> orderList(JhyOrderListDto orderListDto) {
        return null;
    public PageInfo<JhyOrderListVo> orderList(JhyOrderListDto orderListDto) {
        PageHelper.startPage(orderListDto.getPageNo(), orderListDto.getPageSize());
        List<JhyOrderListVo> data = jhyOrderMapper.selectJhyOrderList(orderListDto);
        return new PageInfo<>(data);
    }
}
gc-order/src/main/java/com/xzx/gc/order/vo/JhyOrderListVo.java
@@ -15,7 +15,7 @@
    private String reserveTime;
    @ApiModelProperty(value = "姓名")
    private String name;
    private String username;
    @ApiModelProperty(value = "手机号")
    private String phone;
@@ -27,14 +27,32 @@
    private String address;
    @ApiModelProperty(value = "经度")
    private String lon;
    private String longitude;
    @ApiModelProperty(value = "纬度")
    private String lat;
    private String latitude;
    @ApiModelProperty(value = "重量")
    private String weight;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "入库时间")
    private String storageTime;
    @ApiModelProperty(value = "入库重量")
    private String storageWeight;
    @ApiModelProperty(value = "入库积分")
    private String storageScore;
    @ApiModelProperty(value = "回收重量")
    private String recycleWeight;
    @ApiModelProperty(value = "回收积分")
    private String recycleScore;
    @ApiModelProperty(value = "损耗重量")
    private int lossWeight;
}
gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml
@@ -2,4 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xzx.gc.order.mapper.JhyOrderMapper">
    <select id="selectJhyOrderList" resultType="com.xzx.gc.order.vo.JhyOrderListVo">
        select
            a.id orderid
            ,a.username
            ,CONCAT(a.area, a.address) address
            ,a.longitude
            ,a.latitude
            ,a.weight
            ,a.remark
            ,CONCAT(a.reserve_date, ' ', a.reserve_time) reserveTime
            ,GROUP_CONCAT(b.title) items
        from xzx_jhy_order a
        inner join xzx_jhy_order_items b on a.id=b.order_id
        <where>
            <if test="record.status != 1">
                and jhy_id=#{record.userId}
            </if>
            <if test="record.status != null and record.status != ''">
                and a.status = #{record.status}
            </if>
        </where>
        group by a.id
    </select>
</mapper>