| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.common.wms.entity.WrkMast; |
| | | import com.zy.asrs.common.wms.service.WrkMastService; |
| | |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam(required = false) String timeRange, |
| | | @RequestParam Map<String, Object> param) { |
| | | LambdaQueryWrapper<WrkMast> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(WrkMast::getHostId, getHostId()); |
| | | excludeTrash(param); |
| | | QueryWrapper<WrkMast> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("host_id",getHostId()); |
| | | wrapper.orderByDesc("io_pri"); |
| | | convert(param, wrapper); |
| | | |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(WrkMast::getWrkNo, condition); |
| | | wrapper.and(item -> { |
| | | item.like("wrk_no", condition) |
| | | .or().like("wrk_sts", condition) |
| | | .or().like("sta_no", condition) |
| | | .or().like("source_sta_no", condition) |
| | | .or().like("loc_no", condition) |
| | | .or().like("barcode",condition) |
| | | .or().like("source_loc_no", condition); |
| | | }); |
| | | } |
| | | if (!Cools.isEmpty(timeRange)) { |
| | | String[] range = timeRange.split(RANGE_TIME_LINK); |
| | | wrapper.ge(WrkMast::getAppeTime, DateUtils.convert(range[0])); |
| | | wrapper.le(WrkMast::getAppeTime, DateUtils.convert(range[1])); |
| | | } |
| | | |
| | | return R.ok(wrkMastService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, QueryWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/add/auth") |
| | | @ManagerAuth |