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