@@ -5,6 +5,7 @@ import com.tuoheng.until.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RequestParam; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
@@ -23,7 +24,12 @@ public class PlatformController { | |||
* @return | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult list(){ | |||
return platformService.findAll(); | |||
// public JsonResult list(){ | |||
// return platformService.findAll(); | |||
// } | |||
public JsonResult listWithAirportOption(@RequestParam boolean includeAirport) { | |||
return platformService.findAllWithAirportOption(includeAirport); | |||
} | |||
} |
@@ -4,15 +4,17 @@ import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
import lombok.Data; | |||
/** | |||
* 平台表 | |||
* | |||
* @TableName platform | |||
*/ | |||
@TableName(value ="platform") | |||
@TableName(value = "platform") | |||
@Data | |||
public class Platform implements Serializable { | |||
/** | |||
@@ -63,4 +65,10 @@ public class Platform implements Serializable { | |||
@TableField(exist = false) | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
*是否包含机场平台 | |||
*/ | |||
@TableField("is_airport") | |||
private Boolean isAirport; | |||
} |
@@ -79,4 +79,9 @@ public class CreateClientTenantDto { | |||
*/ | |||
private Integer status; | |||
/** | |||
*是否包含机场平台 | |||
*/ | |||
private Boolean isAirport; | |||
} |
@@ -14,5 +14,7 @@ public interface PlatformService extends IService<Platform> { | |||
* 查询各平台名称 | |||
* @return | |||
*/ | |||
JsonResult findAll(); | |||
//JsonResult findAll(); | |||
JsonResult findAllWithAirportOption(boolean includeAirport); | |||
} |
@@ -1,10 +1,11 @@ | |||
package com.tuoheng.service.impl; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.tuoheng.mapper.PlatformMapper; | |||
import com.tuoheng.model.dto.Platform; | |||
import com.tuoheng.service.PlatformService; | |||
import com.tuoheng.mapper.PlatformMapper; | |||
import com.tuoheng.until.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@@ -28,14 +29,29 @@ public class PlatformServiceImpl extends ServiceImpl<PlatformMapper, Platform> | |||
* | |||
* @return | |||
*/ | |||
// @Override | |||
// public JsonResult findAll() { | |||
// | |||
// List<Platform> platforms = platformMapper.selectList(Wrappers.<Platform>lambdaQuery() | |||
// .eq(Platform::getMark, 1)); | |||
// | |||
// return JsonResult.success(platforms); | |||
// } | |||
//通过机场条件进行查询 | |||
@Override | |||
public JsonResult findAll() { | |||
List<Platform> platforms = platformMapper.selectList(Wrappers.<Platform>lambdaQuery() | |||
.eq(Platform::getMark, 1)); | |||
public JsonResult findAllWithAirportOption(boolean includeAirport) { | |||
LambdaQueryWrapper<Platform> queryWrapper = Wrappers.<Platform>lambdaQuery() | |||
.eq(Platform::getMark, 1); | |||
// 筛选是否含机场平台 | |||
if (!includeAirport) { | |||
queryWrapper.eq(Platform::getIsAirport, false); // 只筛选非机场平台 | |||
} | |||
List<Platform> platforms = platformMapper.selectList(queryWrapper); | |||
return JsonResult.success(platforms); | |||
} | |||
} | |||
@@ -12,7 +12,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.common.CommonConfig; | |||
import com.tuoheng.common.ServiceException; | |||
import com.tuoheng.common.ServiceExceptionEnum; | |||
import com.tuoheng.constant.*; | |||
import com.tuoheng.constant.CommonConstant; | |||
import com.tuoheng.constant.DictConstant; | |||
import com.tuoheng.enums.MarkTypeEnum; | |||
import com.tuoheng.mapper.*; | |||
import com.tuoheng.model.dto.LoginUser; | |||
@@ -36,7 +37,6 @@ import com.tuoheng.model.vo.UserVo; | |||
import com.tuoheng.service.TenantService; | |||
import com.tuoheng.until.JsonResult; | |||
import com.tuoheng.until.MapUtils; | |||
import jdk.nashorn.internal.ir.annotations.Ignore; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -48,10 +48,7 @@ import org.springframework.web.client.RestTemplate; | |||
import java.math.BigDecimal; | |||
import java.math.RoundingMode; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Optional; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
/** | |||
@@ -419,6 +416,8 @@ public class TenantServiceImpl implements TenantService { | |||
} | |||
CreateClientTenantDto dto = new CreateClientTenantDto(); | |||
dto.setId(query.getId()); | |||
//默认是否包含机场为false | |||
Boolean isAirport = false; | |||
//查询出租户的相关信息 | |||
Long tenantId = query.getId(); | |||
//项目相关信息 | |||
@@ -436,6 +435,10 @@ public class TenantServiceImpl implements TenantService { | |||
List<ClientRoleDto> list = new ArrayList<>(); | |||
List<ClientUserRolePo> clientUserRolePos = clientUserRoleMapper.selectListByUserId(tenantPo.getUserId()); | |||
for (ClientUserRolePo clientUserRolePo : clientUserRolePos) { | |||
//判断是否包含机场 | |||
if ("tuoheng-airport-admin".equals(clientUserRolePo.getClientId())) { | |||
isAirport = true; | |||
} | |||
ClientRoleDto clientRoleDto = new ClientRoleDto(); | |||
//此处 暂时格式都为 tuoheng-hhz-web 等格式 如后续维护需要变更形式则此处代码需要更改 | |||
clientRoleDto.setRoleId(clientUserRolePo.getRoleId()); | |||
@@ -450,6 +453,7 @@ public class TenantServiceImpl implements TenantService { | |||
list.add(clientRoleDto); | |||
} | |||
dto.setClientRoleDtoList(list.stream().distinct().collect(Collectors.toList())); | |||
dto.setIsAirport(isAirport); | |||
return JsonResult.success(dto); | |||
} | |||