自动化立体仓库 - WMS系统
chen.llin
2026-01-01 17a71449244e966206e3f24102fd9e56fa3199e4
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
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.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.OrderDetlPakinLog;
import com.zy.asrs.service.OrderDetlPakinLogService;
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("order/pakinLog")
public class OrderDetlPakinLogController extends BaseController {
 
    @Autowired
    private OrderDetlPakinLogService orderDetlService;
 
    @RequestMapping(value = "/orderDetl/list/auth")
    @ManagerAuth
    public R list(@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<OrderDetlPakinLog> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        } else {
            wrapper.orderBy("create_time", false);
        }
        Page<OrderDetlPakinLog> orderDetlPage = orderDetlService.selectPage(new Page<>(curr, limit), wrapper);
        return R.ok(orderDetlPage);
    }
 
    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 (val.contains(RANGE_TIME_LINK)) {
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(key, DateUtils.convert(dates[0]));
                wrapper.le(key, DateUtils.convert(dates[1]));
            } else if ("order_id".equals(key) || "orderId".equals(key)) {
                // order_id使用精确匹配
                wrapper.eq(key, val);
            } else {
                wrapper.like(key, val);
            }
        }
    }
 
}