2025-06-20 15:58:42 +08:00
|
|
|
package com.yupi.springbootinit.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.yupi.springbootinit.common.BaseResponse;
|
|
|
|
|
import com.yupi.springbootinit.common.ErrorCode;
|
|
|
|
|
import com.yupi.springbootinit.exception.BusinessException;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.yupi.springbootinit.model.entity.SystemTenant;
|
|
|
|
|
import com.yupi.springbootinit.mapper.SystemTenantMapper;
|
|
|
|
|
import com.yupi.springbootinit.service.SystemTenantService;
|
|
|
|
|
/*
|
|
|
|
|
* @author: ziin
|
|
|
|
|
* @date: 2025/6/20 14:50
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class SystemTenantServiceImpl extends ServiceImpl<SystemTenantMapper, SystemTenant> implements SystemTenantService{
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Long getTenantIdByName(String name) {
|
|
|
|
|
QueryWrapper<SystemTenant> queryWrapper = new QueryWrapper<>();
|
2025-07-01 16:57:18 +08:00
|
|
|
queryWrapper.eq("name",name)
|
|
|
|
|
.eq("deleted",false );
|
2025-06-20 15:58:42 +08:00
|
|
|
SystemTenant systemTenant = baseMapper.selectOne(queryWrapper);
|
|
|
|
|
if (systemTenant == null){
|
|
|
|
|
throw new BusinessException(ErrorCode.TENANT_NAME_NOT_EXISTS);
|
|
|
|
|
}
|
|
|
|
|
return systemTenant.getId();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|