| | |
| | | package com.dsh.guns.modular.system.service.impl; |
| | | |
| | | import java.sql.Array; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | import com.dsh.course.mapper.DeptMapper; |
| | | import com.dsh.course.model.node.ZTreeNode; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.modular.system.model.TStore; |
| | | import com.dsh.guns.modular.system.service.IStoreService; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private DeptMapper deptMapper; |
| | | @Resource |
| | | private IStoreService storeService; |
| | | |
| | | @Override |
| | | public void deleteDept(Integer deptId) { |
| | |
| | | |
| | | @Override |
| | | public List<ZTreeNode> tree() { |
| | | |
| | | return this.baseMapper.tree(UserExt.getUser().getObjectType(),UserExt.getUser().getObjectId()); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | if (objectType==2){ |
| | | // 查询运营商下的门店ids |
| | | List<Integer> collect = storeService.lambdaQuery().eq(TStore::getOperatorId, objectId).list() |
| | | .stream().map(TStore::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | storeIds.add(-1); |
| | | } |
| | | storeIds.addAll(collect); |
| | | } |
| | | return this.baseMapper.tree(UserExt.getUser().getObjectType(),UserExt.getUser().getObjectId(),storeIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> list(String condition) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | return this.baseMapper.list(condition,objectType,objectId); |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | if (objectType==2){ |
| | | // 查询运营商下的门店ids |
| | | List<Integer> collect = storeService.lambdaQuery().eq(TStore::getOperatorId, objectId).list() |
| | | .stream().map(TStore::getId).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | storeIds.add(-1); |
| | | } |
| | | storeIds.addAll(collect); |
| | | } |
| | | return this.baseMapper.list(condition,objectType,objectId,storeIds); |
| | | } |
| | | } |