| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<TaskWrkLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(taskWrkLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | try{ |
| | | Integer wrkNo = null; |
| | | Integer taskNo = null; |
| | | Integer status = null; |
| | | Date modiTimeStart = null, modiTimeEnd = null; |
| | | for (Map.Entry<String, Object> entry : param.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (Cools.isEmpty(val)) { |
| | | continue; |
| | | } |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | modiTimeStart = DateUtils.convert(dates[0]); |
| | | modiTimeEnd = DateUtils.convert(dates[1]); |
| | | } else if (entry.getKey().equals("wrk_no")) { |
| | | wrkNo = Integer.parseInt(val); |
| | | } else if (entry.getKey().equals("task_no")) { |
| | | taskNo = Integer.parseInt(val); |
| | | } else if (entry.getKey().equals("status")) { |
| | | status = Integer.parseInt(val); |
| | | } |
| | | } |
| | | List<TaskWrkLog> taskWrkList = taskWrkLogService.selectTaskWrkLogList(wrkNo,taskNo,status,modiTimeStart,modiTimeEnd, curr, limit); |
| | | Page<TaskWrkLog> page1 = new Page<TaskWrkLog>(curr, limit).setRecords(taskWrkList); |
| | | page1.setTotal(taskWrkLogService.selectTaskWrkLogListTotal(wrkNo,taskNo,status,modiTimeStart,modiTimeEnd)); |
| | | return R.ok(page1); |
| | | |
| | | } catch (Exception e) { |
| | | return R.error("查询失败,请检查参数:"+e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |