|  |  | @ -3,6 +3,7 @@ package com.glxp.api.service.basic; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.basic.BasicCollectUserRequest; |  |  |  | import com.glxp.api.req.basic.BasicCollectUserRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.basic.UserWorkResponse; |  |  |  | import com.glxp.api.res.basic.UserWorkResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.aspectj.weaver.ast.Var; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.stereotype.Service; |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.dao.basic.BasicCollectUserMapper; |  |  |  | import com.glxp.api.dao.basic.BasicCollectUserMapper; | 
			
		
	
	
		
		
			
				
					|  |  | @ -24,21 +25,27 @@ public class BasicCollectUserService extends ServiceImpl<BasicCollectUserMapper, | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public Boolean bindWorkplace(BasicCollectUserRequest request) { |  |  |  |     public Boolean bindWorkplace(BasicCollectUserRequest request) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         BasicCollectUserEntity basicCollectUserEntity = basicCollectUserMapper.selectOne(new LambdaQueryWrapper<BasicCollectUserEntity>() |  |  |  |         List<String> workplaceIds = request.getWorkplaceId(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 .eq(BasicCollectUserEntity::getUserId, request.getUserId()) |  |  |  |         for (String workplaceId : workplaceIds) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 .eq(BasicCollectUserEntity::getWorkplaceCode,request.getWorkplaceId())); |  |  |  |             BasicCollectUserEntity basicCollectUserEntity = basicCollectUserMapper.selectOne(new LambdaQueryWrapper<BasicCollectUserEntity>() | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if (basicCollectUserEntity != null){ |  |  |  |                     .eq(BasicCollectUserEntity::getUserId, request.getUserId()) | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             //该用户已经绑定改工位
 |  |  |  |                     .eq(BasicCollectUserEntity::getWorkplaceCode,workplaceId)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             if (basicCollectUserEntity != null){ | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //该用户已经绑定改工位
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         BasicCollectUserEntity entity = new BasicCollectUserEntity(); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         entity.setUserId(Long.valueOf(request.getUserId())); |  |  |  |         for (String workplaceId : workplaceIds) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         entity.setWorkplaceCode(Long.valueOf(request.getWorkplaceId())); |  |  |  |             BasicCollectUserEntity entity = new BasicCollectUserEntity(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         entity.setCreateTime(new Date()); |  |  |  |             entity.setUserId(Long.valueOf(request.getUserId())); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         entity.setUpdateTime(new Date()); |  |  |  |             entity.setWorkplaceCode(Long.valueOf(workplaceId)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         int insert = basicCollectUserMapper.insert(entity); |  |  |  |             entity.setCreateTime(new Date()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if (insert == 0){ |  |  |  |             entity.setUpdateTime(new Date()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             int insert = basicCollectUserMapper.insert(entity); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (insert == 0){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         return true; |  |  |  |         return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |