自动化立体仓库 - WMS系统
chen.llin
2025-12-24 60486eff49be63700e94ad78ec0eeae056b2b416
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.zy.asrs.controller;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
import com.core.common.Cools;
import com.core.common.R;
import com.zy.asrs.entity.OrderTimeChangeLog;
import com.zy.asrs.service.OrderTimeChangeLogService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Map;
 
@RestController
@RequestMapping("orderTimeChangeLog")
public class OrderTimeChangeLogController extends BaseController {
 
    @Autowired
    private OrderTimeChangeLogService orderTimeChangeLogService;
 
    /**
     * 分页查询变更记录
     */
    @PostMapping(value = "/page/auth")
    @ManagerAuth(memo = "查询业务时间变更记录")
    public R page(@RequestParam(defaultValue = "1") Integer curr,
                  @RequestParam(defaultValue = "10") Integer limit,
                  @RequestParam(required = false) String orderByField,
                  @RequestParam(required = false) String orderByType,
                  @RequestParam Map<String, Object> param) {
        EntityWrapper<OrderTimeChangeLog> wrapper = new EntityWrapper<>();
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        } else {
            wrapper.orderBy("create_time", false);
        }
        return R.ok(orderTimeChangeLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
 
    /**
     * 根据订单ID查询变更记录
     */
    @PostMapping(value = "/list/byOrderId/auth")
    @ManagerAuth(memo = "根据订单ID查询变更记录")
    public R listByOrderId(@RequestParam Long orderId) {
        EntityWrapper<OrderTimeChangeLog> wrapper = new EntityWrapper<>();
        wrapper.eq("order_id", orderId);
        wrapper.orderBy("create_time", false);
        java.util.List<OrderTimeChangeLog> list = orderTimeChangeLogService.selectList(wrapper);
        // 设置创建人名称
        if (list != null) {
            for (OrderTimeChangeLog log : list) {
                log.setCreateByName(log.getCreateByName());
            }
        }
        return R.ok(list);
    }
 
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) {
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            String key = entry.getKey();
            String val = String.valueOf(entry.getValue());
            if (Cools.isEmpty(val) || "null".equals(val)) {
                continue;
            }
            if ("order_id".equals(key) || "orderId".equals(key)) {
                wrapper.eq(key, val);
            } else {
                wrapper.like(key, val);
            }
        }
    }
}