| | |
| | | import com.zy.asrs.entity.TaskLog; |
| | | import com.zy.asrs.service.TaskLogService; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | public class TaskLogController extends BaseController { |
| | | |
| | |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | try { |
| | | log.info("TaskLog查询请求,参数:curr={}, limit={}, param={}", curr, limit, param); |
| | | EntityWrapper<TaskLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | wrapper.orderBy("appe_time",false); |
| | | return R.ok(taskLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | Page<TaskLog> page = taskLogService.selectPage(new Page<>(curr, limit), wrapper); |
| | | log.info("TaskLog查询成功,返回{}条记录", page.getRecords().size()); |
| | | return R.ok(page); |
| | | } catch (Exception e) { |
| | | log.error("TaskLog查询失败", e); |
| | | e.printStackTrace(); |
| | | return R.error("查询失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | // 跳过空值和 "null" 字符串 |
| | | if (Cools.isEmpty(val) || "null".equals(val)) { |
| | | continue; |
| | | } |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |