| | |
| | | package com.jcdm.main.em.inspectionPlanTask.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.jcdm.common.core.domain.BaseEntity; |
| | | import com.jcdm.main.em.inspectionPlanTask.vo.ProductSelectVO; |
| | | import org.aspectj.weaver.loadtime.Aj; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @GetMapping("/getListLikeDevices") |
| | | public AjaxResult getListLikeDevices(EmInspectionPlanTask emInspectionPlanTask) |
| | | { |
| | | List<ProductSelectVO> result = new ArrayList<>(); |
| | | List<EmInspectionPlanTask> list = emInspectionPlanTaskService.list(new LambdaQueryWrapper<EmInspectionPlanTask>() |
| | | .select(EmInspectionPlanTask::getDevicesCode) |
| | | .like(EmInspectionPlanTask::getDevicesCode,emInspectionPlanTask.getDevicesCode()) |
| | | .groupBy(EmInspectionPlanTask::getDevicesCode)); |
| | | List<String> collect = list.stream().map(EmInspectionPlanTask::getDevicesCode).collect(Collectors.toList()); |
| | | .like(StrUtil.isNotBlank(emInspectionPlanTask.getDevicesCode()),EmInspectionPlanTask::getDevicesCode,emInspectionPlanTask.getDevicesCode()) |
| | | ); |
| | | if (CollUtil.isNotEmpty(list)){ |
| | | ProductSelectVO all = new ProductSelectVO(); |
| | | all.setLabel("å
¨é¨"); |
| | | all.setValue(null); |
| | | result.add(all); |
| | | for (EmInspectionPlanTask inspectionPlanTask : list) { |
| | | ProductSelectVO vo = new ProductSelectVO(); |
| | | vo.setLabel(inspectionPlanTask.getDevicesName()); |
| | | vo.setValue(inspectionPlanTask.getDevicesCode()); |
| | | result.add(vo); |
| | | } |
| | | result = result.stream().distinct().collect(Collectors.toList()); |
| | | |
| | | return AjaxResult.success(collect); |
| | | |
| | | } |
| | | |
| | | |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¹æ£ä»»å¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:list')") |
| | | @GetMapping("/list2") |
| | | public AjaxResult list2(EmInspectionPlanTask emInspectionPlanTask) |
| | | { |
| | | List<EmInspectionPlanTask> list = emInspectionPlanTaskService.selectEmInspectionPlanTaskList(emInspectionPlanTask); |
| | | if (StrUtil.isNotBlank(emInspectionPlanTask.getOrder())){ |
| | | if ("1".equals(emInspectionPlanTask.getOrder())){ |
| | | //é¡ºåº |
| | | list = list.stream().sorted(Comparator.comparing(BaseEntity::getCreateTime)).collect(Collectors.toList()); |
| | | } else if ("0".equals(emInspectionPlanTask.getOrder())) { |
| | | //éåº |
| | | list = list.stream().sorted(Comparator.comparing(BaseEntity::getCreateTime).reversed()).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç¹æ£ä»»å¡å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:export')") |