| | |
| | | } |
| | | |
| | | /** |
| | | * 查询所有 |
| | | */ |
| | | @GetMapping("/listAll") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入equipment") |
| | | public R<List<EquipmentVO>> listAll(Equipment equipment, Query query) throws ParseException { |
| | | List<EquipmentVO> pages = equipmentService.listAll(); |
| | | |
| | | for (int j = 0; j < pages.size(); j++) { |
| | | String expireTime = pages.get(j).getExpireTime(); |
| | | //1.获取当前时间 |
| | | Date dd = new Date(); |
| | | SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String end = sim.format(dd); |
| | | //把string类型转换为long类型的 |
| | | long st = sim.parse(expireTime).getTime(); |
| | | long en = sim.parse(end).getTime(); |
| | | //计算天数 |
| | | int day = (int) ((st - en) / 86400000); |
| | | if (day <= 30) { |
| | | pages.get(j).setType(1); |
| | | } else { |
| | | pages.get(j).setType(0); |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | */ |
| | | @GetMapping("/pages") |