fix
Helius
2021-07-21 a7efd939762321cf0a1718812c9005efb9f6fc48
fix
4 files modified
30 ■■■■ changed files
gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java 6 ●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java 2 ●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java 4 ●●●● patch | view | raw | blame | history
gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml 18 ●●●● patch | view | raw | blame | history
gc-order/src/main/java/com/xzx/gc/order/controller/ApiJhyOrderController.java
@@ -84,9 +84,9 @@
    }
    @ApiOperation("订单状态数量")
    @PostMapping(value = "/jhy/order/orderStatusCnt")
    public JsonResult<Map<Integer, Integer>> orderStatusCnt(HttpServletRequest request) {
        return JsonResult.success(jhyOrderService.orderStatusCount(getUserId(request)));
    @PostMapping(value = "/jhy/order/orderStatusCnt/{type}")
    public JsonResult<Map<Integer, Integer>> orderStatusCnt(@PathVariable("type") Integer type, HttpServletRequest request) {
        return JsonResult.success(jhyOrderService.orderStatusCount(type, getUserId(request)));
    }
}
gc-order/src/main/java/com/xzx/gc/order/mapper/JhyOrderMapper.java
@@ -15,5 +15,5 @@
    List<JhyOrderListVo> selectJhyOrderList(@Param("record") JhyOrderListDto jhyOrderListDto);
    List<JhyStatusCountVo> selectOrderStatusCount(@Param("userId") String userId);
    List<JhyStatusCountVo> selectOrderStatusCount(@Param("type") Integer type, @Param("userId") String userId);
}
gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java
@@ -237,8 +237,8 @@
        distribService.distribRecord(order.getId(), order.getUserId());
    }
    public Map<Integer, Integer> orderStatusCount(String userId) {
        List<JhyStatusCountVo> count = jhyOrderMapper.selectOrderStatusCount(userId);
    public Map<Integer, Integer> orderStatusCount(Integer type, String userId) {
        List<JhyStatusCountVo> count = jhyOrderMapper.selectOrderStatusCount(type, userId);
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 1; i < 6; i++) {
gc-order/src/main/resources/mapper/order/JhyOrderMapper.xml
@@ -48,13 +48,27 @@
        select
           status,
           count(1) cnt
        from xzx_jhy_order where status=1
        from xzx_jhy_order
        <where>
            status=1
            <if test="type == 2">
                and user_id=#{userId}
            </if>
        </where>
        group by status
        union  all
        select
           status,
           count(1) cnt
        from xzx_jhy_order
        where user_id=#{userId}
        <where>
            <if test="type == 1">
                and jhy_id=#{userId}
            </if>
            <if test="type == 2" >
                and user_id=#{userId}
            </if>
        </where>
        group by status
    </select>
</mapper>