ShutdownEvent2Service.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.gyee.runeconomy.service;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  4. import com.gyee.runeconomy.model.auto.ProEconShutdownEvent2;
  5. import com.gyee.runeconomy.service.auto.IProEconShutdownEvent2Service;
  6. import com.gyee.runeconomy.util.StringUtils;
  7. import org.springframework.stereotype.Service;
  8. import javax.annotation.Resource;
  9. import java.util.Date;
  10. @Service
  11. public class ShutdownEvent2Service {
  12. @Resource
  13. private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
  14. public Page<ProEconShutdownEvent2> getShutdownEventList(Integer pageNum, Integer pageSize, String wtId, Date beginDate, Date endDate) {
  15. if (StringUtils.empty(pageNum)) {
  16. pageNum = 1;
  17. }
  18. if (StringUtils.empty(pageSize)) {
  19. pageSize = 10;
  20. }
  21. //构造分页构造器
  22. Page<ProEconShutdownEvent2> pageInfo = new Page<>(pageNum, pageSize);
  23. if (StringUtils.notEmp(wtId) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
  24. //构造条件构造器
  25. QueryWrapper<ProEconShutdownEvent2> queryWrapper = new QueryWrapper<>();
  26. //添加过滤条件
  27. queryWrapper.eq("windturbine_id", wtId)
  28. .ge("stop_time", beginDate)
  29. .le("stop_time", endDate)
  30. .apply("EXTRACT(EPOCH FROM (start_time - stop_time)) / 60 > 10");
  31. //执行查询
  32. proEconShutdownEvent2Service.page(pageInfo, queryWrapper);
  33. }
  34. return pageInfo;
  35. }
  36. }