| | |
| | | package com.ruoyi.management.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.management.domain.SlEquipment; |
| | | import com.ruoyi.management.domain.SlGoodsMaterials; |
| | | import com.ruoyi.management.domain.SlStoreManagement; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | if(slEquipmentQuery.getEquipmentName()!=null&&slEquipmentQuery.getEquipmentName()!=""){ |
| | | wrapper.like(SlEquipment::getEquipmentName,slEquipmentQuery.getEquipmentName()); |
| | | } |
| | | if(slEquipmentQuery.getEquipmentName()!=null&&slEquipmentQuery.getType()!=0){ |
| | | if(slEquipmentQuery.getType()!=null&&slEquipmentQuery.getType()!=0){ |
| | | wrapper.eq(SlEquipment::getType,slEquipmentQuery.getType()); |
| | | } |
| | | wrapper.eq( SlEquipment::getDelFlag,0); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addSlEquipment(SlEquipmentDTO slEquipmentDTO) { |
| | | public AjaxResult addSlEquipment(SlEquipmentDTO slEquipmentDTO) { |
| | | |
| | | if (slEquipmentDTO.getId()==null){ |
| | | List<SlEquipment> list = this.list(new QueryWrapper<SlEquipment>() |
| | | .eq("type", slEquipmentDTO.getType()) |
| | | .eq("equipment_num", slEquipmentDTO.getEquipmentNum())); |
| | | if (!list.isEmpty()){ |
| | | return AjaxResult.error("当前设备已存在相同设备编号"); |
| | | } |
| | | SlEquipment slEquipment=new SlEquipment(); |
| | | slEquipment.setEquipmentName(slEquipmentDTO.getEquipmentName()); |
| | | slEquipment.setEquipmentNum(slEquipmentDTO.getEquipmentNum()); |
| | |
| | | this.save(slEquipment); |
| | | }else{ |
| | | SlEquipment byId = this.getById(slEquipmentDTO.getId()); |
| | | List<SlEquipment> list = this.list(new QueryWrapper<SlEquipment>() |
| | | .eq("type", slEquipmentDTO.getType()) |
| | | .ne("id",slEquipmentDTO.getId()) |
| | | .eq("equipment_num", slEquipmentDTO.getEquipmentNum())); |
| | | if (!list.isEmpty()){ |
| | | return AjaxResult.error("当前设备已存在相同设备编号"); |
| | | } |
| | | if (slEquipmentDTO.getEquipmentName()!=null){ |
| | | byId.setEquipmentName(slEquipmentDTO.getEquipmentName()); |
| | | } |
| | |
| | | } |
| | | this.updateById(byId); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | List<Long> arr=new ArrayList<>(); |
| | | wrapper.eq(SlStoreManagement::getDelFlag,0); |
| | | wrapper.eq(SlStoreManagement::getAdministratorId,seBei.getUserId()); |
| | | List<SlStoreManagement> page = slStoreManagementMapper.selectList(wrapper); |
| | | for (SlStoreManagement a:page){ |
| | | arr.add(a.getId()); |
| | | List<String> list = Arrays.asList(a.getAdministratorId().split(",")); |
| | | if (list.contains(seBei.getUserId().toString())){ |
| | | arr.add(a.getId()); |
| | | } |
| | | } |
| | | LambdaQueryWrapper< SlStoreManagement> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(SlStoreManagement::getDelFlag,0); |
| | | wrapper1.eq(SlStoreManagement::getCompetentId,seBei.getUserId()); |
| | | List<SlStoreManagement> page1 = slStoreManagementMapper.selectList(wrapper1); |
| | | for (SlStoreManagement a1:page1){ |
| | | arr.add(a1.getId()); |
| | | List<String> list = Arrays.asList(a1.getCompetentId().split(",")); |
| | | if (list.contains(seBei.getUserId().toString())){ |
| | | arr.add(a1.getId()); |
| | | } |
| | | } |
| | | LambdaQueryWrapper< SlStoreManagement> wrapper2= Wrappers.lambdaQuery(); |
| | | wrapper2.eq(SlStoreManagement::getDelFlag,0); |
| | | wrapper2.eq(SlStoreManagement::getDirectorId,seBei.getUserId()); |
| | | List<SlStoreManagement> page2 = slStoreManagementMapper.selectList(wrapper2); |
| | | for (SlStoreManagement a2:page2){ |
| | | arr.add(a2.getId()); |
| | | List<String> list = Arrays.asList(a2.getDirectorId().split(",")); |
| | | if (list.contains(seBei.getUserId().toString())){ |
| | | arr.add(a2.getId()); |
| | | } |
| | | } |
| | | Set<Long> set = new HashSet<>(arr); |
| | | arr.clear(); |